 Chromium Code Reviews
 Chromium Code Reviews Issue 7041005:
  Content settings extension API: Implement ContentSetting.getResourceIdentifiers.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 7041005:
  Content settings extension API: Implement ContentSetting.getResourceIdentifiers.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/browser/extensions/extension_content_settings_apitest.cc | 
| diff --git a/chrome/browser/extensions/extension_content_settings_apitest.cc b/chrome/browser/extensions/extension_content_settings_apitest.cc | 
| index 0d8a704ebb01443b66954c2f96b078aa8a259504..982a9cf5a4793ddba4035da38d8a31e1f4f9a359 100644 | 
| --- a/chrome/browser/extensions/extension_content_settings_apitest.cc | 
| +++ b/chrome/browser/extensions/extension_content_settings_apitest.cc | 
| @@ -2,13 +2,16 @@ | 
| // Use of this source code is governed by a BSD-style license that can be | 
| // found in the LICENSE file. | 
| +#include "base/utf_string_conversions.h" | 
| #include "chrome/browser/content_settings/host_content_settings_map.h" | 
| #include "chrome/browser/extensions/extension_apitest.h" | 
| +#include "chrome/browser/extensions/extension_content_settings_api.h" | 
| #include "chrome/browser/prefs/pref_service.h" | 
| #include "chrome/browser/profiles/profile.h" | 
| #include "chrome/browser/ui/browser.h" | 
| #include "chrome/common/chrome_switches.h" | 
| #include "chrome/common/pref_names.h" | 
| +#include "webkit/plugins/npapi/stub_plugin_list.h" | 
| IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { | 
| CommandLine::ForCurrentProcess()->AppendSwitch( | 
| @@ -169,3 +172,40 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettingsOnChange) { | 
| EXPECT_TRUE(RunExtensionTestIncognito("content_settings/onchange")) << | 
| message_; | 
| } | 
| + | 
| +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, | 
| + ContentSettingsGetResourceIdentifiers) { | 
| + CommandLine::ForCurrentProcess()->AppendSwitch( | 
| + switches::kEnableExperimentalExtensionApis); | 
| + CommandLine::ForCurrentProcess()->AppendSwitch( | 
| + switches::kEnableResourceContentSettings); | 
| + | 
| + FilePath::CharType kFooPath[] = FILE_PATH_LITERAL("/plugins/foo.plugin"); | 
| + FilePath::CharType kBarPath[] = FILE_PATH_LITERAL("/plugins/bar.plugin"); | 
| + const char* kFooIdentifier = "foo"; | 
| + const char* kFooGroupName = "Foo"; | 
| + const char* kFooName = "Foo Plugin"; | 
| + const webkit::npapi::PluginGroupDefinition kPluginDefinitions[] = { | 
| + { kFooIdentifier, kFooGroupName, kFooName, NULL, 0, | 
| + "http://example.com/foo" }, | 
| + }; | 
| + | 
| + webkit::npapi::StubPluginList plugin_list(kPluginDefinitions, | 
| + arraysize(kPluginDefinitions)); | 
| + plugin_list.AddPluginToLoad( | 
| + webkit::npapi::WebPluginInfo(ASCIIToUTF16(kFooName), | 
| + FilePath(kFooPath), | 
| + ASCIIToUTF16("1.2.3"), | 
| + ASCIIToUTF16("foo"))); | 
| + plugin_list.AddPluginToLoad( | 
| + webkit::npapi::WebPluginInfo(ASCIIToUTF16("Bar Plugin"), | 
| 
battre
2011/06/14 16:31:01
nit: Why do you use a constant only for the path b
 
Bernhard Bauer
2011/06/15 10:04:57
I tried to clean it up a bit.
 | 
| + FilePath(kBarPath), | 
| + ASCIIToUTF16("2.3.4"), | 
| + ASCIIToUTF16("bar"))); | 
| + GetResourceIdentifiersFunction::SetPluginList(&plugin_list); | 
| + | 
| + EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) | 
| + << message_; | 
| + | 
| + GetResourceIdentifiersFunction::SetPluginList(NULL); | 
| +} |