OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_window_registry.h" | 10 #include "apps/app_window_registry.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 }; | 183 }; |
184 const char* kRecommendedLocales1[] = { | 184 const char* kRecommendedLocales1[] = { |
185 "pl", | 185 "pl", |
186 "et", | 186 "et", |
187 "en-US", | 187 "en-US", |
188 }; | 188 }; |
189 const char* kRecommendedLocales2[] = { | 189 const char* kRecommendedLocales2[] = { |
190 "fr", | 190 "fr", |
191 "nl", | 191 "nl", |
192 }; | 192 }; |
| 193 const char* kInvalidRecommendedLocale[] = { |
| 194 "xx", |
| 195 }; |
193 const char kPublicSessionLocale[] = "de"; | 196 const char kPublicSessionLocale[] = "de"; |
194 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; | 197 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; |
195 | 198 |
196 // The sequence token used by GetKeyboardLayoutsForLocale() for its background | 199 // The sequence token used by GetKeyboardLayoutsForLocale() for its background |
197 // tasks. | 200 // tasks. |
198 const char kSequenceToken[] = "chromeos_login_l10n_util"; | 201 const char kSequenceToken[] = "chromeos_login_l10n_util"; |
199 | 202 |
200 // Helper that serves extension update manifests to Chrome. | 203 // Helper that serves extension update manifests to Chrome. |
201 class TestingUpdateManifestProvider { | 204 class TestingUpdateManifestProvider { |
202 public: | 205 public: |
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); | 1776 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); |
1774 EXPECT_EQ(l10n_util::GetLanguage(kPublicSessionLocale), | 1777 EXPECT_EQ(l10n_util::GetLanguage(kPublicSessionLocale), |
1775 icu::Locale::getDefault().getLanguage()); | 1778 icu::Locale::getDefault().getLanguage()); |
1776 EXPECT_EQ(public_session_input_method_id_, | 1779 EXPECT_EQ(public_session_input_method_id_, |
1777 chromeos::input_method::InputMethodManager::Get() | 1780 chromeos::input_method::InputMethodManager::Get() |
1778 ->GetActiveIMEState() | 1781 ->GetActiveIMEState() |
1779 ->GetCurrentInputMethod() | 1782 ->GetCurrentInputMethod() |
1780 .id()); | 1783 .id()); |
1781 } | 1784 } |
1782 | 1785 |
| 1786 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, InvalidRecommendedLocale) { |
| 1787 // Specify an invalid recommended locale. |
| 1788 SetRecommendedLocales(kInvalidRecommendedLocale, |
| 1789 arraysize(kInvalidRecommendedLocale)); |
| 1790 UploadAndInstallDeviceLocalAccountPolicy(); |
| 1791 AddPublicSessionToDevicePolicy(kAccountId1); |
| 1792 |
| 1793 WaitForPolicy(); |
| 1794 |
| 1795 // Click on the pod to expand it. Verify that the pod expands to its basic |
| 1796 // form as there is only one recommended locale. |
| 1797 bool advanced = false; |
| 1798 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1799 contents_, |
| 1800 base::StringPrintf( |
| 1801 "var pod =" |
| 1802 " document.getElementById('pod-row').getPodWithUsername_('%s');" |
| 1803 "pod.click();" |
| 1804 "domAutomationController.send(pod.classList.contains('advanced'));", |
| 1805 user_id_1_.c_str()), |
| 1806 &advanced)); |
| 1807 EXPECT_FALSE(advanced); |
| 1808 EXPECT_EQ(l10n_util::GetLanguage(initial_locale_), |
| 1809 icu::Locale::getDefault().getLanguage()); |
| 1810 |
| 1811 // Click the enter button to start the session. |
| 1812 ASSERT_TRUE(content::ExecuteScript( |
| 1813 contents_, |
| 1814 base::StringPrintf( |
| 1815 "document.getElementById('pod-row').getPodWithUsername_('%s')" |
| 1816 " .querySelector('.enter-button').click();", |
| 1817 user_id_1_.c_str()))); |
| 1818 |
| 1819 WaitForSessionStart(); |
| 1820 |
| 1821 // Verify that since the recommended locale was invalid, the locale has not |
| 1822 // changed and the first keyboard layout applicable to the locale was chosen. |
| 1823 EXPECT_EQ(initial_locale_, g_browser_process->GetApplicationLocale()); |
| 1824 EXPECT_EQ(l10n_util::GetLanguage(initial_locale_), |
| 1825 icu::Locale::getDefault().getLanguage()); |
| 1826 VerifyKeyboardLayoutMatchesLocale(); |
| 1827 } |
| 1828 |
1783 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, | 1829 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, |
1784 AutoLoginWithoutRecommendedLocales) { | 1830 AutoLoginWithoutRecommendedLocales) { |
1785 UploadAndInstallDeviceLocalAccountPolicy(); | 1831 UploadAndInstallDeviceLocalAccountPolicy(); |
1786 AddPublicSessionToDevicePolicy(kAccountId1); | 1832 AddPublicSessionToDevicePolicy(kAccountId1); |
1787 EnableAutoLogin(); | 1833 EnableAutoLogin(); |
1788 | 1834 |
1789 WaitForPolicy(); | 1835 WaitForPolicy(); |
1790 | 1836 |
1791 WaitForSessionStart(); | 1837 WaitForSessionStart(); |
1792 | 1838 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 ASSERT_TRUE(content::ExecuteScript(contents_, | 2100 ASSERT_TRUE(content::ExecuteScript(contents_, |
2055 "$('tos-accept-button').click();")); | 2101 "$('tos-accept-button').click();")); |
2056 | 2102 |
2057 WaitForSessionStart(); | 2103 WaitForSessionStart(); |
2058 } | 2104 } |
2059 | 2105 |
2060 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2106 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2061 TermsOfServiceDownloadTest, testing::Bool()); | 2107 TermsOfServiceDownloadTest, testing::Bool()); |
2062 | 2108 |
2063 } // namespace policy | 2109 } // namespace policy |
OLD | NEW |