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 "chrome/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 const PermissionSet& all_optional_permissions = | 633 const PermissionSet& all_optional_permissions = |
634 extensions::PermissionsParser::GetOptionalPermissions(extension); | 634 extensions::PermissionsParser::GetOptionalPermissions(extension); |
635 extensions::PermissionsUpdater perms_updater(profile()); | 635 extensions::PermissionsUpdater perms_updater(profile()); |
636 perms_updater.AddPermissions(extension, all_optional_permissions); | 636 perms_updater.AddPermissions(extension, all_optional_permissions); |
637 } | 637 } |
638 | 638 |
639 testing::AssertionResult IsBlocked(const std::string& id) { | 639 testing::AssertionResult IsBlocked(const std::string& id) { |
640 std::unique_ptr<extensions::ExtensionSet> all_unblocked_extensions = | 640 std::unique_ptr<extensions::ExtensionSet> all_unblocked_extensions = |
641 registry()->GenerateInstalledExtensionsSet( | 641 registry()->GenerateInstalledExtensionsSet( |
642 ExtensionRegistry::EVERYTHING & ~ExtensionRegistry::BLOCKED); | 642 ExtensionRegistry::EVERYTHING & ~ExtensionRegistry::BLOCKED); |
643 if (all_unblocked_extensions.get()->Contains(id)) | 643 if (all_unblocked_extensions->Contains(id)) |
644 return testing::AssertionFailure() << id << " is still unblocked!"; | 644 return testing::AssertionFailure() << id << " is still unblocked!"; |
645 if (!registry()->blocked_extensions().Contains(id)) | 645 if (!registry()->blocked_extensions().Contains(id)) |
646 return testing::AssertionFailure() << id << " is not blocked!"; | 646 return testing::AssertionFailure() << id << " is not blocked!"; |
647 return testing::AssertionSuccess(); | 647 return testing::AssertionSuccess(); |
648 } | 648 } |
649 | 649 |
650 // Helper method to test that an extension moves through being blocked and | 650 // Helper method to test that an extension moves through being blocked and |
651 // unblocked as appropriate for its type. | 651 // unblocked as appropriate for its type. |
652 void AssertExtensionBlocksAndUnblocks( | 652 void AssertExtensionBlocksAndUnblocks( |
653 bool should_block, const std::string extension_id) { | 653 bool should_block, const std::string extension_id) { |
(...skipping 6213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6867 | 6867 |
6868 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 6868 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
6869 content::Source<Profile>(profile()), | 6869 content::Source<Profile>(profile()), |
6870 content::NotificationService::NoDetails()); | 6870 content::NotificationService::NoDetails()); |
6871 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 6871 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
6872 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 6872 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
6873 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 6873 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
6874 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 6874 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
6875 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 6875 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
6876 } | 6876 } |
OLD | NEW |