| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
| 8 #include "ash/desktop_background/desktop_background_controller_observer.h" | 8 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 36 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 37 #include "chrome/browser/chromeos/login/wizard_controller.h" | 37 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 38 #include "chrome/browser/chromeos/ownership/fake_owner_settings_service.h" | 38 #include "chrome/browser/chromeos/ownership/fake_owner_settings_service.h" |
| 39 #include "chrome/browser/chromeos/policy/device_local_account.h" | 39 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 40 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 40 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 42 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 42 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 43 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 43 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 44 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" | 44 #include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h" |
| 45 #include "chrome/browser/extensions/extension_service.h" | 45 #include "chrome/browser/extensions/extension_service.h" |
| 46 #include "chrome/browser/extensions/updater/local_extension_cache.h" |
| 46 #include "chrome/browser/profiles/profile_impl.h" | 47 #include "chrome/browser/profiles/profile_impl.h" |
| 47 #include "chrome/browser/profiles/profile_manager.h" | 48 #include "chrome/browser/profiles/profile_manager.h" |
| 48 #include "chrome/browser/profiles/profiles_state.h" | 49 #include "chrome/browser/profiles/profiles_state.h" |
| 49 #include "chrome/browser/signin/signin_manager_factory.h" | 50 #include "chrome/browser/signin/signin_manager_factory.h" |
| 50 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" |
| 51 #include "chrome/common/chrome_constants.h" | 52 #include "chrome/common/chrome_constants.h" |
| 52 #include "chrome/common/chrome_paths.h" | 53 #include "chrome/common/chrome_paths.h" |
| 53 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 55 #include "chromeos/chromeos_paths.h" |
| 54 #include "chromeos/chromeos_switches.h" | 56 #include "chromeos/chromeos_switches.h" |
| 55 #include "chromeos/dbus/cryptohome_client.h" | 57 #include "chromeos/dbus/cryptohome_client.h" |
| 56 #include "chromeos/disks/disk_mount_manager.h" | 58 #include "chromeos/disks/disk_mount_manager.h" |
| 57 #include "chromeos/settings/cros_settings_provider.h" | 59 #include "chromeos/settings/cros_settings_provider.h" |
| 58 #include "components/signin/core/browser/signin_manager.h" | 60 #include "components/signin/core/browser/signin_manager.h" |
| 59 #include "components/signin/core/common/signin_pref_names.h" | 61 #include "components/signin/core/common/signin_pref_names.h" |
| 60 #include "content/public/browser/browser_thread.h" | 62 #include "content/public/browser/browser_thread.h" |
| 61 #include "content/public/browser/notification_observer.h" | 63 #include "content/public/browser/notification_observer.h" |
| 62 #include "content/public/browser/notification_registrar.h" | 64 #include "content/public/browser/notification_registrar.h" |
| 63 #include "content/public/browser/notification_service.h" | 65 #include "content/public/browser/notification_service.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // detail/bmbpicmpniaclbbpdkfglgipkkebnbjf | 113 // detail/bmbpicmpniaclbbpdkfglgipkkebnbjf |
| 112 const char kTestLocalFsKioskApp[] = "bmbpicmpniaclbbpdkfglgipkkebnbjf"; | 114 const char kTestLocalFsKioskApp[] = "bmbpicmpniaclbbpdkfglgipkkebnbjf"; |
| 113 | 115 |
| 114 // An app to test local access to file systems via the | 116 // An app to test local access to file systems via the |
| 115 // chrome.fileSystem.requestFileSystem API. | 117 // chrome.fileSystem.requestFileSystem API. |
| 116 // Webstore data json is in | 118 // Webstore data json is in |
| 117 // chrome/test/data/chromeos/app_mode/webstore/inlineinstall/ | 119 // chrome/test/data/chromeos/app_mode/webstore/inlineinstall/ |
| 118 // detail/aaedpojejpghjkedenggihopfhfijcko | 120 // detail/aaedpojejpghjkedenggihopfhfijcko |
| 119 const char kTestGetVolumeListKioskApp[] = "aaedpojejpghjkedenggihopfhfijcko"; | 121 const char kTestGetVolumeListKioskApp[] = "aaedpojejpghjkedenggihopfhfijcko"; |
| 120 | 122 |
| 123 // Testing apps for testing kiosk multi-app feature. |
| 124 const char kTestPrimaryKioskApp[] = "ceobkcclegcliomogfoeoheahogoecgl"; |
| 125 const char kTestSecondaryApp1[] = "ihplaomghjbeafnpnjkhppmfpnmdihgd"; |
| 126 const char kTestSecondaryApp2[] = "fiehokkcgaojmbhfhlpiheggjhaedjoc"; |
| 127 const char kTestSecondaryApp3[] = "aabnpdpieclcikafhdkkpldcaodmfoai"; |
| 128 |
| 121 // Fake usb stick mount path. | 129 // Fake usb stick mount path. |
| 122 const char kFakeUsbMountPathUpdatePass[] = | 130 const char kFakeUsbMountPathUpdatePass[] = |
| 123 "chromeos/app_mode/external_update/update_pass"; | 131 "chromeos/app_mode/external_update/update_pass"; |
| 124 const char kFakeUsbMountPathNoManifest[] = | 132 const char kFakeUsbMountPathNoManifest[] = |
| 125 "chromeos/app_mode/external_update/no_manifest"; | 133 "chromeos/app_mode/external_update/no_manifest"; |
| 126 const char kFakeUsbMountPathBadManifest[] = | 134 const char kFakeUsbMountPathBadManifest[] = |
| 127 "chromeos/app_mode/external_update/bad_manifest"; | 135 "chromeos/app_mode/external_update/bad_manifest"; |
| 128 const char kFakeUsbMountPathLowerAppVersion[] = | 136 const char kFakeUsbMountPathLowerAppVersion[] = |
| 129 "chromeos/app_mode/external_update/lower_app_version"; | 137 "chromeos/app_mode/external_update/lower_app_version"; |
| 130 const char kFakeUsbMountPathLowerCrxVersion[] = | 138 const char kFakeUsbMountPathLowerCrxVersion[] = |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 void OnNetworkWaitTimedOut(const base::Closure& runner_quit_task) { | 190 void OnNetworkWaitTimedOut(const base::Closure& runner_quit_task) { |
| 183 runner_quit_task.Run(); | 191 runner_quit_task.Run(); |
| 184 } | 192 } |
| 185 | 193 |
| 186 // Helper function for LockFileThread. | 194 // Helper function for LockFileThread. |
| 187 void LockAndUnlock(scoped_ptr<base::Lock> lock) { | 195 void LockAndUnlock(scoped_ptr<base::Lock> lock) { |
| 188 lock->Acquire(); | 196 lock->Acquire(); |
| 189 lock->Release(); | 197 lock->Release(); |
| 190 } | 198 } |
| 191 | 199 |
| 200 bool IsAppInstalled(const std::string app_id) { |
| 201 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
| 202 DCHECK(app_profile); |
| 203 const extensions::Extension* app = |
| 204 extensions::ExtensionSystem::Get(app_profile) |
| 205 ->extension_service() |
| 206 ->GetInstalledExtension(app_id); |
| 207 return app != nullptr; |
| 208 } |
| 209 |
| 192 // Helper functions for CanConfigureNetwork mock. | 210 // Helper functions for CanConfigureNetwork mock. |
| 193 class ScopedCanConfigureNetwork { | 211 class ScopedCanConfigureNetwork { |
| 194 public: | 212 public: |
| 195 ScopedCanConfigureNetwork(bool can_configure, bool needs_owner_auth) | 213 ScopedCanConfigureNetwork(bool can_configure, bool needs_owner_auth) |
| 196 : can_configure_(can_configure), | 214 : can_configure_(can_configure), |
| 197 needs_owner_auth_(needs_owner_auth), | 215 needs_owner_auth_(needs_owner_auth), |
| 198 can_configure_network_callback_( | 216 can_configure_network_callback_( |
| 199 base::Bind(&ScopedCanConfigureNetwork::CanConfigureNetwork, | 217 base::Bind(&ScopedCanConfigureNetwork::CanConfigureNetwork, |
| 200 base::Unretained(this))), | 218 base::Unretained(this))), |
| 201 needs_owner_auth_callback_(base::Bind( | 219 needs_owner_auth_callback_(base::Bind( |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 | 1258 |
| 1241 // Check that no launch has started. | 1259 // Check that no launch has started. |
| 1242 EXPECT_FALSE(login_display_host->GetAppLaunchController()); | 1260 EXPECT_FALSE(login_display_host->GetAppLaunchController()); |
| 1243 } | 1261 } |
| 1244 | 1262 |
| 1245 class KioskUpdateTest : public KioskTest { | 1263 class KioskUpdateTest : public KioskTest { |
| 1246 public: | 1264 public: |
| 1247 KioskUpdateTest() {} | 1265 KioskUpdateTest() {} |
| 1248 ~KioskUpdateTest() override {} | 1266 ~KioskUpdateTest() override {} |
| 1249 | 1267 |
| 1268 struct TestAppInfo { |
| 1269 std::string id; |
| 1270 std::string version; |
| 1271 std::string crx_filename; |
| 1272 TestAppInfo() {} |
| 1273 TestAppInfo(const std::string& id, |
| 1274 const std::string& version, |
| 1275 const std::string& crx_filename) |
| 1276 : id(id), version(version), crx_filename(crx_filename) {} |
| 1277 ~TestAppInfo() {} |
| 1278 }; |
| 1279 |
| 1250 protected: | 1280 protected: |
| 1251 void SetUp() override { | 1281 void SetUp() override { |
| 1252 fake_disk_mount_manager_ = new KioskFakeDiskMountManager(); | 1282 fake_disk_mount_manager_ = new KioskFakeDiskMountManager(); |
| 1253 disks::DiskMountManager::InitializeForTesting(fake_disk_mount_manager_); | 1283 disks::DiskMountManager::InitializeForTesting(fake_disk_mount_manager_); |
| 1254 | 1284 |
| 1255 KioskTest::SetUp(); | 1285 KioskTest::SetUp(); |
| 1256 } | 1286 } |
| 1257 | 1287 |
| 1258 void TearDown() override { | 1288 void TearDown() override { |
| 1259 disks::DiskMountManager::Shutdown(); | 1289 disks::DiskMountManager::Shutdown(); |
| 1260 | 1290 |
| 1261 KioskTest::TearDown(); | 1291 KioskTest::TearDown(); |
| 1262 } | 1292 } |
| 1263 | 1293 |
| 1264 void SetUpOnMainThread() override { | 1294 void SetUpOnMainThread() override { |
| 1265 // For update tests, we cache the app in the PRE part, and then we load it | 1295 // For update tests, we cache the app in the PRE part, and then we load it |
| 1266 // in the test, so we need to both store the apps list on teardown (so that | 1296 // in the test, so we need to both store the apps list on teardown (so that |
| 1267 // the app manager would accept existing files in its extension cache on the | 1297 // the app manager would accept existing files in its extension cache on the |
| 1268 // next startup) and copy the list to our stub settings provider as well. | 1298 // next startup) and copy the list to our stub settings provider as well. |
| 1269 settings_helper_.CopyStoredValue(kAccountsPrefDeviceLocalAccounts); | 1299 settings_helper_.CopyStoredValue(kAccountsPrefDeviceLocalAccounts); |
| 1300 |
| 1301 CreateAndInitializeLocalCache(); |
| 1302 |
| 1270 KioskTest::SetUpOnMainThread(); | 1303 KioskTest::SetUpOnMainThread(); |
| 1271 } | 1304 } |
| 1272 | 1305 |
| 1273 void TearDownOnMainThread() override { | 1306 void TearDownOnMainThread() override { |
| 1274 settings_helper_.StoreCachedDeviceSetting(kAccountsPrefDeviceLocalAccounts); | 1307 settings_helper_.StoreCachedDeviceSetting(kAccountsPrefDeviceLocalAccounts); |
| 1275 KioskTest::TearDownOnMainThread(); | 1308 KioskTest::TearDownOnMainThread(); |
| 1276 } | 1309 } |
| 1277 | 1310 |
| 1278 void PreCacheApp(const std::string& app_id, | 1311 void PreCacheApp(const std::string& app_id, |
| 1279 const std::string& version, | 1312 const std::string& version, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 set_test_app_id(app_id); | 1369 set_test_app_id(app_id); |
| 1337 set_test_app_version(version); | 1370 set_test_app_version(version); |
| 1338 set_test_crx_file(crx_file); | 1371 set_test_crx_file(crx_file); |
| 1339 PrepareAppLaunch(); | 1372 PrepareAppLaunch(); |
| 1340 SimulateNetworkOnline(); | 1373 SimulateNetworkOnline(); |
| 1341 LaunchApp(test_app_id(), false); | 1374 LaunchApp(test_app_id(), false); |
| 1342 WaitForAppLaunchSuccess(); | 1375 WaitForAppLaunchSuccess(); |
| 1343 EXPECT_EQ(version, GetInstalledAppVersion().GetString()); | 1376 EXPECT_EQ(version, GetInstalledAppVersion().GetString()); |
| 1344 } | 1377 } |
| 1345 | 1378 |
| 1379 void LaunchKioskWithSecondaryApps( |
| 1380 const TestAppInfo& primary_app, |
| 1381 const std::vector<TestAppInfo>& secondary_apps) { |
| 1382 // Pre-cache the primary app. |
| 1383 PreCacheApp(primary_app.id, primary_app.version, primary_app.crx_filename); |
| 1384 |
| 1385 set_test_app_id(primary_app.id); |
| 1386 fake_cws()->SetNoUpdate(primary_app.id); |
| 1387 for (size_t i = 0; i < secondary_apps.size(); ++i) { |
| 1388 fake_cws()->SetUpdateCrx(secondary_apps[i].id, |
| 1389 secondary_apps[i].crx_filename, |
| 1390 secondary_apps[i].version); |
| 1391 } |
| 1392 |
| 1393 // Launch the primary app. |
| 1394 StartUIForAppLaunch(); |
| 1395 SimulateNetworkOnline(); |
| 1396 LaunchApp(test_app_id(), false); |
| 1397 WaitForAppLaunchWithOptions(false, true); |
| 1398 |
| 1399 // Verify the primary app and the secondary apps are all installed. |
| 1400 EXPECT_EQ(primary_app.version, GetInstalledAppVersion().GetString()); |
| 1401 for (size_t i = 0; i < secondary_apps.size(); ++i) |
| 1402 EXPECT_TRUE(IsAppInstalled(secondary_apps[i].id)); |
| 1403 } |
| 1404 |
| 1405 void LaunchTestKioskAppWithTwoSecondaryApps() { |
| 1406 TestAppInfo primary_app(kTestPrimaryKioskApp, "1.0.0", |
| 1407 std::string(kTestPrimaryKioskApp) + "-1.0.0.crx"); |
| 1408 |
| 1409 std::vector<TestAppInfo> secondary_apps; |
| 1410 TestAppInfo secondary_app_1(kTestSecondaryApp1, "1.0.0", |
| 1411 std::string(kTestSecondaryApp1) + "-1.0.0.crx"); |
| 1412 secondary_apps.push_back(secondary_app_1); |
| 1413 TestAppInfo secondary_app_2(kTestSecondaryApp2, "1.0.0", |
| 1414 std::string(kTestSecondaryApp2) + "-1.0.0.crx"); |
| 1415 secondary_apps.push_back(secondary_app_2); |
| 1416 |
| 1417 LaunchKioskWithSecondaryApps(primary_app, secondary_apps); |
| 1418 } |
| 1419 |
| 1346 private: | 1420 private: |
| 1347 class KioskAppExternalUpdateWaiter : public KioskAppManagerObserver { | 1421 class KioskAppExternalUpdateWaiter : public KioskAppManagerObserver { |
| 1348 public: | 1422 public: |
| 1349 KioskAppExternalUpdateWaiter(KioskAppManager* manager, | 1423 KioskAppExternalUpdateWaiter(KioskAppManager* manager, |
| 1350 const std::string& app_id) | 1424 const std::string& app_id) |
| 1351 : runner_(NULL), | 1425 : runner_(NULL), |
| 1352 manager_(manager), | 1426 manager_(manager), |
| 1353 app_id_(app_id), | 1427 app_id_(app_id), |
| 1354 quit_(false), | 1428 quit_(false), |
| 1355 update_success_(false), | 1429 update_success_(false), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 scoped_refptr<content::MessageLoopRunner> runner_; | 1462 scoped_refptr<content::MessageLoopRunner> runner_; |
| 1389 KioskAppManager* manager_; | 1463 KioskAppManager* manager_; |
| 1390 const std::string app_id_; | 1464 const std::string app_id_; |
| 1391 bool quit_; | 1465 bool quit_; |
| 1392 bool update_success_; | 1466 bool update_success_; |
| 1393 bool app_update_notified_; | 1467 bool app_update_notified_; |
| 1394 | 1468 |
| 1395 DISALLOW_COPY_AND_ASSIGN(KioskAppExternalUpdateWaiter); | 1469 DISALLOW_COPY_AND_ASSIGN(KioskAppExternalUpdateWaiter); |
| 1396 }; | 1470 }; |
| 1397 | 1471 |
| 1472 // The local cache is supposed to be initialized on chromeos device, and a |
| 1473 // ready flag file will be pre-created to mark the ready state, before chrome |
| 1474 // starts. In order for the tests to run without being on real chromeos |
| 1475 // device, we need to manually create this file. |
| 1476 void CreateAndInitializeLocalCache() { |
| 1477 base::FilePath extension_cache_dir; |
| 1478 CHECK(PathService::Get(chromeos::DIR_DEVICE_EXTENSION_LOCAL_CACHE, |
| 1479 &extension_cache_dir)); |
| 1480 base::FilePath cache_init_file = extension_cache_dir.Append( |
| 1481 extensions::LocalExtensionCache::kCacheReadyFlagFileName); |
| 1482 EXPECT_EQ(base::WriteFile(cache_init_file, "", 0), 0); |
| 1483 } |
| 1484 |
| 1398 // Owned by DiskMountManager. | 1485 // Owned by DiskMountManager. |
| 1399 KioskFakeDiskMountManager* fake_disk_mount_manager_; | 1486 KioskFakeDiskMountManager* fake_disk_mount_manager_; |
| 1400 | 1487 |
| 1401 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); | 1488 DISALLOW_COPY_AND_ASSIGN(KioskUpdateTest); |
| 1402 }; | 1489 }; |
| 1403 | 1490 |
| 1404 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_LaunchOfflineEnabledAppNoNetwork) { | 1491 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_LaunchOfflineEnabledAppNoNetwork) { |
| 1405 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, | 1492 PreCacheAndLaunchApp(kTestOfflineEnabledKioskApp, |
| 1406 "1.0.0", | 1493 "1.0.0", |
| 1407 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); | 1494 std::string(kTestOfflineEnabledKioskApp) + "_v1.crx"); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); | 1788 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); |
| 1702 extensions::ResultCatcher catcher; | 1789 extensions::ResultCatcher catcher; |
| 1703 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1790 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
| 1704 WaitForAppLaunchWithOptions(true /* check_launch_data */, | 1791 WaitForAppLaunchWithOptions(true /* check_launch_data */, |
| 1705 false /* terminate_app */); | 1792 false /* terminate_app */); |
| 1706 | 1793 |
| 1707 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1794 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1708 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1795 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 1709 } | 1796 } |
| 1710 | 1797 |
| 1798 /* ***** Test Kiosk multi-app feature ***** */ |
| 1799 |
| 1800 // Launch a primary kiosk app which has two secondary apps. |
| 1801 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, |
| 1802 LaunchTestKioskAppWithTwoSecondaryApps) { |
| 1803 LaunchTestKioskAppWithTwoSecondaryApps(); |
| 1804 } |
| 1805 |
| 1806 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_UpdateMultiAppKioskRemoveOneApp) { |
| 1807 LaunchTestKioskAppWithTwoSecondaryApps(); |
| 1808 } |
| 1809 |
| 1810 // Update the primary app to version 2 which removes one of the secondary app |
| 1811 // from its manifest. |
| 1812 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UpdateMultiAppKioskRemoveOneApp) { |
| 1813 set_test_app_id(kTestPrimaryKioskApp); |
| 1814 fake_cws()->SetUpdateCrx( |
| 1815 kTestPrimaryKioskApp, |
| 1816 std::string(kTestPrimaryKioskApp) + "-2.0.0-1app.crx", "2.0.0"); |
| 1817 fake_cws()->SetNoUpdate(kTestSecondaryApp1); |
| 1818 fake_cws()->SetNoUpdate(kTestSecondaryApp2); |
| 1819 |
| 1820 StartUIForAppLaunch(); |
| 1821 SimulateNetworkOnline(); |
| 1822 LaunchApp(test_app_id(), false); |
| 1823 WaitForAppLaunchWithOptions(false, true); |
| 1824 |
| 1825 // Verify the secondary app kTestSecondaryApp1 is removed. |
| 1826 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
| 1827 EXPECT_FALSE(IsAppInstalled(kTestSecondaryApp1)); |
| 1828 EXPECT_TRUE(IsAppInstalled(kTestSecondaryApp2)); |
| 1829 } |
| 1830 |
| 1831 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_UpdateMultiAppKioskAddOneApp) { |
| 1832 LaunchTestKioskAppWithTwoSecondaryApps(); |
| 1833 } |
| 1834 |
| 1835 // Update the primary app to version 3 which adds a new secondary app in its |
| 1836 // manifest. |
| 1837 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, UpdateMultiAppKioskAddOneApp) { |
| 1838 set_test_app_id(kTestPrimaryKioskApp); |
| 1839 fake_cws()->SetUpdateCrx( |
| 1840 kTestPrimaryKioskApp, |
| 1841 std::string(kTestPrimaryKioskApp) + "-3.0.0-3app.crx", "3.0.0"); |
| 1842 fake_cws()->SetNoUpdate(kTestSecondaryApp1); |
| 1843 fake_cws()->SetNoUpdate(kTestSecondaryApp2); |
| 1844 fake_cws()->SetUpdateCrx(kTestSecondaryApp3, |
| 1845 std::string(kTestSecondaryApp3) + "-1.0.0.crx", |
| 1846 "1.0.0"); |
| 1847 |
| 1848 StartUIForAppLaunch(); |
| 1849 SimulateNetworkOnline(); |
| 1850 LaunchApp(test_app_id(), false); |
| 1851 WaitForAppLaunchWithOptions(false, true); |
| 1852 |
| 1853 // Verify the secondary app kTestSecondaryApp3 is installed. |
| 1854 EXPECT_EQ("3.0.0", GetInstalledAppVersion().GetString()); |
| 1855 EXPECT_TRUE(IsAppInstalled(kTestSecondaryApp1)); |
| 1856 EXPECT_TRUE(IsAppInstalled(kTestSecondaryApp2)); |
| 1857 EXPECT_TRUE(IsAppInstalled(kTestSecondaryApp3)); |
| 1858 } |
| 1859 |
| 1711 class KioskEnterpriseTest : public KioskTest { | 1860 class KioskEnterpriseTest : public KioskTest { |
| 1712 protected: | 1861 protected: |
| 1713 KioskEnterpriseTest() { | 1862 KioskEnterpriseTest() { |
| 1714 set_use_consumer_kiosk_mode(false); | 1863 set_use_consumer_kiosk_mode(false); |
| 1715 } | 1864 } |
| 1716 | 1865 |
| 1717 void SetUpInProcessBrowserTestFixture() override { | 1866 void SetUpInProcessBrowserTestFixture() override { |
| 1718 policy::DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy( | 1867 policy::DevicePolicyCrosTestHelper::MarkAsEnterpriseOwnedBy( |
| 1719 kTestOwnerEmail); | 1868 kTestOwnerEmail); |
| 1720 settings_helper_.SetCurrentUserIsOwner(false); | 1869 settings_helper_.SetCurrentUserIsOwner(false); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 content::WindowedNotificationObserver( | 2094 content::WindowedNotificationObserver( |
| 1946 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 2095 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
| 1947 content::NotificationService::AllSources()).Wait(); | 2096 content::NotificationService::AllSources()).Wait(); |
| 1948 | 2097 |
| 1949 // Wait for the wallpaper to load. | 2098 // Wait for the wallpaper to load. |
| 1950 WaitForWallpaper(); | 2099 WaitForWallpaper(); |
| 1951 EXPECT_TRUE(wallpaper_loaded()); | 2100 EXPECT_TRUE(wallpaper_loaded()); |
| 1952 } | 2101 } |
| 1953 | 2102 |
| 1954 } // namespace chromeos | 2103 } // namespace chromeos |
| OLD | NEW |