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 "chrome/browser/chromeos/policy/device_local_account.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "base/memory/ref_counted.h" | 30 #include "base/memory/ref_counted.h" |
31 #include "base/path_service.h" | 31 #include "base/path_service.h" |
32 #include "base/run_loop.h" | 32 #include "base/run_loop.h" |
33 #include "base/sequenced_task_runner.h" | 33 #include "base/sequenced_task_runner.h" |
34 #include "base/single_thread_task_runner.h" | 34 #include "base/single_thread_task_runner.h" |
35 #include "base/strings/string_number_conversions.h" | 35 #include "base/strings/string_number_conversions.h" |
36 #include "base/strings/string_util.h" | 36 #include "base/strings/string_util.h" |
37 #include "base/strings/stringprintf.h" | 37 #include "base/strings/stringprintf.h" |
38 #include "base/strings/utf_string_conversions.h" | 38 #include "base/strings/utf_string_conversions.h" |
39 #include "base/synchronization/lock.h" | 39 #include "base/synchronization/lock.h" |
40 #include "base/threading/sequenced_worker_pool.h" | |
41 #include "base/threading/thread_task_runner_handle.h" | 40 #include "base/threading/thread_task_runner_handle.h" |
42 #include "base/values.h" | 41 #include "base/values.h" |
43 #include "chrome/browser/browser_process.h" | 42 #include "chrome/browser/browser_process.h" |
44 #include "chrome/browser/chrome_notification_types.h" | 43 #include "chrome/browser/chrome_notification_types.h" |
45 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" | 44 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic
y_loader.h" |
46 #include "chrome/browser/chromeos/extensions/external_cache.h" | 45 #include "chrome/browser/chromeos/extensions/external_cache.h" |
47 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 46 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
48 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 47 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
49 #include "chrome/browser/chromeos/login/screens/base_screen.h" | 48 #include "chrome/browser/chromeos/login/screens/base_screen.h" |
50 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 49 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #include "components/policy/core/common/policy_service.h" | 105 #include "components/policy/core/common/policy_service.h" |
107 #include "components/policy/core/common/policy_switches.h" | 106 #include "components/policy/core/common/policy_switches.h" |
108 #include "components/policy/policy_constants.h" | 107 #include "components/policy/policy_constants.h" |
109 #include "components/prefs/pref_change_registrar.h" | 108 #include "components/prefs/pref_change_registrar.h" |
110 #include "components/prefs/pref_service.h" | 109 #include "components/prefs/pref_service.h" |
111 #include "components/session_manager/core/session_manager.h" | 110 #include "components/session_manager/core/session_manager.h" |
112 #include "components/signin/core/browser/signin_manager.h" | 111 #include "components/signin/core/browser/signin_manager.h" |
113 #include "components/user_manager/user.h" | 112 #include "components/user_manager/user.h" |
114 #include "components/user_manager/user_manager.h" | 113 #include "components/user_manager/user_manager.h" |
115 #include "components/user_manager/user_type.h" | 114 #include "components/user_manager/user_type.h" |
116 #include "content/public/browser/browser_thread.h" | |
117 #include "content/public/browser/notification_details.h" | 115 #include "content/public/browser/notification_details.h" |
118 #include "content/public/browser/notification_service.h" | 116 #include "content/public/browser/notification_service.h" |
119 #include "content/public/browser/notification_source.h" | 117 #include "content/public/browser/notification_source.h" |
120 #include "content/public/browser/web_contents.h" | 118 #include "content/public/browser/web_contents.h" |
121 #include "content/public/browser/web_ui.h" | 119 #include "content/public/browser/web_ui.h" |
122 #include "content/public/test/browser_test_utils.h" | 120 #include "content/public/test/browser_test_utils.h" |
123 #include "content/public/test/test_utils.h" | 121 #include "content/public/test/test_utils.h" |
124 #include "crypto/rsa_private_key.h" | 122 #include "crypto/rsa_private_key.h" |
125 #include "extensions/browser/app_window/app_window.h" | 123 #include "extensions/browser/app_window/app_window.h" |
126 #include "extensions/browser/app_window/app_window_registry.h" | 124 #include "extensions/browser/app_window/app_window_registry.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 const char* const kRecommendedLocales2[] = { | 207 const char* const kRecommendedLocales2[] = { |
210 "fr", | 208 "fr", |
211 "nl", | 209 "nl", |
212 }; | 210 }; |
213 const char* const kInvalidRecommendedLocale[] = { | 211 const char* const kInvalidRecommendedLocale[] = { |
214 "xx", | 212 "xx", |
215 }; | 213 }; |
216 const char kPublicSessionLocale[] = "de"; | 214 const char kPublicSessionLocale[] = "de"; |
217 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; | 215 const char kPublicSessionInputMethodIDTemplate[] = "_comp_ime_%sxkb:de:neo:ger"; |
218 | 216 |
219 // The sequence token used by GetKeyboardLayoutsForLocale() for its background | |
220 // tasks. | |
221 const char kSequenceToken[] = "chromeos_login_l10n_util"; | |
222 | |
223 // Helper that serves extension update manifests to Chrome. | 217 // Helper that serves extension update manifests to Chrome. |
224 class TestingUpdateManifestProvider | 218 class TestingUpdateManifestProvider |
225 : public base::RefCountedThreadSafe<TestingUpdateManifestProvider> { | 219 : public base::RefCountedThreadSafe<TestingUpdateManifestProvider> { |
226 public: | 220 public: |
227 // Update manifests will be served at |relative_update_url|. | 221 // Update manifests will be served at |relative_update_url|. |
228 explicit TestingUpdateManifestProvider( | 222 explicit TestingUpdateManifestProvider( |
229 const std::string& relative_update_url); | 223 const std::string& relative_update_url); |
230 | 224 |
231 // When an update manifest is requested for the given extension |id|, indicate | 225 // When an update manifest is requested for the given extension |id|, indicate |
232 // that |version| of the extension can be downloaded at |crx_url|. | 226 // that |version| of the extension can be downloaded at |crx_url|. |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 account_id_1_.Serialize().c_str()), | 687 account_id_1_.Serialize().c_str()), |
694 &advanced)); | 688 &advanced)); |
695 // Verify that the pod expanded to its basic/advanced form, as expected. | 689 // Verify that the pod expanded to its basic/advanced form, as expected. |
696 EXPECT_EQ(expect_advanced, advanced); | 690 EXPECT_EQ(expect_advanced, advanced); |
697 | 691 |
698 // Verify that the construction of the pod's language list did not affect | 692 // Verify that the construction of the pod's language list did not affect |
699 // the current ICU locale. | 693 // the current ICU locale. |
700 EXPECT_EQ(initial_language_, icu::Locale::getDefault().getLanguage()); | 694 EXPECT_EQ(initial_language_, icu::Locale::getDefault().getLanguage()); |
701 } | 695 } |
702 | 696 |
703 // GetKeyboardLayoutsForLocale() posts a task to a background task runner. | 697 // GetKeyboardLayoutsForLocale() posts a task to a background task runner and |
704 // This method flushes that task runner and the current thread's message loop | 698 // handles the response on the main thread. This method flushes both the |
705 // to ensure that GetKeyboardLayoutsForLocale() is finished. | 699 // thread pool backing the background task runner and the main thread. |
706 void WaitForGetKeyboardLayoutsForLocaleToFinish() { | 700 void WaitForGetKeyboardLayoutsForLocaleToFinish() { |
707 base::SequencedWorkerPool* worker_pool = | 701 content::RunAllBlockingPoolTasksUntilIdle(); |
708 content::BrowserThread::GetBlockingPool(); | |
709 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | |
710 worker_pool->GetSequencedTaskRunner( | |
711 worker_pool->GetNamedSequenceToken(kSequenceToken)); | |
712 base::RunLoop run_loop; | |
713 background_task_runner->PostTaskAndReply(FROM_HERE, | |
714 base::Bind(&base::DoNothing), | |
715 run_loop.QuitClosure()); | |
716 run_loop.Run(); | |
717 base::RunLoop().RunUntilIdle(); | |
718 | 702 |
719 // Verify that the construction of the keyboard layout list did not affect | 703 // Verify that the construction of the keyboard layout list did not affect |
720 // the current ICU locale. | 704 // the current ICU locale. |
721 EXPECT_EQ(initial_language_, icu::Locale::getDefault().getLanguage()); | 705 EXPECT_EQ(initial_language_, icu::Locale::getDefault().getLanguage()); |
722 } | 706 } |
723 | 707 |
724 void StartLogin(const std::string& locale, | 708 void StartLogin(const std::string& locale, |
725 const std::string& input_method) { | 709 const std::string& input_method) { |
726 // Start login into the device-local account. | 710 // Start login into the device-local account. |
727 chromeos::LoginDisplayHost* host = | 711 chromeos::LoginDisplayHost* host = |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 ASSERT_TRUE(content::ExecuteScript(contents_, | 2432 ASSERT_TRUE(content::ExecuteScript(contents_, |
2449 "$('tos-accept-button').click();")); | 2433 "$('tos-accept-button').click();")); |
2450 | 2434 |
2451 WaitForSessionStart(); | 2435 WaitForSessionStart(); |
2452 } | 2436 } |
2453 | 2437 |
2454 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2438 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2455 TermsOfServiceDownloadTest, testing::Bool()); | 2439 TermsOfServiceDownloadTest, testing::Bool()); |
2456 | 2440 |
2457 } // namespace policy | 2441 } // namespace policy |
OLD | NEW |