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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_apitest.cc

Issue 19706002: Remove plugin_list.h includes from chrome tests in preparation for moving webkit/plugins to content… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix posix tests Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/content_settings/cookie_settings.h" 7 #include "chrome/browser/content_settings/cookie_settings.h"
8 #include "chrome/browser/content_settings/host_content_settings_map.h" 8 #include "chrome/browser/content_settings/host_content_settings_map.h"
9 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" 9 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "webkit/plugins/npapi/mock_plugin_list.h" 15 #include "content/public/browser/plugin_service.h"
16 #include "webkit/plugins/webplugininfo.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) { 20 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentSettings) {
20 CommandLine::ForCurrentProcess()->AppendSwitch( 21 CommandLine::ForCurrentProcess()->AppendSwitch(
21 switches::kEnableExperimentalExtensionApis); 22 switches::kEnableExperimentalExtensionApis);
22 23
23 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_; 24 EXPECT_TRUE(RunExtensionTest("content_settings/standard")) << message_;
24 25
25 HostContentSettingsMap* map = 26 HostContentSettingsMap* map =
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #if 0 88 #if 0
88 EXPECT_EQ(CONTENT_SETTING_BLOCK, 89 EXPECT_EQ(CONTENT_SETTING_BLOCK,
89 map->GetContentSetting( 90 map->GetContentSetting(
90 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); 91 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, ""));
91 #endif 92 #endif
92 EXPECT_EQ(CONTENT_SETTING_BLOCK, 93 EXPECT_EQ(CONTENT_SETTING_BLOCK,
93 map->GetContentSetting( 94 map->GetContentSetting(
94 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); 95 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()));
95 } 96 }
96 97
98 class ContentSettingsGetResourceIdentifiersTest : public ExtensionApiTest {
99 public:
100 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
101 ExtensionApiTest::SetUpCommandLine(command_line);
102 command_line->AppendSwitch(switches::kDisablePluginsDiscovery);
103 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
104 }
105 };
106
97 // Flaky on the trybots. See http://crbug.com/96725. 107 // Flaky on the trybots. See http://crbug.com/96725.
98 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, 108 IN_PROC_BROWSER_TEST_F(ContentSettingsGetResourceIdentifiersTest,
99 DISABLED_ContentSettingsGetResourceIdentifiers) { 109 DISABLED_Test) {
100 CommandLine::ForCurrentProcess()->AppendSwitch(
101 switches::kEnableExperimentalExtensionApis);
102
103 base::FilePath::CharType kFooPath[] = 110 base::FilePath::CharType kFooPath[] =
104 FILE_PATH_LITERAL("/plugins/foo.plugin"); 111 FILE_PATH_LITERAL("/plugins/foo.plugin");
105 base::FilePath::CharType kBarPath[] = 112 base::FilePath::CharType kBarPath[] =
106 FILE_PATH_LITERAL("/plugins/bar.plugin"); 113 FILE_PATH_LITERAL("/plugins/bar.plugin");
107 const char* kFooName = "Foo Plugin"; 114 const char* kFooName = "Foo Plugin";
108 const char* kBarName = "Bar Plugin"; 115 const char* kBarName = "Bar Plugin";
109 116
110 webkit::npapi::MockPluginList plugin_list; 117 content::PluginService::GetInstance()->RegisterInternalPlugin(
111 plugin_list.AddPluginToLoad(
112 webkit::WebPluginInfo(ASCIIToUTF16(kFooName), 118 webkit::WebPluginInfo(ASCIIToUTF16(kFooName),
113 base::FilePath(kFooPath), 119 base::FilePath(kFooPath),
114 ASCIIToUTF16("1.2.3"), 120 ASCIIToUTF16("1.2.3"),
115 ASCIIToUTF16("foo"))); 121 ASCIIToUTF16("foo")),
116 plugin_list.AddPluginToLoad( 122 false);
117 webkit::WebPluginInfo(ASCIIToUTF16(kBarName), 123 content::PluginService::GetInstance()->RegisterInternalPlugin(
124 webkit::WebPluginInfo(ASCIIToUTF16(kBarName),
118 base::FilePath(kBarPath), 125 base::FilePath(kBarPath),
119 ASCIIToUTF16("2.3.4"), 126 ASCIIToUTF16("2.3.4"),
120 ASCIIToUTF16("bar"))); 127 ASCIIToUTF16("bar")),
121 128 false);
122 std::vector<webkit::WebPluginInfo> plugins;
123 plugin_list.GetPlugins(&plugins);
124
125 ContentSettingsContentSettingGetResourceIdentifiersFunction::
126 SetPluginsForTesting(&plugins);
127 129
128 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) 130 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers"))
129 << message_; 131 << message_;
130
131 ContentSettingsContentSettingGetResourceIdentifiersFunction::
132 SetPluginsForTesting(NULL);
133 } 132 }
134 133
135 } // namespace extensions 134 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698