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

Unified Diff: chrome/browser/extensions/extension_prefs_unittest.cc

Issue 1025613003: Fix for ERROR:url_pattern_set.cc(240)] Invalid url pattern: chrome://print/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/test_extension_prefs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_prefs_unittest.cc
diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc
index d9067d3c9daaea0510bb1f46e465f4a605a9b0aa..fa04288e2e2056d388aab5dc0f073ec1282c9977 100644
--- a/chrome/browser/extensions/extension_prefs_unittest.cc
+++ b/chrome/browser/extensions/extension_prefs_unittest.cc
@@ -913,4 +913,54 @@ class ExtensionPrefsClearLastLaunched : public ExtensionPrefsTest {
};
TEST_F(ExtensionPrefsClearLastLaunched, ExtensionPrefsClearLastLaunched) {}
+class ExtensionPrefsComponentExtension : public ExtensionPrefsTest {
+ public:
+ ~ExtensionPrefsComponentExtension() override {}
+ void Initialize() override {
+ component_extension_ =
+ prefs_.AddExtensionWithManifestLocation("test", Manifest::COMPONENT);
not at google - send to devlin 2015/04/10 17:49:26 I don't understand. This isn't what I asked you to
Deepak 2015/04/11 05:35:26 Done.
+ no_component_extension_ = prefs_.AddExtension("a");
+
+ APIPermissionSet api_perms;
+ api_perms.insert(APIPermission::kTab);
+ api_perms.insert(APIPermission::kBookmark);
+ api_perms.insert(APIPermission::kHistory);
+
+ ManifestPermissionSet empty_manifest_permissions;
+
+ URLPatternSet ehosts, shosts;
+ AddPattern(&shosts, "chrome://print/*");
+
+ active_perms_ = new PermissionSet(api_perms, empty_manifest_permissions,
+ ehosts, shosts);
+ // Set the active permissions.
+ prefs()->SetActivePermissions(component_extension_->id(),
+ active_perms_.get());
+ prefs()->SetActivePermissions(no_component_extension_->id(),
+ active_perms_.get());
+ }
+
+ void Verify() override {
+ scoped_refptr<PermissionSet> permissions(
+ prefs()->GetActivePermissions(component_extension_->id()));
+ EXPECT_EQ(active_perms_->scriptable_hosts(),
+ permissions->scriptable_hosts());
+ EXPECT_EQ(*active_perms_.get(), *permissions.get());
+
+ URLPatternSet scriptable_hosts;
+ std::string pref_key = "active_permissions.scriptable_host";
+ EXPECT_TRUE(prefs()->ReadPrefAsURLPatternSet(
+ component_extension_->id(), pref_key, &scriptable_hosts, 15));
+ EXPECT_FALSE(prefs()->ReadPrefAsURLPatternSet(
+ no_component_extension_->id(), pref_key, &scriptable_hosts, 15));
+ }
+
+ private:
+ scoped_refptr<PermissionSet> active_perms_;
+ scoped_refptr<Extension> component_extension_;
+ scoped_refptr<Extension> no_component_extension_;
+};
+TEST_F(ExtensionPrefsComponentExtension, ExtensionPrefsComponentExtension) {
+}
+
} // namespace extensions
« no previous file with comments | « no previous file | chrome/browser/extensions/test_extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698