| 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 <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/chromeos/policy/device_local_account.h" | 26 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 27 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 27 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 28 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 28 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 29 #include "chrome/browser/lifetime/application_lifetime.h" | 29 #include "chrome/browser/lifetime/application_lifetime.h" |
| 30 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 30 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
| 31 #include "chrome/browser/policy/cloud/policy_builder.h" | 31 #include "chrome/browser/policy/cloud/policy_builder.h" |
| 32 #include "chrome/browser/policy/policy_service.h" | 32 #include "chrome/browser/policy/policy_service.h" |
| 33 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" | 33 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" |
| 34 #include "chrome/browser/policy/test/local_policy_test_server.h" | 34 #include "chrome/browser/policy/test/local_policy_test_server.h" |
| 35 #include "chrome/browser/prefs/session_startup_pref.h" | 35 #include "chrome/browser/prefs/session_startup_pref.h" |
| 36 #include "chrome/browser/profiles/profile.h" |
| 37 #include "chrome/browser/profiles/profile_manager.h" |
| 36 #include "chrome/browser/ui/browser.h" | 38 #include "chrome/browser/ui/browser.h" |
| 39 #include "chrome/browser/ui/browser_commands.h" |
| 37 #include "chrome/browser/ui/browser_finder.h" | 40 #include "chrome/browser/ui/browser_finder.h" |
| 38 #include "chrome/browser/ui/browser_list.h" | 41 #include "chrome/browser/ui/browser_list.h" |
| 42 #include "chrome/browser/ui/browser_window.h" |
| 39 #include "chrome/browser/ui/host_desktop.h" | 43 #include "chrome/browser/ui/host_desktop.h" |
| 40 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 44 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 41 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| 42 #include "chromeos/chromeos_switches.h" | 46 #include "chromeos/chromeos_switches.h" |
| 43 #include "chromeos/dbus/cryptohome_client.h" | 47 #include "chromeos/dbus/cryptohome_client.h" |
| 44 #include "chromeos/dbus/dbus_method_call_status.h" | 48 #include "chromeos/dbus/dbus_method_call_status.h" |
| 45 #include "chromeos/dbus/fake_cryptohome_client.h" | 49 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 46 #include "chromeos/dbus/fake_session_manager_client.h" | 50 #include "chromeos/dbus/fake_session_manager_client.h" |
| 47 #include "chromeos/dbus/session_manager_client.h" | 51 #include "chromeos/dbus/session_manager_client.h" |
| 48 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 InstallDeviceLocalAccountPolicy(); | 299 InstallDeviceLocalAccountPolicy(); |
| 296 AddPublicSessionToDevicePolicy(kAccountId1); | 300 AddPublicSessionToDevicePolicy(kAccountId1); |
| 297 | 301 |
| 298 // This observes the display name becoming available as this indicates | 302 // This observes the display name becoming available as this indicates |
| 299 // device-local account policy is fully loaded, which is a prerequisite for | 303 // device-local account policy is fully loaded, which is a prerequisite for |
| 300 // successful login. | 304 // successful login. |
| 301 content::WindowedNotificationObserver( | 305 content::WindowedNotificationObserver( |
| 302 chrome::NOTIFICATION_USER_LIST_CHANGED, | 306 chrome::NOTIFICATION_USER_LIST_CHANGED, |
| 303 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName)).Wait(); | 307 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName)).Wait(); |
| 304 | 308 |
| 309 // Start login into the device-local account. |
| 305 chromeos::LoginDisplayHost* host = | 310 chromeos::LoginDisplayHost* host = |
| 306 chromeos::LoginDisplayHostImpl::default_host(); | 311 chromeos::LoginDisplayHostImpl::default_host(); |
| 307 ASSERT_TRUE(host); | 312 ASSERT_TRUE(host); |
| 308 host->StartSignInScreen(); | 313 host->StartSignInScreen(); |
| 309 chromeos::ExistingUserController* controller = | 314 chromeos::ExistingUserController* controller = |
| 310 chromeos::ExistingUserController::current_controller(); | 315 chromeos::ExistingUserController::current_controller(); |
| 311 ASSERT_TRUE(controller); | 316 ASSERT_TRUE(controller); |
| 312 controller->LoginAsPublicAccount(user_id_1_); | 317 controller->LoginAsPublicAccount(user_id_1_); |
| 313 | 318 |
| 314 // Wait for the session to start. | 319 // Wait for the session to start. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 375 |
| 371 // Verify that the Terms of Service screen is being shown. | 376 // Verify that the Terms of Service screen is being shown. |
| 372 chromeos::WizardController* wizard_controller = | 377 chromeos::WizardController* wizard_controller = |
| 373 chromeos::WizardController::default_controller(); | 378 chromeos::WizardController::default_controller(); |
| 374 ASSERT_TRUE(wizard_controller); | 379 ASSERT_TRUE(wizard_controller); |
| 375 ASSERT_TRUE(wizard_controller->current_screen()); | 380 ASSERT_TRUE(wizard_controller->current_screen()); |
| 376 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName, | 381 EXPECT_EQ(chromeos::WizardController::kTermsOfServiceScreenName, |
| 377 wizard_controller->current_screen()->GetName()); | 382 wizard_controller->current_screen()->GetName()); |
| 378 } | 383 } |
| 379 | 384 |
| 385 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, FullscreenDisabled) { |
| 386 InstallDeviceLocalAccountPolicy(); |
| 387 AddPublicSessionToDevicePolicy(kAccountId1); |
| 388 |
| 389 // This observes the display name becoming available as this indicates |
| 390 // device-local account policy is fully loaded, which is a prerequisite for |
| 391 // successful login. |
| 392 content::WindowedNotificationObserver( |
| 393 chrome::NOTIFICATION_USER_LIST_CHANGED, |
| 394 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName)).Wait(); |
| 395 |
| 396 // Ensure that the browser stays alive, even though no windows are opened |
| 397 // during session start. |
| 398 chrome::StartKeepAlive(); |
| 399 |
| 400 // Start login into the device-local account. |
| 401 chromeos::LoginDisplayHost* host = |
| 402 chromeos::LoginDisplayHostImpl::default_host(); |
| 403 ASSERT_TRUE(host); |
| 404 host->StartSignInScreen(); |
| 405 chromeos::ExistingUserController* controller = |
| 406 chromeos::ExistingUserController::current_controller(); |
| 407 ASSERT_TRUE(controller); |
| 408 controller->LoginAsPublicAccount(user_id_1_); |
| 409 |
| 410 // Wait for the session to start. |
| 411 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, |
| 412 base::Bind(IsSessionStarted)).Wait(); |
| 413 |
| 414 // Open a browser window. |
| 415 chrome::NewEmptyWindow(ProfileManager::GetDefaultProfile(), |
| 416 chrome::HOST_DESKTOP_TYPE_ASH); |
| 417 BrowserList* browser_list = |
| 418 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 419 EXPECT_EQ(1U, browser_list->size()); |
| 420 Browser* browser = browser_list->get(0); |
| 421 ASSERT_TRUE(browser); |
| 422 BrowserWindow* browser_window = browser->window(); |
| 423 ASSERT_TRUE(browser_window); |
| 424 chrome::EndKeepAlive(); |
| 425 |
| 426 // Verify that an attempt to enter fullscreen mode is denied. |
| 427 EXPECT_FALSE(browser_window->IsFullscreen()); |
| 428 chrome::ToggleFullscreenMode(browser); |
| 429 EXPECT_FALSE(browser_window->IsFullscreen()); |
| 430 } |
| 431 |
| 380 } // namespace policy | 432 } // namespace policy |
| OLD | NEW |