| 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/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 ASSERT_TRUE(host); | 600 ASSERT_TRUE(host); |
| 601 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); | 601 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); |
| 602 ASSERT_TRUE(oobe_ui); | 602 ASSERT_TRUE(oobe_ui); |
| 603 base::RunLoop run_loop; | 603 base::RunLoop run_loop; |
| 604 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); | 604 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); |
| 605 if (!oobe_ui_ready) | 605 if (!oobe_ui_ready) |
| 606 run_loop.Run(); | 606 run_loop.Run(); |
| 607 | 607 |
| 608 // Ensure that the browser stays alive, even though no windows are opened | 608 // Ensure that the browser stays alive, even though no windows are opened |
| 609 // during session start. | 609 // during session start. |
| 610 chrome::StartKeepAlive(); | 610 chrome::IncrementKeepAliveCount(); |
| 611 | 611 |
| 612 // Start login into the device-local account. | 612 // Start login into the device-local account. |
| 613 host->StartSignInScreen(LoginScreenContext()); | 613 host->StartSignInScreen(LoginScreenContext()); |
| 614 chromeos::ExistingUserController* controller = | 614 chromeos::ExistingUserController* controller = |
| 615 chromeos::ExistingUserController::current_controller(); | 615 chromeos::ExistingUserController::current_controller(); |
| 616 ASSERT_TRUE(controller); | 616 ASSERT_TRUE(controller); |
| 617 controller->LoginAsPublicAccount(user_id_1_); | 617 controller->LoginAsPublicAccount(user_id_1_); |
| 618 | 618 |
| 619 // Wait for the session to start. | 619 // Wait for the session to start. |
| 620 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, | 620 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, |
| 621 base::Bind(IsSessionStarted)).Wait(); | 621 base::Bind(IsSessionStarted)).Wait(); |
| 622 | 622 |
| 623 // Open a browser window. | 623 // Open a browser window. |
| 624 chrome::NewEmptyWindow(GetProfileForTest(), chrome::HOST_DESKTOP_TYPE_ASH); | 624 chrome::NewEmptyWindow(GetProfileForTest(), chrome::HOST_DESKTOP_TYPE_ASH); |
| 625 BrowserList* browser_list = | 625 BrowserList* browser_list = |
| 626 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 626 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
| 627 EXPECT_EQ(1U, browser_list->size()); | 627 EXPECT_EQ(1U, browser_list->size()); |
| 628 Browser* browser = browser_list->get(0); | 628 Browser* browser = browser_list->get(0); |
| 629 ASSERT_TRUE(browser); | 629 ASSERT_TRUE(browser); |
| 630 BrowserWindow* browser_window = browser->window(); | 630 BrowserWindow* browser_window = browser->window(); |
| 631 ASSERT_TRUE(browser_window); | 631 ASSERT_TRUE(browser_window); |
| 632 chrome::EndKeepAlive(); | 632 chrome::DecrementKeepAliveCount(); |
| 633 | 633 |
| 634 // Verify that an attempt to enter fullscreen mode is denied. | 634 // Verify that an attempt to enter fullscreen mode is denied. |
| 635 EXPECT_FALSE(browser_window->IsFullscreen()); | 635 EXPECT_FALSE(browser_window->IsFullscreen()); |
| 636 chrome::ToggleFullscreenMode(browser); | 636 chrome::ToggleFullscreenMode(browser); |
| 637 EXPECT_FALSE(browser_window->IsFullscreen()); | 637 EXPECT_FALSE(browser_window->IsFullscreen()); |
| 638 } | 638 } |
| 639 | 639 |
| 640 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) { | 640 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) { |
| 641 // Make it possible to force-install a hosted app and an extension. | 641 // Make it possible to force-install a hosted app and an extension. |
| 642 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 642 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 ASSERT_TRUE(host); | 683 ASSERT_TRUE(host); |
| 684 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); | 684 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); |
| 685 ASSERT_TRUE(oobe_ui); | 685 ASSERT_TRUE(oobe_ui); |
| 686 base::RunLoop run_loop; | 686 base::RunLoop run_loop; |
| 687 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); | 687 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); |
| 688 if (!oobe_ui_ready) | 688 if (!oobe_ui_ready) |
| 689 run_loop.Run(); | 689 run_loop.Run(); |
| 690 | 690 |
| 691 // Ensure that the browser stays alive, even though no windows are opened | 691 // Ensure that the browser stays alive, even though no windows are opened |
| 692 // during session start. | 692 // during session start. |
| 693 chrome::StartKeepAlive(); | 693 chrome::IncrementKeepAliveCount(); |
| 694 | 694 |
| 695 // Start listening for app/extension installation results. | 695 // Start listening for app/extension installation results. |
| 696 content::WindowedNotificationObserver hosted_app_observer( | 696 content::WindowedNotificationObserver hosted_app_observer( |
| 697 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 697 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 698 base::Bind(DoesInstallSuccessReferToId, kHostedAppID)); | 698 base::Bind(DoesInstallSuccessReferToId, kHostedAppID)); |
| 699 content::WindowedNotificationObserver extension_observer( | 699 content::WindowedNotificationObserver extension_observer( |
| 700 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 700 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
| 701 base::Bind(DoesInstallFailureReferToId, kGoodExtensionID)); | 701 base::Bind(DoesInstallFailureReferToId, kGoodExtensionID)); |
| 702 | 702 |
| 703 // Start login into the device-local account. | 703 // Start login into the device-local account. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 ASSERT_TRUE(host); | 782 ASSERT_TRUE(host); |
| 783 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); | 783 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); |
| 784 ASSERT_TRUE(oobe_ui); | 784 ASSERT_TRUE(oobe_ui); |
| 785 base::RunLoop run_loop; | 785 base::RunLoop run_loop; |
| 786 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); | 786 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure()); |
| 787 if (!oobe_ui_ready) | 787 if (!oobe_ui_ready) |
| 788 run_loop.Run(); | 788 run_loop.Run(); |
| 789 | 789 |
| 790 // Ensure that the browser stays alive, even though no windows are opened | 790 // Ensure that the browser stays alive, even though no windows are opened |
| 791 // during session start. | 791 // during session start. |
| 792 chrome::StartKeepAlive(); | 792 chrome::IncrementKeepAliveCount(); |
| 793 | 793 |
| 794 // Start listening for app/extension installation results. | 794 // Start listening for app/extension installation results. |
| 795 content::WindowedNotificationObserver hosted_app_observer( | 795 content::WindowedNotificationObserver hosted_app_observer( |
| 796 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 796 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 797 base::Bind(DoesInstallSuccessReferToId, kHostedAppID)); | 797 base::Bind(DoesInstallSuccessReferToId, kHostedAppID)); |
| 798 content::WindowedNotificationObserver extension_observer( | 798 content::WindowedNotificationObserver extension_observer( |
| 799 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 799 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
| 800 base::Bind(DoesInstallFailureReferToId, kGoodExtensionID)); | 800 base::Bind(DoesInstallFailureReferToId, kGoodExtensionID)); |
| 801 | 801 |
| 802 // Start login into the device-local account. | 802 // Start login into the device-local account. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 ASSERT_TRUE(host); | 908 ASSERT_TRUE(host); |
| 909 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); | 909 chromeos::OobeUI* oobe_ui = host->GetOobeUI(); |
| 910 ASSERT_TRUE(oobe_ui); | 910 ASSERT_TRUE(oobe_ui); |
| 911 run_loop.reset(new base::RunLoop); | 911 run_loop.reset(new base::RunLoop); |
| 912 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop->QuitClosure()); | 912 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop->QuitClosure()); |
| 913 if (!oobe_ui_ready) | 913 if (!oobe_ui_ready) |
| 914 run_loop->Run(); | 914 run_loop->Run(); |
| 915 | 915 |
| 916 // Ensure that the browser stays alive, even though no windows are opened | 916 // Ensure that the browser stays alive, even though no windows are opened |
| 917 // during session start. | 917 // during session start. |
| 918 chrome::StartKeepAlive(); | 918 chrome::IncrementKeepAliveCount(); |
| 919 | 919 |
| 920 // Start login into the device-local account. | 920 // Start login into the device-local account. |
| 921 host->StartSignInScreen(LoginScreenContext()); | 921 host->StartSignInScreen(LoginScreenContext()); |
| 922 chromeos::ExistingUserController* controller = | 922 chromeos::ExistingUserController* controller = |
| 923 chromeos::ExistingUserController::current_controller(); | 923 chromeos::ExistingUserController::current_controller(); |
| 924 ASSERT_TRUE(controller); | 924 ASSERT_TRUE(controller); |
| 925 controller->LoginAsPublicAccount(user_id_1_); | 925 controller->LoginAsPublicAccount(user_id_1_); |
| 926 | 926 |
| 927 // Wait for the session to start. | 927 // Wait for the session to start. |
| 928 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, | 928 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 if (!IsSessionStarted()) { | 1188 if (!IsSessionStarted()) { |
| 1189 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, | 1189 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, |
| 1190 base::Bind(IsSessionStarted)).Wait(); | 1190 base::Bind(IsSessionStarted)).Wait(); |
| 1191 } | 1191 } |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance, | 1194 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance, |
| 1195 TermsOfServiceTest, testing::Bool()); | 1195 TermsOfServiceTest, testing::Bool()); |
| 1196 | 1196 |
| 1197 } // namespace policy | 1197 } // namespace policy |
| OLD | NEW |