Chromium Code Reviews| 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 "chrome/browser/extensions/extension_prefs_unittest.h" | 5 #include "chrome/browser/extensions/extension_prefs_unittest.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/prefs/mock_pref_change_callback.h" | 10 #include "base/prefs/mock_pref_change_callback.h" |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 // Other preferences should be untouched. | 906 // Other preferences should be untouched. |
| 907 EXPECT_TRUE(prefs()->AllowFileAccess(extension_a_->id())); | 907 EXPECT_TRUE(prefs()->AllowFileAccess(extension_a_->id())); |
| 908 } | 908 } |
| 909 | 909 |
| 910 private: | 910 private: |
| 911 scoped_refptr<const Extension> extension_a_; | 911 scoped_refptr<const Extension> extension_a_; |
| 912 scoped_refptr<const Extension> extension_b_; | 912 scoped_refptr<const Extension> extension_b_; |
| 913 }; | 913 }; |
| 914 TEST_F(ExtensionPrefsClearLastLaunched, ExtensionPrefsClearLastLaunched) {} | 914 TEST_F(ExtensionPrefsClearLastLaunched, ExtensionPrefsClearLastLaunched) {} |
| 915 | 915 |
| 916 class ExtensionPrefsChromePattern : public ExtensionPrefsTest { | |
| 917 public: | |
| 918 ~ExtensionPrefsChromePattern() override {} | |
| 919 void Initialize() override { | |
| 920 base::DictionaryValue dictionary; | |
| 921 dictionary.SetString(manifest_keys::kName, "test"); | |
| 922 dictionary.SetString(manifest_keys::kVersion, "0.1"); | |
| 923 webstore_extension_ = prefs_.AddExtensionWithManifestAndFlags( | |
| 924 dictionary, Manifest::COMPONENT, Extension::NO_FLAGS); | |
| 925 | |
| 926 APIPermissionSet api_perms; | |
| 927 api_perms.insert(APIPermission::kTab); | |
| 928 api_perms.insert(APIPermission::kBookmark); | |
| 929 api_perms.insert(APIPermission::kHistory); | |
| 930 | |
| 931 ManifestPermissionSet empty_manifest_permissions; | |
| 932 | |
| 933 URLPatternSet ehosts, shosts; | |
| 934 AddPattern(&shosts, "chrome://print/*"); | |
|
not at google - send to devlin
2015/04/09 14:56:07
Thanks for writing this test, getting there, but I
Deepak
2015/04/10 05:16:34
1) I have added a new function in test_extension_p
| |
| 935 | |
| 936 active_perms_ = new PermissionSet(api_perms, empty_manifest_permissions, | |
| 937 ehosts, shosts); | |
| 938 // Set the active permissions. | |
| 939 prefs()->SetActivePermissions(webstore_extension_->id(), | |
| 940 active_perms_.get()); | |
|
not at google - send to devlin
2015/04/09 14:56:07
I don't know exactly why that GetInstalledExtensio
Deepak
2015/04/10 05:16:34
Done.
| |
| 941 } | |
| 942 | |
| 943 void Verify() override { | |
| 944 URLPatternSet scriptable_hosts; | |
| 945 std::string pref_key = "active_permissions.scriptable_host"; | |
| 946 prefs()->SetAllowFileAccess(webstore_extension_->id(), true); | |
|
not at google - send to devlin
2015/04/09 14:56:07
Why is file access relevant?
Deepak
2015/04/10 05:16:34
Done.
| |
| 947 EXPECT_TRUE(prefs()->ReadPrefAsURLPatternSet( | |
| 948 webstore_extension_->id(), pref_key, &scriptable_hosts, 15)); | |
| 949 } | |
| 950 | |
| 951 private: | |
| 952 scoped_refptr<PermissionSet> active_perms_; | |
| 953 scoped_refptr<Extension> webstore_extension_; | |
| 954 }; | |
| 955 TEST_F(ExtensionPrefsChromePattern, ExtensionPrefsChromePattern) { | |
| 956 } | |
| 957 | |
| 916 } // namespace extensions | 958 } // namespace extensions |
| OLD | NEW |