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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 public: | 230 public: |
231 KioskTest() : fake_cws_(new FakeCWS) { | 231 KioskTest() : fake_cws_(new FakeCWS) { |
232 set_exit_when_last_browser_closes(false); | 232 set_exit_when_last_browser_closes(false); |
233 } | 233 } |
234 | 234 |
235 virtual ~KioskTest() {} | 235 virtual ~KioskTest() {} |
236 | 236 |
237 protected: | 237 protected: |
238 virtual void SetUp() OVERRIDE { | 238 virtual void SetUp() OVERRIDE { |
239 test_app_id_ = kTestKioskApp; | 239 test_app_id_ = kTestKioskApp; |
240 needs_background_networking_ = true; | |
240 mock_user_manager_.reset(new MockUserManager); | 241 mock_user_manager_.reset(new MockUserManager); |
241 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(true); | 242 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(true); |
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 TearDown() OVERRIDE { | 249 virtual void TearDown() OVERRIDE { |
249 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(false); | 250 ProfileHelper::SetAlwaysReturnPrimaryUserForTesting(false); |
(...skipping 18 matching lines...) Expand all Loading... | |
268 | 269 |
269 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { | 270 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { |
270 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 271 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
271 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? | 272 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? |
272 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, | 273 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, |
273 base::StringValue(app_id), | 274 base::StringValue(app_id), |
274 base::FundamentalValue(diagnostic_mode)); | 275 base::FundamentalValue(diagnostic_mode)); |
275 } | 276 } |
276 | 277 |
277 void ReloadKioskApps() { | 278 void ReloadKioskApps() { |
279 SetupTestAppUpdateCheck(); | |
280 | |
278 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. | 281 // Remove then add to ensure NOTIFICATION_KIOSK_APPS_LOADED fires. |
279 KioskAppManager::Get()->RemoveApp(test_app_id_); | 282 KioskAppManager::Get()->RemoveApp(test_app_id_); |
280 KioskAppManager::Get()->AddApp(test_app_id_); | 283 KioskAppManager::Get()->AddApp(test_app_id_); |
281 } | 284 } |
282 | 285 |
286 void SetupTestAppUpdateCheck() { | |
287 if (!test_app_version().empty()) { | |
288 fake_cws_->SetUpdateCrx( | |
289 test_app_id(), test_crx_file(), test_app_version()); | |
290 } | |
291 } | |
292 | |
283 void ReloadAutolaunchKioskApps() { | 293 void ReloadAutolaunchKioskApps() { |
294 set_test_app_version("1.0.0"); | |
295 set_test_crx_file(test_app_id() + ".crx"); | |
296 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
| |
297 | |
284 KioskAppManager::Get()->AddApp(test_app_id_); | 298 KioskAppManager::Get()->AddApp(test_app_id_); |
285 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); | 299 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); |
286 } | 300 } |
287 | 301 |
288 void PrepareAppLaunch() { | 302 void PrepareAppLaunch() { |
289 EnableConsumerKioskMode(); | 303 EnableConsumerKioskMode(); |
290 | 304 |
291 // Start UI | 305 // Start UI |
292 content::WindowedNotificationObserver login_signal( | 306 content::WindowedNotificationObserver login_signal( |
293 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, | 307 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 } | 472 } |
459 | 473 |
460 void RunAppLaunchNetworkDownTest() { | 474 void RunAppLaunchNetworkDownTest() { |
461 mock_user_manager()->SetActiveUser(kTestOwnerEmail); | 475 mock_user_manager()->SetActiveUser(kTestOwnerEmail); |
462 AppLaunchSigninScreen::SetUserManagerForTesting(mock_user_manager()); | 476 AppLaunchSigninScreen::SetUserManagerForTesting(mock_user_manager()); |
463 | 477 |
464 // Mock network could be configured with owner's password. | 478 // Mock network could be configured with owner's password. |
465 ScopedCanConfigureNetwork can_configure_network(true, true); | 479 ScopedCanConfigureNetwork can_configure_network(true, true); |
466 | 480 |
467 // Start app launch and wait for network connectivity timeout. | 481 // Start app launch and wait for network connectivity timeout. |
482 set_test_app_version("1.0.0"); | |
483 set_test_crx_file(test_app_id() + ".crx"); | |
468 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 484 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
469 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 485 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
470 splash_waiter.Wait(); | 486 splash_waiter.Wait(); |
471 WaitForAppLaunchNetworkTimeout(); | 487 WaitForAppLaunchNetworkTimeout(); |
472 | 488 |
473 // Configure network link should be visible. | 489 // Configure network link should be visible. |
474 JsExpect("$('splash-config-network').hidden == false"); | 490 JsExpect("$('splash-config-network').hidden == false"); |
475 | 491 |
476 // Set up fake user manager with an owner for the test. | 492 // Set up fake user manager with an owner for the test. |
477 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()) | 493 static_cast<LoginDisplayHostImpl*>(LoginDisplayHostImpl::default_host()) |
(...skipping 24 matching lines...) Expand all Loading... | |
502 return chromeos::LoginDisplayHostImpl::default_host() | 518 return chromeos::LoginDisplayHostImpl::default_host() |
503 ->GetAppLaunchController(); | 519 ->GetAppLaunchController(); |
504 } | 520 } |
505 | 521 |
506 MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } | 522 MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } |
507 | 523 |
508 void set_test_app_id(const std::string& test_app_id) { | 524 void set_test_app_id(const std::string& test_app_id) { |
509 test_app_id_ = test_app_id; | 525 test_app_id_ = test_app_id; |
510 } | 526 } |
511 const std::string& test_app_id() const { return test_app_id_; } | 527 const std::string& test_app_id() const { return test_app_id_; } |
528 void set_test_app_version(const std::string& version) { | |
529 test_app_version_ = version; | |
530 } | |
531 const std::string& test_app_version() const { return test_app_version_; } | |
532 void set_test_crx_file(const std::string& filename) { | |
533 test_crx_file_ = filename; | |
534 } | |
535 const std::string& test_crx_file() const { return test_crx_file_; } | |
512 FakeCWS* fake_cws() { return fake_cws_.get(); } | 536 FakeCWS* fake_cws() { return fake_cws_.get(); } |
513 | 537 |
514 private: | 538 private: |
515 std::string test_app_id_; | 539 std::string test_app_id_; |
540 std::string test_app_version_; | |
541 std::string test_crx_file_; | |
516 scoped_ptr<FakeCWS> fake_cws_; | 542 scoped_ptr<FakeCWS> fake_cws_; |
517 scoped_ptr<MockUserManager> mock_user_manager_; | 543 scoped_ptr<MockUserManager> mock_user_manager_; |
518 | 544 |
519 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 545 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
520 }; | 546 }; |
521 | 547 |
522 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { | 548 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { |
549 set_test_app_version("1.0.0"); | |
550 set_test_crx_file(test_app_id() + ".crx"); | |
523 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 551 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
524 WaitForAppLaunchSuccess(); | 552 WaitForAppLaunchSuccess(); |
525 } | 553 } |
526 | 554 |
527 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { | 555 IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { |
528 // Tests that the kiosk session is not considered to be logged in with a GAIA | 556 // Tests that the kiosk session is not considered to be logged in with a GAIA |
529 // account. | 557 // account. |
558 set_test_app_version("1.0.0"); | |
559 set_test_crx_file(test_app_id() + ".crx"); | |
530 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 560 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
531 WaitForAppLaunchSuccess(); | 561 WaitForAppLaunchSuccess(); |
532 | 562 |
533 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 563 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
534 ASSERT_TRUE(app_profile); | 564 ASSERT_TRUE(app_profile); |
535 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( | 565 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( |
536 prefs::kGoogleServicesUsername)); | 566 prefs::kGoogleServicesUsername)); |
537 } | 567 } |
538 | 568 |
539 IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { | 569 IN_PROC_BROWSER_TEST_F(KioskTest, PRE_LaunchAppNetworkDown) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
578 "})();")); | 608 "})();")); |
579 | 609 |
580 WaitForAppLaunchSuccess(); | 610 WaitForAppLaunchSuccess(); |
581 } | 611 } |
582 | 612 |
583 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDownConfigureNotAllowed) { | 613 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchAppNetworkDownConfigureNotAllowed) { |
584 // Mock network could not be configured. | 614 // Mock network could not be configured. |
585 ScopedCanConfigureNetwork can_configure_network(false, true); | 615 ScopedCanConfigureNetwork can_configure_network(false, true); |
586 | 616 |
587 // Start app launch and wait for network connectivity timeout. | 617 // Start app launch and wait for network connectivity timeout. |
618 set_test_app_version("1.0.0"); | |
619 set_test_crx_file(test_app_id() + ".crx"); | |
588 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); | 620 StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); |
589 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); | 621 OobeScreenWaiter splash_waiter(OobeDisplay::SCREEN_APP_LAUNCH_SPLASH); |
590 splash_waiter.Wait(); | 622 splash_waiter.Wait(); |
591 WaitForAppLaunchNetworkTimeout(); | 623 WaitForAppLaunchNetworkTimeout(); |
592 | 624 |
593 // Configure network link should not be visible. | 625 // Configure network link should not be visible. |
594 JsExpect("$('splash-config-network').hidden == true"); | 626 JsExpect("$('splash-config-network').hidden == true"); |
595 | 627 |
596 // Network becomes online and app launch is resumed. | 628 // Network becomes online and app launch is resumed. |
597 SimulateNetworkOnline(); | 629 SimulateNetworkOnline(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 chrome::NOTIFICATION_APP_TERMINATING, | 661 chrome::NOTIFICATION_APP_TERMINATING, |
630 content::NotificationService::AllSources()); | 662 content::NotificationService::AllSources()); |
631 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", | 663 GetLoginUI()->CallJavascriptFunction("cr.ui.Oobe.handleAccelerator", |
632 base::StringValue("app_launch_bailout")); | 664 base::StringValue("app_launch_bailout")); |
633 signal.Wait(); | 665 signal.Wait(); |
634 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL, | 666 EXPECT_EQ(chromeos::KioskAppLaunchError::USER_CANCEL, |
635 chromeos::KioskAppLaunchError::Get()); | 667 chromeos::KioskAppLaunchError::Get()); |
636 } | 668 } |
637 | 669 |
638 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) { | 670 IN_PROC_BROWSER_TEST_F(KioskTest, LaunchInDiagnosticMode) { |
671 set_test_app_version("1.0.0"); | |
672 set_test_crx_file(test_app_id() + ".crx"); | |
639 PrepareAppLaunch(); | 673 PrepareAppLaunch(); |
640 SimulateNetworkOnline(); | 674 SimulateNetworkOnline(); |
641 | 675 |
642 LaunchApp(kTestKioskApp, true); | 676 LaunchApp(kTestKioskApp, true); |
643 | 677 |
644 content::WebContents* login_contents = GetLoginUI()->GetWebContents(); | 678 content::WebContents* login_contents = GetLoginUI()->GetWebContents(); |
645 | 679 |
646 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 680 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
647 JsConditionWaiter(login_contents, new_kiosk_ui ? | 681 JsConditionWaiter(login_contents, new_kiosk_ui ? |
648 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI).Wait(); | 682 kCheckDiagnosticModeNewAPI : kCheckDiagnosticModeOldAPI).Wait(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
875 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, | 909 chrome::NOTIFICATION_KIOSK_ENABLE_WARNING_VISIBLE, |
876 content::NotificationService::AllSources()).Wait(); | 910 content::NotificationService::AllSources()).Wait(); |
877 } | 911 } |
878 | 912 |
879 class KioskUpdateTest : public KioskTest { | 913 class KioskUpdateTest : public KioskTest { |
880 public: | 914 public: |
881 KioskUpdateTest() {} | 915 KioskUpdateTest() {} |
882 virtual ~KioskUpdateTest() {} | 916 virtual ~KioskUpdateTest() {} |
883 | 917 |
884 protected: | 918 protected: |
885 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
886 // Needs background networking so that ExtensionDownloader works. | |
887 needs_background_networking_ = true; | |
888 KioskTest::SetUpCommandLine(command_line); | |
889 } | |
890 | |
891 virtual void SetUpOnMainThread() OVERRIDE { | 919 virtual void SetUpOnMainThread() OVERRIDE { |
892 KioskTest::SetUpOnMainThread(); | 920 KioskTest::SetUpOnMainThread(); |
893 } | 921 } |
894 | 922 |
895 private: | 923 private: |
896 | 924 |
897 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); | 925 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); |
898 }; | 926 }; |
899 | 927 |
900 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { | 928 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { |
901 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"); | |
902 | 932 |
903 PrepareAppLaunch(); | 933 PrepareAppLaunch(); |
904 SimulateNetworkOffline(); | 934 SimulateNetworkOffline(); |
905 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 935 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
906 | 936 |
907 LaunchApp(test_app_id(), false); | 937 LaunchApp(test_app_id(), false); |
908 WaitForAppLaunchSuccess(); | 938 WaitForAppLaunchSuccess(); |
909 } | 939 } |
910 | 940 |
911 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { | 941 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { |
912 set_test_app_id(kTestOfflineEnabledKioskApp); | 942 set_test_app_id(kTestOfflineEnabledKioskApp); |
913 | 943 |
914 fake_cws()->SetNoUpdate(test_app_id()); | 944 fake_cws()->SetNoUpdate(test_app_id()); |
915 | 945 |
916 PrepareAppLaunch(); | 946 PrepareAppLaunch(); |
917 SimulateNetworkOnline(); | 947 SimulateNetworkOnline(); |
918 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 948 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
919 | 949 |
920 LaunchApp(test_app_id(), false); | 950 LaunchApp(test_app_id(), false); |
921 WaitForAppLaunchSuccess(); | 951 WaitForAppLaunchSuccess(); |
922 | 952 |
923 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 953 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
924 } | 954 } |
925 | 955 |
926 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { | 956 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { |
927 set_test_app_id(kTestOfflineEnabledKioskApp); | 957 set_test_app_id(kTestOfflineEnabledKioskApp); |
928 | 958 set_test_app_version("2.0.0"); |
929 fake_cws()->SetUpdateCrx( | 959 set_test_crx_file(test_app_id() + ".crx"); |
930 test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); | |
931 | |
932 PrepareAppLaunch(); | 960 PrepareAppLaunch(); |
933 SimulateNetworkOnline(); | 961 SimulateNetworkOnline(); |
934 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 962 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
935 | 963 |
936 LaunchApp(test_app_id(), false); | 964 LaunchApp(test_app_id(), false); |
937 WaitForAppLaunchSuccess(); | 965 WaitForAppLaunchSuccess(); |
938 | 966 |
939 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 967 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
940 } | 968 } |
941 | 969 |
942 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) { | 970 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) { |
943 set_test_app_id(kTestOfflineEnabledKioskApp); | 971 set_test_app_id(kTestOfflineEnabledKioskApp); |
944 | 972 set_test_app_version("2.0.0"); |
945 fake_cws()->SetUpdateCrx( | 973 set_test_crx_file(test_app_id() + "_v2_permission_change.crx"); |
946 test_app_id(), | |
947 "ajoggoflpgplnnjkjamcmbepjdjdnpdp_v2_permission_change.crx", | |
948 "2.0.0"); | |
949 | |
950 PrepareAppLaunch(); | 974 PrepareAppLaunch(); |
951 SimulateNetworkOnline(); | 975 SimulateNetworkOnline(); |
952 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 976 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
953 | 977 |
954 LaunchApp(test_app_id(), false); | 978 LaunchApp(test_app_id(), false); |
955 WaitForAppLaunchSuccess(); | 979 WaitForAppLaunchSuccess(); |
956 | 980 |
957 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 981 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
958 } | 982 } |
959 | 983 |
960 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PreserveLocalData) { | 984 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PreserveLocalData) { |
961 // Installs v1 app and writes some local data. | 985 // Installs v1 app and writes some local data. |
962 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"); | |
963 | 989 |
964 ResultCatcher catcher; | 990 ResultCatcher catcher; |
965 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 991 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
966 WaitForAppLaunchSuccess(); | 992 WaitForAppLaunchSuccess(); |
967 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 993 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
968 } | 994 } |
969 | 995 |
970 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PreserveLocalData) { | 996 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PreserveLocalData) { |
971 // Update existing v1 app installed in PRE_PreserveLocalData to v2 | 997 // Update existing v1 app installed in PRE_PreserveLocalData to v2 |
972 // that reads and verifies the local data. | 998 // that reads and verifies the local data. |
973 set_test_app_id(kTestLocalFsKioskApp); | 999 set_test_app_id(kTestLocalFsKioskApp); |
974 | 1000 set_test_app_version("2.0.0"); |
975 fake_cws()->SetUpdateCrx( | 1001 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); |
976 test_app_id(), | |
977 "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx", | |
978 "2.0.0"); | |
979 | |
980 ResultCatcher catcher; | 1002 ResultCatcher catcher; |
981 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1003 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
982 WaitForAppLaunchSuccess(); | 1004 WaitForAppLaunchSuccess(); |
983 | 1005 |
984 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1006 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
985 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1007 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
986 } | 1008 } |
987 | 1009 |
988 class KioskEnterpriseTest : public KioskTest { | 1010 class KioskEnterpriseTest : public KioskTest { |
989 protected: | 1011 protected: |
990 KioskEnterpriseTest() {} | 1012 KioskEnterpriseTest() {} |
991 | 1013 |
992 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 1014 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
993 device_policy_test_helper_.MarkAsEnterpriseOwned(); | 1015 device_policy_test_helper_.MarkAsEnterpriseOwned(); |
994 device_policy_test_helper_.InstallOwnerKey(); | 1016 device_policy_test_helper_.InstallOwnerKey(); |
995 | 1017 |
996 KioskTest::SetUpInProcessBrowserTestFixture(); | 1018 KioskTest::SetUpInProcessBrowserTestFixture(); |
997 } | 1019 } |
998 | 1020 |
999 virtual void SetUpOnMainThread() OVERRIDE { | 1021 virtual void SetUpOnMainThread() OVERRIDE { |
1022 set_test_app_id(kTestEnterpriseKioskApp); | |
1023 set_test_app_version("1.0.0"); | |
1024 set_test_crx_file(test_app_id() + ".crx"); | |
1025 SetupTestAppUpdateCheck(); | |
1026 | |
1000 KioskTest::SetUpOnMainThread(); | 1027 KioskTest::SetUpOnMainThread(); |
1001 // Configure kTestEnterpriseKioskApp in device policy. | 1028 // Configure kTestEnterpriseKioskApp in device policy. |
1002 em::DeviceLocalAccountsProto* accounts = | 1029 em::DeviceLocalAccountsProto* accounts = |
1003 device_policy_test_helper_.device_policy()->payload() | 1030 device_policy_test_helper_.device_policy()->payload() |
1004 .mutable_device_local_accounts(); | 1031 .mutable_device_local_accounts(); |
1005 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); | 1032 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); |
1006 account->set_account_id(kTestEnterpriseAccountId); | 1033 account->set_account_id(kTestEnterpriseAccountId); |
1007 account->set_type( | 1034 account->set_type( |
1008 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); | 1035 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); |
1009 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); | 1036 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1193 content::WindowedNotificationObserver( | 1220 content::WindowedNotificationObserver( |
1194 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1221 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1195 content::NotificationService::AllSources()).Wait(); | 1222 content::NotificationService::AllSources()).Wait(); |
1196 | 1223 |
1197 // Wait for the wallpaper to load. | 1224 // Wait for the wallpaper to load. |
1198 WaitForWallpaper(); | 1225 WaitForWallpaper(); |
1199 EXPECT_TRUE(wallpaper_loaded()); | 1226 EXPECT_TRUE(wallpaper_loaded()); |
1200 } | 1227 } |
1201 | 1228 |
1202 } // namespace chromeos | 1229 } // namespace chromeos |
OLD | NEW |