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 "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
6 #include "ash/desktop_background/desktop_background_controller_observer.h" | 6 #include "ash/desktop_background/desktop_background_controller_observer.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // chrome/test/data/chromeos/app_mode/webstore/downloads/ | 90 // chrome/test/data/chromeos/app_mode/webstore/downloads/ |
91 const char kTestOfflineEnabledKioskApp[] = "ajoggoflpgplnnjkjamcmbepjdjdnpdp"; | 91 const char kTestOfflineEnabledKioskApp[] = "ajoggoflpgplnnjkjamcmbepjdjdnpdp"; |
92 | 92 |
93 // An app to test local fs data persistence across app update. V1 app writes | 93 // An app to test local fs data persistence across app update. V1 app writes |
94 // data into local fs. V2 app reads and verifies the data. | 94 // data into local fs. V2 app reads and verifies the data. |
95 // Webstore data json is in | 95 // Webstore data json is in |
96 // chrome/test/data/chromeos/app_mode/webstore/inlineinstall/ | 96 // chrome/test/data/chromeos/app_mode/webstore/inlineinstall/ |
97 // detail/bmbpicmpniaclbbpdkfglgipkkebnbjf | 97 // detail/bmbpicmpniaclbbpdkfglgipkkebnbjf |
98 const char kTestLocalFsKioskApp[] = "bmbpicmpniaclbbpdkfglgipkkebnbjf"; | 98 const char kTestLocalFsKioskApp[] = "bmbpicmpniaclbbpdkfglgipkkebnbjf"; |
99 | 99 |
100 const char kFakeUsbStickMountPath[] = "chromeos/app_mode/external_update/"; | 100 // Fake usb stick mount path. |
| 101 const char kFakeUsbMountPathUpdatePass[] = |
| 102 "chromeos/app_mode/external_update/update_pass"; |
| 103 const char kFakeUsbMountPathNoManifest[] = |
| 104 "chromeos/app_mode/external_update/no_manifest"; |
| 105 const char kFakeUsbMountPathBadManifest[] = |
| 106 "chromeos/app_mode/external_update/bad_manifest"; |
| 107 const char kFakeUsbMountPathLowerAppVersion[] = |
| 108 "chromeos/app_mode/external_update/lower_app_version"; |
| 109 const char kFakeUsbMountPathLowerCrxVersion[] = |
| 110 "chromeos/app_mode/external_update/lower_crx_version"; |
| 111 const char kFakeUsbMountPathBadCrx[] = |
| 112 "chromeos/app_mode/external_update/bad_crx"; |
101 | 113 |
102 // Timeout while waiting for network connectivity during tests. | 114 // Timeout while waiting for network connectivity during tests. |
103 const int kTestNetworkTimeoutSeconds = 1; | 115 const int kTestNetworkTimeoutSeconds = 1; |
104 | 116 |
105 // Email of owner account for test. | 117 // Email of owner account for test. |
106 const char kTestOwnerEmail[] = "owner@example.com"; | 118 const char kTestOwnerEmail[] = "owner@example.com"; |
107 | 119 |
108 const char kTestEnterpriseAccountId[] = "enterprise-kiosk-app@localhost"; | 120 const char kTestEnterpriseAccountId[] = "enterprise-kiosk-app@localhost"; |
109 const char kTestEnterpriseServiceAccountId[] = "service_account@example.com"; | 121 const char kTestEnterpriseServiceAccountId[] = "service_account@example.com"; |
110 const char kTestRefreshToken[] = "fake-refresh-token"; | 122 const char kTestRefreshToken[] = "fake-refresh-token"; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 249 |
238 content::WebContents* web_contents_; | 250 content::WebContents* web_contents_; |
239 const std::string js_; | 251 const std::string js_; |
240 scoped_refptr<content::MessageLoopRunner> runner_; | 252 scoped_refptr<content::MessageLoopRunner> runner_; |
241 | 253 |
242 DISALLOW_COPY_AND_ASSIGN(JsConditionWaiter); | 254 DISALLOW_COPY_AND_ASSIGN(JsConditionWaiter); |
243 }; | 255 }; |
244 | 256 |
245 class KioskFakeDiskMountManager : public file_manager::FakeDiskMountManager { | 257 class KioskFakeDiskMountManager : public file_manager::FakeDiskMountManager { |
246 public: | 258 public: |
247 explicit KioskFakeDiskMountManager(const std::string& usb_mount_path) | 259 KioskFakeDiskMountManager() {} |
248 : usb_mount_path_(usb_mount_path) {} | |
249 | 260 |
250 virtual ~KioskFakeDiskMountManager() {} | 261 virtual ~KioskFakeDiskMountManager() {} |
251 | 262 |
| 263 void set_usb_mount_path(const std::string& usb_mount_path) { |
| 264 usb_mount_path_ = usb_mount_path; |
| 265 } |
| 266 |
252 void MountUsbStick() { | 267 void MountUsbStick() { |
| 268 DCHECK(!usb_mount_path_.empty()); |
253 MountPath(usb_mount_path_, "", "", chromeos::MOUNT_TYPE_DEVICE); | 269 MountPath(usb_mount_path_, "", "", chromeos::MOUNT_TYPE_DEVICE); |
254 } | 270 } |
255 | 271 |
256 void UnMountUsbStick() { | 272 void UnMountUsbStick() { |
| 273 DCHECK(!usb_mount_path_.empty()); |
257 UnmountPath(usb_mount_path_, | 274 UnmountPath(usb_mount_path_, |
258 UNMOUNT_OPTIONS_NONE, | 275 UNMOUNT_OPTIONS_NONE, |
259 disks::DiskMountManager::UnmountPathCallback()); | 276 disks::DiskMountManager::UnmountPathCallback()); |
260 } | 277 } |
261 | 278 |
262 private: | 279 private: |
263 std::string usb_mount_path_; | 280 std::string usb_mount_path_; |
264 | 281 |
265 DISALLOW_COPY_AND_ASSIGN(KioskFakeDiskMountManager); | 282 DISALLOW_COPY_AND_ASSIGN(KioskFakeDiskMountManager); |
266 }; | 283 }; |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 content::NotificationService::AllSources()).Wait(); | 962 content::NotificationService::AllSources()).Wait(); |
946 } | 963 } |
947 | 964 |
948 class KioskUpdateTest : public KioskTest { | 965 class KioskUpdateTest : public KioskTest { |
949 public: | 966 public: |
950 KioskUpdateTest() {} | 967 KioskUpdateTest() {} |
951 virtual ~KioskUpdateTest() {} | 968 virtual ~KioskUpdateTest() {} |
952 | 969 |
953 protected: | 970 protected: |
954 virtual void SetUp() OVERRIDE { | 971 virtual void SetUp() OVERRIDE { |
955 base::FilePath test_data_dir; | 972 fake_disk_mount_manager_ = new KioskFakeDiskMountManager(); |
956 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); | |
957 test_data_dir = test_data_dir.AppendASCII(kFakeUsbStickMountPath); | |
958 fake_disk_mount_manager_ = | |
959 new KioskFakeDiskMountManager(test_data_dir.value()); | |
960 disks::DiskMountManager::InitializeForTesting(fake_disk_mount_manager_); | 973 disks::DiskMountManager::InitializeForTesting(fake_disk_mount_manager_); |
961 | 974 |
962 KioskTest::SetUp(); | 975 KioskTest::SetUp(); |
963 } | 976 } |
964 | 977 |
965 virtual void TearDown() OVERRIDE { | 978 virtual void TearDown() OVERRIDE { |
966 disks::DiskMountManager::Shutdown(); | 979 disks::DiskMountManager::Shutdown(); |
967 | 980 |
968 KioskTest::TearDown(); | 981 KioskTest::TearDown(); |
969 } | 982 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 KioskAppManager::Get()->UpdateExternalCache(); | 1014 KioskAppManager::Get()->UpdateExternalCache(); |
1002 waiter.Wait(); | 1015 waiter.Wait(); |
1003 EXPECT_TRUE(waiter.loaded()); | 1016 EXPECT_TRUE(waiter.loaded()); |
1004 std::string cached_version; | 1017 std::string cached_version; |
1005 base::FilePath file_path; | 1018 base::FilePath file_path; |
1006 EXPECT_TRUE( | 1019 EXPECT_TRUE( |
1007 manager->GetCachedCrx(test_app_id(), &file_path, &cached_version)); | 1020 manager->GetCachedCrx(test_app_id(), &file_path, &cached_version)); |
1008 EXPECT_EQ(version, cached_version); | 1021 EXPECT_EQ(version, cached_version); |
1009 } | 1022 } |
1010 | 1023 |
1011 void SimulateUpdateAppFromUsbStick() { | 1024 void SetupFakeDiskMountManagerMountPath(const std::string mount_path) { |
| 1025 base::FilePath test_data_dir; |
| 1026 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
| 1027 test_data_dir = test_data_dir.AppendASCII(mount_path); |
| 1028 fake_disk_mount_manager_->set_usb_mount_path(test_data_dir.value()); |
| 1029 } |
| 1030 |
| 1031 void SimulateUpdateAppFromUsbStick(const std::string& usb_mount_path, |
| 1032 bool* app_update_notified, |
| 1033 bool* update_success) { |
| 1034 SetupFakeDiskMountManagerMountPath(usb_mount_path); |
1012 KioskAppExternalUpdateWaiter waiter(KioskAppManager::Get(), test_app_id()); | 1035 KioskAppExternalUpdateWaiter waiter(KioskAppManager::Get(), test_app_id()); |
1013 fake_disk_mount_manager_->MountUsbStick(); | 1036 fake_disk_mount_manager_->MountUsbStick(); |
1014 waiter.Wait(); | 1037 waiter.Wait(); |
1015 fake_disk_mount_manager_->UnMountUsbStick(); | 1038 fake_disk_mount_manager_->UnMountUsbStick(); |
| 1039 *update_success = waiter.update_success(); |
| 1040 *app_update_notified = waiter.app_update_notified(); |
1016 } | 1041 } |
1017 | 1042 |
1018 void PreCacheAndLaunchApp(const std::string& app_id, | 1043 void PreCacheAndLaunchApp(const std::string& app_id, |
1019 const std::string& version, | 1044 const std::string& version, |
1020 const std::string& crx_file) { | 1045 const std::string& crx_file) { |
1021 set_test_app_id(app_id); | 1046 set_test_app_id(app_id); |
1022 set_test_app_version(version); | 1047 set_test_app_version(version); |
1023 set_test_crx_file(crx_file); | 1048 set_test_crx_file(crx_file); |
1024 PrepareAppLaunch(); | 1049 PrepareAppLaunch(); |
1025 SimulateNetworkOnline(); | 1050 SimulateNetworkOnline(); |
1026 LaunchApp(test_app_id(), false); | 1051 LaunchApp(test_app_id(), false); |
1027 WaitForAppLaunchSuccess(); | 1052 WaitForAppLaunchSuccess(); |
1028 EXPECT_EQ(version, GetInstalledAppVersion().GetString()); | 1053 EXPECT_EQ(version, GetInstalledAppVersion().GetString()); |
1029 } | 1054 } |
1030 | 1055 |
1031 private: | 1056 private: |
1032 class KioskAppExternalUpdateWaiter : KioskAppManagerObserver { | 1057 class KioskAppExternalUpdateWaiter : public KioskAppManagerObserver { |
1033 public: | 1058 public: |
1034 KioskAppExternalUpdateWaiter(KioskAppManager* manager, | 1059 KioskAppExternalUpdateWaiter(KioskAppManager* manager, |
1035 const std::string& app_id) | 1060 const std::string& app_id) |
1036 : runner_(NULL), manager_(manager), app_id_(app_id), quit_(false) { | 1061 : runner_(NULL), |
| 1062 manager_(manager), |
| 1063 app_id_(app_id), |
| 1064 quit_(false), |
| 1065 update_success_(false), |
| 1066 app_update_notified_(false) { |
1037 manager_->AddObserver(this); | 1067 manager_->AddObserver(this); |
1038 } | 1068 } |
1039 | 1069 |
1040 virtual ~KioskAppExternalUpdateWaiter() { manager_->RemoveObserver(this); } | 1070 virtual ~KioskAppExternalUpdateWaiter() { manager_->RemoveObserver(this); } |
1041 | 1071 |
1042 void Wait() { | 1072 void Wait() { |
1043 if (quit_) | 1073 if (quit_) |
1044 return; | 1074 return; |
1045 runner_ = new content::MessageLoopRunner; | 1075 runner_ = new content::MessageLoopRunner; |
1046 runner_->Run(); | 1076 runner_->Run(); |
1047 } | 1077 } |
1048 | 1078 |
| 1079 bool update_success() const { return update_success_; } |
| 1080 |
| 1081 bool app_update_notified() const { return app_update_notified_; } |
| 1082 |
1049 private: | 1083 private: |
1050 // KioskAppManagerObserver overrides: | 1084 // KioskAppManagerObserver overrides: |
1051 virtual void OnKioskAppCacheUpdated(const std::string& app_id) OVERRIDE { | 1085 virtual void OnKioskAppCacheUpdated(const std::string& app_id) OVERRIDE { |
1052 if (app_id_ != app_id) | 1086 if (app_id_ != app_id) |
1053 return; | 1087 return; |
| 1088 app_update_notified_ = true; |
| 1089 } |
| 1090 |
| 1091 virtual void OnKioskAppExternalUpdateComplete(bool success) OVERRIDE { |
1054 quit_ = true; | 1092 quit_ = true; |
| 1093 update_success_ = success; |
1055 if (runner_) | 1094 if (runner_) |
1056 runner_->Quit(); | 1095 runner_->Quit(); |
1057 } | 1096 } |
1058 | 1097 |
1059 scoped_refptr<content::MessageLoopRunner> runner_; | 1098 scoped_refptr<content::MessageLoopRunner> runner_; |
1060 KioskAppManager* manager_; | 1099 KioskAppManager* manager_; |
| 1100 bool wait_for_update_success_; |
1061 const std::string app_id_; | 1101 const std::string app_id_; |
1062 bool quit_; | 1102 bool quit_; |
| 1103 bool update_success_; |
| 1104 bool app_update_notified_; |
1063 | 1105 |
1064 DISALLOW_COPY_AND_ASSIGN(KioskAppExternalUpdateWaiter); | 1106 DISALLOW_COPY_AND_ASSIGN(KioskAppExternalUpdateWaiter); |
1065 }; | 1107 }; |
1066 | 1108 |
1067 class AppDataLoadWaiter : public KioskAppManagerObserver { | 1109 class AppDataLoadWaiter : public KioskAppManagerObserver { |
1068 public: | 1110 public: |
1069 AppDataLoadWaiter(KioskAppManager* manager, | 1111 AppDataLoadWaiter(KioskAppManager* manager, |
1070 const std::string& app_id, | 1112 const std::string& app_id, |
1071 const std::string& version) | 1113 const std::string& version) |
1072 : runner_(NULL), | 1114 : runner_(NULL), |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1281 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
1240 | 1282 |
1241 set_test_app_id(kTestOfflineEnabledKioskApp); | 1283 set_test_app_id(kTestOfflineEnabledKioskApp); |
1242 StartUIForAppLaunch(); | 1284 StartUIForAppLaunch(); |
1243 SimulateNetworkOffline(); | 1285 SimulateNetworkOffline(); |
1244 LaunchApp(test_app_id(), false); | 1286 LaunchApp(test_app_id(), false); |
1245 WaitForAppLaunchSuccess(); | 1287 WaitForAppLaunchSuccess(); |
1246 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1288 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
1247 | 1289 |
1248 // Simulate mounting of usb stick with v2 app on the stick. | 1290 // Simulate mounting of usb stick with v2 app on the stick. |
1249 SimulateUpdateAppFromUsbStick(); | 1291 bool update_success; |
| 1292 bool app_update_notified; |
| 1293 SimulateUpdateAppFromUsbStick( |
| 1294 kFakeUsbMountPathUpdatePass, &app_update_notified, &update_success); |
| 1295 EXPECT_TRUE(update_success); |
| 1296 EXPECT_TRUE(app_update_notified); |
1250 | 1297 |
1251 // The v2 kiosk app is copied into external cache, but won't be loaded | 1298 // The v2 kiosk app is loaded into external cache, but won't be installed |
1252 // until next time the device is started. | 1299 // until next time the device is started. |
| 1300 base::FilePath crx_path; |
| 1301 std::string cached_version; |
| 1302 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1303 test_app_id(), &crx_path, &cached_version)); |
| 1304 EXPECT_EQ("2.0.0", cached_version); |
1253 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); | 1305 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
1254 } | 1306 } |
1255 | 1307 |
1256 // Restart the device, verify the app has been updated to v2. | 1308 // Restart the device, verify the app has been updated to v2. |
1257 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppNoNetwork) { | 1309 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppNoNetwork) { |
1258 // Verify the kiosk app has been updated to v2. | 1310 // Verify the kiosk app has been updated to v2. |
1259 set_test_app_id(kTestOfflineEnabledKioskApp); | 1311 set_test_app_id(kTestOfflineEnabledKioskApp); |
1260 StartUIForAppLaunch(); | 1312 StartUIForAppLaunch(); |
1261 SimulateNetworkOffline(); | 1313 SimulateNetworkOffline(); |
1262 LaunchApp(test_app_id(), false); | 1314 LaunchApp(test_app_id(), false); |
1263 WaitForAppLaunchSuccess(); | 1315 WaitForAppLaunchSuccess(); |
1264 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1316 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
1265 } | 1317 } |
1266 | 1318 |
| 1319 // Usb stick is plugged in without a manifest file on it. |
| 1320 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppNoManifest) { |
| 1321 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1322 "1.0.0", |
| 1323 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1324 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1325 |
| 1326 // Simulate mounting of usb stick with v2 app on the stick. |
| 1327 bool update_success; |
| 1328 bool app_update_notified; |
| 1329 SimulateUpdateAppFromUsbStick( |
| 1330 kFakeUsbMountPathNoManifest, &app_update_notified, &update_success); |
| 1331 EXPECT_FALSE(update_success); |
| 1332 |
| 1333 // Kiosk app is not updated. |
| 1334 base::FilePath crx_path; |
| 1335 std::string cached_version; |
| 1336 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1337 test_app_id(), &crx_path, &cached_version)); |
| 1338 EXPECT_EQ("1.0.0", cached_version); |
| 1339 } |
| 1340 |
| 1341 // Usb stick is plugged in with a bad manifest file on it. |
| 1342 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppBadManifest) { |
| 1343 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1344 "1.0.0", |
| 1345 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1346 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1347 |
| 1348 // Simulate mounting of usb stick with v2 app on the stick. |
| 1349 bool update_success; |
| 1350 bool app_update_notified; |
| 1351 SimulateUpdateAppFromUsbStick( |
| 1352 kFakeUsbMountPathBadManifest, &app_update_notified, &update_success); |
| 1353 EXPECT_FALSE(update_success); |
| 1354 |
| 1355 // Kiosk app is not updated. |
| 1356 base::FilePath crx_path; |
| 1357 std::string cached_version; |
| 1358 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1359 test_app_id(), &crx_path, &cached_version)); |
| 1360 EXPECT_EQ("1.0.0", cached_version); |
| 1361 } |
| 1362 |
| 1363 // Usb stick is plugged in with a lower version of crx file specified in |
| 1364 // manifest. |
| 1365 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppLowerAppVersion) { |
| 1366 // Precache v2 version of app. |
| 1367 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1368 "2.0.0", |
| 1369 std::string(kTestOfflineEnabledKioskApp) + ".crx"); |
| 1370 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1371 |
| 1372 // Simulate mounting of usb stick with v1 app on the stick. |
| 1373 bool update_success; |
| 1374 bool app_update_notified; |
| 1375 SimulateUpdateAppFromUsbStick( |
| 1376 kFakeUsbMountPathLowerAppVersion, &app_update_notified, &update_success); |
| 1377 EXPECT_FALSE(update_success); |
| 1378 |
| 1379 // Kiosk app is NOT updated to the lower version. |
| 1380 base::FilePath crx_path; |
| 1381 std::string cached_version; |
| 1382 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1383 test_app_id(), &crx_path, &cached_version)); |
| 1384 EXPECT_EQ("2.0.0", cached_version); |
| 1385 } |
| 1386 |
| 1387 // Usb stick is plugged in with a v1 crx file, although the manifest says |
| 1388 // this is a v3 version. |
| 1389 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppLowerCrxVersion) { |
| 1390 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1391 "2.0.0", |
| 1392 std::string(kTestOfflineEnabledKioskApp) + ".crx"); |
| 1393 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1394 |
| 1395 // Simulate mounting of usb stick with v1 crx file on the stick, although |
| 1396 // the manifest says it is v3 app. |
| 1397 bool update_success; |
| 1398 bool app_update_notified; |
| 1399 SimulateUpdateAppFromUsbStick( |
| 1400 kFakeUsbMountPathLowerCrxVersion, &app_update_notified, &update_success); |
| 1401 EXPECT_FALSE(update_success); |
| 1402 |
| 1403 // Kiosk app is NOT updated to the lower version. |
| 1404 base::FilePath crx_path; |
| 1405 std::string cached_version; |
| 1406 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1407 test_app_id(), &crx_path, &cached_version)); |
| 1408 EXPECT_EQ("2.0.0", cached_version); |
| 1409 } |
| 1410 |
| 1411 // Usb stick is plugged in with a bad crx file. |
| 1412 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UsbStickUpdateAppBadCrx) { |
| 1413 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1414 "1.0.0", |
| 1415 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| 1416 EXPECT_EQ("1.0.0", GetInstalledAppVersion().GetString()); |
| 1417 |
| 1418 // Simulate mounting of usb stick with v1 crx file on the stick, although |
| 1419 // the manifest says it is v3 app. |
| 1420 bool update_success; |
| 1421 bool app_update_notified; |
| 1422 SimulateUpdateAppFromUsbStick( |
| 1423 kFakeUsbMountPathBadCrx, &app_update_notified, &update_success); |
| 1424 EXPECT_FALSE(update_success); |
| 1425 |
| 1426 // Kiosk app is NOT updated. |
| 1427 base::FilePath crx_path; |
| 1428 std::string cached_version; |
| 1429 EXPECT_TRUE(KioskAppManager::Get()->GetCachedCrx( |
| 1430 test_app_id(), &crx_path, &cached_version)); |
| 1431 EXPECT_EQ("1.0.0", cached_version); |
| 1432 } |
| 1433 |
1267 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PermissionChange) { | 1434 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PermissionChange) { |
1268 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1435 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
1269 "2.0.0", | 1436 "2.0.0", |
1270 std::string(kTestOfflineEnabledKioskApp) + ".crx"); | 1437 std::string(kTestOfflineEnabledKioskApp) + ".crx"); |
1271 } | 1438 } |
1272 | 1439 |
1273 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) { | 1440 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PermissionChange) { |
1274 set_test_app_id(kTestOfflineEnabledKioskApp); | 1441 set_test_app_id(kTestOfflineEnabledKioskApp); |
1275 set_test_app_version("2.0.0"); | 1442 set_test_app_version("2.0.0"); |
1276 set_test_crx_file(test_app_id() + "_v2_permission_change.crx"); | 1443 set_test_crx_file(test_app_id() + "_v2_permission_change.crx"); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 content::WindowedNotificationObserver( | 1695 content::WindowedNotificationObserver( |
1529 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1696 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1530 content::NotificationService::AllSources()).Wait(); | 1697 content::NotificationService::AllSources()).Wait(); |
1531 | 1698 |
1532 // Wait for the wallpaper to load. | 1699 // Wait for the wallpaper to load. |
1533 WaitForWallpaper(); | 1700 WaitForWallpaper(); |
1534 EXPECT_TRUE(wallpaper_loaded()); | 1701 EXPECT_TRUE(wallpaper_loaded()); |
1535 } | 1702 } |
1536 | 1703 |
1537 } // namespace chromeos | 1704 } // namespace chromeos |
OLD | NEW |