Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
| 6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
| 7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/desktop_background_controller_observer.h" | 9 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 public: | 231 public: |
| 232 KioskTest() : fake_cws_(new FakeCWS) { | 232 KioskTest() : fake_cws_(new FakeCWS) { |
| 233 set_exit_when_last_browser_closes(false); | 233 set_exit_when_last_browser_closes(false); |
| 234 } | 234 } |
| 235 | 235 |
| 236 virtual ~KioskTest() {} | 236 virtual ~KioskTest() {} |
| 237 | 237 |
| 238 protected: | 238 protected: |
| 239 virtual void SetUp() OVERRIDE { | 239 virtual void SetUp() OVERRIDE { |
| 240 test_app_id_ = kTestKioskApp; | 240 test_app_id_ = kTestKioskApp; |
| 241 needs_background_networking_ = true; | |
| 241 mock_user_manager_.reset(new MockUserManager); | 242 mock_user_manager_.reset(new MockUserManager); |
| 242 AppLaunchController::SkipSplashWaitForTesting(); | 243 AppLaunchController::SkipSplashWaitForTesting(); |
| 243 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds); | 244 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds); |
| 244 | 245 |
| 245 OobeBaseTest::SetUp(); | 246 OobeBaseTest::SetUp(); |
| 246 } | 247 } |
| 247 | 248 |
| 248 virtual void CleanUpOnMainThread() OVERRIDE { | 249 virtual void CleanUpOnMainThread() OVERRIDE { |
| 249 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); | 250 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); |
| 250 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); | 251 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 263 | 264 |
| 264 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { | 265 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { |
| 265 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 266 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
| 266 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? | 267 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? |
| 267 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, | 268 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, |
| 268 base::StringValue(app_id), | 269 base::StringValue(app_id), |
| 269 base::FundamentalValue(diagnostic_mode)); | 270 base::FundamentalValue(diagnostic_mode)); |
| 270 } | 271 } |
| 271 | 272 |
| 272 void ReloadKioskApps() { | 273 void ReloadKioskApps() { |
| 274 SetupTestAppUpdateCheck(); | |
| 275 | |
| 273 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. | 276 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. |
| 274 KioskAppManager::Get()->RemoveApp(test_app_id_); | 277 KioskAppManager::Get()->RemoveApp(test_app_id_); |
| 275 KioskAppManager::Get()->AddApp(test_app_id_); | 278 KioskAppManager::Get()->AddApp(test_app_id_); |
| 276 } | 279 } |
| 277 | 280 |
| 281 void SetupTestAppUpdateCheck() { | |
| 282 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.
| |
| 283 fake_cws_->SetUpdateCrx( | |
| 284 test_app_id(), test_crx_file(), test_app_version()); | |
| 285 } | |
| 286 | |
| 278 void ReloadAutolaunchKioskApps() { | 287 void ReloadAutolaunchKioskApps() { |
| 288 set_test_app_version("1.0.0"); | |
| 289 set_test_crx_file(test_app_id() + ".crx"); | |
| 290 SetupTestAppUpdateCheck(); | |
| 291 | |
| 279 KioskAppManager::Get()->AddApp(test_app_id_); | 292 KioskAppManager::Get()->AddApp(test_app_id_); |
| 280 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); | 293 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); |
| 281 } | 294 } |
| 282 | 295 |
| 283 void PrepareAppLaunch() { | 296 void PrepareAppLaunch() { |
| 284 EnableConsumerKioskMode(); | 297 EnableConsumerKioskMode(); |
| 285 | 298 |
| 286 // Start UI | 299 // Start UI |
| 287 content::WindowedNotificationObserver login_signal( | 300 content::WindowedNotificationObserver login_signal( |
| 288 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 301 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 base::CopyDirectory(test_data_dir.AppendASCII("Extensions"), | 463 base::CopyDirectory(test_data_dir.AppendASCII("Extensions"), |
| 451 app_profile_dir, | 464 app_profile_dir, |
| 452 true)); | 465 true)); |
| 453 } | 466 } |
| 454 | 467 |
| 455 void RunAppLaunchNetworkDownTest() { | 468 void RunAppLaunchNetworkDownTest() { |
| 456 // Mock network could be configured with owner's password. | 469 // Mock network could be configured with owner's password. |
| 457 ScopedCanConfigureNetwork can_configure_network(true, true); | 470 ScopedCanConfigureNetwork can_configure_network(true, true); |
| 458 | 471 |
| 459 // Start app launch and wait for network connectivity timeout. | 472 // Start app launch and wait for network connectivity timeout. |
| 473 set_test_app_version("1.0.0"); | |
| 474 set_test_crx_file(test_app_id() + ".crx"); | |
| 460 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 475 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
| 461 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 476 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| 462 splash_waiter.Wait(); | 477 splash_waiter.Wait(); |
| 463 WaitForAppLaunchNetworkTimeout(); | 478 WaitForAppLaunchNetworkTimeout(); |
| 464 | 479 |
| 465 // Configure network link should be visible. | 480 // Configure network link should be visible. |
| 466 JsExpect("$('splash-config-network').hidden == false"); | 481 JsExpect("$('splash-config-network').hidden == false"); |
| 467 | 482 |
| 468 // Set up fake user manager with an owner for the test. | 483 // Set up fake user manager with an owner for the test. |
| 469 mock_user_manager()->SetActiveUser(kTestOwnerEmail); | 484 mock_user_manager()->SetActiveUser(kTestOwnerEmail); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 496 return chromeos::LoginDisplayHostImpl::default_host() | 511 return chromeos::LoginDisplayHostImpl::default_host() |
| 497 ->GetAppLaunchController(); | 512 ->GetAppLaunchController(); |
| 498 } | 513 } |
| 499 | 514 |
| 500 MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } | 515 MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } |
| 501 | 516 |
| 502 void set_test_app_id(const std::string& test_app_id) { | 517 void set_test_app_id(const std::string& test_app_id) { |
| 503 test_app_id_ = test_app_id; | 518 test_app_id_ = test_app_id; |
| 504 } | 519 } |
| 505 const std::string& test_app_id() const { return test_app_id_; } | 520 const std::string& test_app_id() const { return test_app_id_; } |
| 521 void set_test_app_version(const std::string& version) { | |
| 522 test_app_version_ = version; | |
| 523 } | |
| 524 const std::string& test_app_version() const { return test_app_version_; } | |
| 525 void set_test_crx_file(const std::string& filename) { | |
| 526 test_crx_file_ = filename; | |
| 527 } | |
| 528 const std::string& test_crx_file() const { return test_crx_file_; } | |
| 506 FakeCWS* fake_cws() { return fake_cws_.get(); } | 529 FakeCWS* fake_cws() { return fake_cws_.get(); } |
| 507 | 530 |
| 508 private: | 531 private: |
| 509 std::string test_app_id_; | 532 std::string test_app_id_; |
| 533 std::string test_app_version_; | |
| 534 std::string test_crx_file_; | |
| 510 scoped_ptr<FakeCWS> fake_cws_; | 535 scoped_ptr<FakeCWS> fake_cws_; |
| 511 scoped_ptr<MockUserManager> mock_user_manager_; | 536 scoped_ptr<MockUserManager> mock_user_manager_; |
| 512 | 537 |
| 513 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 538 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
| 514 }; | 539 }; |
| 515 | 540 |
| 516 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { | 541 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { |
| 542 set_test_app_version("1.0.0"); | |
| 543 set_test_crx_file(test_app_id() + ".crx"); | |
| 517 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 544 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 518 WaitForAppLaunchSuccess(); | 545 WaitForAppLaunchSuccess(); |
| 519 } | 546 } |
| 520 | 547 |
| 521 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { | 548 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { |
| 522 // Tests that the kiosk session is not considered to be logged in with a GAIA | 549 // Tests that the kiosk session is not considered to be logged in with a GAIA |
| 523 // account. | 550 // account. |
| 551 set_test_app_version("1.0.0"); | |
| 552 set_test_crx_file(test_app_id() + ".crx"); | |
| 524 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 553 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 525 WaitForAppLaunchSuccess(); | 554 WaitForAppLaunchSuccess(); |
| 526 | 555 |
| 527 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 556 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 528 ASSERT_TRUE(app_profile); | 557 ASSERT_TRUE(app_profile); |
| 529 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( | 558 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( |
| 530 prefs::kGoogleServicesUsername)); | 559 prefs::kGoogleServicesUsername)); |
| 531 } | 560 } |
| 532 | 561 |
| 533 IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { | 562 IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 "})();")); | 601 "})();")); |
| 573 | 602 |
| 574 WaitForAppLaunchSuccess(); | 603 WaitForAppLaunchSuccess(); |
| 575 } | 604 } |
| 576 | 605 |
| 577 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDownConfigureNotAllowed) { | 606 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDownConfigureNotAllowed) { |
| 578 // Mock network could not be configured. | 607 // Mock network could not be configured. |
| 579 ScopedCanConfigureNetwork can_configure_network(false, true); | 608 ScopedCanConfigureNetwork can_configure_network(false, true); |
| 580 | 609 |
| 581 // Start app launch and wait for network connectivity timeout. | 610 // Start app launch and wait for network connectivity timeout. |
| 611 set_test_app_version("1.0.0"); | |
| 612 set_test_crx_file(test_app_id() + ".crx"); | |
| 582 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 613 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
| 583 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 614 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
| 584 splash_waiter.Wait(); | 615 splash_waiter.Wait(); |
| 585 WaitForAppLaunchNetworkTimeout(); | 616 WaitForAppLaunchNetworkTimeout(); |
| 586 | 617 |
| 587 // Configure network link should not be visible. | 618 // Configure network link should not be visible. |
| 588 JsExpect("$('splash-config-network').hidden == true"); | 619 JsExpect("$('splash-config-network').hidden == true"); |
| 589 | 620 |
| 590 // Network becomes online and app launch is resumed. | 621 // Network becomes online and app launch is resumed. |
| 591 SimulateNetworkOnline(); | 622 SimulateNetworkOnline(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 chrome::NOTIFICATION_APP_TERMINATING, | 654 chrome::NOTIFICATION_APP_TERMINATING, |
| 624 content::NotificationService::AllSources()); | 655 content::NotificationService::AllSources()); |
| 625 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", | 656 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", |
| 626 base::StringValue("app_launch_bailout")); | 657 base::StringValue("app_launch_bailout")); |
| 627 signal.Wait(); | 658 signal.Wait(); |
| 628 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL, | 659 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL, |
| 629 chromeos::KioskAppLaunchError::Get()); | 660 chromeos::KioskAppLaunchError::Get()); |
| 630 } | 661 } |
| 631 | 662 |
| 632 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) { | 663 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) { |
| 664 set_test_app_version("1.0.0"); | |
| 665 set_test_crx_file(test_app_id() + ".crx"); | |
| 633 PrepareAppLaunch(); | 666 PrepareAppLaunch(); |
| 634 SimulateNetworkOnline(); | 667 SimulateNetworkOnline(); |
| 635 | 668 |
| 636 LaunchApp(kTestKioskApp, true); | 669 LaunchApp(kTestKioskApp, true); |
| 637 | 670 |
| 638 content::WebContents* login_contents = GetLoginUI()->GetWebContents(); | 671 content::WebContents* login_contents = GetLoginUI()->GetWebContents(); |
| 639 | 672 |
| 640 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 673 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
| 641 JsConditionWaiter(login_contents, new_kiosk_ui ? | 674 JsConditionWaiter(login_contents, new_kiosk_ui ? |
| 642 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI).Wait(); | 675 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI).Wait(); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 871 } | 904 } |
| 872 | 905 |
| 873 class KioskUpdateTest : public KioskTest, | 906 class KioskUpdateTest : public KioskTest, |
| 874 public testing::WithParamInterface<bool> { | 907 public testing::WithParamInterface<bool> { |
| 875 public: | 908 public: |
| 876 KioskUpdateTest() {} | 909 KioskUpdateTest() {} |
| 877 virtual ~KioskUpdateTest() {} | 910 virtual ~KioskUpdateTest() {} |
| 878 | 911 |
| 879 protected: | 912 protected: |
| 880 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 913 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 881 // Needs background networking so that ExtensionDownloader works. | |
| 882 needs_background_networking_ = true; | |
| 883 | |
| 884 KioskTest::SetUpCommandLine(command_line); | 914 KioskTest::SetUpCommandLine(command_line); |
| 885 if (GetParam()) | 915 if (GetParam()) |
| 886 command_line->AppendSwitch(::switches::kMultiProfiles); | 916 command_line->AppendSwitch(::switches::kMultiProfiles); |
| 887 } | 917 } |
| 888 | 918 |
| 889 virtual void SetUpOnMainThread() OVERRIDE { | 919 virtual void SetUpOnMainThread() OVERRIDE { |
| 890 KioskTest::SetUpOnMainThread(); | 920 KioskTest::SetUpOnMainThread(); |
| 891 } | 921 } |
| 892 | 922 |
| 893 private: | 923 private: |
| 894 | 924 |
| 895 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); | 925 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); |
| 896 }; | 926 }; |
| 897 | 927 |
| 898 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { | 928 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { |
| 899 set_test_app_id(kTestOfflineEnabledKioskApp); | 929 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 930 set_test_app_version("1.0.0"); | |
| 931 set_test_crx_file(test_app_id() + ".crx"); | |
| 900 | 932 |
| 901 PrepareAppLaunch(); | 933 PrepareAppLaunch(); |
| 902 SimulateNetworkOffline(); | 934 SimulateNetworkOffline(); |
| 903 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 935 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 904 | 936 |
| 905 LaunchApp(test_app_id(), false); | 937 LaunchApp(test_app_id(), false); |
| 906 WaitForAppLaunchSuccess(); | 938 WaitForAppLaunchSuccess(); |
| 907 } | 939 } |
| 908 | 940 |
| 909 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { | 941 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { |
| 910 set_test_app_id(kTestOfflineEnabledKioskApp); | 942 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 911 | 943 |
| 912 fake_cws()->SetNoUpdate(test_app_id()); | 944 fake_cws()->SetNoUpdate(test_app_id()); |
| 913 | 945 |
| 914 PrepareAppLaunch(); | 946 PrepareAppLaunch(); |
| 915 SimulateNetworkOnline(); | 947 SimulateNetworkOnline(); |
| 916 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 948 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 917 | 949 |
| 918 LaunchApp(test_app_id(), false); | 950 LaunchApp(test_app_id(), false); |
| 919 WaitForAppLaunchSuccess(); | 951 WaitForAppLaunchSuccess(); |
| 920 | 952 |
| 921 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 953 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 922 } | 954 } |
| 923 | 955 |
| 924 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { | 956 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { |
| 925 set_test_app_id(kTestOfflineEnabledKioskApp); | 957 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 926 | 958 set_test_app_version("2.0.0"); |
| 927 fake_cws()->SetUpdateCrx( | 959 set_test_crx_file(test_app_id() + ".crx"); |
| 928 test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); | |
| 929 | |
| 930 PrepareAppLaunch(); | 960 PrepareAppLaunch(); |
| 931 SimulateNetworkOnline(); | 961 SimulateNetworkOnline(); |
| 932 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 962 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 933 | 963 |
| 934 LaunchApp(test_app_id(), false); | 964 LaunchApp(test_app_id(), false); |
| 935 WaitForAppLaunchSuccess(); | 965 WaitForAppLaunchSuccess(); |
| 936 | 966 |
| 937 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 967 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 938 } | 968 } |
| 939 | 969 |
| 940 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PermissionChange) { | 970 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PermissionChange) { |
| 941 set_test_app_id(kTestOfflineEnabledKioskApp); | 971 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 942 | 972 set_test_app_version("2.0.0"); |
| 943 fake_cws()->SetUpdateCrx( | 973 set_test_crx_file(test_app_id() + "_v2_permission_change.crx"); |
| 944 test_app_id(), | |
| 945 "ajoggoflpgplnnjkjamcmbepjdjdnpdp_v2_permission_change.crx", | |
| 946 "2.0.0"); | |
| 947 | |
| 948 PrepareAppLaunch(); | 974 PrepareAppLaunch(); |
| 949 SimulateNetworkOnline(); | 975 SimulateNetworkOnline(); |
| 950 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 976 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 951 | 977 |
| 952 LaunchApp(test_app_id(), false); | 978 LaunchApp(test_app_id(), false); |
| 953 WaitForAppLaunchSuccess(); | 979 WaitForAppLaunchSuccess(); |
| 954 | 980 |
| 955 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 981 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 956 } | 982 } |
| 957 | 983 |
| 958 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_PreserveLocalData) { | 984 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_PreserveLocalData) { |
| 959 // Installs v1 app and writes some local data. | 985 // Installs v1 app and writes some local data. |
| 960 set_test_app_id(kTestLocalFsKioskApp); | 986 set_test_app_id(kTestLocalFsKioskApp); |
| 987 set_test_app_version("1.0.0"); | |
| 988 set_test_crx_file(test_app_id() + ".crx"); | |
| 961 | 989 |
| 962 ResultCatcher catcher; | 990 ResultCatcher catcher; |
| 963 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 991 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 964 WaitForAppLaunchSuccess(); | 992 WaitForAppLaunchSuccess(); |
| 965 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 993 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 966 } | 994 } |
| 967 | 995 |
| 968 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PreserveLocalData) { | 996 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PreserveLocalData) { |
| 969 // Update existing v1 app installed in PRE_PreserveLocalData to v2 | 997 // Update existing v1 app installed in PRE_PreserveLocalData to v2 |
| 970 // that reads and verifies the local data. | 998 // that reads and verifies the local data. |
| 971 set_test_app_id(kTestLocalFsKioskApp); | 999 set_test_app_id(kTestLocalFsKioskApp); |
| 972 | 1000 set_test_app_version("2.0.0"); |
| 973 fake_cws()->SetUpdateCrx( | 1001 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); |
| 974 test_app_id(), | |
| 975 "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx", | |
| 976 "2.0.0"); | |
| 977 | |
| 978 ResultCatcher catcher; | 1002 ResultCatcher catcher; |
| 979 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1003 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 980 WaitForAppLaunchSuccess(); | 1004 WaitForAppLaunchSuccess(); |
| 981 | 1005 |
| 982 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1006 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 983 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1007 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 984 } | 1008 } |
| 985 | 1009 |
| 986 // TODO(xiyuan): Remove this after multi profile is turned on by default. | 1010 // TODO(xiyuan): Remove this after multi profile is turned on by default. |
| 987 INSTANTIATE_TEST_CASE_P(KioskUpdateTestInstantiation, | 1011 INSTANTIATE_TEST_CASE_P(KioskUpdateTestInstantiation, |
| 988 KioskUpdateTest, | 1012 KioskUpdateTest, |
| 989 testing::Bool()); | 1013 testing::Bool()); |
| 990 | 1014 |
| 991 class KioskEnterpriseTest : public KioskTest { | 1015 class KioskEnterpriseTest : public KioskTest { |
| 992 protected: | 1016 protected: |
| 993 KioskEnterpriseTest() {} | 1017 KioskEnterpriseTest() {} |
| 994 | 1018 |
| 995 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 1019 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 996 device_policy_test_helper_.MarkAsEnterpriseOwned(); | 1020 device_policy_test_helper_.MarkAsEnterpriseOwned(); |
| 997 device_policy_test_helper_.InstallOwnerKey(); | 1021 device_policy_test_helper_.InstallOwnerKey(); |
| 998 | 1022 |
| 999 KioskTest::SetUpInProcessBrowserTestFixture(); | 1023 KioskTest::SetUpInProcessBrowserTestFixture(); |
| 1000 } | 1024 } |
| 1001 | 1025 |
| 1002 virtual void SetUpOnMainThread() OVERRIDE { | 1026 virtual void SetUpOnMainThread() OVERRIDE { |
| 1027 set_test_app_id(kTestEnterpriseKioskApp); | |
| 1028 set_test_app_version("1.0.0"); | |
| 1029 set_test_crx_file(test_app_id() + ".crx"); | |
| 1030 SetupTestAppUpdateCheck(); | |
| 1031 | |
| 1003 KioskTest::SetUpOnMainThread(); | 1032 KioskTest::SetUpOnMainThread(); |
| 1004 // Configure kTestEnterpriseKioskApp in device policy. | 1033 // Configure kTestEnterpriseKioskApp in device policy. |
| 1005 em::DeviceLocalAccountsProto* accounts = | 1034 em::DeviceLocalAccountsProto* accounts = |
| 1006 device_policy_test_helper_.device_policy()->payload() | 1035 device_policy_test_helper_.device_policy()->payload() |
| 1007 .mutable_device_local_accounts(); | 1036 .mutable_device_local_accounts(); |
| 1008 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); | 1037 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); |
| 1009 account->set_account_id(kTestEnterpriseAccountId); | 1038 account->set_account_id(kTestEnterpriseAccountId); |
| 1010 account->set_type( | 1039 account->set_type( |
| 1011 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); | 1040 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); |
| 1012 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); | 1041 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 content::WindowedNotificationObserver( | 1225 content::WindowedNotificationObserver( |
| 1197 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1226 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1198 content::NotificationService::AllSources()).Wait(); | 1227 content::NotificationService::AllSources()).Wait(); |
| 1199 | 1228 |
| 1200 // Wait for the wallpaper to load. | 1229 // Wait for the wallpaper to load. |
| 1201 WaitForWallpaper(); | 1230 WaitForWallpaper(); |
| 1202 EXPECT_TRUE(wallpaper_loaded()); | 1231 EXPECT_TRUE(wallpaper_loaded()); |
| 1203 } | 1232 } |
| 1204 | 1233 |
| 1205 } // namespace chromeos | 1234 } // namespace chromeos |
| OLD | NEW |