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 13f35d1c7db3c7d278bef66b1c14c614f4330240..c1558cead49511d1e273de5eb167c92e2af482bb 100644 |
| --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc |
| +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc |
| @@ -238,6 +238,7 @@ class KioskTest : public OobeBaseTest { |
| protected: |
| virtual void SetUp() OVERRIDE { |
| test_app_id_ = kTestKioskApp; |
| + needs_background_networking_ = true; |
| mock_user_manager_.reset(new MockUserManager); |
| AppLaunchController::SkipSplashWaitForTesting(); |
| AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds); |
| @@ -270,12 +271,24 @@ 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()) |
|
xiyuan
2014/05/29 19:49:01
nit: {} since the branch is more than one line
jennyz
2014/07/07 21:11:13
Done.
|
| + 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(); |
| + |
| KioskAppManager::Get()->AddApp(test_app_id_); |
| KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); |
| } |
| @@ -457,6 +470,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(); |
| @@ -503,10 +518,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_; |
| @@ -514,6 +539,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(); |
| } |
| @@ -521,6 +548,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(); |
| @@ -579,6 +608,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(); |
| @@ -630,6 +661,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(); |
| @@ -878,9 +911,6 @@ class KioskUpdateTest : public KioskTest, |
| protected: |
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| - // Needs background networking so that ExtensionDownloader works. |
| - needs_background_networking_ = true; |
| - |
| KioskTest::SetUpCommandLine(command_line); |
| if (GetParam()) |
| command_line->AppendSwitch(::switches::kMultiProfiles); |
| @@ -897,6 +927,8 @@ class KioskUpdateTest : public KioskTest, |
| IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { |
| set_test_app_id(kTestOfflineEnabledKioskApp); |
| + set_test_app_version("1.0.0"); |
| + set_test_crx_file(test_app_id() + ".crx"); |
| PrepareAppLaunch(); |
| SimulateNetworkOffline(); |
| @@ -923,10 +955,8 @@ IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { |
| IN_PROC_BROWSER_TEST_P(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"); |
| @@ -939,12 +969,8 @@ IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { |
| IN_PROC_BROWSER_TEST_P(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"); |
| @@ -958,6 +984,8 @@ IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PermissionChange) { |
| IN_PROC_BROWSER_TEST_P(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()); |
| @@ -969,12 +997,8 @@ IN_PROC_BROWSER_TEST_P(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(); |
| @@ -1000,6 +1024,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 = |