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

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

Issue 623293003: replace OVERRIDE and FINAL with override and final in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run git cl format on echo_dialog_view.h Created 6 years, 2 months 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 "ash/desktop_background/desktop_background_controller.h" 5 #include "ash/desktop_background/desktop_background_controller.h"
6 #include "ash/desktop_background/desktop_background_controller_observer.h" 6 #include "ash/desktop_background/desktop_background_controller_observer.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 class KioskTest : public OobeBaseTest { 290 class KioskTest : public OobeBaseTest {
291 public: 291 public:
292 KioskTest() : fake_cws_(new FakeCWS) { 292 KioskTest() : fake_cws_(new FakeCWS) {
293 set_exit_when_last_browser_closes(false); 293 set_exit_when_last_browser_closes(false);
294 } 294 }
295 295
296 virtual ~KioskTest() {} 296 virtual ~KioskTest() {}
297 297
298 protected: 298 protected:
299 virtual void SetUp() OVERRIDE { 299 virtual void SetUp() override {
300 test_app_id_ = kTestKioskApp; 300 test_app_id_ = kTestKioskApp;
301 set_test_app_version("1.0.0"); 301 set_test_app_version("1.0.0");
302 set_test_crx_file(test_app_id() + ".crx"); 302 set_test_crx_file(test_app_id() + ".crx");
303 needs_background_networking_ = true; 303 needs_background_networking_ = true;
304 mock_user_manager_.reset(new MockUserManager); 304 mock_user_manager_.reset(new MockUserManager);
305 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(true); 305 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(true);
306 AppLaunchController::SkipSplashWaitForTesting(); 306 AppLaunchController::SkipSplashWaitForTesting();
307 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds); 307 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds);
308 308
309 OobeBaseTest::SetUp(); 309 OobeBaseTest::SetUp();
310 } 310 }
311 311
312 virtual void TearDown() OVERRIDE { 312 virtual void TearDown() override {
313 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(false); 313 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(false);
314 OobeBaseTest::TearDown(); 314 OobeBaseTest::TearDown();
315 } 315 }
316 316
317 virtual void SetUpOnMainThread() OVERRIDE { 317 virtual void SetUpOnMainThread() override {
318 OobeBaseTest::SetUpOnMainThread(); 318 OobeBaseTest::SetUpOnMainThread();
319 // Needed to avoid showing Gaia screen instead of owner signin for 319 // Needed to avoid showing Gaia screen instead of owner signin for
320 // consumer network down test cases. 320 // consumer network down test cases.
321 StartupUtils::MarkDeviceRegistered(base::Closure()); 321 StartupUtils::MarkDeviceRegistered(base::Closure());
322 } 322 }
323 323
324 virtual void TearDownOnMainThread() OVERRIDE { 324 virtual void TearDownOnMainThread() override {
325 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); 325 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL);
326 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); 326 AppLaunchSigninScreen::SetUserManagerForTesting(NULL);
327 327
328 OobeBaseTest::TearDownOnMainThread(); 328 OobeBaseTest::TearDownOnMainThread();
329 329
330 // Clean up while main thread still runs. 330 // Clean up while main thread still runs.
331 // See http://crbug.com/176659. 331 // See http://crbug.com/176659.
332 KioskAppManager::Get()->CleanUp(); 332 KioskAppManager::Get()->CleanUp();
333 } 333 }
334 334
335 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 335 virtual void SetUpCommandLine(CommandLine* command_line) override {
336 OobeBaseTest::SetUpCommandLine(command_line); 336 OobeBaseTest::SetUpCommandLine(command_line);
337 fake_cws_->Init(embedded_test_server()); 337 fake_cws_->Init(embedded_test_server());
338 } 338 }
339 339
340 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { 340 void LaunchApp(const std::string& app_id, bool diagnostic_mode) {
341 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); 341 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI();
342 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? 342 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ?
343 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, 343 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI,
344 base::StringValue(app_id), 344 base::StringValue(app_id),
345 base::FundamentalValue(diagnostic_mode)); 345 base::FundamentalValue(diagnostic_mode));
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, 1039 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE,
1040 content::NotificationService::AllSources()).Wait(); 1040 content::NotificationService::AllSources()).Wait();
1041 } 1041 }
1042 1042
1043 class KioskUpdateTest : public KioskTest { 1043 class KioskUpdateTest : public KioskTest {
1044 public: 1044 public:
1045 KioskUpdateTest() {} 1045 KioskUpdateTest() {}
1046 virtual ~KioskUpdateTest() {} 1046 virtual ~KioskUpdateTest() {}
1047 1047
1048 protected: 1048 protected:
1049 virtual void SetUp() OVERRIDE { 1049 virtual void SetUp() override {
1050 fake_disk_mount_manager_ = new KioskFakeDiskMountManager(); 1050 fake_disk_mount_manager_ = new KioskFakeDiskMountManager();
1051 disks::DiskMountManager::InitializeForTesting(fake_disk_mount_manager_); 1051 disks::DiskMountManager::InitializeForTesting(fake_disk_mount_manager_);
1052 1052
1053 KioskTest::SetUp(); 1053 KioskTest::SetUp();
1054 } 1054 }
1055 1055
1056 virtual void TearDown() OVERRIDE { 1056 virtual void TearDown() override {
1057 disks::DiskMountManager::Shutdown(); 1057 disks::DiskMountManager::Shutdown();
1058 1058
1059 KioskTest::TearDown(); 1059 KioskTest::TearDown();
1060 } 1060 }
1061 1061
1062 virtual void SetUpOnMainThread() OVERRIDE { 1062 virtual void SetUpOnMainThread() override {
1063 KioskTest::SetUpOnMainThread(); 1063 KioskTest::SetUpOnMainThread();
1064 } 1064 }
1065 1065
1066 void PreCacheApp(const std::string& app_id, 1066 void PreCacheApp(const std::string& app_id,
1067 const std::string& version, 1067 const std::string& version,
1068 const std::string& crx_file) { 1068 const std::string& crx_file) {
1069 set_test_app_id(app_id); 1069 set_test_app_id(app_id);
1070 set_test_app_version(version); 1070 set_test_app_version(version);
1071 set_test_crx_file(crx_file); 1071 set_test_crx_file(crx_file);
1072 1072
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 runner_ = new content::MessageLoopRunner; 1153 runner_ = new content::MessageLoopRunner;
1154 runner_->Run(); 1154 runner_->Run();
1155 } 1155 }
1156 1156
1157 bool update_success() const { return update_success_; } 1157 bool update_success() const { return update_success_; }
1158 1158
1159 bool app_update_notified() const { return app_update_notified_; } 1159 bool app_update_notified() const { return app_update_notified_; }
1160 1160
1161 private: 1161 private:
1162 // KioskAppManagerObserver overrides: 1162 // KioskAppManagerObserver overrides:
1163 virtual void OnKioskAppCacheUpdated(const std::string& app_id) OVERRIDE { 1163 virtual void OnKioskAppCacheUpdated(const std::string& app_id) override {
1164 if (app_id_ != app_id) 1164 if (app_id_ != app_id)
1165 return; 1165 return;
1166 app_update_notified_ = true; 1166 app_update_notified_ = true;
1167 } 1167 }
1168 1168
1169 virtual void OnKioskAppExternalUpdateComplete(bool success) OVERRIDE { 1169 virtual void OnKioskAppExternalUpdateComplete(bool success) override {
1170 quit_ = true; 1170 quit_ = true;
1171 update_success_ = success; 1171 update_success_ = success;
1172 if (runner_.get()) 1172 if (runner_.get())
1173 runner_->Quit(); 1173 runner_->Quit();
1174 } 1174 }
1175 1175
1176 scoped_refptr<content::MessageLoopRunner> runner_; 1176 scoped_refptr<content::MessageLoopRunner> runner_;
1177 KioskAppManager* manager_; 1177 KioskAppManager* manager_;
1178 bool wait_for_update_success_; 1178 bool wait_for_update_success_;
1179 const std::string app_id_; 1179 const std::string app_id_;
(...skipping 25 matching lines...) Expand all
1205 return; 1205 return;
1206 runner_ = new content::MessageLoopRunner; 1206 runner_ = new content::MessageLoopRunner;
1207 runner_->Run(); 1207 runner_->Run();
1208 } 1208 }
1209 1209
1210 bool loaded() const { return loaded_; } 1210 bool loaded() const { return loaded_; }
1211 1211
1212 private: 1212 private:
1213 // KioskAppManagerObserver overrides: 1213 // KioskAppManagerObserver overrides:
1214 virtual void OnKioskExtensionLoadedInCache( 1214 virtual void OnKioskExtensionLoadedInCache(
1215 const std::string& app_id) OVERRIDE { 1215 const std::string& app_id) override {
1216 std::string cached_version; 1216 std::string cached_version;
1217 base::FilePath file_path; 1217 base::FilePath file_path;
1218 if (!manager_->GetCachedCrx(app_id_, &file_path, &cached_version)) 1218 if (!manager_->GetCachedCrx(app_id_, &file_path, &cached_version))
1219 return; 1219 return;
1220 if (version_ != cached_version) 1220 if (version_ != cached_version)
1221 return; 1221 return;
1222 loaded_ = true; 1222 loaded_ = true;
1223 quit_ = true; 1223 quit_ = true;
1224 if (runner_.get()) 1224 if (runner_.get())
1225 runner_->Quit(); 1225 runner_->Quit();
1226 } 1226 }
1227 1227
1228 virtual void OnKioskExtensionDownloadFailed( 1228 virtual void OnKioskExtensionDownloadFailed(
1229 const std::string& app_id) OVERRIDE { 1229 const std::string& app_id) override {
1230 loaded_ = false; 1230 loaded_ = false;
1231 quit_ = true; 1231 quit_ = true;
1232 if (runner_.get()) 1232 if (runner_.get())
1233 runner_->Quit(); 1233 runner_->Quit();
1234 } 1234 }
1235 1235
1236 scoped_refptr<content::MessageLoopRunner> runner_; 1236 scoped_refptr<content::MessageLoopRunner> runner_;
1237 KioskAppManager* manager_; 1237 KioskAppManager* manager_;
1238 bool loaded_; 1238 bool loaded_;
1239 bool quit_; 1239 bool quit_;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 WaitForAppLaunchAndOptionallyTerminateApp(false); 1551 WaitForAppLaunchAndOptionallyTerminateApp(false);
1552 1552
1553 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); 1553 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString());
1554 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 1554 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
1555 } 1555 }
1556 1556
1557 class KioskEnterpriseTest : public KioskTest { 1557 class KioskEnterpriseTest : public KioskTest {
1558 protected: 1558 protected:
1559 KioskEnterpriseTest() {} 1559 KioskEnterpriseTest() {}
1560 1560
1561 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 1561 virtual void SetUpInProcessBrowserTestFixture() override {
1562 device_policy_test_helper_.MarkAsEnterpriseOwned(); 1562 device_policy_test_helper_.MarkAsEnterpriseOwned();
1563 device_policy_test_helper_.InstallOwnerKey(); 1563 device_policy_test_helper_.InstallOwnerKey();
1564 1564
1565 KioskTest::SetUpInProcessBrowserTestFixture(); 1565 KioskTest::SetUpInProcessBrowserTestFixture();
1566 } 1566 }
1567 1567
1568 virtual void SetUpOnMainThread() OVERRIDE { 1568 virtual void SetUpOnMainThread() override {
1569 set_test_app_id(kTestEnterpriseKioskApp); 1569 set_test_app_id(kTestEnterpriseKioskApp);
1570 set_test_app_version("1.0.0"); 1570 set_test_app_version("1.0.0");
1571 set_test_crx_file(test_app_id() + ".crx"); 1571 set_test_crx_file(test_app_id() + ".crx");
1572 SetupTestAppUpdateCheck(); 1572 SetupTestAppUpdateCheck();
1573 1573
1574 KioskTest::SetUpOnMainThread(); 1574 KioskTest::SetUpOnMainThread();
1575 // Configure kTestEnterpriseKioskApp in device policy. 1575 // Configure kTestEnterpriseKioskApp in device policy.
1576 em::DeviceLocalAccountsProto* accounts = 1576 em::DeviceLocalAccountsProto* accounts =
1577 device_policy_test_helper_.device_policy()->payload() 1577 device_policy_test_helper_.device_policy()->payload()
1578 .mutable_device_local_accounts(); 1578 .mutable_device_local_accounts();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 } 1701 }
1702 1702
1703 // Specialized test fixture for testing kiosk mode on the 1703 // Specialized test fixture for testing kiosk mode on the
1704 // hidden WebUI initialization flow for slow hardware. 1704 // hidden WebUI initialization flow for slow hardware.
1705 class KioskHiddenWebUITest : public KioskTest, 1705 class KioskHiddenWebUITest : public KioskTest,
1706 public ash::DesktopBackgroundControllerObserver { 1706 public ash::DesktopBackgroundControllerObserver {
1707 public: 1707 public:
1708 KioskHiddenWebUITest() : wallpaper_loaded_(false) {} 1708 KioskHiddenWebUITest() : wallpaper_loaded_(false) {}
1709 1709
1710 // KioskTest overrides: 1710 // KioskTest overrides:
1711 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 1711 virtual void SetUpCommandLine(CommandLine* command_line) override {
1712 KioskTest::SetUpCommandLine(command_line); 1712 KioskTest::SetUpCommandLine(command_line);
1713 command_line->AppendSwitch(switches::kDisableBootAnimation); 1713 command_line->AppendSwitch(switches::kDisableBootAnimation);
1714 } 1714 }
1715 1715
1716 virtual void SetUpOnMainThread() OVERRIDE { 1716 virtual void SetUpOnMainThread() override {
1717 KioskTest::SetUpOnMainThread(); 1717 KioskTest::SetUpOnMainThread();
1718 ash::Shell::GetInstance()->desktop_background_controller() 1718 ash::Shell::GetInstance()->desktop_background_controller()
1719 ->AddObserver(this); 1719 ->AddObserver(this);
1720 } 1720 }
1721 1721
1722 virtual void TearDownOnMainThread() OVERRIDE { 1722 virtual void TearDownOnMainThread() override {
1723 ash::Shell::GetInstance()->desktop_background_controller() 1723 ash::Shell::GetInstance()->desktop_background_controller()
1724 ->RemoveObserver(this); 1724 ->RemoveObserver(this);
1725 KioskTest::TearDownOnMainThread(); 1725 KioskTest::TearDownOnMainThread();
1726 } 1726 }
1727 1727
1728 void WaitForWallpaper() { 1728 void WaitForWallpaper() {
1729 if (!wallpaper_loaded_) { 1729 if (!wallpaper_loaded_) {
1730 runner_ = new content::MessageLoopRunner; 1730 runner_ = new content::MessageLoopRunner;
1731 runner_->Run(); 1731 runner_->Run();
1732 } 1732 }
1733 } 1733 }
1734 1734
1735 bool wallpaper_loaded() const { return wallpaper_loaded_; } 1735 bool wallpaper_loaded() const { return wallpaper_loaded_; }
1736 1736
1737 // ash::DesktopBackgroundControllerObserver overrides: 1737 // ash::DesktopBackgroundControllerObserver overrides:
1738 virtual void OnWallpaperDataChanged() OVERRIDE { 1738 virtual void OnWallpaperDataChanged() override {
1739 wallpaper_loaded_ = true; 1739 wallpaper_loaded_ = true;
1740 if (runner_.get()) 1740 if (runner_.get())
1741 runner_->Quit(); 1741 runner_->Quit();
1742 } 1742 }
1743 1743
1744 bool wallpaper_loaded_; 1744 bool wallpaper_loaded_;
1745 scoped_refptr<content::MessageLoopRunner> runner_; 1745 scoped_refptr<content::MessageLoopRunner> runner_;
1746 1746
1747 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest); 1747 DISALLOW_COPY_AND_ASSIGN(KioskHiddenWebUITest);
1748 }; 1748 };
(...skipping 24 matching lines...) Expand all
1773 content::WindowedNotificationObserver( 1773 content::WindowedNotificationObserver(
1774 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, 1774 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE,
1775 content::NotificationService::AllSources()).Wait(); 1775 content::NotificationService::AllSources()).Wait();
1776 1776
1777 // Wait for the wallpaper to load. 1777 // Wait for the wallpaper to load.
1778 WaitForWallpaper(); 1778 WaitForWallpaper();
1779 EXPECT_TRUE(wallpaper_loaded()); 1779 EXPECT_TRUE(wallpaper_loaded());
1780 } 1780 }
1781 1781
1782 } // namespace chromeos 1782 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/fake_login_utils.h ('k') | chrome/browser/chromeos/login/lock/screen_locker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698