diff options
Diffstat (limited to 'tests/wpt/tests/ai/resources/locale-util.js')
-rw-r--r-- | tests/wpt/tests/ai/resources/locale-util.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/wpt/tests/ai/resources/locale-util.js b/tests/wpt/tests/ai/resources/locale-util.js index cacb11f4f25..70a00a5630b 100644 --- a/tests/wpt/tests/ai/resources/locale-util.js +++ b/tests/wpt/tests/ai/resources/locale-util.js @@ -42,3 +42,20 @@ function assert_is_variation(variation_language_tag, expected_language_tag) { const expected_locale = new Intl.Locale(expected_language_tag); assert_equals(variation_locale.language, expected_locale.language); } + +function assert_availability_consistent( + language_subtag_availability, variation_availability) { + if (variation_availability == 'unavailable') { + // If the language subtag is not available then no variation of it should + // be available. + assert_equals(language_subtag_availability, 'unavailable'); + } else { + // If the language subtag is available, then it definitely shouldn't be + // unavailable since whatever backing it has could support any variation of + // it. A variation could have a different availability if a more specific + // backing is required. + assert_in_array( + language_subtag_availability, + ['downloadable', 'downloading', 'available']); + } +} |