Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/browser/chromeos/policy/device_local_account_browsertest.cc

Issue 27548004: Cache force-installed apps/extensions in device-local accounts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/scoped_temp_dir.h"
15 #include "base/json/json_reader.h" 16 #include "base/json/json_reader.h"
16 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
17 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
18 #include "base/path_service.h" 19 #include "base/path_service.h"
19 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
21 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
22 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/test/scoped_path_override.h"
23 #include "base/values.h" 26 #include "base/values.h"
24 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_notification_types.h" 28 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/chromeos/login/existing_user_controller.h" 29 #include "chrome/browser/chromeos/login/existing_user_controller.h"
27 #include "chrome/browser/chromeos/login/login_display_host.h" 30 #include "chrome/browser/chromeos/login/login_display_host.h"
28 #include "chrome/browser/chromeos/login/login_display_host_impl.h" 31 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
29 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" 32 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h"
30 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" 33 #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
31 #include "chrome/browser/chromeos/login/user.h" 34 #include "chrome/browser/chromeos/login/user.h"
32 #include "chrome/browser/chromeos/login/user_manager.h" 35 #include "chrome/browser/chromeos/login/user_manager.h"
(...skipping 17 matching lines...) Expand all
50 #include "chrome/browser/ui/browser_commands.h" 53 #include "chrome/browser/ui/browser_commands.h"
51 #include "chrome/browser/ui/browser_finder.h" 54 #include "chrome/browser/ui/browser_finder.h"
52 #include "chrome/browser/ui/browser_list.h" 55 #include "chrome/browser/ui/browser_list.h"
53 #include "chrome/browser/ui/browser_window.h" 56 #include "chrome/browser/ui/browser_window.h"
54 #include "chrome/browser/ui/host_desktop.h" 57 #include "chrome/browser/ui/host_desktop.h"
55 #include "chrome/browser/ui/tabs/tab_strip_model.h" 58 #include "chrome/browser/ui/tabs/tab_strip_model.h"
56 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 59 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
57 #include "chrome/common/chrome_paths.h" 60 #include "chrome/common/chrome_paths.h"
58 #include "chrome/common/chrome_switches.h" 61 #include "chrome/common/chrome_switches.h"
59 #include "chrome/common/extensions/extension.h" 62 #include "chrome/common/extensions/extension.h"
63 #include "chromeos/chromeos_paths.h"
60 #include "chromeos/chromeos_switches.h" 64 #include "chromeos/chromeos_switches.h"
61 #include "chromeos/dbus/cryptohome_client.h" 65 #include "chromeos/dbus/cryptohome_client.h"
62 #include "chromeos/dbus/dbus_method_call_status.h" 66 #include "chromeos/dbus/dbus_method_call_status.h"
63 #include "chromeos/dbus/fake_session_manager_client.h" 67 #include "chromeos/dbus/fake_session_manager_client.h"
64 #include "chromeos/dbus/session_manager_client.h" 68 #include "chromeos/dbus/session_manager_client.h"
65 #include "content/public/browser/notification_details.h" 69 #include "content/public/browser/notification_details.h"
66 #include "content/public/browser/notification_source.h" 70 #include "content/public/browser/notification_source.h"
67 #include "content/public/browser/web_contents.h" 71 #include "content/public/browser/web_contents.h"
68 #include "content/public/browser/web_ui.h" 72 #include "content/public/browser/web_ui.h"
69 #include "content/public/test/browser_test_utils.h" 73 #include "content/public/test/browser_test_utils.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 "<?xml version='1.0' encoding='UTF-8'?>\n" 110 "<?xml version='1.0' encoding='UTF-8'?>\n"
107 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>\n"; 111 "<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>\n";
108 const char kUpdateManifestTemplate[] = 112 const char kUpdateManifestTemplate[] =
109 " <app appid='%s'>\n" 113 " <app appid='%s'>\n"
110 " <updatecheck codebase='%s' version='%s' />\n" 114 " <updatecheck codebase='%s' version='%s' />\n"
111 " </app>\n"; 115 " </app>\n";
112 const char kUpdateManifestFooter[] = 116 const char kUpdateManifestFooter[] =
113 "</gupdate>\n"; 117 "</gupdate>\n";
114 const char kHostedAppID[] = "kbmnembihfiondgfjekmnmcbddelicoi"; 118 const char kHostedAppID[] = "kbmnembihfiondgfjekmnmcbddelicoi";
115 const char kHostedAppCRXPath[] = "extensions/hosted_app.crx"; 119 const char kHostedAppCRXPath[] = "extensions/hosted_app.crx";
116 const char kHostedAppVersion[] = "0.1"; 120 const char kHostedAppVersion[] = "1.0.0.0";
117 const char kGoodExtensionID[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; 121 const char kGoodExtensionID[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
118 const char kGoodExtensionPath[] = "extensions/good.crx"; 122 const char kGoodExtensionCRXPath[] = "extensions/good.crx";
119 const char kGoodExtensionVersion[] = "1.0"; 123 const char kGoodExtensionVersion[] = "1.0";
120 124
121 // Helper that serves extension update manifests to Chrome. 125 // Helper that serves extension update manifests to Chrome.
122 class TestingUpdateManifestProvider { 126 class TestingUpdateManifestProvider {
123 public: 127 public:
124 128
125 // Update manifests will be served at |relative_update_url|. 129 // Update manifests will be served at |relative_update_url|.
126 explicit TestingUpdateManifestProvider( 130 explicit TestingUpdateManifestProvider(
127 const std::string& relative_update_url); 131 const std::string& relative_update_url);
128 ~TestingUpdateManifestProvider(); 132 ~TestingUpdateManifestProvider();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 virtual void SetUp() OVERRIDE { 244 virtual void SetUp() OVERRIDE {
241 // Configure and start the test server. 245 // Configure and start the test server.
242 scoped_ptr<crypto::RSAPrivateKey> signing_key( 246 scoped_ptr<crypto::RSAPrivateKey> signing_key(
243 PolicyBuilder::CreateTestSigningKey()); 247 PolicyBuilder::CreateTestSigningKey());
244 ASSERT_TRUE(test_server_.SetSigningKey(signing_key.get())); 248 ASSERT_TRUE(test_server_.SetSigningKey(signing_key.get()));
245 signing_key.reset(); 249 signing_key.reset();
246 test_server_.RegisterClient(PolicyBuilder::kFakeToken, 250 test_server_.RegisterClient(PolicyBuilder::kFakeToken,
247 PolicyBuilder::kFakeDeviceId); 251 PolicyBuilder::kFakeDeviceId);
248 ASSERT_TRUE(test_server_.Start()); 252 ASSERT_TRUE(test_server_.Start());
249 253
254 ASSERT_TRUE(extension_cache_root_dir_.CreateUniqueTempDir());
255 extension_cache_root_dir_override_.reset(new base::ScopedPathOverride(
256 chromeos::DIR_DEVICE_LOCAL_ACCOUNT_CACHE,
257 extension_cache_root_dir_.path()));
258
250 DevicePolicyCrosBrowserTest::SetUp(); 259 DevicePolicyCrosBrowserTest::SetUp();
251 } 260 }
252 261
253 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 262 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
254 command_line->AppendSwitch(chromeos::switches::kLoginManager); 263 command_line->AppendSwitch(chromeos::switches::kLoginManager);
255 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); 264 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
256 command_line->AppendSwitchASCII( 265 command_line->AppendSwitchASCII(
257 switches::kDeviceManagementUrl, test_server_.GetServiceURL().spec()); 266 switches::kDeviceManagementUrl, test_server_.GetServiceURL().spec());
258 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 267 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
259 } 268 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 std::string(), proto.SerializeAsString()); 338 std::string(), proto.SerializeAsString());
330 } 339 }
331 340
332 void CheckPublicSessionPresent(const std::string& id) { 341 void CheckPublicSessionPresent(const std::string& id) {
333 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(id); 342 const chromeos::User* user = chromeos::UserManager::Get()->FindUser(id);
334 ASSERT_TRUE(user); 343 ASSERT_TRUE(user);
335 EXPECT_EQ(id, user->email()); 344 EXPECT_EQ(id, user->email());
336 EXPECT_EQ(chromeos::User::USER_TYPE_PUBLIC_ACCOUNT, user->GetType()); 345 EXPECT_EQ(chromeos::User::USER_TYPE_PUBLIC_ACCOUNT, user->GetType());
337 } 346 }
338 347
348 base::FilePath GetCacheDirectoryForAccountID(const std::string& account_id) {
349 return extension_cache_root_dir_.path()
350 .Append(base::HexEncode(account_id.c_str(), account_id.size()));
351 }
352
353 base::FilePath GetCacheCRXFile(const std::string& account_id,
354 const std::string& id,
355 const std::string& version) {
356 return GetCacheDirectoryForAccountID(account_id)
357 .Append(base::StringPrintf("%s-%s.crx", id.c_str(), version.c_str()));
358 }
359
339 const std::string user_id_1_; 360 const std::string user_id_1_;
340 const std::string user_id_2_; 361 const std::string user_id_2_;
341 362
363 base::ScopedTempDir extension_cache_root_dir_;
364 scoped_ptr<base::ScopedPathOverride> extension_cache_root_dir_override_;
365
342 UserPolicyBuilder device_local_account_policy_; 366 UserPolicyBuilder device_local_account_policy_;
343 LocalPolicyTestServer test_server_; 367 LocalPolicyTestServer test_server_;
344 }; 368 };
345 369
346 static bool IsKnownUser(const std::string& account_id) { 370 static bool IsKnownUser(const std::string& account_id) {
347 return chromeos::UserManager::Get()->IsKnownUser(account_id); 371 return chromeos::UserManager::Get()->IsKnownUser(account_id);
348 } 372 }
349 373
350 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, LoginScreen) { 374 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, LoginScreen) {
351 AddPublicSessionToDevicePolicy(kAccountId1); 375 AddPublicSessionToDevicePolicy(kAccountId1);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 BrowserWindow* browser_window = browser->window(); 571 BrowserWindow* browser_window = browser->window();
548 ASSERT_TRUE(browser_window); 572 ASSERT_TRUE(browser_window);
549 chrome::EndKeepAlive(); 573 chrome::EndKeepAlive();
550 574
551 // Verify that an attempt to enter fullscreen mode is denied. 575 // Verify that an attempt to enter fullscreen mode is denied.
552 EXPECT_FALSE(browser_window->IsFullscreen()); 576 EXPECT_FALSE(browser_window->IsFullscreen());
553 chrome::ToggleFullscreenMode(browser); 577 chrome::ToggleFullscreenMode(browser);
554 EXPECT_FALSE(browser_window->IsFullscreen()); 578 EXPECT_FALSE(browser_window->IsFullscreen());
555 } 579 }
556 580
557 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionWhitelist) { 581 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) {
558 // Make it possible to force-install a hosted app and an extension. 582 // Make it possible to force-install a hosted app and an extension.
559 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 583 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
560 TestingUpdateManifestProvider testing_update_manifest_provider( 584 TestingUpdateManifestProvider testing_update_manifest_provider(
561 kRelativeUpdateURL); 585 kRelativeUpdateURL);
562 testing_update_manifest_provider.AddUpdate( 586 testing_update_manifest_provider.AddUpdate(
563 kHostedAppID, 587 kHostedAppID,
564 kHostedAppVersion, 588 kHostedAppVersion,
565 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath)); 589 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath));
566 testing_update_manifest_provider.AddUpdate( 590 testing_update_manifest_provider.AddUpdate(
567 kGoodExtensionID, 591 kGoodExtensionID,
568 kGoodExtensionVersion, 592 kGoodExtensionVersion,
569 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionPath)); 593 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionCRXPath));
570 embedded_test_server()->RegisterRequestHandler( 594 embedded_test_server()->RegisterRequestHandler(
571 base::Bind(&TestingUpdateManifestProvider::HandleRequest, 595 base::Bind(&TestingUpdateManifestProvider::HandleRequest,
572 base::Unretained(&testing_update_manifest_provider))); 596 base::Unretained(&testing_update_manifest_provider)));
573 597
574 // Specify policy to force-install the hosted app and the extension. 598 // Specify policy to force-install the hosted app and the extension.
575 em::StringList* forcelist = device_local_account_policy_.payload() 599 em::StringList* forcelist = device_local_account_policy_.payload()
576 .mutable_extensioninstallforcelist()->mutable_value(); 600 .mutable_extensioninstallforcelist()->mutable_value();
577 forcelist->add_entries(base::StringPrintf( 601 forcelist->add_entries(base::StringPrintf(
578 "%s;%s", 602 "%s;%s",
579 kHostedAppID, 603 kHostedAppID,
(...skipping 28 matching lines...) Expand all
608 // Ensure that the browser stays alive, even though no windows are opened 632 // Ensure that the browser stays alive, even though no windows are opened
609 // during session start. 633 // during session start.
610 chrome::StartKeepAlive(); 634 chrome::StartKeepAlive();
611 635
612 // Start listening for app/extension installation results. 636 // Start listening for app/extension installation results.
613 content::WindowedNotificationObserver hosted_app_observer( 637 content::WindowedNotificationObserver hosted_app_observer(
614 chrome::NOTIFICATION_EXTENSION_INSTALLED, 638 chrome::NOTIFICATION_EXTENSION_INSTALLED,
615 base::Bind(DoesInstallSuccessReferToId, kHostedAppID)); 639 base::Bind(DoesInstallSuccessReferToId, kHostedAppID));
616 content::WindowedNotificationObserver extension_observer( 640 content::WindowedNotificationObserver extension_observer(
617 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, 641 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
618 base::Bind(DoesInstallFailureReferToId, kGoodExtensionID)); 642 base::Bind(DoesInstallFailureReferToId, kGoodExtensionID));
Joao da Silva 2013/10/17 14:57:54 Why does the extension fail to install?
bartfab (slow) 2013/10/18 12:58:39 Extensions are not allowed in device-local account
619 643
620 // Start login into the device-local account. 644 // Start login into the device-local account.
621 host->StartSignInScreen(); 645 host->StartSignInScreen();
622 chromeos::ExistingUserController* controller = 646 chromeos::ExistingUserController* controller =
623 chromeos::ExistingUserController::current_controller(); 647 chromeos::ExistingUserController::current_controller();
624 ASSERT_TRUE(controller); 648 ASSERT_TRUE(controller);
625 controller->LoginAsPublicAccount(user_id_1_); 649 controller->LoginAsPublicAccount(user_id_1_);
626 650
627 // Wait for the hosted app installation to succeed and the extension 651 // Wait for the hosted app installation to succeed and the extension
628 // installation to fail. 652 // installation to fail.
629 hosted_app_observer.Wait(); 653 hosted_app_observer.Wait();
630 extension_observer.Wait(); 654 extension_observer.Wait();
631 655
632 // Verify that the hosted app was installed. 656 // Verify that the hosted app was installed.
633 Profile* profile = ProfileManager::GetDefaultProfile(); 657 Profile* profile = ProfileManager::GetDefaultProfile();
634 ASSERT_TRUE(profile); 658 ASSERT_TRUE(profile);
635 ExtensionService* extension_service = 659 ExtensionService* extension_service =
636 extensions::ExtensionSystem::Get(profile)->extension_service(); 660 extensions::ExtensionSystem::Get(profile)->extension_service();
637 EXPECT_TRUE(extension_service->GetExtensionById(kHostedAppID, true)); 661 EXPECT_TRUE(extension_service->GetExtensionById(kHostedAppID, true));
638 662
639 // Verify that the extension was not installed. 663 // Verify that the extension was not installed.
640 EXPECT_FALSE(extension_service->GetExtensionById(kGoodExtensionID, true)); 664 EXPECT_FALSE(extension_service->GetExtensionById(kGoodExtensionID, true));
665
666 // Verify that the app was copied to the account's extension cache.
667 base::FilePath test_dir;
668 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
669 EXPECT_TRUE(ContentsEqual(
670 GetCacheCRXFile(kAccountId1, kHostedAppID, kHostedAppVersion),
671 test_dir.Append(kHostedAppCRXPath)));
672
673 // Verify that the extension was not copied to the account's extension cache.
674 EXPECT_FALSE(PathExists(GetCacheCRXFile(
675 kAccountId1, kGoodExtensionID, kGoodExtensionVersion)));
676 }
677
678 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) {
679 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
680
681 // Pre-populate the device local account's extension cache with a hosted app
682 // and an extension.
683 EXPECT_TRUE(file_util::CreateDirectory(
684 GetCacheDirectoryForAccountID(kAccountId1)));
685 base::FilePath test_dir;
686 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
687 const base::FilePath cached_hosted_app =
688 GetCacheCRXFile(kAccountId1, kHostedAppID, kHostedAppVersion);
689 EXPECT_TRUE(CopyFile(test_dir.Append(kHostedAppCRXPath),
690 cached_hosted_app));
691 const base::FilePath cached_extension =
692 GetCacheCRXFile(kAccountId1, kGoodExtensionID, kGoodExtensionVersion);
693 EXPECT_TRUE(CopyFile(test_dir.Append(kGoodExtensionCRXPath),
694 cached_extension));
695
696 // Specify policy to force-install the hosted app.
697 em::StringList* forcelist = device_local_account_policy_.payload()
698 .mutable_extensioninstallforcelist()->mutable_value();
699 forcelist->add_entries(base::StringPrintf(
700 "%s;%s",
701 kHostedAppID,
702 embedded_test_server()->GetURL(kRelativeUpdateURL).spec().c_str()));
703 forcelist->add_entries(base::StringPrintf(
704 "%s;%s",
705 kGoodExtensionID,
706 embedded_test_server()->GetURL(kRelativeUpdateURL).spec().c_str()));
707
708 UploadAndInstallDeviceLocalAccountPolicy();
709 AddPublicSessionToDevicePolicy(kAccountId1);
710
711 // This observes the display name becoming available as this indicates
712 // device-local account policy is fully loaded, which is a prerequisite for
713 // successful login.
714 content::WindowedNotificationObserver(
715 chrome::NOTIFICATION_USER_LIST_CHANGED,
716 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName)).Wait();
717
718 // Wait for the login UI to be ready.
719 chromeos::LoginDisplayHostImpl* host =
720 reinterpret_cast<chromeos::LoginDisplayHostImpl*>(
721 chromeos::LoginDisplayHostImpl::default_host());
722 ASSERT_TRUE(host);
723 chromeos::OobeUI* oobe_ui = host->GetOobeUI();
724 ASSERT_TRUE(oobe_ui);
725 base::RunLoop run_loop;
726 const bool oobe_ui_ready = oobe_ui->IsJSReady(run_loop.QuitClosure());
727 if (!oobe_ui_ready)
728 run_loop.Run();
729
730 // Ensure that the browser stays alive, even though no windows are opened
731 // during session start.
732 chrome::StartKeepAlive();
733
734 // Start listening for app/extension installation results.
735 content::WindowedNotificationObserver hosted_app_observer(
736 chrome::NOTIFICATION_EXTENSION_INSTALLED,
737 base::Bind(DoesInstallSuccessReferToId, kHostedAppID));
738 content::WindowedNotificationObserver extension_observer(
739 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
740 base::Bind(DoesInstallFailureReferToId, kGoodExtensionID));
741
742 // Start login into the device-local account.
743 host->StartSignInScreen();
744 chromeos::ExistingUserController* controller =
745 chromeos::ExistingUserController::current_controller();
746 ASSERT_TRUE(controller);
747 controller->LoginAsPublicAccount(user_id_1_);
748
749 // Wait for the hosted app installation to succeed and the extension
750 // installation to fail.
751 hosted_app_observer.Wait();
752 extension_observer.Wait();
753
754 // Verify that the hosted app was installed.
755 Profile* profile = ProfileManager::GetDefaultProfile();
756 ASSERT_TRUE(profile);
757 ExtensionService* extension_service =
758 extensions::ExtensionSystem::Get(profile)->extension_service();
759 EXPECT_TRUE(extension_service->GetExtensionById(kHostedAppID, true));
760
761 // Verify that the extension was not installed.
762 EXPECT_FALSE(extension_service->GetExtensionById(kGoodExtensionID, true));
763
764 // Verify that the app is still in the account's extension cache.
765 EXPECT_TRUE(PathExists(cached_hosted_app));
766
767 // Verify that the extension was removed from the account's extension cache.
768 EXPECT_FALSE(PathExists(cached_extension));
641 } 769 }
642 770
643 class TermsOfServiceTest : public DeviceLocalAccountTest, 771 class TermsOfServiceTest : public DeviceLocalAccountTest,
644 public testing::WithParamInterface<bool> { 772 public testing::WithParamInterface<bool> {
645 }; 773 };
646 774
647 IN_PROC_BROWSER_TEST_P(TermsOfServiceTest, TermsOfServiceScreen) { 775 IN_PROC_BROWSER_TEST_P(TermsOfServiceTest, TermsOfServiceScreen) {
648 // Specify Terms of Service URL. 776 // Specify Terms of Service URL.
649 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 777 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
650 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( 778 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value(
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 if (!IsSessionStarted()) { 922 if (!IsSessionStarted()) {
795 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED, 923 content::WindowedNotificationObserver(chrome::NOTIFICATION_SESSION_STARTED,
796 base::Bind(IsSessionStarted)).Wait(); 924 base::Bind(IsSessionStarted)).Wait();
797 } 925 }
798 } 926 }
799 927
800 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance, 928 INSTANTIATE_TEST_CASE_P(TermsOfServiceTestInstance,
801 TermsOfServiceTest, testing::Bool()); 929 TermsOfServiceTest, testing::Bool());
802 930
803 } // namespace policy 931 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698