Chromium Code Reviews| 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 |