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

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

Issue 5626004: Update valid URLPattern schemes in ExtensionPrefs::GetGrantedPermissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove kValidWebExtentSchemes from GetGrantedPermissions Created 10 years 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
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/common/extensions/extension.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 api_perm_set1_.insert("tabs"); 176 api_perm_set1_.insert("tabs");
177 api_perm_set1_.insert("bookmarks"); 177 api_perm_set1_.insert("bookmarks");
178 api_perm_set1_.insert("something_random"); 178 api_perm_set1_.insert("something_random");
179 179
180 api_perm_set2_.insert("history"); 180 api_perm_set2_.insert("history");
181 api_perm_set2_.insert("unknown2"); 181 api_perm_set2_.insert("unknown2");
182 182
183 AddPattern(&host_perm_set1_, "http://*.google.com/*"); 183 AddPattern(&host_perm_set1_, "http://*.google.com/*");
184 AddPattern(&host_perm_set1_, "http://example.com/*"); 184 AddPattern(&host_perm_set1_, "http://example.com/*");
185 AddPattern(&host_perm_set1_, "chrome://favicon/*");
185 186
186 AddPattern(&host_perm_set2_, "https://*.google.com/*"); 187 AddPattern(&host_perm_set2_, "https://*.google.com/*");
187 // with duplicate: 188 // with duplicate:
188 AddPattern(&host_perm_set2_, "http://*.google.com/*"); 189 AddPattern(&host_perm_set2_, "http://*.google.com/*");
189 190
190 std::set_union(api_perm_set1_.begin(), api_perm_set1_.end(), 191 std::set_union(api_perm_set1_.begin(), api_perm_set1_.end(),
191 api_perm_set2_.begin(), api_perm_set2_.end(), 192 api_perm_set2_.begin(), api_perm_set2_.end(),
192 std::inserter(api_permissions_, api_permissions_.begin())); 193 std::inserter(api_permissions_, api_permissions_.begin()));
193 194
194 AddPattern(&host_permissions_, "http://*.google.com/*"); 195 AddPattern(&host_permissions_, "http://*.google.com/*");
195 AddPattern(&host_permissions_, "http://example.com/*"); 196 AddPattern(&host_permissions_, "http://example.com/*");
197 AddPattern(&host_permissions_, "chrome://favicon/*");
196 AddPattern(&host_permissions_, "https://*.google.com/*"); 198 AddPattern(&host_permissions_, "https://*.google.com/*");
197 199
198 std::set<std::string> empty_set; 200 std::set<std::string> empty_set;
199 std::set<std::string> api_perms; 201 std::set<std::string> api_perms;
200 bool full_access = false; 202 bool full_access = false;
201 ExtensionExtent host_perms; 203 ExtensionExtent host_perms;
202 ExtensionExtent empty_extent; 204 ExtensionExtent empty_extent;
203 205
204 // Make sure both granted api and host permissions start empty. 206 // Make sure both granted api and host permissions start empty.
205 EXPECT_FALSE(prefs()->GetGrantedPermissions( 207 EXPECT_FALSE(prefs()->GetGrantedPermissions(
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 EXPECT_EQ(launch_index + 1, new_launch_index); 520 EXPECT_EQ(launch_index + 1, new_launch_index);
519 521
520 // This extension doesn't exist, so it should return -1. 522 // This extension doesn't exist, so it should return -1.
521 EXPECT_EQ(-1, prefs()->GetAppLaunchIndex("foo")); 523 EXPECT_EQ(-1, prefs()->GetAppLaunchIndex("foo"));
522 } 524 }
523 525
524 private: 526 private:
525 scoped_refptr<Extension> extension_; 527 scoped_refptr<Extension> extension_;
526 }; 528 };
527 TEST_F(ExtensionPrefsAppLaunchIndex, ExtensionPrefsAppLaunchIndex) {} 529 TEST_F(ExtensionPrefsAppLaunchIndex, ExtensionPrefsAppLaunchIndex) {}
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698