| 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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/chromeos/app_mode/fake_cws.h" |
| 18 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 19 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 19 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 20 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 20 #include "chrome/browser/chromeos/login/app_launch_controller.h" | 21 #include "chrome/browser/chromeos/login/app_launch_controller.h" |
| 21 #include "chrome/browser/chromeos/login/fake_user_manager.h" | 22 #include "chrome/browser/chromeos/login/fake_user_manager.h" |
| 22 #include "chrome/browser/chromeos/login/mock_user_manager.h" | 23 #include "chrome/browser/chromeos/login/mock_user_manager.h" |
| 23 #include "chrome/browser/chromeos/login/oobe_base_test.h" | 24 #include "chrome/browser/chromeos/login/oobe_base_test.h" |
| 24 #include "chrome/browser/chromeos/login/startup_utils.h" | 25 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 25 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" | 26 #include "chrome/browser/chromeos/login/test/app_window_waiter.h" |
| 26 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" | 27 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
| 27 #include "chrome/browser/chromeos/login/wizard_controller.h" | 28 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 38 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
| 39 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
| 40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 41 #include "chromeos/chromeos_switches.h" | 42 #include "chromeos/chromeos_switches.h" |
| 42 #include "chromeos/dbus/cryptohome_client.h" | 43 #include "chromeos/dbus/cryptohome_client.h" |
| 43 #include "components/signin/core/common/signin_pref_names.h" | 44 #include "components/signin/core/common/signin_pref_names.h" |
| 44 #include "content/public/browser/notification_observer.h" | 45 #include "content/public/browser/notification_observer.h" |
| 45 #include "content/public/browser/notification_registrar.h" | 46 #include "content/public/browser/notification_registrar.h" |
| 46 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/test/browser_test_utils.h" | 48 #include "content/public/test/browser_test_utils.h" |
| 48 #include "crypto/sha2.h" | |
| 49 #include "extensions/browser/extension_system.h" | 49 #include "extensions/browser/extension_system.h" |
| 50 #include "google_apis/gaia/gaia_constants.h" | 50 #include "google_apis/gaia/gaia_constants.h" |
| 51 #include "google_apis/gaia/gaia_switches.h" | 51 #include "google_apis/gaia/gaia_switches.h" |
| 52 #include "google_apis/gaia/gaia_urls.h" | 52 #include "google_apis/gaia/gaia_urls.h" |
| 53 #include "net/test/embedded_test_server/embedded_test_server.h" | 53 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 54 #include "net/test/embedded_test_server/http_request.h" | |
| 55 #include "net/test/embedded_test_server/http_response.h" | |
| 56 | |
| 57 using net::test_server::BasicHttpResponse; | |
| 58 using net::test_server::HttpRequest; | |
| 59 using net::test_server::HttpResponse; | |
| 60 | 54 |
| 61 namespace em = enterprise_management; | 55 namespace em = enterprise_management; |
| 62 | 56 |
| 63 namespace chromeos { | 57 namespace chromeos { |
| 64 | 58 |
| 65 namespace { | 59 namespace { |
| 66 | 60 |
| 67 // This is a simple test app that creates an app window and immediately closes | 61 // This is a simple test app that creates an app window and immediately closes |
| 68 // it again. Webstore data json is in | 62 // it again. Webstore data json is in |
| 69 // chrome/test/data/chromeos/app_mode/webstore/inlineinstall/ | 63 // chrome/test/data/chromeos/app_mode/webstore/inlineinstall/ |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 const std::string js_; | 221 const std::string js_; |
| 228 scoped_refptr<content::MessageLoopRunner> runner_; | 222 scoped_refptr<content::MessageLoopRunner> runner_; |
| 229 | 223 |
| 230 DISALLOW_COPY_AND_ASSIGN(JsConditionWaiter); | 224 DISALLOW_COPY_AND_ASSIGN(JsConditionWaiter); |
| 231 }; | 225 }; |
| 232 | 226 |
| 233 } // namespace | 227 } // namespace |
| 234 | 228 |
| 235 class KioskTest : public OobeBaseTest { | 229 class KioskTest : public OobeBaseTest { |
| 236 public: | 230 public: |
| 237 KioskTest() { | 231 KioskTest() : fake_cws_(new FakeCWS) { |
| 238 set_exit_when_last_browser_closes(false); | 232 set_exit_when_last_browser_closes(false); |
| 239 } | 233 } |
| 240 | 234 |
| 241 virtual ~KioskTest() {} | 235 virtual ~KioskTest() {} |
| 242 | 236 |
| 243 protected: | 237 protected: |
| 244 virtual void SetUp() OVERRIDE { | 238 virtual void SetUp() OVERRIDE { |
| 245 test_app_id_ = kTestKioskApp; | 239 test_app_id_ = kTestKioskApp; |
| 246 mock_user_manager_.reset(new MockUserManager); | 240 mock_user_manager_.reset(new MockUserManager); |
| 247 AppLaunchController::SkipSplashWaitForTesting(); | 241 AppLaunchController::SkipSplashWaitForTesting(); |
| 248 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds); | 242 AppLaunchController::SetNetworkWaitForTesting(kTestNetworkTimeoutSeconds); |
| 249 | 243 |
| 250 OobeBaseTest::SetUp(); | 244 OobeBaseTest::SetUp(); |
| 251 } | 245 } |
| 252 | 246 |
| 253 virtual void CleanUpOnMainThread() OVERRIDE { | 247 virtual void CleanUpOnMainThread() OVERRIDE { |
| 254 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); | 248 AppLaunchController::SetNetworkTimeoutCallbackForTesting(NULL); |
| 255 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); | 249 AppLaunchSigninScreen::SetUserManagerForTesting(NULL); |
| 256 | 250 |
| 257 OobeBaseTest::CleanUpOnMainThread(); | 251 OobeBaseTest::CleanUpOnMainThread(); |
| 258 | 252 |
| 259 // Clean up while main thread still runs. | 253 // Clean up while main thread still runs. |
| 260 // See http://crbug.com/176659. | 254 // See http://crbug.com/176659. |
| 261 KioskAppManager::Get()->CleanUp(); | 255 KioskAppManager::Get()->CleanUp(); |
| 262 } | 256 } |
| 263 | 257 |
| 264 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 258 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 265 OobeBaseTest::SetUpCommandLine(command_line); | 259 OobeBaseTest::SetUpCommandLine(command_line); |
| 266 | 260 fake_cws_->Init(embedded_test_server()); |
| 267 // Create gaia and webstore URL from test server url but using different | |
| 268 // host names. This is to avoid gaia response being tagged as from | |
| 269 // webstore in chrome_resource_dispatcher_host_delegate.cc. | |
| 270 GURL webstore_url = GetTestWebstoreUrl(); | |
| 271 command_line->AppendSwitchASCII( | |
| 272 ::switches::kAppsGalleryURL, | |
| 273 webstore_url.Resolve("/chromeos/app_mode/webstore").spec()); | |
| 274 command_line->AppendSwitchASCII( | |
| 275 ::switches::kAppsGalleryDownloadURL, | |
| 276 webstore_url.Resolve( | |
| 277 "/chromeos/app_mode/webstore/downloads/%s.crx").spec()); | |
| 278 } | |
| 279 | |
| 280 GURL GetTestWebstoreUrl() { | |
| 281 const GURL& server_url = embedded_test_server()->base_url(); | |
| 282 std::string webstore_host("webstore"); | |
| 283 GURL::Replacements replace_webstore_host; | |
| 284 replace_webstore_host.SetHostStr(webstore_host); | |
| 285 return server_url.ReplaceComponents(replace_webstore_host); | |
| 286 } | 261 } |
| 287 | 262 |
| 288 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { | 263 void LaunchApp(const std::string& app_id, bool diagnostic_mode) { |
| 289 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); | 264 bool new_kiosk_ui = KioskAppMenuHandler::EnableNewKioskUI(); |
| 290 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? | 265 GetLoginUI()->CallJavascriptFunction(new_kiosk_ui ? |
| 291 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, | 266 kLaunchAppForTestNewAPI : kLaunchAppForTestOldAPI, |
| 292 base::StringValue(app_id), | 267 base::StringValue(app_id), |
| 293 base::FundamentalValue(diagnostic_mode)); | 268 base::FundamentalValue(diagnostic_mode)); |
| 294 } | 269 } |
| 295 | 270 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 return chromeos::LoginDisplayHostImpl::default_host() | 502 return chromeos::LoginDisplayHostImpl::default_host() |
| 528 ->GetAppLaunchController(); | 503 ->GetAppLaunchController(); |
| 529 } | 504 } |
| 530 | 505 |
| 531 MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } | 506 MockUserManager* mock_user_manager() { return mock_user_manager_.get(); } |
| 532 | 507 |
| 533 void set_test_app_id(const std::string& test_app_id) { | 508 void set_test_app_id(const std::string& test_app_id) { |
| 534 test_app_id_ = test_app_id; | 509 test_app_id_ = test_app_id; |
| 535 } | 510 } |
| 536 const std::string& test_app_id() const { return test_app_id_; } | 511 const std::string& test_app_id() const { return test_app_id_; } |
| 512 FakeCWS* fake_cws() { return fake_cws_.get(); } |
| 537 | 513 |
| 538 private: | 514 private: |
| 539 std::string test_app_id_; | 515 std::string test_app_id_; |
| 516 scoped_ptr<FakeCWS> fake_cws_; |
| 540 scoped_ptr<MockUserManager> mock_user_manager_; | 517 scoped_ptr<MockUserManager> mock_user_manager_; |
| 541 | 518 |
| 542 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 519 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
| 543 }; | 520 }; |
| 544 | 521 |
| 545 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { | 522 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { |
| 546 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 523 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 547 WaitForAppLaunchSuccess(); | 524 WaitForAppLaunchSuccess(); |
| 548 } | 525 } |
| 549 | 526 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 // Needs background networking so that ExtensionDownloader works. | 887 // Needs background networking so that ExtensionDownloader works. |
| 911 needs_background_networking_ = true; | 888 needs_background_networking_ = true; |
| 912 | 889 |
| 913 KioskTest::SetUpCommandLine(command_line); | 890 KioskTest::SetUpCommandLine(command_line); |
| 914 if (GetParam()) | 891 if (GetParam()) |
| 915 command_line->AppendSwitch(::switches::kMultiProfiles); | 892 command_line->AppendSwitch(::switches::kMultiProfiles); |
| 916 } | 893 } |
| 917 | 894 |
| 918 virtual void SetUpOnMainThread() OVERRIDE { | 895 virtual void SetUpOnMainThread() OVERRIDE { |
| 919 KioskTest::SetUpOnMainThread(); | 896 KioskTest::SetUpOnMainThread(); |
| 920 | |
| 921 GURL webstore_url = GetTestWebstoreUrl(); | |
| 922 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
| 923 ::switches::kAppsGalleryUpdateURL, | |
| 924 webstore_url.Resolve("/update_check.xml").spec()); | |
| 925 | |
| 926 embedded_test_server()->RegisterRequestHandler( | |
| 927 base::Bind(&KioskUpdateTest::HandleRequest, | |
| 928 base::Unretained(this))); | |
| 929 } | |
| 930 | |
| 931 void SetNoUpdate() { | |
| 932 SetUpdateCheckContent( | |
| 933 "chromeos/app_mode/webstore/update_check/no_update.xml", | |
| 934 GURL(), | |
| 935 "", | |
| 936 "", | |
| 937 ""); | |
| 938 } | |
| 939 | |
| 940 void SetUpdateCrx(const std::string& crx_file, const std::string& version) { | |
| 941 GURL webstore_url = GetTestWebstoreUrl(); | |
| 942 GURL crx_download_url = webstore_url.Resolve( | |
| 943 "/chromeos/app_mode/webstore/downloads/" + crx_file); | |
| 944 base::FilePath test_data_dir; | |
| 945 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | |
| 946 base::FilePath crx_file_path = | |
| 947 test_data_dir.AppendASCII("chromeos/app_mode/webstore/downloads") | |
| 948 .AppendASCII(crx_file); | |
| 949 | |
| 950 std::string crx_content; | |
| 951 ASSERT_TRUE(base::ReadFileToString(crx_file_path, &crx_content)); | |
| 952 | |
| 953 const std::string sha256 = crypto::SHA256HashString(crx_content); | |
| 954 const std::string sha256_hex = | |
| 955 base::HexEncode(sha256.c_str(), sha256.size()); | |
| 956 | |
| 957 SetUpdateCheckContent( | |
| 958 "chromeos/app_mode/webstore/update_check/has_update.xml", | |
| 959 crx_download_url, | |
| 960 sha256_hex, | |
| 961 base::UintToString(crx_content.size()), | |
| 962 version); | |
| 963 } | 897 } |
| 964 | 898 |
| 965 private: | 899 private: |
| 966 void SetUpdateCheckContent(const std::string& update_check_file, | |
| 967 const GURL& crx_download_url, | |
| 968 const std::string& crx_fp, | |
| 969 const std::string& crx_size, | |
| 970 const std::string& version) { | |
| 971 base::FilePath test_data_dir; | |
| 972 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | |
| 973 base::FilePath update_file = | |
| 974 test_data_dir.AppendASCII(update_check_file.c_str()); | |
| 975 ASSERT_TRUE(base::ReadFileToString(update_file, &update_check_content_)); | |
| 976 | |
| 977 ReplaceSubstringsAfterOffset( | |
| 978 &update_check_content_, 0, "$AppId", test_app_id()); | |
| 979 ReplaceSubstringsAfterOffset( | |
| 980 &update_check_content_, 0, "$CrxDownloadUrl", crx_download_url.spec()); | |
| 981 ReplaceSubstringsAfterOffset(&update_check_content_, 0, "$FP", crx_fp); | |
| 982 ReplaceSubstringsAfterOffset(&update_check_content_, 0, "$Size", crx_size); | |
| 983 ReplaceSubstringsAfterOffset( | |
| 984 &update_check_content_, 0, "$Version", version); | |
| 985 } | |
| 986 | |
| 987 scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { | |
| 988 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); | |
| 989 std::string request_path = request_url.path(); | |
| 990 if (!update_check_content_.empty() && | |
| 991 request_path == "/update_check.xml") { | |
| 992 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); | |
| 993 http_response->set_code(net::HTTP_OK); | |
| 994 http_response->set_content_type("text/xml"); | |
| 995 http_response->set_content(update_check_content_); | |
| 996 return http_response.PassAs<HttpResponse>(); | |
| 997 } | |
| 998 | |
| 999 return scoped_ptr<HttpResponse>(); | |
| 1000 } | |
| 1001 | |
| 1002 std::string update_check_content_; | |
| 1003 | 900 |
| 1004 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); | 901 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); |
| 1005 }; | 902 }; |
| 1006 | 903 |
| 1007 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { | 904 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoNetwork) { |
| 1008 set_test_app_id(kTestOfflineEnabledKioskApp); | 905 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1009 | 906 |
| 1010 PrepareAppLaunch(); | 907 PrepareAppLaunch(); |
| 1011 SimulateNetworkOffline(); | 908 SimulateNetworkOffline(); |
| 1012 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 909 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 1013 | 910 |
| 1014 LaunchApp(test_app_id(), false); | 911 LaunchApp(test_app_id(), false); |
| 1015 WaitForAppLaunchSuccess(); | 912 WaitForAppLaunchSuccess(); |
| 1016 } | 913 } |
| 1017 | 914 |
| 1018 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { | 915 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppNoUpdate) { |
| 1019 set_test_app_id(kTestOfflineEnabledKioskApp); | 916 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1020 | 917 |
| 1021 SetNoUpdate(); | 918 fake_cws()->SetNoUpdate(test_app_id()); |
| 1022 | 919 |
| 1023 PrepareAppLaunch(); | 920 PrepareAppLaunch(); |
| 1024 SimulateNetworkOnline(); | 921 SimulateNetworkOnline(); |
| 1025 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 922 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 1026 | 923 |
| 1027 LaunchApp(test_app_id(), false); | 924 LaunchApp(test_app_id(), false); |
| 1028 WaitForAppLaunchSuccess(); | 925 WaitForAppLaunchSuccess(); |
| 1029 | 926 |
| 1030 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 927 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1031 } | 928 } |
| 1032 | 929 |
| 1033 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { | 930 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, LaunchOfflineEnabledAppHasUpdate) { |
| 1034 set_test_app_id(kTestOfflineEnabledKioskApp); | 931 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1035 | 932 |
| 1036 SetUpdateCrx("ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); | 933 fake_cws()->SetUpdateCrx( |
| 934 test_app_id(), "ajoggoflpgplnnjkjamcmbepjdjdnpdp.crx", "2.0.0"); |
| 1037 | 935 |
| 1038 PrepareAppLaunch(); | 936 PrepareAppLaunch(); |
| 1039 SimulateNetworkOnline(); | 937 SimulateNetworkOnline(); |
| 1040 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 938 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 1041 | 939 |
| 1042 LaunchApp(test_app_id(), false); | 940 LaunchApp(test_app_id(), false); |
| 1043 WaitForAppLaunchSuccess(); | 941 WaitForAppLaunchSuccess(); |
| 1044 | 942 |
| 1045 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 943 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1046 } | 944 } |
| 1047 | 945 |
| 1048 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PermissionChange) { | 946 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PermissionChange) { |
| 1049 set_test_app_id(kTestOfflineEnabledKioskApp); | 947 set_test_app_id(kTestOfflineEnabledKioskApp); |
| 1050 | 948 |
| 1051 SetUpdateCrx("ajoggoflpgplnnjkjamcmbepjdjdnpdp_v2_permission_change.crx", | 949 fake_cws()->SetUpdateCrx( |
| 1052 "2.0.0"); | 950 test_app_id(), |
| 951 "ajoggoflpgplnnjkjamcmbepjdjdnpdp_v2_permission_change.crx", |
| 952 "2.0.0"); |
| 1053 | 953 |
| 1054 PrepareAppLaunch(); | 954 PrepareAppLaunch(); |
| 1055 SimulateNetworkOnline(); | 955 SimulateNetworkOnline(); |
| 1056 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); | 956 SetupAppProfile("chromeos/app_mode/offline_enabled_app_profile"); |
| 1057 | 957 |
| 1058 LaunchApp(test_app_id(), false); | 958 LaunchApp(test_app_id(), false); |
| 1059 WaitForAppLaunchSuccess(); | 959 WaitForAppLaunchSuccess(); |
| 1060 | 960 |
| 1061 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 961 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1062 } | 962 } |
| 1063 | 963 |
| 1064 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_PreserveLocalData) { | 964 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PRE_PreserveLocalData) { |
| 1065 // Installs v1 app and writes some local data. | 965 // Installs v1 app and writes some local data. |
| 1066 set_test_app_id(kTestLocalFsKioskApp); | 966 set_test_app_id(kTestLocalFsKioskApp); |
| 1067 | 967 |
| 1068 ResultCatcher catcher; | 968 ResultCatcher catcher; |
| 1069 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 969 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 1070 WaitForAppLaunchSuccess(); | 970 WaitForAppLaunchSuccess(); |
| 1071 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 971 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 1072 } | 972 } |
| 1073 | 973 |
| 1074 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PreserveLocalData) { | 974 IN_PROC_BROWSER_TEST_P(KioskUpdateTest, PreserveLocalData) { |
| 1075 // Update existing v1 app installed in PRE_PreserveLocalData to v2 | 975 // Update existing v1 app installed in PRE_PreserveLocalData to v2 |
| 1076 // that reads and verifies the local data. | 976 // that reads and verifies the local data. |
| 1077 set_test_app_id(kTestLocalFsKioskApp); | 977 set_test_app_id(kTestLocalFsKioskApp); |
| 1078 | 978 |
| 1079 SetUpdateCrx("bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx", | 979 fake_cws()->SetUpdateCrx( |
| 1080 "2.0.0"); | 980 test_app_id(), |
| 981 "bmbpicmpniaclbbpdkfglgipkkebnbjf_v2_read_and_verify_data.crx", |
| 982 "2.0.0"); |
| 1081 | 983 |
| 1082 ResultCatcher catcher; | 984 ResultCatcher catcher; |
| 1083 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 985 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 1084 WaitForAppLaunchSuccess(); | 986 WaitForAppLaunchSuccess(); |
| 1085 | 987 |
| 1086 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 988 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1087 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 989 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 1088 } | 990 } |
| 1089 | 991 |
| 1090 // TODO(xiyuan): Remove this after multi profile is turned on by default. | 992 // TODO(xiyuan): Remove this after multi profile is turned on by default. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 content::WindowedNotificationObserver( | 1202 content::WindowedNotificationObserver( |
| 1301 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1203 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1302 content::NotificationService::AllSources()).Wait(); | 1204 content::NotificationService::AllSources()).Wait(); |
| 1303 | 1205 |
| 1304 // Wait for the wallpaper to load. | 1206 // Wait for the wallpaper to load. |
| 1305 WaitForWallpaper(); | 1207 WaitForWallpaper(); |
| 1306 EXPECT_TRUE(wallpaper_loaded()); | 1208 EXPECT_TRUE(wallpaper_loaded()); |
| 1307 } | 1209 } |
| 1308 | 1210 |
| 1309 } // namespace chromeos | 1211 } // namespace chromeos |
| OLD | NEW |