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

Side by Side Diff: chrome/browser/extensions/permissions_updater_unittest.cc

Issue 347803005: Move UpdateActivePermissions from ExtensionService to PermissionsUpdater (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/UpdateActivePermissions/InitializeActivePermissions Created 6 years, 6 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
« no previous file with comments | « chrome/browser/extensions/permissions_updater.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/permissions_updater.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698