| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/chrome_notification_types.h" | 30 #include "chrome/browser/chrome_notification_types.h" |
| 31 #include "chrome/browser/extensions/app_sync_data.h" | 31 #include "chrome/browser/extensions/app_sync_data.h" |
| 32 #include "chrome/browser/extensions/blacklist.h" | 32 #include "chrome/browser/extensions/blacklist.h" |
| 33 #include "chrome/browser/extensions/chrome_app_sorting.h" | 33 #include "chrome/browser/extensions/chrome_app_sorting.h" |
| 34 #include "chrome/browser/extensions/component_loader.h" | 34 #include "chrome/browser/extensions/component_loader.h" |
| 35 #include "chrome/browser/extensions/crx_installer.h" | 35 #include "chrome/browser/extensions/crx_installer.h" |
| 36 #include "chrome/browser/extensions/default_apps.h" | 36 #include "chrome/browser/extensions/default_apps.h" |
| 37 #include "chrome/browser/extensions/extension_creator.h" | 37 #include "chrome/browser/extensions/extension_creator.h" |
| 38 #include "chrome/browser/extensions/extension_error_reporter.h" | 38 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 39 #include "chrome/browser/extensions/extension_error_ui.h" | 39 #include "chrome/browser/extensions/extension_error_ui.h" |
| 40 #include "chrome/browser/extensions/extension_management_test_util.h" |
| 40 #include "chrome/browser/extensions/extension_notification_observer.h" | 41 #include "chrome/browser/extensions/extension_notification_observer.h" |
| 41 #include "chrome/browser/extensions/extension_service.h" | 42 #include "chrome/browser/extensions/extension_service.h" |
| 42 #include "chrome/browser/extensions/extension_service_test_base.h" | 43 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 43 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 44 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 44 #include "chrome/browser/extensions/extension_sync_data.h" | 45 #include "chrome/browser/extensions/extension_sync_data.h" |
| 45 #include "chrome/browser/extensions/extension_sync_service.h" | 46 #include "chrome/browser/extensions/extension_sync_service.h" |
| 46 #include "chrome/browser/extensions/extension_util.h" | 47 #include "chrome/browser/extensions/extension_util.h" |
| 47 #include "chrome/browser/extensions/external_install_error.h" | 48 #include "chrome/browser/extensions/external_install_error.h" |
| 48 #include "chrome/browser/extensions/external_install_manager.h" | 49 #include "chrome/browser/extensions/external_install_manager.h" |
| 49 #include "chrome/browser/extensions/external_policy_loader.h" | 50 #include "chrome/browser/extensions/external_policy_loader.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 #include "content/public/browser/plugin_service.h" | 85 #include "content/public/browser/plugin_service.h" |
| 85 #include "content/public/browser/render_process_host.h" | 86 #include "content/public/browser/render_process_host.h" |
| 86 #include "content/public/browser/storage_partition.h" | 87 #include "content/public/browser/storage_partition.h" |
| 87 #include "content/public/common/content_constants.h" | 88 #include "content/public/common/content_constants.h" |
| 88 #include "content/public/test/test_utils.h" | 89 #include "content/public/test/test_utils.h" |
| 89 #include "extensions/browser/extension_registry.h" | 90 #include "extensions/browser/extension_registry.h" |
| 90 #include "extensions/browser/extension_system.h" | 91 #include "extensions/browser/extension_system.h" |
| 91 #include "extensions/browser/external_provider_interface.h" | 92 #include "extensions/browser/external_provider_interface.h" |
| 92 #include "extensions/browser/install_flag.h" | 93 #include "extensions/browser/install_flag.h" |
| 93 #include "extensions/browser/management_policy.h" | 94 #include "extensions/browser/management_policy.h" |
| 94 #include "extensions/browser/pref_names.h" | |
| 95 #include "extensions/browser/test_management_policy.h" | 95 #include "extensions/browser/test_management_policy.h" |
| 96 #include "extensions/browser/uninstall_reason.h" | 96 #include "extensions/browser/uninstall_reason.h" |
| 97 #include "extensions/common/constants.h" | 97 #include "extensions/common/constants.h" |
| 98 #include "extensions/common/extension.h" | 98 #include "extensions/common/extension.h" |
| 99 #include "extensions/common/extension_builder.h" | 99 #include "extensions/common/extension_builder.h" |
| 100 #include "extensions/common/extension_l10n_util.h" | 100 #include "extensions/common/extension_l10n_util.h" |
| 101 #include "extensions/common/extension_resource.h" | 101 #include "extensions/common/extension_resource.h" |
| 102 #include "extensions/common/feature_switch.h" | 102 #include "extensions/common/feature_switch.h" |
| 103 #include "extensions/common/manifest_constants.h" | 103 #include "extensions/common/manifest_constants.h" |
| 104 #include "extensions/common/manifest_handlers/background_info.h" | 104 #include "extensions/common/manifest_handlers/background_info.h" |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 | 1097 |
| 1098 extensions::ManagementPolicy* GetManagementPolicy() { | 1098 extensions::ManagementPolicy* GetManagementPolicy() { |
| 1099 return ExtensionSystem::Get(browser_context())->management_policy(); | 1099 return ExtensionSystem::Get(browser_context())->management_policy(); |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 ExtensionSyncService* extension_sync_service() { | 1102 ExtensionSyncService* extension_sync_service() { |
| 1103 return extension_sync_service_.get(); | 1103 return extension_sync_service_.get(); |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 protected: | 1106 protected: |
| 1107 typedef extensions::ExtensionManagementPrefUpdater<TestingPrefServiceSyncable> |
| 1108 ManagementPrefUpdater; |
| 1107 scoped_ptr<ExtensionSyncService> extension_sync_service_; | 1109 scoped_ptr<ExtensionSyncService> extension_sync_service_; |
| 1108 extensions::ExtensionList loaded_; | 1110 extensions::ExtensionList loaded_; |
| 1109 std::string unloaded_id_; | 1111 std::string unloaded_id_; |
| 1110 UnloadedExtensionInfo::Reason unloaded_reason_; | 1112 UnloadedExtensionInfo::Reason unloaded_reason_; |
| 1111 const Extension* installed_; | 1113 const Extension* installed_; |
| 1112 bool was_update_; | 1114 bool was_update_; |
| 1113 std::string old_name_; | 1115 std::string old_name_; |
| 1114 FeatureSwitch::ScopedOverride override_external_install_prompt_; | 1116 FeatureSwitch::ScopedOverride override_external_install_prompt_; |
| 1115 | 1117 |
| 1116 private: | 1118 private: |
| (...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 InitializeEmptyExtensionServiceWithTestingPrefs(); | 3287 InitializeEmptyExtensionServiceWithTestingPrefs(); |
| 3286 test_blacklist.Attach(service()->blacklist_); | 3288 test_blacklist.Attach(service()->blacklist_); |
| 3287 | 3289 |
| 3288 base::FilePath path = data_dir().AppendASCII("good.crx"); | 3290 base::FilePath path = data_dir().AppendASCII("good.crx"); |
| 3289 | 3291 |
| 3290 const Extension* good = InstallCRX(path, INSTALL_NEW); | 3292 const Extension* good = InstallCRX(path, INSTALL_NEW); |
| 3291 EXPECT_EQ(good_crx, good->id()); | 3293 EXPECT_EQ(good_crx, good->id()); |
| 3292 UpdateExtension(good_crx, path, FAILED_SILENTLY); | 3294 UpdateExtension(good_crx, path, FAILED_SILENTLY); |
| 3293 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 3295 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 3294 | 3296 |
| 3295 base::ListValue whitelist; | 3297 { |
| 3296 whitelist.Append(new base::StringValue(good_crx)); | 3298 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3297 profile_->GetTestingPrefService()->SetManagedPref( | 3299 pref.SetIndividualExtensionInstallationAllowed(good_crx, true); |
| 3298 extensions::pref_names::kInstallAllowList, whitelist.DeepCopy()); | 3300 } |
| 3299 | 3301 |
| 3300 test_blacklist.SetBlacklistState( | 3302 test_blacklist.SetBlacklistState( |
| 3301 good_crx, extensions::BLACKLISTED_MALWARE, true); | 3303 good_crx, extensions::BLACKLISTED_MALWARE, true); |
| 3302 base::RunLoop().RunUntilIdle(); | 3304 base::RunLoop().RunUntilIdle(); |
| 3303 | 3305 |
| 3304 // The good_crx is blacklisted and the whitelist doesn't negate it. | 3306 // The good_crx is blacklisted and the whitelist doesn't negate it. |
| 3305 ASSERT_TRUE(ValidateBooleanPref(good_crx, "blacklist", true)); | 3307 ASSERT_TRUE(ValidateBooleanPref(good_crx, "blacklist", true)); |
| 3306 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 3308 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 3307 } | 3309 } |
| 3308 #endif // defined(ENABLE_BLACKLIST_TESTS) | 3310 #endif // defined(ENABLE_BLACKLIST_TESTS) |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3580 } | 3582 } |
| 3581 | 3583 |
| 3582 #endif // defined(ENABLE_BLACKLIST_TESTS) | 3584 #endif // defined(ENABLE_BLACKLIST_TESTS) |
| 3583 | 3585 |
| 3584 // Will not install extension blacklisted by policy. | 3586 // Will not install extension blacklisted by policy. |
| 3585 TEST_F(ExtensionServiceTest, BlacklistedByPolicyWillNotInstall) { | 3587 TEST_F(ExtensionServiceTest, BlacklistedByPolicyWillNotInstall) { |
| 3586 InitializeEmptyExtensionServiceWithTestingPrefs(); | 3588 InitializeEmptyExtensionServiceWithTestingPrefs(); |
| 3587 | 3589 |
| 3588 // Blacklist everything. | 3590 // Blacklist everything. |
| 3589 { | 3591 { |
| 3590 ListPrefUpdate update(profile()->GetPrefs(), | 3592 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3591 extensions::pref_names::kInstallDenyList); | 3593 pref.SetBlacklistedByDefault(true); |
| 3592 base::ListValue* blacklist = update.Get(); | |
| 3593 blacklist->Append(new base::StringValue("*")); | |
| 3594 } | 3594 } |
| 3595 | 3595 |
| 3596 // Blacklist prevents us from installing good_crx. | 3596 // Blacklist prevents us from installing good_crx. |
| 3597 base::FilePath path = data_dir().AppendASCII("good.crx"); | 3597 base::FilePath path = data_dir().AppendASCII("good.crx"); |
| 3598 InstallCRX(path, INSTALL_FAILED); | 3598 InstallCRX(path, INSTALL_FAILED); |
| 3599 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 3599 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 3600 | 3600 |
| 3601 // Now whitelist this particular extension. | 3601 // Now whitelist this particular extension. |
| 3602 { | 3602 { |
| 3603 base::ListValue whitelist; | 3603 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3604 whitelist.Append(new base::StringValue(good_crx)); | 3604 pref.SetIndividualExtensionInstallationAllowed(good_crx, true); |
| 3605 profile_->GetTestingPrefService()->SetManagedPref( | |
| 3606 extensions::pref_names::kInstallAllowList, whitelist.DeepCopy()); | |
| 3607 } | 3605 } |
| 3608 | 3606 |
| 3609 // Ensure we can now install good_crx. | 3607 // Ensure we can now install good_crx. |
| 3610 InstallCRX(path, INSTALL_NEW); | 3608 InstallCRX(path, INSTALL_NEW); |
| 3611 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 3609 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 3612 } | 3610 } |
| 3613 | 3611 |
| 3614 // Extension blacklisted by policy get unloaded after installing. | 3612 // Extension blacklisted by policy get unloaded after installing. |
| 3615 TEST_F(ExtensionServiceTest, BlacklistedByPolicyRemovedIfRunning) { | 3613 TEST_F(ExtensionServiceTest, BlacklistedByPolicyRemovedIfRunning) { |
| 3616 InitializeEmptyExtensionService(); | 3614 InitializeEmptyExtensionServiceWithTestingPrefs(); |
| 3617 | 3615 |
| 3618 // Install good_crx. | 3616 // Install good_crx. |
| 3619 base::FilePath path = data_dir().AppendASCII("good.crx"); | 3617 base::FilePath path = data_dir().AppendASCII("good.crx"); |
| 3620 InstallCRX(path, INSTALL_NEW); | 3618 InstallCRX(path, INSTALL_NEW); |
| 3621 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 3619 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 3622 | 3620 |
| 3623 { // Scope for pref update notification. | 3621 { |
| 3624 PrefService* prefs = profile()->GetPrefs(); | 3622 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3625 ListPrefUpdate update(prefs, extensions::pref_names::kInstallDenyList); | |
| 3626 base::ListValue* blacklist = update.Get(); | |
| 3627 ASSERT_TRUE(blacklist != NULL); | |
| 3628 | |
| 3629 // Blacklist this extension. | 3623 // Blacklist this extension. |
| 3630 blacklist->Append(new base::StringValue(good_crx)); | 3624 pref.SetIndividualExtensionInstallationAllowed(good_crx, false); |
| 3631 } | 3625 } |
| 3632 | 3626 |
| 3633 // Extension should not be running now. | 3627 // Extension should not be running now. |
| 3634 base::RunLoop().RunUntilIdle(); | 3628 base::RunLoop().RunUntilIdle(); |
| 3635 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 3629 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 3636 } | 3630 } |
| 3637 | 3631 |
| 3638 // Tests that component extensions are not blacklisted by policy. | 3632 // Tests that component extensions are not blacklisted by policy. |
| 3639 TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) { | 3633 TEST_F(ExtensionServiceTest, ComponentExtensionWhitelisted) { |
| 3640 InitializeEmptyExtensionService(); | 3634 InitializeEmptyExtensionServiceWithTestingPrefs(); |
| 3641 | 3635 |
| 3642 // Blacklist everything. | 3636 // Blacklist everything. |
| 3643 { | 3637 { |
| 3644 ListPrefUpdate update(profile()->GetPrefs(), | 3638 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3645 extensions::pref_names::kInstallDenyList); | 3639 pref.SetBlacklistedByDefault(true); |
| 3646 base::ListValue* blacklist = update.Get(); | |
| 3647 blacklist->Append(new base::StringValue("*")); | |
| 3648 } | 3640 } |
| 3649 | 3641 |
| 3650 // Install a component extension. | 3642 // Install a component extension. |
| 3651 base::FilePath path = data_dir() | 3643 base::FilePath path = data_dir() |
| 3652 .AppendASCII("good") | 3644 .AppendASCII("good") |
| 3653 .AppendASCII("Extensions") | 3645 .AppendASCII("Extensions") |
| 3654 .AppendASCII(good0) | 3646 .AppendASCII(good0) |
| 3655 .AppendASCII("1.0.0.0"); | 3647 .AppendASCII("1.0.0.0"); |
| 3656 std::string manifest; | 3648 std::string manifest; |
| 3657 ASSERT_TRUE(base::ReadFileToString( | 3649 ASSERT_TRUE(base::ReadFileToString( |
| 3658 path.Append(extensions::kManifestFilename), &manifest)); | 3650 path.Append(extensions::kManifestFilename), &manifest)); |
| 3659 service()->component_loader()->Add(manifest, path); | 3651 service()->component_loader()->Add(manifest, path); |
| 3660 service()->Init(); | 3652 service()->Init(); |
| 3661 | 3653 |
| 3662 // Extension should be installed despite blacklist. | 3654 // Extension should be installed despite blacklist. |
| 3663 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 3655 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
| 3664 EXPECT_TRUE(service()->GetExtensionById(good0, false)); | 3656 EXPECT_TRUE(service()->GetExtensionById(good0, false)); |
| 3665 | 3657 |
| 3666 // Poke external providers and make sure the extension is still present. | 3658 // Poke external providers and make sure the extension is still present. |
| 3667 service()->CheckForExternalUpdates(); | 3659 service()->CheckForExternalUpdates(); |
| 3668 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 3660 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
| 3669 EXPECT_TRUE(service()->GetExtensionById(good0, false)); | 3661 EXPECT_TRUE(service()->GetExtensionById(good0, false)); |
| 3670 | 3662 |
| 3671 // Extension should not be uninstalled on blacklist changes. | 3663 // Extension should not be uninstalled on blacklist changes. |
| 3672 { | 3664 { |
| 3673 ListPrefUpdate update(profile()->GetPrefs(), | 3665 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3674 extensions::pref_names::kInstallDenyList); | 3666 pref.SetIndividualExtensionInstallationAllowed(good0, false); |
| 3675 base::ListValue* blacklist = update.Get(); | |
| 3676 blacklist->Append(new base::StringValue(good0)); | |
| 3677 } | 3667 } |
| 3678 base::RunLoop().RunUntilIdle(); | 3668 base::RunLoop().RunUntilIdle(); |
| 3679 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 3669 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
| 3680 EXPECT_TRUE(service()->GetExtensionById(good0, false)); | 3670 EXPECT_TRUE(service()->GetExtensionById(good0, false)); |
| 3681 } | 3671 } |
| 3682 | 3672 |
| 3683 // Tests that policy-installed extensions are not blacklisted by policy. | 3673 // Tests that policy-installed extensions are not blacklisted by policy. |
| 3684 TEST_F(ExtensionServiceTest, PolicyInstalledExtensionsWhitelisted) { | 3674 TEST_F(ExtensionServiceTest, PolicyInstalledExtensionsWhitelisted) { |
| 3685 InitializeEmptyExtensionServiceWithTestingPrefs(); | 3675 InitializeEmptyExtensionServiceWithTestingPrefs(); |
| 3686 | 3676 |
| 3687 { | 3677 { |
| 3678 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3688 // Blacklist everything. | 3679 // Blacklist everything. |
| 3689 ListPrefUpdate blacklist_update(profile()->GetPrefs(), | 3680 pref.SetBlacklistedByDefault(true); |
| 3690 extensions::pref_names::kInstallDenyList); | |
| 3691 base::ListValue* blacklist = blacklist_update.Get(); | |
| 3692 blacklist->AppendString("*"); | |
| 3693 } | |
| 3694 | |
| 3695 { | |
| 3696 // Mark good.crx for force-installation. | 3681 // Mark good.crx for force-installation. |
| 3697 base::DictionaryValue forcelist; | 3682 pref.SetIndividualExtensionAutoInstalled( |
| 3698 extensions::ExternalPolicyLoader::AddExtension( | 3683 good_crx, "http://example.com/update_url", true); |
| 3699 &forcelist, good_crx, "http://example.com/update_url"); | |
| 3700 profile_->GetTestingPrefService()->SetManagedPref( | |
| 3701 extensions::pref_names::kInstallForceList, forcelist.DeepCopy()); | |
| 3702 } | 3684 } |
| 3703 | 3685 |
| 3704 // Have policy force-install an extension. | 3686 // Have policy force-install an extension. |
| 3705 MockExtensionProvider* provider = | 3687 MockExtensionProvider* provider = |
| 3706 new MockExtensionProvider(service(), Manifest::EXTERNAL_POLICY_DOWNLOAD); | 3688 new MockExtensionProvider(service(), Manifest::EXTERNAL_POLICY_DOWNLOAD); |
| 3707 AddMockExternalProvider(provider); | 3689 AddMockExternalProvider(provider); |
| 3708 provider->UpdateOrAddExtension( | 3690 provider->UpdateOrAddExtension( |
| 3709 good_crx, "1.0.0.0", data_dir().AppendASCII("good.crx")); | 3691 good_crx, "1.0.0.0", data_dir().AppendASCII("good.crx")); |
| 3710 | 3692 |
| 3711 // Reloading extensions should find our externally registered extension | 3693 // Reloading extensions should find our externally registered extension |
| 3712 // and install it. | 3694 // and install it. |
| 3713 content::WindowedNotificationObserver observer( | 3695 content::WindowedNotificationObserver observer( |
| 3714 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 3696 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
| 3715 content::NotificationService::AllSources()); | 3697 content::NotificationService::AllSources()); |
| 3716 service()->CheckForExternalUpdates(); | 3698 service()->CheckForExternalUpdates(); |
| 3717 observer.Wait(); | 3699 observer.Wait(); |
| 3718 | 3700 |
| 3719 // Extension should be installed despite blacklist. | 3701 // Extension should be installed despite blacklist. |
| 3720 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 3702 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
| 3721 EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); | 3703 EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); |
| 3722 | 3704 |
| 3723 // Blacklist update should not uninstall the extension. | 3705 // Blacklist update should not uninstall the extension. |
| 3724 { | 3706 { |
| 3725 ListPrefUpdate update(profile()->GetPrefs(), | 3707 ManagementPrefUpdater pref(profile_->GetTestingPrefService()); |
| 3726 extensions::pref_names::kInstallDenyList); | 3708 pref.SetIndividualExtensionInstallationAllowed(good0, false); |
| 3727 base::ListValue* blacklist = update.Get(); | |
| 3728 blacklist->Append(new base::StringValue(good0)); | |
| 3729 } | 3709 } |
| 3730 base::RunLoop().RunUntilIdle(); | 3710 base::RunLoop().RunUntilIdle(); |
| 3731 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 3711 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
| 3732 EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); | 3712 EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); |
| 3733 } | 3713 } |
| 3734 | 3714 |
| 3735 // Tests that extensions cannot be installed if the policy provider prohibits | 3715 // Tests that extensions cannot be installed if the policy provider prohibits |
| 3736 // it. This functionality is implemented in CrxInstaller::ConfirmInstall(). | 3716 // it. This functionality is implemented in CrxInstaller::ConfirmInstall(). |
| 3737 TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsInstall) { | 3717 TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsInstall) { |
| 3738 InitializeEmptyExtensionService(); | 3718 InitializeEmptyExtensionService(); |
| (...skipping 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7164 | 7144 |
| 7165 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 7145 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 7166 content::Source<Profile>(profile()), | 7146 content::Source<Profile>(profile()), |
| 7167 content::NotificationService::NoDetails()); | 7147 content::NotificationService::NoDetails()); |
| 7168 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 7148 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
| 7169 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 7149 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 7170 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 7150 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
| 7171 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 7151 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
| 7172 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 7152 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
| 7173 } | 7153 } |
| OLD | NEW |