Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: chrome/browser/chromeos/login/kiosk_browsertest.cc

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Fix Win GN build. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 use_consumer_kiosk_mode_(true),
455 fake_cws_(new FakeCWS) { 454 fake_cws_(new FakeCWS) {
456 set_exit_when_last_browser_closes(false); 455 set_exit_when_last_browser_closes(false);
457 } 456 }
458 457
459 ~KioskTest() override {} 458 ~KioskTest() override {}
460 459
461 protected: 460 protected:
462 void SetUp() override { 461 void SetUp() override {
463 test_app_id_ = kTestKioskApp; 462 test_app_id_ = kTestKioskApp;
464 set_test_app_version("1.0.0"); 463 set_test_app_version("1.0.0");
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 base::Bind(&ConsumerKioskAutoLaunchStatusCheck, 696 base::Bind(&ConsumerKioskAutoLaunchStatusCheck,
698 &status, 697 &status,
699 runner->QuitClosure())); 698 runner->QuitClosure()));
700 runner->Run(); 699 runner->Run();
701 CHECK_NE(status, 700 CHECK_NE(status,
702 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1)); 701 static_cast<KioskAppManager::ConsumerKioskAutoLaunchStatus>(-1));
703 return status; 702 return status;
704 } 703 }
705 704
706 void RunAppLaunchNetworkDownTest() { 705 void RunAppLaunchNetworkDownTest() {
707 mock_user_manager()->SetActiveUser(kTestOwnerEmail); 706 mock_user_manager()->SetActiveUser(test_owner_account_id_);
708 AppLaunchSigninScreen::SetUserManagerForTesting(mock_user_manager()); 707 AppLaunchSigninScreen::SetUserManagerForTesting(mock_user_manager());
709 708
710 // Mock network could be configured with owner's password. 709 // Mock network could be configured with owner's password.
711 ScopedCanConfigureNetwork can_configure_network(true, true); 710 ScopedCanConfigureNetwork can_configure_network(true, true);
712 711
713 // Start app launch and wait for network connectivity timeout. 712 // Start app launch and wait for network connectivity timeout.
714 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); 713 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure());
715 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); 714 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH);
716 splash_waiter.Wait(); 715 splash_waiter.Wait();
717 WaitForAppLaunchNetworkTimeout(); 716 WaitForAppLaunchNetworkTimeout();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 const std::string& test_crx_file() const { return test_crx_file_; } 780 const std::string& test_crx_file() const { return test_crx_file_; }
782 FakeCWS* fake_cws() { return fake_cws_.get(); } 781 FakeCWS* fake_cws() { return fake_cws_.get(); }
783 782
784 void set_use_consumer_kiosk_mode(bool use) { 783 void set_use_consumer_kiosk_mode(bool use) {
785 use_consumer_kiosk_mode_ = use; 784 use_consumer_kiosk_mode_ = use;
786 } 785 }
787 786
788 ScopedCrosSettingsTestHelper settings_helper_; 787 ScopedCrosSettingsTestHelper settings_helper_;
789 scoped_ptr<FakeOwnerSettingsService> owner_settings_service_; 788 scoped_ptr<FakeOwnerSettingsService> owner_settings_service_;
790 789
790 const AccountId test_owner_account_id_ =
791 AccountId::FromUserEmail(kTestOwnerEmail);
792
791 private: 793 private:
792 bool use_consumer_kiosk_mode_; 794 bool use_consumer_kiosk_mode_ = true;
793 std::string test_app_id_; 795 std::string test_app_id_;
794 std::string test_app_version_; 796 std::string test_app_version_;
795 std::string test_crx_file_; 797 std::string test_crx_file_;
796 scoped_ptr<FakeCWS> fake_cws_; 798 scoped_ptr<FakeCWS> fake_cws_;
797 scoped_ptr<MockUserManager> mock_user_manager_; 799 scoped_ptr<MockUserManager> mock_user_manager_;
798 800
799 DISALLOW_COPY_AND_ASSIGN(KioskTest); 801 DISALLOW_COPY_AND_ASSIGN(KioskTest);
800 }; 802 };
801 803
802 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { 804 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) {
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 } 2012 }
2011 2013
2012 class KioskEnterpriseTest : public KioskTest { 2014 class KioskEnterpriseTest : public KioskTest {
2013 protected: 2015 protected:
2014 KioskEnterpriseTest() { 2016 KioskEnterpriseTest() {
2015 set_use_consumer_kiosk_mode(false); 2017 set_use_consumer_kiosk_mode(false);
2016 } 2018 }
2017 2019
2018 void SetUpInProcessBrowserTestFixture() override { 2020 void SetUpInProcessBrowserTestFixture() override {
2019 policy::DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy( 2021 policy::DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy(
2020 kTestOwnerEmail); 2022 test_owner_account_id_.GetUserEmail());
2021 settings_helper_.SetCurrentUserIsOwner(false); 2023 settings_helper_.SetCurrentUserIsOwner(false);
2022 2024
2023 KioskTest::SetUpInProcessBrowserTestFixture(); 2025 KioskTest::SetUpInProcessBrowserTestFixture();
2024 } 2026 }
2025 2027
2026 void SetUpOnMainThread() override { 2028 void SetUpOnMainThread() override {
2027 KioskTest::SetUpOnMainThread(); 2029 KioskTest::SetUpOnMainThread();
2028 2030
2029 // Configure OAuth authentication. 2031 // Configure OAuth authentication.
2030 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); 2032 GaiaUrls* gaia_urls = GaiaUrls::GetInstance();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 2223
2222 bool wallpaper_loaded_; 2224 bool wallpaper_loaded_;
2223 scoped_refptr<content::MessageLoopRunner> runner_; 2225 scoped_refptr<content::MessageLoopRunner> runner_;
2224 2226
2225 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); 2227 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest);
2226 }; 2228 };
2227 2229
2228 IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) { 2230 IN_PROC_BROWSER_TEST_F(KioskHiddenWebUITest, AutolaunchWarning) {
2229 // Add a device owner. 2231 // Add a device owner.
2230 FakeChromeUserManager* user_manager = new FakeChromeUserManager(); 2232 FakeChromeUserManager* user_manager = new FakeChromeUserManager();
2231 user_manager->AddUser(kTestOwnerEmail); 2233 user_manager->AddUser(test_owner_account_id_);
2232 ScopedUserManagerEnabler enabler(user_manager); 2234 ScopedUserManagerEnabler enabler(user_manager);
2233 2235
2234 // Set kiosk app to autolaunch. 2236 // Set kiosk app to autolaunch.
2235 EnableConsumerKioskMode(); 2237 EnableConsumerKioskMode();
2236 WizardController::SkipPostLoginScreensForTesting(); 2238 WizardController::SkipPostLoginScreensForTesting();
2237 WizardController* wizard_controller = WizardController::default_controller(); 2239 WizardController* wizard_controller = WizardController::default_controller();
2238 CHECK(wizard_controller); 2240 CHECK(wizard_controller);
2239 2241
2240 // Start login screen after configuring auto launch app since the warning 2242 // Start login screen after configuring auto launch app since the warning
2241 // is triggered when switching to login screen. 2243 // is triggered when switching to login screen.
2242 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName); 2244 wizard_controller->AdvanceToScreen(WizardController::kNetworkScreenName);
2243 ReloadAutolaunchKioskApps(); 2245 ReloadAutolaunchKioskApps();
2244 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); 2246 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
2245 2247
2246 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty()); 2248 EXPECT_FALSE(KioskAppManager::Get()->GetAutoLaunchApp().empty());
2247 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled()); 2249 EXPECT_FALSE(KioskAppManager::Get()->IsAutoLaunchEnabled());
2248 2250
2249 // Wait for the auto launch warning come up. 2251 // Wait for the auto launch warning come up.
2250 content::WindowedNotificationObserver( 2252 content::WindowedNotificationObserver(
2251 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 2253 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
2252 content::NotificationService::AllSources()).Wait(); 2254 content::NotificationService::AllSources()).Wait();
2253 2255
2254 // Wait for the wallpaper to load. 2256 // Wait for the wallpaper to load.
2255 WaitForWallpaper(); 2257 WaitForWallpaper();
2256 EXPECT_TRUE(wallpaper_loaded()); 2258 EXPECT_TRUE(wallpaper_loaded());
2257 } 2259 }
2258 2260
2259 } // namespace chromeos 2261 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698