Chromium Code Reviews| Index: chrome/browser/chromeos/login/kiosk_browsertest.cc |
| diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc |
| index c0f0451410c35e9166972032429630030e966789..28f53b7a8c6603ef6cd170d19cb0914420fbc7cf 100644 |
| --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc |
| +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc |
| @@ -237,6 +237,7 @@ class KioskTest : public OobeBaseTest { |
| protected: |
| virtual void SetUp() OVERRIDE { |
| test_app_id_ = kTestKioskApp; |
| + needs_background_networking_ = true; |
| mock_user_manager_.reset(new MockUserManager); |
| ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(true); |
| AppLaunchController::SkipSplashWaitForTesting(); |
| @@ -275,12 +276,25 @@ class KioskTest : public OobeBaseTest { |
| } |
| void ReloadKioskApps() { |
| + SetupTestAppUpdateCheck(); |
| + |
| // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. |
| KioskAppManager::Get()->RemoveApp(test_app_id_); |
| KioskAppManager::Get()->AddApp(test_app_id_); |
| } |
| + void SetupTestAppUpdateCheck() { |
| + if (!test_app_version().empty()) { |
| + fake_cws_->SetUpdateCrx( |
| + test_app_id(), test_crx_file(), test_app_version()); |
| + } |
| + } |
| + |
| void ReloadAutolaunchKioskApps() { |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| + SetupTestAppUpdateCheck(); |
|
xiyuan
2014/07/08 21:51:00
These three lines don't feel belong here. Maybe mo
jennyz
2014/07/12 00:03:21
For some reason, when I moved them to Setup(), Kio
|
| + |
| KioskAppManager::Get()->AddApp(test_app_id_); |
| KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); |
| } |
| @@ -465,6 +479,8 @@ class KioskTest : public OobeBaseTest { |
| ScopedCanConfigureNetwork can_configure_network(true, true); |
| // Start app launch and wait for network connectivity timeout. |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
| OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| splash_waiter.Wait(); |
| @@ -509,10 +525,20 @@ class KioskTest : public OobeBaseTest { |
| test_app_id_ = test_app_id; |
| } |
| const std::string& test_app_id() const { return test_app_id_; } |
| + void set_test_app_version(const std::string& version) { |
| + test_app_version_ = version; |
| + } |
| + const std::string& test_app_version() const { return test_app_version_; } |
| + void set_test_crx_file(const std::string& filename) { |
| + test_crx_file_ = filename; |
| + } |
| + const std::string& test_crx_file() const { return test_crx_file_; } |
| FakeCWS* fake_cws() { return fake_cws_.get(); } |
| private: |
| std::string test_app_id_; |
| + std::string test_app_version_; |
| + std::string test_crx_file_; |
| scoped_ptr<FakeCWS> fake_cws_; |
| scoped_ptr<MockUserManager> mock_user_manager_; |
| @@ -520,6 +546,8 @@ class KioskTest : public OobeBaseTest { |
| }; |
| IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| WaitForAppLaunchSuccess(); |
| } |
| @@ -527,6 +555,8 @@ IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { |
| IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { |
| // Tests that the kiosk session is not considered to be logged in with a GAIA |
| // account. |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| WaitForAppLaunchSuccess(); |
| @@ -585,6 +615,8 @@ IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDownConfigureNotAllowed) { |
| ScopedCanConfigureNetwork can_configure_network(false, true); |
| // Start app launch and wait for network connectivity timeout. |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
| OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| splash_waiter.Wait(); |
| @@ -636,6 +668,8 @@ IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppUserCancel) { |
| } |
| IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) { |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| PrepareAppLaunch(); |
| SimulateNetworkOnline(); |
| @@ -882,12 +916,6 @@ class KioskUpdateTest : public KioskTest { |
| virtual ~KioskUpdateTest() {} |
| protected: |
| - virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| - // Needs background networking so that ExtensionDownloader works. |
| - needs_background_networking_ = true; |
| - KioskTest::SetUpCommandLine(command_line); |
| - } |
| - |
| virtual void SetUpOnMainThread() OVERRIDE { |
| KioskTest::SetUpOnMainThread(); |
| } |
| @@ -899,6 +927,8 @@ class KioskUpdateTest : public KioskTest { |
| IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { |
| set_test_app_id(kTestOfflineEnabledKioskApp); |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| PrepareAppLaunch(); |
| SimulateNetworkOffline(); |
| @@ -925,10 +955,8 @@ IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { |
| IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { |
| set_test_app_id(kTestOfflineEnabledKioskApp); |
| - |
| - fake_cws()->SetUpdateCrx( |
| - test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); |
| - |
| + set_test_app_version("2.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| PrepareAppLaunch(); |
| SimulateNetworkOnline(); |
| SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| @@ -941,12 +969,8 @@ IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { |
| IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) { |
| set_test_app_id(kTestOfflineEnabledKioskApp); |
| - |
| - fake_cws()->SetUpdateCrx( |
| - test_app_id(), |
| - "ajoggoflpgplnnjkjamcmbepjdjdnpdp_v2_permission_change.crx", |
| - "2.0.0"); |
| - |
| + set_test_app_version("2.0.0"); |
| + set_test_crx_file(test_app_id() + "_v2_permission_change.crx"); |
| PrepareAppLaunch(); |
| SimulateNetworkOnline(); |
| SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| @@ -960,6 +984,8 @@ IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) { |
| IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PreserveLocalData) { |
| // Installs v1 app and writes some local data. |
| set_test_app_id(kTestLocalFsKioskApp); |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| ResultCatcher catcher; |
| StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| @@ -971,12 +997,8 @@ IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PreserveLocalData) { |
| // Update existing v1 app installed in PRE_PreserveLocalData to v2 |
| // that reads and verifies the local data. |
| set_test_app_id(kTestLocalFsKioskApp); |
| - |
| - fake_cws()->SetUpdateCrx( |
| - test_app_id(), |
| - "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx", |
| - "2.0.0"); |
| - |
| + set_test_app_version("2.0.0"); |
| + set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); |
| ResultCatcher catcher; |
| StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| WaitForAppLaunchSuccess(); |
| @@ -997,6 +1019,11 @@ class KioskEnterpriseTest : public KioskTest { |
| } |
| virtual void SetUpOnMainThread() OVERRIDE { |
| + set_test_app_id(kTestEnterpriseKioskApp); |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| + SetupTestAppUpdateCheck(); |
| + |
| KioskTest::SetUpOnMainThread(); |
| // Configure kTestEnterpriseKioskApp in device policy. |
| em::DeviceLocalAccountsProto* accounts = |