| 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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 chromeos::input_method::InputMethodManager* input_method_manager = | 685 chromeos::input_method::InputMethodManager* input_method_manager = |
| 686 chromeos::input_method::InputMethodManager::Get(); | 686 chromeos::input_method::InputMethodManager::Get(); |
| 687 std::vector<std::string> layouts_from_locale; | 687 std::vector<std::string> layouts_from_locale; |
| 688 input_method_manager->GetInputMethodUtil()-> | 688 input_method_manager->GetInputMethodUtil()-> |
| 689 GetInputMethodIdsFromLanguageCode( | 689 GetInputMethodIdsFromLanguageCode( |
| 690 g_browser_process->GetApplicationLocale(), | 690 g_browser_process->GetApplicationLocale(), |
| 691 chromeos::input_method::kKeyboardLayoutsOnly, | 691 chromeos::input_method::kKeyboardLayoutsOnly, |
| 692 &layouts_from_locale); | 692 &layouts_from_locale); |
| 693 ASSERT_FALSE(layouts_from_locale.empty()); | 693 ASSERT_FALSE(layouts_from_locale.empty()); |
| 694 EXPECT_EQ(layouts_from_locale.front(), | 694 EXPECT_EQ(layouts_from_locale.front(), |
| 695 input_method_manager->GetCurrentInputMethod().id()); | 695 input_method_manager->GetActiveIMEState() |
| 696 ->GetCurrentInputMethod() |
| 697 .id()); |
| 696 } | 698 } |
| 697 | 699 |
| 698 const std::string user_id_1_; | 700 const std::string user_id_1_; |
| 699 const std::string user_id_2_; | 701 const std::string user_id_2_; |
| 700 const std::string public_session_input_method_id_; | 702 const std::string public_session_input_method_id_; |
| 701 | 703 |
| 702 scoped_ptr<base::RunLoop> run_loop_; | 704 scoped_ptr<base::RunLoop> run_loop_; |
| 703 | 705 |
| 704 UserPolicyBuilder device_local_account_policy_; | 706 UserPolicyBuilder device_local_account_policy_; |
| 705 LocalPolicyTestServer test_server_; | 707 LocalPolicyTestServer test_server_; |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 "pod.querySelector('.keyboard-select').value = '%s';" | 1494 "pod.querySelector('.keyboard-select').value = '%s';" |
| 1493 "pod.querySelector('.enter-button').click();", | 1495 "pod.querySelector('.enter-button').click();", |
| 1494 user_id_1_.c_str(), | 1496 user_id_1_.c_str(), |
| 1495 public_session_input_method_id_.c_str()))); | 1497 public_session_input_method_id_.c_str()))); |
| 1496 | 1498 |
| 1497 WaitForSessionStart(); | 1499 WaitForSessionStart(); |
| 1498 | 1500 |
| 1499 // Verify that the locale and keyboard layout have been applied. | 1501 // Verify that the locale and keyboard layout have been applied. |
| 1500 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); | 1502 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); |
| 1501 EXPECT_EQ(public_session_input_method_id_, | 1503 EXPECT_EQ(public_session_input_method_id_, |
| 1502 chromeos::input_method::InputMethodManager::Get()-> | 1504 chromeos::input_method::InputMethodManager::Get() |
| 1503 GetCurrentInputMethod().id()); | 1505 ->GetActiveIMEState() |
| 1506 ->GetCurrentInputMethod() |
| 1507 .id()); |
| 1504 } | 1508 } |
| 1505 | 1509 |
| 1506 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, OneRecommendedLocale) { | 1510 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, OneRecommendedLocale) { |
| 1507 // Specify a recommended locale. | 1511 // Specify a recommended locale. |
| 1508 SetRecommendedLocales(kSingleRecommendedLocale, | 1512 SetRecommendedLocales(kSingleRecommendedLocale, |
| 1509 arraysize(kSingleRecommendedLocale)); | 1513 arraysize(kSingleRecommendedLocale)); |
| 1510 UploadAndInstallDeviceLocalAccountPolicy(); | 1514 UploadAndInstallDeviceLocalAccountPolicy(); |
| 1511 AddPublicSessionToDevicePolicy(kAccountId1); | 1515 AddPublicSessionToDevicePolicy(kAccountId1); |
| 1512 | 1516 |
| 1513 WaitForPolicy(); | 1517 WaitForPolicy(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 base::StringPrintf( | 1745 base::StringPrintf( |
| 1742 "document.getElementById('pod-row').getPodWithUsername_('%s')" | 1746 "document.getElementById('pod-row').getPodWithUsername_('%s')" |
| 1743 " .querySelector('.enter-button').click();", | 1747 " .querySelector('.enter-button').click();", |
| 1744 user_id_1_.c_str()))); | 1748 user_id_1_.c_str()))); |
| 1745 | 1749 |
| 1746 WaitForSessionStart(); | 1750 WaitForSessionStart(); |
| 1747 | 1751 |
| 1748 // Verify that the locale and keyboard layout have been applied. | 1752 // Verify that the locale and keyboard layout have been applied. |
| 1749 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); | 1753 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); |
| 1750 EXPECT_EQ(public_session_input_method_id_, | 1754 EXPECT_EQ(public_session_input_method_id_, |
| 1751 chromeos::input_method::InputMethodManager::Get()-> | 1755 chromeos::input_method::InputMethodManager::Get() |
| 1752 GetCurrentInputMethod().id()); | 1756 ->GetActiveIMEState() |
| 1757 ->GetCurrentInputMethod() |
| 1758 .id()); |
| 1753 } | 1759 } |
| 1754 | 1760 |
| 1755 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, | 1761 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, |
| 1756 AutoLoginWithoutRecommendedLocales) { | 1762 AutoLoginWithoutRecommendedLocales) { |
| 1757 const std::string initial_locale = g_browser_process->GetApplicationLocale(); | 1763 const std::string initial_locale = g_browser_process->GetApplicationLocale(); |
| 1758 | 1764 |
| 1759 UploadAndInstallDeviceLocalAccountPolicy(); | 1765 UploadAndInstallDeviceLocalAccountPolicy(); |
| 1760 AddPublicSessionToDevicePolicy(kAccountId1); | 1766 AddPublicSessionToDevicePolicy(kAccountId1); |
| 1761 EnableAutoLogin(); | 1767 EnableAutoLogin(); |
| 1762 | 1768 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 "var observer = new MutationObserver(SendReplyIfDownloadDone);" | 1872 "var observer = new MutationObserver(SendReplyIfDownloadDone);" |
| 1867 "if (!SendReplyIfDownloadDone()) {" | 1873 "if (!SendReplyIfDownloadDone()) {" |
| 1868 " var options = { attributes: true, attributeFilter: [ 'class' ] };" | 1874 " var options = { attributes: true, attributeFilter: [ 'class' ] };" |
| 1869 " observer.observe(screenElement, options);" | 1875 " observer.observe(screenElement, options);" |
| 1870 "}", | 1876 "}", |
| 1871 &done)); | 1877 &done)); |
| 1872 | 1878 |
| 1873 // Verify that the locale and keyboard layout have been applied. | 1879 // Verify that the locale and keyboard layout have been applied. |
| 1874 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); | 1880 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); |
| 1875 EXPECT_EQ(public_session_input_method_id_, | 1881 EXPECT_EQ(public_session_input_method_id_, |
| 1876 chromeos::input_method::InputMethodManager::Get()-> | 1882 chromeos::input_method::InputMethodManager::Get() |
| 1877 GetCurrentInputMethod().id()); | 1883 ->GetActiveIMEState() |
| 1884 ->GetCurrentInputMethod() |
| 1885 .id()); |
| 1878 | 1886 |
| 1879 // Click the accept button. | 1887 // Click the accept button. |
| 1880 ASSERT_TRUE(content::ExecuteScript(contents_, | 1888 ASSERT_TRUE(content::ExecuteScript(contents_, |
| 1881 "$('tos-accept-button').click();")); | 1889 "$('tos-accept-button').click();")); |
| 1882 | 1890 |
| 1883 WaitForSessionStart(); | 1891 WaitForSessionStart(); |
| 1884 | 1892 |
| 1885 // Verify that the locale and keyboard layout are still in force. | 1893 // Verify that the locale and keyboard layout are still in force. |
| 1886 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); | 1894 EXPECT_EQ(kPublicSessionLocale, g_browser_process->GetApplicationLocale()); |
| 1887 EXPECT_EQ(public_session_input_method_id_, | 1895 EXPECT_EQ(public_session_input_method_id_, |
| 1888 chromeos::input_method::InputMethodManager::Get()-> | 1896 chromeos::input_method::InputMethodManager::Get() |
| 1889 GetCurrentInputMethod().id()); | 1897 ->GetActiveIMEState() |
| 1898 ->GetCurrentInputMethod() |
| 1899 .id()); |
| 1890 } | 1900 } |
| 1891 | 1901 |
| 1892 class TermsOfServiceDownloadTest : public DeviceLocalAccountTest, | 1902 class TermsOfServiceDownloadTest : public DeviceLocalAccountTest, |
| 1893 public testing::WithParamInterface<bool> { | 1903 public testing::WithParamInterface<bool> { |
| 1894 }; | 1904 }; |
| 1895 | 1905 |
| 1896 IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) { | 1906 IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) { |
| 1897 // Specify Terms of Service URL. | 1907 // Specify Terms of Service URL. |
| 1898 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 1908 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 1899 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( | 1909 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 ASSERT_TRUE(content::ExecuteScript(contents_, | 2024 ASSERT_TRUE(content::ExecuteScript(contents_, |
| 2015 "$('tos-accept-button').click();")); | 2025 "$('tos-accept-button').click();")); |
| 2016 | 2026 |
| 2017 WaitForSessionStart(); | 2027 WaitForSessionStart(); |
| 2018 } | 2028 } |
| 2019 | 2029 |
| 2020 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2030 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
| 2021 TermsOfServiceDownloadTest, testing::Bool()); | 2031 TermsOfServiceDownloadTest, testing::Bool()); |
| 2022 | 2032 |
| 2023 } // namespace policy | 2033 } // namespace policy |
| OLD | NEW |