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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 private: | 284 private: |
285 std::string usb_mount_path_; | 285 std::string usb_mount_path_; |
286 | 286 |
287 DISALLOW_COPY_AND_ASSIGN(KioskFakeDiskMountManager); | 287 DISALLOW_COPY_AND_ASSIGN(KioskFakeDiskMountManager); |
288 }; | 288 }; |
289 | 289 |
290 } // namespace | 290 } // namespace |
291 | 291 |
292 class KioskTest : public OobeBaseTest { | 292 class KioskTest : public OobeBaseTest { |
293 public: | 293 public: |
294 KioskTest() : fake_cws_(new FakeCWS) { | 294 KioskTest() : use_consumer_kiosk_mode_(true), |
| 295 fake_cws_(new FakeCWS) { |
295 set_exit_when_last_browser_closes(false); | 296 set_exit_when_last_browser_closes(false); |
296 } | 297 } |
297 | 298 |
298 virtual ~KioskTest() {} | 299 virtual ~KioskTest() {} |
299 | 300 |
300 protected: | 301 protected: |
301 virtual void SetUp() override { | 302 virtual void SetUp() override { |
302 test_app_id_ = kTestKioskApp; | 303 test_app_id_ = kTestKioskApp; |
303 set_test_app_version("1.0.0"); | 304 set_test_app_version("1.0.0"); |
304 set_test_crx_file(test_app_id() + ".crx"); | 305 set_test_crx_file(test_app_id() + ".crx"); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 368 } |
368 | 369 |
369 void ReloadAutolaunchKioskApps() { | 370 void ReloadAutolaunchKioskApps() { |
370 SetupTestAppUpdateCheck(); | 371 SetupTestAppUpdateCheck(); |
371 | 372 |
372 KioskAppManager::Get()->AddApp(test_app_id_); | 373 KioskAppManager::Get()->AddApp(test_app_id_); |
373 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); | 374 KioskAppManager::Get()->SetAutoLaunchApp(test_app_id_); |
374 } | 375 } |
375 | 376 |
376 void StartUIForAppLaunch() { | 377 void StartUIForAppLaunch() { |
377 EnableConsumerKioskMode(); | 378 if (use_consumer_kiosk_mode_) |
| 379 EnableConsumerKioskMode(); |
378 | 380 |
379 // Start UI | 381 // Start UI |
380 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 382 chromeos::WizardController::SkipPostLoginScreensForTesting(); |
381 chromeos::WizardController* wizard_controller = | 383 chromeos::WizardController* wizard_controller = |
382 chromeos::WizardController::default_controller(); | 384 chromeos::WizardController::default_controller(); |
383 if (wizard_controller) { | 385 if (wizard_controller) { |
384 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 386 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); |
385 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait(); | 387 OobeScreenWaiter(OobeDisplay::SCREEN_GAIA_SIGNIN).Wait(); |
386 } else { | 388 } else { |
387 // No wizard and running with an existing profile and it should land | 389 // No wizard and running with an existing profile and it should land |
(...skipping 30 matching lines...) Expand all Loading... |
418 const extensions::Extension* GetInstalledApp() { | 420 const extensions::Extension* GetInstalledApp() { |
419 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 421 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
420 return extensions::ExtensionSystem::Get(app_profile)-> | 422 return extensions::ExtensionSystem::Get(app_profile)-> |
421 extension_service()->GetInstalledExtension(test_app_id_); | 423 extension_service()->GetInstalledExtension(test_app_id_); |
422 } | 424 } |
423 | 425 |
424 const Version& GetInstalledAppVersion() { | 426 const Version& GetInstalledAppVersion() { |
425 return *GetInstalledApp()->version(); | 427 return *GetInstalledApp()->version(); |
426 } | 428 } |
427 | 429 |
428 void WaitForAppLaunchAndOptionallyTerminateApp(bool terminate_app) { | 430 void WaitForAppLaunchWithOptions(bool check_launch_data, bool terminate_app) { |
429 ExtensionTestMessageListener | 431 ExtensionTestMessageListener |
430 launch_data_check_listener("launchData.isKioskSession = true", false); | 432 launch_data_check_listener("launchData.isKioskSession = true", false); |
431 | 433 |
432 // Wait for the Kiosk App to launch. | 434 // Wait for the Kiosk App to launch. |
433 content::WindowedNotificationObserver( | 435 content::WindowedNotificationObserver( |
434 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, | 436 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, |
435 content::NotificationService::AllSources()).Wait(); | 437 content::NotificationService::AllSources()).Wait(); |
436 | 438 |
437 // Default profile switches to app profile after app is launched. | 439 // Default profile switches to app profile after app is launched. |
438 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 440 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 // Terminate the app. | 472 // Terminate the app. |
471 if (terminate_app) | 473 if (terminate_app) |
472 window->GetBaseWindow()->Close(); | 474 window->GetBaseWindow()->Close(); |
473 | 475 |
474 // Wait until the app terminates if it is still running. | 476 // Wait until the app terminates if it is still running. |
475 if (!app_window_registry->GetAppWindowsForApp(test_app_id_).empty()) | 477 if (!app_window_registry->GetAppWindowsForApp(test_app_id_).empty()) |
476 content::RunMessageLoop(); | 478 content::RunMessageLoop(); |
477 | 479 |
478 // Check that the app had been informed that it is running in a kiosk | 480 // Check that the app had been informed that it is running in a kiosk |
479 // session. | 481 // session. |
480 EXPECT_TRUE(launch_data_check_listener.was_satisfied()); | 482 if (check_launch_data) |
| 483 EXPECT_TRUE(launch_data_check_listener.was_satisfied()); |
481 } | 484 } |
482 | 485 |
483 void WaitForAppLaunchSuccess() { | 486 void WaitForAppLaunchSuccess() { |
484 WaitForAppLaunchAndOptionallyTerminateApp(true); | 487 WaitForAppLaunchWithOptions(true /* check_launch_data */, |
| 488 true /* terminate_app */); |
485 } | 489 } |
486 | 490 |
487 void WaitForAppLaunchNetworkTimeout() { | 491 void WaitForAppLaunchNetworkTimeout() { |
488 if (GetAppLaunchController()->network_wait_timedout()) | 492 if (GetAppLaunchController()->network_wait_timedout()) |
489 return; | 493 return; |
490 | 494 |
491 scoped_refptr<content::MessageLoopRunner> runner = | 495 scoped_refptr<content::MessageLoopRunner> runner = |
492 new content::MessageLoopRunner; | 496 new content::MessageLoopRunner; |
493 | 497 |
494 base::Closure callback = base::Bind( | 498 base::Closure callback = base::Bind( |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 void set_test_app_version(const std::string& version) { | 604 void set_test_app_version(const std::string& version) { |
601 test_app_version_ = version; | 605 test_app_version_ = version; |
602 } | 606 } |
603 const std::string& test_app_version() const { return test_app_version_; } | 607 const std::string& test_app_version() const { return test_app_version_; } |
604 void set_test_crx_file(const std::string& filename) { | 608 void set_test_crx_file(const std::string& filename) { |
605 test_crx_file_ = filename; | 609 test_crx_file_ = filename; |
606 } | 610 } |
607 const std::string& test_crx_file() const { return test_crx_file_; } | 611 const std::string& test_crx_file() const { return test_crx_file_; } |
608 FakeCWS* fake_cws() { return fake_cws_.get(); } | 612 FakeCWS* fake_cws() { return fake_cws_.get(); } |
609 | 613 |
| 614 void set_use_consumer_kiosk_mode(bool use) { |
| 615 use_consumer_kiosk_mode_ = use; |
| 616 } |
| 617 |
610 private: | 618 private: |
| 619 bool use_consumer_kiosk_mode_; |
611 std::string test_app_id_; | 620 std::string test_app_id_; |
612 std::string test_app_version_; | 621 std::string test_app_version_; |
613 std::string test_crx_file_; | 622 std::string test_crx_file_; |
614 scoped_ptr<FakeCWS> fake_cws_; | 623 scoped_ptr<FakeCWS> fake_cws_; |
615 scoped_ptr<MockUserManager> mock_user_manager_; | 624 scoped_ptr<MockUserManager> mock_user_manager_; |
616 | 625 |
617 DISALLOW_COPY_AND_ASSIGN(KioskTest); | 626 DISALLOW_COPY_AND_ASSIGN(KioskTest); |
618 }; | 627 }; |
619 | 628 |
620 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { | 629 IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 } | 1543 } |
1535 | 1544 |
1536 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PreserveLocalData) { | 1545 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PRE_PreserveLocalData) { |
1537 // Installs v1 app and writes some local data. | 1546 // Installs v1 app and writes some local data. |
1538 set_test_app_id(kTestLocalFsKioskApp); | 1547 set_test_app_id(kTestLocalFsKioskApp); |
1539 set_test_app_version("1.0.0"); | 1548 set_test_app_version("1.0.0"); |
1540 set_test_crx_file(test_app_id() + ".crx"); | 1549 set_test_crx_file(test_app_id() + ".crx"); |
1541 | 1550 |
1542 extensions::ResultCatcher catcher; | 1551 extensions::ResultCatcher catcher; |
1543 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1552 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
1544 WaitForAppLaunchAndOptionallyTerminateApp(false); | 1553 WaitForAppLaunchWithOptions(true /* check_launch_data */, |
| 1554 false /* terminate_app */); |
1545 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1555 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
1546 } | 1556 } |
1547 | 1557 |
1548 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PreserveLocalData) { | 1558 IN_PROC_BROWSER_TEST_F(KioskUpdateTest, PreserveLocalData) { |
1549 // Update existing v1 app installed in PRE_PreserveLocalData to v2 | 1559 // Update existing v1 app installed in PRE_PreserveLocalData to v2 |
1550 // that reads and verifies the local data. | 1560 // that reads and verifies the local data. |
1551 set_test_app_id(kTestLocalFsKioskApp); | 1561 set_test_app_id(kTestLocalFsKioskApp); |
1552 set_test_app_version("2.0.0"); | 1562 set_test_app_version("2.0.0"); |
1553 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); | 1563 set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); |
1554 extensions::ResultCatcher catcher; | 1564 extensions::ResultCatcher catcher; |
1555 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); | 1565 StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); |
1556 WaitForAppLaunchAndOptionallyTerminateApp(false); | 1566 WaitForAppLaunchWithOptions(true /* check_launch_data */, |
| 1567 false /* terminate_app */); |
1557 | 1568 |
1558 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); | 1569 EXPECT_EQ("2.0.0", GetInstalledAppVersion().GetString()); |
1559 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 1570 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
1560 } | 1571 } |
1561 | 1572 |
1562 class KioskEnterpriseTest : public KioskTest { | 1573 class KioskEnterpriseTest : public KioskTest { |
1563 protected: | 1574 protected: |
1564 KioskEnterpriseTest() {} | 1575 KioskEnterpriseTest() { |
| 1576 set_use_consumer_kiosk_mode(false); |
| 1577 } |
1565 | 1578 |
1566 virtual void SetUpInProcessBrowserTestFixture() override { | 1579 virtual void SetUpInProcessBrowserTestFixture() override { |
1567 device_policy_test_helper_.MarkAsEnterpriseOwned(); | 1580 device_policy_test_helper_.MarkAsEnterpriseOwned(); |
1568 device_policy_test_helper_.InstallOwnerKey(); | 1581 device_policy_test_helper_.InstallOwnerKey(); |
1569 | 1582 |
1570 KioskTest::SetUpInProcessBrowserTestFixture(); | 1583 KioskTest::SetUpInProcessBrowserTestFixture(); |
1571 } | 1584 } |
1572 | 1585 |
1573 virtual void SetUpOnMainThread() override { | 1586 virtual void SetUpOnMainThread() override { |
1574 set_test_app_id(kTestEnterpriseKioskApp); | |
1575 set_test_app_version("1.0.0"); | |
1576 set_test_crx_file(test_app_id() + ".crx"); | |
1577 SetupTestAppUpdateCheck(); | |
1578 | |
1579 KioskTest::SetUpOnMainThread(); | 1587 KioskTest::SetUpOnMainThread(); |
1580 // Configure kTestEnterpriseKioskApp in device policy. | |
1581 em::DeviceLocalAccountsProto* accounts = | |
1582 device_policy_test_helper_.device_policy()->payload() | |
1583 .mutable_device_local_accounts(); | |
1584 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); | |
1585 account->set_account_id(kTestEnterpriseAccountId); | |
1586 account->set_type( | |
1587 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); | |
1588 account->mutable_kiosk_app()->set_app_id(kTestEnterpriseKioskApp); | |
1589 accounts->set_auto_login_id(kTestEnterpriseAccountId); | |
1590 em::PolicyData& policy_data = | |
1591 device_policy_test_helper_.device_policy()->policy_data(); | |
1592 policy_data.set_service_account_identity(kTestEnterpriseServiceAccountId); | |
1593 device_policy_test_helper_.device_policy()->Build(); | |
1594 | |
1595 base::RunLoop run_loop; | |
1596 DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy( | |
1597 device_policy_test_helper_.device_policy()->GetBlob(), | |
1598 base::Bind(&KioskEnterpriseTest::StorePolicyCallback, | |
1599 run_loop.QuitClosure())); | |
1600 run_loop.Run(); | |
1601 | |
1602 DeviceSettingsService::Get()->Load(); | |
1603 | 1588 |
1604 // Configure OAuth authentication. | 1589 // Configure OAuth authentication. |
1605 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); | 1590 GaiaUrls* gaia_urls = GaiaUrls::GetInstance(); |
1606 | 1591 |
1607 // This token satisfies the userinfo.email request from | 1592 // This token satisfies the userinfo.email request from |
1608 // DeviceOAuth2TokenService used in token validation. | 1593 // DeviceOAuth2TokenService used in token validation. |
1609 FakeGaia::AccessTokenInfo userinfo_token_info; | 1594 FakeGaia::AccessTokenInfo userinfo_token_info; |
1610 userinfo_token_info.token = kTestUserinfoToken; | 1595 userinfo_token_info.token = kTestUserinfoToken; |
1611 userinfo_token_info.scopes.insert( | 1596 userinfo_token_info.scopes.insert( |
1612 "https://www.googleapis.com/auth/userinfo.email"); | 1597 "https://www.googleapis.com/auth/userinfo.email"); |
(...skipping 21 matching lines...) Expand all Loading... |
1634 token_service->SetAndSaveRefreshToken( | 1619 token_service->SetAndSaveRefreshToken( |
1635 kTestRefreshToken, DeviceOAuth2TokenService::StatusCallback()); | 1620 kTestRefreshToken, DeviceOAuth2TokenService::StatusCallback()); |
1636 base::RunLoop().RunUntilIdle(); | 1621 base::RunLoop().RunUntilIdle(); |
1637 } | 1622 } |
1638 | 1623 |
1639 static void StorePolicyCallback(const base::Closure& callback, bool result) { | 1624 static void StorePolicyCallback(const base::Closure& callback, bool result) { |
1640 ASSERT_TRUE(result); | 1625 ASSERT_TRUE(result); |
1641 callback.Run(); | 1626 callback.Run(); |
1642 } | 1627 } |
1643 | 1628 |
| 1629 void ConfigureKioskAppInPolicy(const std::string& account_id, |
| 1630 const std::string& app_id, |
| 1631 const std::string& update_url) { |
| 1632 em::DeviceLocalAccountsProto* accounts = |
| 1633 device_policy_test_helper_.device_policy()->payload() |
| 1634 .mutable_device_local_accounts(); |
| 1635 em::DeviceLocalAccountInfoProto* account = accounts->add_account(); |
| 1636 account->set_account_id(account_id); |
| 1637 account->set_type( |
| 1638 em::DeviceLocalAccountInfoProto::ACCOUNT_TYPE_KIOSK_APP); |
| 1639 account->mutable_kiosk_app()->set_app_id(app_id); |
| 1640 if (!update_url.empty()) |
| 1641 account->mutable_kiosk_app()->set_update_url(update_url); |
| 1642 accounts->set_auto_login_id(account_id); |
| 1643 em::PolicyData& policy_data = |
| 1644 device_policy_test_helper_.device_policy()->policy_data(); |
| 1645 policy_data.set_service_account_identity(kTestEnterpriseServiceAccountId); |
| 1646 device_policy_test_helper_.device_policy()->Build(); |
| 1647 |
| 1648 base::RunLoop run_loop; |
| 1649 DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy( |
| 1650 device_policy_test_helper_.device_policy()->GetBlob(), |
| 1651 base::Bind(&KioskEnterpriseTest::StorePolicyCallback, |
| 1652 run_loop.QuitClosure())); |
| 1653 run_loop.Run(); |
| 1654 |
| 1655 DeviceSettingsService::Get()->Load(); |
| 1656 } |
| 1657 |
1644 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; | 1658 policy::DevicePolicyCrosTestHelper device_policy_test_helper_; |
1645 | 1659 |
1646 private: | 1660 private: |
1647 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); | 1661 DISALLOW_COPY_AND_ASSIGN(KioskEnterpriseTest); |
1648 }; | 1662 }; |
1649 | 1663 |
1650 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { | 1664 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, EnterpriseKioskApp) { |
1651 chromeos::WizardController::SkipPostLoginScreensForTesting(); | 1665 // Prepare Fake CWS to serve app crx. |
1652 chromeos::WizardController* wizard_controller = | 1666 set_test_app_id(kTestEnterpriseKioskApp); |
1653 chromeos::WizardController::default_controller(); | 1667 set_test_app_version("1.0.0"); |
1654 wizard_controller->SkipToLoginForTesting(LoginScreenContext()); | 1668 set_test_crx_file(test_app_id() + ".crx"); |
| 1669 SetupTestAppUpdateCheck(); |
1655 | 1670 |
1656 // Wait for the Kiosk App configuration to reload, then launch the app. | 1671 // Configure kTestEnterpriseKioskApp in device policy. |
1657 KioskAppManager::App app; | 1672 ConfigureKioskAppInPolicy(kTestEnterpriseAccountId, |
1658 content::WindowedNotificationObserver app_config_waiter( | 1673 kTestEnterpriseKioskApp, |
1659 chrome::NOTIFICATION_KIOSK_APPS_LOADED, | 1674 ""); |
1660 base::Bind(&KioskAppManager::GetApp, | |
1661 base::Unretained(KioskAppManager::Get()), | |
1662 kTestEnterpriseKioskApp, &app)); | |
1663 FireKioskAppSettingsChanged(); | |
1664 app_config_waiter.Wait(); | |
1665 | 1675 |
| 1676 PrepareAppLaunch(); |
1666 LaunchApp(kTestEnterpriseKioskApp, false); | 1677 LaunchApp(kTestEnterpriseKioskApp, false); |
1667 | 1678 |
1668 // Wait for the Kiosk App to launch. | 1679 // Wait for the Kiosk App to launch. |
1669 content::WindowedNotificationObserver( | 1680 content::WindowedNotificationObserver( |
1670 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, | 1681 chrome::NOTIFICATION_KIOSK_APP_LAUNCHED, |
1671 content::NotificationService::AllSources()).Wait(); | 1682 content::NotificationService::AllSources()).Wait(); |
1672 | 1683 |
1673 // Check installer status. | 1684 // Check installer status. |
1674 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, | 1685 EXPECT_EQ(chromeos::KioskAppLaunchError::NONE, |
1675 chromeos::KioskAppLaunchError::Get()); | 1686 chromeos::KioskAppLaunchError::Get()); |
(...skipping 22 matching lines...) Expand all Loading... |
1698 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); | 1709 Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); |
1699 ASSERT_TRUE(app_profile); | 1710 ASSERT_TRUE(app_profile); |
1700 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( | 1711 EXPECT_FALSE(app_profile->GetPrefs()->HasPrefPath( |
1701 prefs::kGoogleServicesUsername)); | 1712 prefs::kGoogleServicesUsername)); |
1702 | 1713 |
1703 // Terminate the app. | 1714 // Terminate the app. |
1704 window->GetBaseWindow()->Close(); | 1715 window->GetBaseWindow()->Close(); |
1705 content::RunAllPendingInMessageLoop(); | 1716 content::RunAllPendingInMessageLoop(); |
1706 } | 1717 } |
1707 | 1718 |
| 1719 IN_PROC_BROWSER_TEST_F(KioskEnterpriseTest, PrivateStore) { |
| 1720 set_test_app_id(kTestEnterpriseKioskApp); |
| 1721 |
| 1722 const char kPrivateStoreUpdate[] = "/private_store_update"; |
| 1723 net::test_server::EmbeddedTestServer private_server; |
| 1724 ASSERT_TRUE(private_server.InitializeAndWaitUntilReady()); |
| 1725 |
| 1726 // |private_server| serves crx from test data dir. |
| 1727 base::FilePath test_data_dir; |
| 1728 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); |
| 1729 private_server.ServeFilesFromDirectory(test_data_dir); |
| 1730 |
| 1731 FakeCWS private_store; |
| 1732 private_store.InitAsPrivateStore(&private_server, kPrivateStoreUpdate); |
| 1733 private_store.SetUpdateCrx(kTestEnterpriseKioskApp, |
| 1734 std::string(kTestEnterpriseKioskApp) + ".crx", |
| 1735 "1.0.0"); |
| 1736 |
| 1737 // Configure kTestEnterpriseKioskApp in device policy. |
| 1738 ConfigureKioskAppInPolicy(kTestEnterpriseAccountId, |
| 1739 kTestEnterpriseKioskApp, |
| 1740 private_server.GetURL(kPrivateStoreUpdate).spec()); |
| 1741 |
| 1742 PrepareAppLaunch(); |
| 1743 LaunchApp(kTestEnterpriseKioskApp, false); |
| 1744 WaitForAppLaunchWithOptions(false /* check_launch_data */, |
| 1745 true /* terminate_app */); |
| 1746 |
| 1747 // Private store should serve crx and CWS should not. |
| 1748 DCHECK_GT(private_store.GetUpdateCheckCountAndReset(), 0); |
| 1749 DCHECK_EQ(0, fake_cws()->GetUpdateCheckCountAndReset()); |
| 1750 } |
| 1751 |
1708 // Specialized test fixture for testing kiosk mode on the | 1752 // Specialized test fixture for testing kiosk mode on the |
1709 // hidden WebUI initialization flow for slow hardware. | 1753 // hidden WebUI initialization flow for slow hardware. |
1710 class KioskHiddenWebUITest : public KioskTest, | 1754 class KioskHiddenWebUITest : public KioskTest, |
1711 public ash::DesktopBackgroundControllerObserver { | 1755 public ash::DesktopBackgroundControllerObserver { |
1712 public: | 1756 public: |
1713 KioskHiddenWebUITest() : wallpaper_loaded_(false) {} | 1757 KioskHiddenWebUITest() : wallpaper_loaded_(false) {} |
1714 | 1758 |
1715 // KioskTest overrides: | 1759 // KioskTest overrides: |
1716 virtual void SetUpCommandLine(CommandLine* command_line) override { | 1760 virtual void SetUpCommandLine(CommandLine* command_line) override { |
1717 KioskTest::SetUpCommandLine(command_line); | 1761 KioskTest::SetUpCommandLine(command_line); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 content::WindowedNotificationObserver( | 1822 content::WindowedNotificationObserver( |
1779 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, | 1823 chrome::NOTIFICATION_KIOSK_AUTOLAUNCH_WARNING_VISIBLE, |
1780 content::NotificationService::AllSources()).Wait(); | 1824 content::NotificationService::AllSources()).Wait(); |
1781 | 1825 |
1782 // Wait for the wallpaper to load. | 1826 // Wait for the wallpaper to load. |
1783 WaitForWallpaper(); | 1827 WaitForWallpaper(); |
1784 EXPECT_TRUE(wallpaper_loaded()); | 1828 EXPECT_TRUE(wallpaper_loaded()); |
1785 } | 1829 } |
1786 | 1830 |
1787 } // namespace chromeos | 1831 } // namespace chromeos |
OLD | NEW |