Commit 9e68943e authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Skip test if device is not running in US locale

Test TranslateInfobarModalOverlayMediatorTest.UpdateLanguageInfo
fails if system locale is not "en-US". This prevents running the
test on a developer device if they want to use the device in their
language.

Bug: 1102968
Change-Id: Icdc61da3c1015388c89a8ecc90aeb45e5e93a88d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421457
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808877}
parent 5e0e0dcb
...@@ -121,6 +121,14 @@ TEST_F(TranslateInfobarModalOverlayMediatorTest, ShowOriginalLanguage) { ...@@ -121,6 +121,14 @@ TEST_F(TranslateInfobarModalOverlayMediatorTest, ShowOriginalLanguage) {
// called, and didSelectSourceLanguageIndex and didSelectTargetLanguageIndex // called, and didSelectSourceLanguageIndex and didSelectTargetLanguageIndex
// were called beforehand to change the source and target languages. // were called beforehand to change the source and target languages.
TEST_F(TranslateInfobarModalOverlayMediatorTest, UpdateLanguageInfo) { TEST_F(TranslateInfobarModalOverlayMediatorTest, UpdateLanguageInfo) {
// The order of the languages depends on the locale the device is running.
// Skip the test if the locale is no en-US where the indexes have been
// computed.
NSString* currentLanguage =
[[[NSBundle mainBundle] preferredLocalizations] firstObject];
if (![currentLanguage isEqual:@"en-US"])
return;
// Language indexes are different on iOS 14. // Language indexes are different on iOS 14.
// TODO(crbug.com/1102968): Avoid hard-coding indexes here. // TODO(crbug.com/1102968): Avoid hard-coding indexes here.
const int portuguese_index = base::ios::IsRunningOnIOS14OrLater() ? 67 : 69; const int portuguese_index = base::ios::IsRunningOnIOS14OrLater() ? 67 : 69;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment