blob: 58affc3ee4b5a31c077046c995ba74affe4d8f37 [file] [log] [blame]
Tests that the user's preferred languages are honored.
**Set track preferences and user preferred languages
RUN(internals.settings.setShouldDisplayTrackKind('Captions', true))
RUN(internals.setUserPreferredLanguages(['jp', 'es-ES', 'en', 'fr', 'pt-PT']))
EVENT(canplaythrough)
Test: a track language matches one of the user's preferred languages exactly.
- creating tracks for: [fr,en,jp].
EVENT(load)
EXPECTED (track.readyState == '2') OK
EXPECTED (track.srclang == 'jp') OK
Test: a track language without locale exactly matches one of the user's preferred languages.
- creating tracks for: [fr-CH,da].
EVENT(load)
EXPECTED (track.readyState == '2') OK
EXPECTED (track.srclang == 'fr-CH') OK
Test: a track language without locale matches one of the user's preferred languages without locale.
- creating tracks for: [fr,es-MX].
EVENT(load)
EXPECTED (track.readyState == '2') OK
EXPECTED (track.srclang == 'es-MX') OK
Test: no track language matches any of the user's preferred languages.
- creating tracks for: [fa,ru,no].
EVENT(load)
EXPECTED (track.readyState == '2') OK
EXPECTED (track.srclang == 'fa') OK
Test: a track language without locale matches one of the user's preferred languages exactly when another language matches locale only.
- creating tracks for: [pt-BR,nl-NL,pt-PT].
EVENT(load)
EXPECTED (track.readyState == '2') OK
EXPECTED (track.srclang == 'pt-PT') OK
END OF TEST