Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1384)

Unified Diff: chrome/browser/chromeos/policy/device_local_account_browsertest.cc

Issue 483523005: Default to current UI locale when recommended locales are invalid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 82bdf883145c09551334560e1b9b2f488a17c301..04b8ec5526f92e9773fa3a7d1403536eed2a2f5e 100644
--- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -190,6 +190,9 @@ const char* kRecommendedLocales2[] = {
"fr",
"nl",
};
+const char* kInvalidRecommendedLocale[] = {
+ "xx",
+};
const char kPublicSessionLocale[] = "de";
const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger";
@@ -1780,6 +1783,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();

Powered by Google App Engine
This is Rietveld 408576698