Index: chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
index 23c1675331bdd432b756b5ee65893738859f23b4..bd70560e8481cbe8eef9214234d01c0b9ddb6a12 100644 |
--- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
+++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc |
@@ -191,6 +191,9 @@ const char* kRecommendedLocales2[] = { |
"fr", |
"nl", |
}; |
+const char* kInvalidRecommendedLocale[] = { |
+ "xx", |
+}; |
const char kPublicSessionLocale[] = "de"; |
const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; |
@@ -1748,6 +1751,49 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, MultipleRecommendedLocales) { |
.id()); |
} |
+IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, InvalidRecommendedLocale) { |
+ // Specify an invalid recommended locale. |
+ SetRecommendedLocales(kInvalidRecommendedLocale, |
+ arraysize(kInvalidRecommendedLocale)); |
+ UploadAndInstallDeviceLocalAccountPolicy(); |
+ AddPublicSessionToDevicePolicy(kAccountId1); |
+ |
+ WaitForPolicy(); |
+ |
+ // Click on the pod to expand it. Verify that the pod expands to its basic |
+ // form as there is only one recommended locale. |
+ bool advanced = false; |
+ ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
+ contents_, |
+ base::StringPrintf( |
+ "var pod =" |
+ " document.getElementById('pod-row').getPodWithUsername_('%s');" |
+ "pod.click();" |
+ "domAutomationController.send(pod.classList.contains('advanced'));", |
+ user_id_1_.c_str()), |
+ &advanced)); |
+ EXPECT_FALSE(advanced); |
+ EXPECT_EQ(l10n_util::GetLanguage(initial_locale_), |
+ icu::Locale::getDefault().getLanguage()); |
+ |
+ // Click the enter button to start the session. |
+ ASSERT_TRUE(content::ExecuteScript( |
+ contents_, |
+ base::StringPrintf( |
+ "document.getElementById('pod-row').getPodWithUsername_('%s')" |
+ " .querySelector('.enter-button').click();", |
+ user_id_1_.c_str()))); |
+ |
+ WaitForSessionStart(); |
+ |
+ // Verify that since the recommended locale was invalid, the locale has not |
+ // changed and the first keyboard layout applicable to the locale was chosen. |
+ EXPECT_EQ(initial_locale_, g_browser_process->GetApplicationLocale()); |
+ EXPECT_EQ(l10n_util::GetLanguage(initial_locale_), |
+ icu::Locale::getDefault().getLanguage()); |
+ VerifyKeyboardLayoutMatchesLocale(); |
+} |
+ |
IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, |
AutoLoginWithoutRecommendedLocales) { |
UploadAndInstallDeviceLocalAccountPolicy(); |