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" | |
11 #include "apps/app_window_registry.h" | |
12 #include "ash/shell.h" | 10 #include "ash/shell.h" |
13 #include "ash/system/chromeos/session/logout_confirmation_controller.h" | 11 #include "ash/system/chromeos/session/logout_confirmation_controller.h" |
14 #include "ash/system/chromeos/session/logout_confirmation_dialog.h" | 12 #include "ash/system/chromeos/session/logout_confirmation_dialog.h" |
15 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
16 #include "base/bind.h" | 14 #include "base/bind.h" |
17 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
18 #include "base/callback.h" | 16 #include "base/callback.h" |
19 #include "base/command_line.h" | 17 #include "base/command_line.h" |
20 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
21 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #include "components/user_manager/user_type.h" | 105 #include "components/user_manager/user_type.h" |
108 #include "content/public/browser/browser_thread.h" | 106 #include "content/public/browser/browser_thread.h" |
109 #include "content/public/browser/notification_details.h" | 107 #include "content/public/browser/notification_details.h" |
110 #include "content/public/browser/notification_service.h" | 108 #include "content/public/browser/notification_service.h" |
111 #include "content/public/browser/notification_source.h" | 109 #include "content/public/browser/notification_source.h" |
112 #include "content/public/browser/web_contents.h" | 110 #include "content/public/browser/web_contents.h" |
113 #include "content/public/browser/web_ui.h" | 111 #include "content/public/browser/web_ui.h" |
114 #include "content/public/test/browser_test_utils.h" | 112 #include "content/public/test/browser_test_utils.h" |
115 #include "content/public/test/test_utils.h" | 113 #include "content/public/test/test_utils.h" |
116 #include "crypto/rsa_private_key.h" | 114 #include "crypto/rsa_private_key.h" |
| 115 #include "extensions/browser/app_window/app_window.h" |
| 116 #include "extensions/browser/app_window/app_window_registry.h" |
117 #include "extensions/browser/app_window/native_app_window.h" | 117 #include "extensions/browser/app_window/native_app_window.h" |
118 #include "extensions/browser/extension_system.h" | 118 #include "extensions/browser/extension_system.h" |
119 #include "extensions/browser/management_policy.h" | 119 #include "extensions/browser/management_policy.h" |
120 #include "extensions/browser/notification_types.h" | 120 #include "extensions/browser/notification_types.h" |
121 #include "extensions/common/extension.h" | 121 #include "extensions/common/extension.h" |
122 #include "net/base/url_util.h" | 122 #include "net/base/url_util.h" |
123 #include "net/http/http_status_code.h" | 123 #include "net/http/http_status_code.h" |
124 #include "net/test/embedded_test_server/embedded_test_server.h" | 124 #include "net/test/embedded_test_server/embedded_test_server.h" |
125 #include "net/test/embedded_test_server/http_request.h" | 125 #include "net/test/embedded_test_server/http_request.h" |
126 #include "net/test/embedded_test_server/http_response.h" | 126 #include "net/test/embedded_test_server/http_response.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 379 |
380 bool IsSessionStarted() { | 380 bool IsSessionStarted() { |
381 return user_manager::UserManager::Get()->IsSessionStarted(); | 381 return user_manager::UserManager::Get()->IsSessionStarted(); |
382 } | 382 } |
383 | 383 |
384 } // namespace | 384 } // namespace |
385 | 385 |
386 class DeviceLocalAccountTest : public DevicePolicyCrosBrowserTest, | 386 class DeviceLocalAccountTest : public DevicePolicyCrosBrowserTest, |
387 public user_manager::UserManager::Observer, | 387 public user_manager::UserManager::Observer, |
388 public chrome::BrowserListObserver, | 388 public chrome::BrowserListObserver, |
389 public apps::AppWindowRegistry::Observer { | 389 public extensions::AppWindowRegistry::Observer { |
390 protected: | 390 protected: |
391 DeviceLocalAccountTest() | 391 DeviceLocalAccountTest() |
392 : user_id_1_(GenerateDeviceLocalAccountUserId( | 392 : user_id_1_(GenerateDeviceLocalAccountUserId( |
393 kAccountId1, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), | 393 kAccountId1, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), |
394 user_id_2_(GenerateDeviceLocalAccountUserId( | 394 user_id_2_(GenerateDeviceLocalAccountUserId( |
395 kAccountId2, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), | 395 kAccountId2, DeviceLocalAccount::TYPE_PUBLIC_SESSION)), |
396 public_session_input_method_id_(base::StringPrintf( | 396 public_session_input_method_id_(base::StringPrintf( |
397 kPublicSessionInputMethodIDTemplate, | 397 kPublicSessionInputMethodIDTemplate, |
398 chromeos::extension_ime_util::kXkbExtensionId)), | 398 chromeos::extension_ime_util::kXkbExtensionId)), |
399 contents_(NULL) { | 399 contents_(NULL) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 user_manager::UserManager* user_manager) OVERRIDE { | 513 user_manager::UserManager* user_manager) OVERRIDE { |
514 if (run_loop_) | 514 if (run_loop_) |
515 run_loop_->Quit(); | 515 run_loop_->Quit(); |
516 } | 516 } |
517 | 517 |
518 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE { | 518 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE { |
519 if (run_loop_) | 519 if (run_loop_) |
520 run_loop_->Quit(); | 520 run_loop_->Quit(); |
521 } | 521 } |
522 | 522 |
523 virtual void OnAppWindowAdded(apps::AppWindow* app_window) OVERRIDE { | 523 virtual void OnAppWindowAdded(extensions::AppWindow* app_window) OVERRIDE { |
524 if (run_loop_) | 524 if (run_loop_) |
525 run_loop_->Quit(); | 525 run_loop_->Quit(); |
526 } | 526 } |
527 | 527 |
528 virtual void OnAppWindowRemoved(apps::AppWindow* app_window) OVERRIDE { | 528 virtual void OnAppWindowRemoved(extensions::AppWindow* app_window) OVERRIDE { |
529 if (run_loop_) | 529 if (run_loop_) |
530 run_loop_->Quit(); | 530 run_loop_->Quit(); |
531 } | 531 } |
532 | 532 |
533 void InitializePolicy() { | 533 void InitializePolicy() { |
534 device_policy()->policy_data().set_public_key_version(1); | 534 device_policy()->policy_data().set_public_key_version(1); |
535 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); | 535 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); |
536 proto.mutable_show_user_names()->set_show_user_names(true); | 536 proto.mutable_show_user_names()->set_show_user_names(true); |
537 | 537 |
538 device_local_account_policy_.policy_data().set_policy_type( | 538 device_local_account_policy_.policy_data().set_policy_type( |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 UploadAndInstallDeviceLocalAccountPolicy(); | 1280 UploadAndInstallDeviceLocalAccountPolicy(); |
1281 AddPublicSessionToDevicePolicy(kAccountId1); | 1281 AddPublicSessionToDevicePolicy(kAccountId1); |
1282 | 1282 |
1283 WaitForPolicy(); | 1283 WaitForPolicy(); |
1284 | 1284 |
1285 ASSERT_NO_FATAL_FAILURE(StartLogin(std::string(), std::string())); | 1285 ASSERT_NO_FATAL_FAILURE(StartLogin(std::string(), std::string())); |
1286 WaitForSessionStart(); | 1286 WaitForSessionStart(); |
1287 | 1287 |
1288 Profile* profile = GetProfileForTest(); | 1288 Profile* profile = GetProfileForTest(); |
1289 ASSERT_TRUE(profile); | 1289 ASSERT_TRUE(profile); |
1290 apps::AppWindowRegistry* app_window_registry = | 1290 extensions::AppWindowRegistry* app_window_registry = |
1291 apps::AppWindowRegistry::Get(profile); | 1291 extensions::AppWindowRegistry::Get(profile); |
1292 app_window_registry->AddObserver(this); | 1292 app_window_registry->AddObserver(this); |
1293 | 1293 |
1294 // Verify that the logout confirmation dialog is not showing. | 1294 // Verify that the logout confirmation dialog is not showing. |
1295 ash::LogoutConfirmationController* logout_confirmation_controller = | 1295 ash::LogoutConfirmationController* logout_confirmation_controller = |
1296 ash::Shell::GetInstance()->logout_confirmation_controller(); | 1296 ash::Shell::GetInstance()->logout_confirmation_controller(); |
1297 ASSERT_TRUE(logout_confirmation_controller); | 1297 ASSERT_TRUE(logout_confirmation_controller); |
1298 EXPECT_FALSE(logout_confirmation_controller->dialog_for_testing()); | 1298 EXPECT_FALSE(logout_confirmation_controller->dialog_for_testing()); |
1299 | 1299 |
1300 // Remove policy that allows only explicitly whitelisted apps to be installed | 1300 // Remove policy that allows only explicitly whitelisted apps to be installed |
1301 // in a public session. | 1301 // in a public session. |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 ASSERT_TRUE(content::ExecuteScript(contents_, | 2065 ASSERT_TRUE(content::ExecuteScript(contents_, |
2066 "$('tos-accept-button').click();")); | 2066 "$('tos-accept-button').click();")); |
2067 | 2067 |
2068 WaitForSessionStart(); | 2068 WaitForSessionStart(); |
2069 } | 2069 } |
2070 | 2070 |
2071 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2071 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2072 TermsOfServiceDownloadTest, testing::Bool()); | 2072 TermsOfServiceDownloadTest, testing::Bool()); |
2073 | 2073 |
2074 } // namespace policy | 2074 } // namespace policy |
OLD | NEW |