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