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.h" | 10 #include "apps/app_window.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 }; | 184 }; |
185 const char* kRecommendedLocales1[] = { | 185 const char* kRecommendedLocales1[] = { |
186 "pl", | 186 "pl", |
187 "et", | 187 "et", |
188 "en-US", | 188 "en-US", |
189 }; | 189 }; |
190 const char* kRecommendedLocales2[] = { | 190 const char* kRecommendedLocales2[] = { |
191 "fr", | 191 "fr", |
192 "nl", | 192 "nl", |
193 }; | 193 }; |
| 194 const char* kInvalidRecommendedLocale[] = { |
| 195 "xx", |
| 196 }; |
194 const char kPublicSessionLocale[] = "de"; | 197 const char kPublicSessionLocale[] = "de"; |
195 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; | 198 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; |
196 | 199 |
197 // The sequence token used by GetKeyboardLayoutsForLocale() for its background | 200 // The sequence token used by GetKeyboardLayoutsForLocale() for its background |
198 // tasks. | 201 // tasks. |
199 const char kSequenceToken[] = "chromeos_login_l10n_util"; | 202 const char kSequenceToken[] = "chromeos_login_l10n_util"; |
200 | 203 |
201 // Helper that serves extension update manifests to Chrome. | 204 // Helper that serves extension update manifests to Chrome. |
202 class TestingUpdateManifestProvider { | 205 class TestingUpdateManifestProvider { |
203 public: | 206 public: |
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); | 1744 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); |
1742 EXPECT_EQ(l10n_util::GetLanguage(kPublicSessionLocale), | 1745 EXPECT_EQ(l10n_util::GetLanguage(kPublicSessionLocale), |
1743 icu::Locale::getDefault().getLanguage()); | 1746 icu::Locale::getDefault().getLanguage()); |
1744 EXPECT_EQ(public_session_input_method_id_, | 1747 EXPECT_EQ(public_session_input_method_id_, |
1745 chromeos::input_method::InputMethodManager::Get() | 1748 chromeos::input_method::InputMethodManager::Get() |
1746 ->GetActiveIMEState() | 1749 ->GetActiveIMEState() |
1747 ->GetCurrentInputMethod() | 1750 ->GetCurrentInputMethod() |
1748 .id()); | 1751 .id()); |
1749 } | 1752 } |
1750 | 1753 |
| 1754 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, InvalidRecommendedLocale) { |
| 1755 // Specify an invalid recommended locale. |
| 1756 SetRecommendedLocales(kInvalidRecommendedLocale, |
| 1757 arraysize(kInvalidRecommendedLocale)); |
| 1758 UploadAndInstallDeviceLocalAccountPolicy(); |
| 1759 AddPublicSessionToDevicePolicy(kAccountId1); |
| 1760 |
| 1761 WaitForPolicy(); |
| 1762 |
| 1763 // Click on the pod to expand it. Verify that the pod expands to its basic |
| 1764 // form as there is only one recommended locale. |
| 1765 bool advanced = false; |
| 1766 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 1767 contents_, |
| 1768 base::StringPrintf( |
| 1769 "var pod =" |
| 1770 " document.getElementById('pod-row').getPodWithUsername_('%s');" |
| 1771 "pod.click();" |
| 1772 "domAutomationController.send(pod.classList.contains('advanced'));", |
| 1773 user_id_1_.c_str()), |
| 1774 &advanced)); |
| 1775 EXPECT_FALSE(advanced); |
| 1776 EXPECT_EQ(l10n_util::GetLanguage(initial_locale_), |
| 1777 icu::Locale::getDefault().getLanguage()); |
| 1778 |
| 1779 // Click the enter button to start the session. |
| 1780 ASSERT_TRUE(content::ExecuteScript( |
| 1781 contents_, |
| 1782 base::StringPrintf( |
| 1783 "document.getElementById('pod-row').getPodWithUsername_('%s')" |
| 1784 " .querySelector('.enter-button').click();", |
| 1785 user_id_1_.c_str()))); |
| 1786 |
| 1787 WaitForSessionStart(); |
| 1788 |
| 1789 // Verify that since the recommended locale was invalid, the locale has not |
| 1790 // changed and the first keyboard layout applicable to the locale was chosen. |
| 1791 EXPECT_EQ(initial_locale_, g_browser_process->GetApplicationLocale()); |
| 1792 EXPECT_EQ(l10n_util::GetLanguage(initial_locale_), |
| 1793 icu::Locale::getDefault().getLanguage()); |
| 1794 VerifyKeyboardLayoutMatchesLocale(); |
| 1795 } |
| 1796 |
1751 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, | 1797 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, |
1752 AutoLoginWithoutRecommendedLocales) { | 1798 AutoLoginWithoutRecommendedLocales) { |
1753 UploadAndInstallDeviceLocalAccountPolicy(); | 1799 UploadAndInstallDeviceLocalAccountPolicy(); |
1754 AddPublicSessionToDevicePolicy(kAccountId1); | 1800 AddPublicSessionToDevicePolicy(kAccountId1); |
1755 EnableAutoLogin(); | 1801 EnableAutoLogin(); |
1756 | 1802 |
1757 WaitForPolicy(); | 1803 WaitForPolicy(); |
1758 | 1804 |
1759 WaitForSessionStart(); | 1805 WaitForSessionStart(); |
1760 | 1806 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 ASSERT_TRUE(content::ExecuteScript(contents_, | 2065 ASSERT_TRUE(content::ExecuteScript(contents_, |
2020 "$('tos-accept-button').click();")); | 2066 "$('tos-accept-button').click();")); |
2021 | 2067 |
2022 WaitForSessionStart(); | 2068 WaitForSessionStart(); |
2023 } | 2069 } |
2024 | 2070 |
2025 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2071 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2026 TermsOfServiceDownloadTest, testing::Bool()); | 2072 TermsOfServiceDownloadTest, testing::Bool()); |
2027 | 2073 |
2028 } // namespace policy | 2074 } // namespace policy |
OLD | NEW |