OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 void AddPattern(URLPatternSet* extent, const std::string& pattern) { | 104 void AddPattern(URLPatternSet* extent, const std::string& pattern) { |
105 int schemes = URLPattern::SCHEME_ALL; | 105 int schemes = URLPattern::SCHEME_ALL; |
106 extent->AddPattern(URLPattern(schemes, pattern)); | 106 extent->AddPattern(URLPattern(schemes, pattern)); |
107 } | 107 } |
108 | 108 |
109 } // namespace | 109 } // namespace |
110 | 110 |
111 // Test that the PermissionUpdater can correctly add and remove active | 111 // Test that the PermissionUpdater can correctly add and remove active |
112 // permissions. This tests all of PermissionsUpdater's public methods because | 112 // permissions. This tests all of PermissionsUpdater's public methods because |
113 // GrantActivePermissions and UpdateActivePermissions are used by | 113 // GrantActivePermissions and SetActivePermissions are used by AddPermissions. |
114 // AddPermissions. | |
115 TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) { | 114 TEST_F(PermissionsUpdaterTest, AddAndRemovePermissions) { |
116 InitializeEmptyExtensionService(); | 115 InitializeEmptyExtensionService(); |
117 | 116 |
118 // Load the test extension. | 117 // Load the test extension. |
119 scoped_refptr<Extension> extension = LoadOurManifest(); | 118 scoped_refptr<Extension> extension = LoadOurManifest(); |
120 ASSERT_TRUE(extension.get()); | 119 ASSERT_TRUE(extension.get()); |
121 | 120 |
122 APIPermissionSet default_apis; | 121 APIPermissionSet default_apis; |
123 default_apis.insert(APIPermission::kManagement); | 122 default_apis.insert(APIPermission::kManagement); |
124 ManifestPermissionSet empty_manifest_permissions; | 123 ManifestPermissionSet empty_manifest_permissions; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Verify that the extension prefs hold the new active permissions and the | 202 // Verify that the extension prefs hold the new active permissions and the |
204 // same granted permissions. | 203 // same granted permissions. |
205 from_prefs = prefs->GetActivePermissions(extension->id()); | 204 from_prefs = prefs->GetActivePermissions(extension->id()); |
206 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); | 205 ASSERT_EQ(*active_permissions.get(), *from_prefs.get()); |
207 | 206 |
208 from_prefs = prefs->GetGrantedPermissions(extension->id()); | 207 from_prefs = prefs->GetGrantedPermissions(extension->id()); |
209 ASSERT_EQ(*granted_permissions.get(), *from_prefs.get()); | 208 ASSERT_EQ(*granted_permissions.get(), *from_prefs.get()); |
210 } | 209 } |
211 | 210 |
212 } // namespace extensions | 211 } // namespace extensions |
OLD | NEW |