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

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

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

Powered by Google App Engine
This is Rietveld 408576698