Chromium Code Reviews| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
| 8 #include "ash/desktop_background/desktop_background_controller_observer.h" | 8 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 | 444 |
| 445 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); | 445 DISALLOW_COPY_AND_ASSIGN(AppDataLoadWaiter); |
| 446 }; | 446 }; |
| 447 | 447 |
| 448 } // namespace | 448 } // namespace |
| 449 | 449 |
| 450 class KioskTest : public OobeBaseTest { | 450 class KioskTest : public OobeBaseTest { |
| 451 public: | 451 public: |
| 452 KioskTest() | 452 KioskTest() |
| 453 : settings_helper_(false), | 453 : settings_helper_(false), |
| 454 test_owner_account_id_(AccountId::FromUserEmail(kTestOwnerEmail)), | |
|
achuithb
2015/10/23 00:08:49
in-class member initialization
Alexander Alekseev
2015/10/23 09:11:21
Done.
| |
| 454 use_consumer_kiosk_mode_(true), | 455 use_consumer_kiosk_mode_(true), |
| 455 fake_cws_(new FakeCWS) { | 456 fake_cws_(new FakeCWS) { |
| 456 set_exit_when_last_browser_closes(false); | 457 set_exit_when_last_browser_closes(false); |
| 457 } | 458 } |
| 458 | 459 |
| 459 ~KioskTest() override {} | 460 ~KioskTest() override {} |
| 460 | 461 |
| 461 protected: | 462 protected: |
| 462 void SetUp() override { | 463 void SetUp() override { |
| 463 test_app_id_ = kTestKioskApp; | 464 test_app_id_ = kTestKioskApp; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, | 698 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, |
| 698 &status, | 699 &status, |
| 699 runner->QuitClosure())); | 700 runner->QuitClosure())); |
| 700 runner->Run(); | 701 runner->Run(); |
| 701 CHECK_NE(status, | 702 CHECK_NE(status, |
| 702 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1)); | 703 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1)); |
| 703 return status; | 704 return status; |
| 704 } | 705 } |
| 705 | 706 |
| 706 void RunAppLaunchNetworkDownTest() { | 707 void RunAppLaunchNetworkDownTest() { |
| 707 mock_user_manager()->SetActiveUser(kTestOwnerEmail); | 708 mock_user_manager()->SetActiveUser(test_owner_account_id_); |
| 708 AppLaunchSigninScreen::SetUserManagerForTesting(mock_user_manager()); | 709 AppLaunchSigninScreen::SetUserManagerForTesting(mock_user_manager()); |
| 709 | 710 |
| 710 // Mock network could be configured with owner's password. | 711 // Mock network could be configured with owner's password. |
| 711 ScopedCanConfigureNetwork can_configure_network(true, true); | 712 ScopedCanConfigureNetwork can_configure_network(true, true); |
| 712 | 713 |
| 713 // Start app launch and wait for network connectivity timeout. | 714 // Start app launch and wait for network connectivity timeout. |
| 714 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 715 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
| 715 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 716 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| 716 splash_waiter.Wait(); | 717 splash_waiter.Wait(); |
| 717 WaitForAppLaunchNetworkTimeout(); | 718 WaitForAppLaunchNetworkTimeout(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 781 const std::string& test_crx_file() const { return test_crx_file_; } | 782 const std::string& test_crx_file() const { return test_crx_file_; } |
| 782 FakeCWS* fake_cws() { return fake_cws_.get(); } | 783 FakeCWS* fake_cws() { return fake_cws_.get(); } |
| 783 | 784 |
| 784 void set_use_consumer_kiosk_mode(bool use) { | 785 void set_use_consumer_kiosk_mode(bool use) { |
| 785 use_consumer_kiosk_mode_ = use; | 786 use_consumer_kiosk_mode_ = use; |
| 786 } | 787 } |
| 787 | 788 |
| 788 ScopedCrosSettingsTestHelper settings_helper_; | 789 ScopedCrosSettingsTestHelper settings_helper_; |
| 789 scoped_ptr<FakeOwnerSettingsService> owner_settings_service_; | 790 scoped_ptr<FakeOwnerSettingsService> owner_settings_service_; |
| 790 | 791 |
| 792 const AccountId test_owner_account_id_; | |
| 793 | |
| 791 private: | 794 private: |
| 792 bool use_consumer_kiosk_mode_; | 795 bool use_consumer_kiosk_mode_; |
| 793 std::string test_app_id_; | 796 std::string test_app_id_; |
| 794 std::string test_app_version_; | 797 std::string test_app_version_; |
| 795 std::string test_crx_file_; | 798 std::string test_crx_file_; |
| 796 scoped_ptr<FakeCWS> fake_cws_; | 799 scoped_ptr<FakeCWS> fake_cws_; |
| 797 scoped_ptr<MockUserManager> mock_user_manager_; | 800 scoped_ptr<MockUserManager> mock_user_manager_; |
| 798 | 801 |
| 799 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 802 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
| 800 }; | 803 }; |
| (...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2010 } | 2013 } |
| 2011 | 2014 |
| 2012 class KioskEnterpriseTest : public KioskTest { | 2015 class KioskEnterpriseTest : public KioskTest { |
| 2013 protected: | 2016 protected: |
| 2014 KioskEnterpriseTest() { | 2017 KioskEnterpriseTest() { |
| 2015 set_use_consumer_kiosk_mode(false); | 2018 set_use_consumer_kiosk_mode(false); |
| 2016 } | 2019 } |
| 2017 | 2020 |
| 2018 void SetUpInProcessBrowserTestFixture() override { | 2021 void SetUpInProcessBrowserTestFixture() override { |
| 2019 policy::DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy( | 2022 policy::DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy( |
| 2020 kTestOwnerEmail); | 2023 test_owner_account_id_.GetUserEmail()); |
| 2021 settings_helper_.SetCurrentUserIsOwner(false); | 2024 settings_helper_.SetCurrentUserIsOwner(false); |
| 2022 | 2025 |
| 2023 KioskTest::SetUpInProcessBrowserTestFixture(); | 2026 KioskTest::SetUpInProcessBrowserTestFixture(); |
| 2024 } | 2027 } |
| 2025 | 2028 |
| 2026 void SetUpOnMainThread() override { | 2029 void SetUpOnMainThread() override { |
| 2027 KioskTest::SetUpOnMainThread(); | 2030 KioskTest::SetUpOnMainThread(); |
| 2028 | 2031 |
| 2029 // Configure OAuth authentication. | 2032 // Configure OAuth authentication. |
| 2030 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); | 2033 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2221 | 2224 |
| 2222 bool wallpaper_loaded_; | 2225 bool wallpaper_loaded_; |
| 2223 scoped_refptr<content::MessageLoopRunner> runner_; | 2226 scoped_refptr<content::MessageLoopRunner> runner_; |
| 2224 | 2227 |
| 2225 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); | 2228 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); |
| 2226 }; | 2229 }; |
| 2227 | 2230 |
| 2228 IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) { | 2231 IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) { |
| 2229 // Add a device owner. | 2232 // Add a device owner. |
| 2230 FakeChromeUserManager* user_manager = new FakeChromeUserManager(); | 2233 FakeChromeUserManager* user_manager = new FakeChromeUserManager(); |
| 2231 user_manager->AddUser(kTestOwnerEmail); | 2234 user_manager->AddUser(test_owner_account_id_); |
| 2232 ScopedUserManagerEnabler enabler(user_manager); | 2235 ScopedUserManagerEnabler enabler(user_manager); |
| 2233 | 2236 |
| 2234 // Set kiosk app to autolaunch. | 2237 // Set kiosk app to autolaunch. |
| 2235 EnableConsumerKioskMode(); | 2238 EnableConsumerKioskMode(); |
| 2236 WizardController::SkipPostLoginScreensForTesting(); | 2239 WizardController::SkipPostLoginScreensForTesting(); |
| 2237 WizardController* wizard_controller = WizardController::default_controller(); | 2240 WizardController* wizard_controller = WizardController::default_controller(); |
| 2238 CHECK(wizard_controller); | 2241 CHECK(wizard_controller); |
| 2239 | 2242 |
| 2240 // Start login screen after configuring auto launch app since the warning | 2243 // Start login screen after configuring auto launch app since the warning |
| 2241 // is triggered when switching to login screen. | 2244 // is triggered when switching to login screen. |
| 2242 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); | 2245 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); |
| 2243 ReloadAutolaunchKioskApps(); | 2246 ReloadAutolaunchKioskApps(); |
| 2244 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 2247 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
| 2245 | 2248 |
| 2246 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); | 2249 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); |
| 2247 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); | 2250 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); |
| 2248 | 2251 |
| 2249 // Wait for the auto launch warning come up. | 2252 // Wait for the auto launch warning come up. |
| 2250 content::WindowedNotificationObserver( | 2253 content::WindowedNotificationObserver( |
| 2251 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2254 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 2252 content::NotificationService::AllSources()).Wait(); | 2255 content::NotificationService::AllSources()).Wait(); |
| 2253 | 2256 |
| 2254 // Wait for the wallpaper to load. | 2257 // Wait for the wallpaper to load. |
| 2255 WaitForWallpaper(); | 2258 WaitForWallpaper(); |
| 2256 EXPECT_TRUE(wallpaper_loaded()); | 2259 EXPECT_TRUE(wallpaper_loaded()); |
| 2257 } | 2260 } |
| 2258 | 2261 |
| 2259 } // namespace chromeos | 2262 } // namespace chromeos |
| OLD | NEW |