Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / content_settings / content_settings_browsertest.cc
blobaf3aac5704b80d8fc2539ada2309ffdbea9696d8
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
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/path_service.h"
7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/content_settings/cookie_settings_factory.h"
11 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
12 #include "chrome/browser/net/url_request_mock_util.h"
13 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_commands.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/test/base/in_process_browser_test.h"
20 #include "chrome/test/base/test_switches.h"
21 #include "chrome/test/base/ui_test_utils.h"
22 #include "components/content_settings/core/browser/cookie_settings.h"
23 #include "components/content_settings/core/browser/host_content_settings_map.h"
24 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/plugin_service.h"
28 #include "content/public/browser/render_frame_host.h"
29 #include "content/public/browser/render_process_host.h"
30 #include "content/public/browser/render_view_host.h"
31 #include "content/public/browser/web_contents.h"
32 #include "content/public/common/content_switches.h"
33 #include "content/public/test/browser_test_utils.h"
34 #include "content/public/test/test_utils.h"
35 #include "net/test/spawned_test_server/spawned_test_server.h"
36 #include "net/test/url_request/url_request_mock_http_job.h"
38 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
40 #if defined(OS_MACOSX)
41 #include "base/mac/scoped_nsautorelease_pool.h"
42 #endif
44 using content::BrowserThread;
45 using net::URLRequestMockHTTPJob;
47 class ContentSettingsTest : public InProcessBrowserTest {
48 public:
49 ContentSettingsTest()
50 : https_server_(net::SpawnedTestServer::TYPE_HTTPS,
51 net::SpawnedTestServer::SSLOptions(
52 net::SpawnedTestServer::SSLOptions::CERT_OK),
53 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
56 void SetUpOnMainThread() override {
57 BrowserThread::PostTask(
58 BrowserThread::IO, FROM_HERE,
59 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true));
62 // Check the cookie for the given URL in an incognito window.
63 void CookieCheckIncognitoWindow(const GURL& url, bool cookies_enabled) {
64 ASSERT_TRUE(content::GetCookies(browser()->profile(), url).empty());
66 Browser* incognito = CreateIncognitoBrowser();
67 ASSERT_TRUE(content::GetCookies(incognito->profile(), url).empty());
68 ui_test_utils::NavigateToURL(incognito, url);
69 ASSERT_EQ(cookies_enabled,
70 !content::GetCookies(incognito->profile(), url).empty());
72 // Ensure incognito cookies don't leak to regular profile.
73 ASSERT_TRUE(content::GetCookies(browser()->profile(), url).empty());
75 // Ensure cookies get wiped after last incognito window closes.
76 CloseBrowserSynchronously(incognito);
78 incognito = CreateIncognitoBrowser();
79 ASSERT_TRUE(content::GetCookies(incognito->profile(), url).empty());
80 CloseBrowserSynchronously(incognito);
83 void PreBasic(const GURL& url) {
84 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
86 CookieCheckIncognitoWindow(url, true);
88 ui_test_utils::NavigateToURL(browser(), url);
89 ASSERT_FALSE(GetCookies(browser()->profile(), url).empty());
92 void Basic(const GURL& url) {
93 ASSERT_FALSE(GetCookies(browser()->profile(), url).empty());
96 net::SpawnedTestServer https_server_;
99 // Sanity check on cookies before we do other tests. While these can be written
100 // in content_browsertests, we want to verify Chrome's cookie storage and how it
101 // handles incognito windows.
102 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BasicCookies) {
103 ASSERT_TRUE(test_server()->Start());
104 GURL http_url = test_server()->GetURL("files/setcookie.html");
105 PreBasic(http_url);
108 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookies) {
109 ASSERT_TRUE(test_server()->Start());
110 GURL http_url = test_server()->GetURL("files/setcookie.html");
111 Basic(http_url);
114 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BasicCookiesHttps) {
115 ASSERT_TRUE(https_server_.Start());
116 GURL https_url = https_server_.GetURL("files/setcookie.html");
117 PreBasic(https_url);
120 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookiesHttps) {
121 ASSERT_TRUE(https_server_.Start());
122 GURL https_url = https_server_.GetURL("files/setcookie.html");
123 Basic(https_url);
126 // Verify that cookies are being blocked.
127 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, PRE_BlockCookies) {
128 ASSERT_TRUE(test_server()->Start());
129 CookieSettingsFactory::GetForProfile(browser()->profile())
130 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
131 GURL url = test_server()->GetURL("files/setcookie.html");
132 ui_test_utils::NavigateToURL(browser(), url);
133 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
134 CookieCheckIncognitoWindow(url, false);
137 // Ensure that the setting persists.
138 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BlockCookies) {
139 ASSERT_EQ(CONTENT_SETTING_BLOCK,
140 CookieSettingsFactory::GetForProfile(browser()->profile())
141 ->GetDefaultCookieSetting(NULL));
144 // Verify that cookies can be allowed and set using exceptions for particular
145 // website(s) when all others are blocked.
146 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, AllowCookiesUsingExceptions) {
147 ASSERT_TRUE(test_server()->Start());
148 GURL url = test_server()->GetURL("files/setcookie.html");
149 content_settings::CookieSettings* settings =
150 CookieSettingsFactory::GetForProfile(browser()->profile()).get();
151 settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
153 ui_test_utils::NavigateToURL(browser(), url);
154 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
156 settings->SetCookieSetting(
157 ContentSettingsPattern::FromURL(url),
158 ContentSettingsPattern::Wildcard(), CONTENT_SETTING_ALLOW);
160 ui_test_utils::NavigateToURL(browser(), url);
161 ASSERT_FALSE(GetCookies(browser()->profile(), url).empty());
164 // Verify that cookies can be blocked for a specific website using exceptions.
165 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BlockCookiesUsingExceptions) {
166 ASSERT_TRUE(test_server()->Start());
167 GURL url = test_server()->GetURL("files/setcookie.html");
168 content_settings::CookieSettings* settings =
169 CookieSettingsFactory::GetForProfile(browser()->profile()).get();
170 settings->SetCookieSetting(ContentSettingsPattern::FromURL(url),
171 ContentSettingsPattern::Wildcard(),
172 CONTENT_SETTING_BLOCK);
174 ui_test_utils::NavigateToURL(browser(), url);
175 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
177 ASSERT_TRUE(https_server_.Start());
178 GURL unblocked_url = https_server_.GetURL("files/cookie1.html");
180 ui_test_utils::NavigateToURL(browser(), unblocked_url);
181 ASSERT_FALSE(GetCookies(browser()->profile(), unblocked_url).empty());
184 // This fails on ChromeOS because kRestoreOnStartup is ignored and the startup
185 // preference is always "continue where I left off.
186 #if !defined(OS_CHROMEOS)
188 // Verify that cookies can be allowed and set using exceptions for particular
189 // website(s) only for a session when all others are blocked.
190 IN_PROC_BROWSER_TEST_F(ContentSettingsTest,
191 PRE_AllowCookiesForASessionUsingExceptions) {
192 // NOTE: don't use test_server here, since we need the port to be the same
193 // across the restart.
194 GURL url = URLRequestMockHTTPJob::GetMockUrl(
195 base::FilePath(FILE_PATH_LITERAL("setcookie.html")));
196 content_settings::CookieSettings* settings =
197 CookieSettingsFactory::GetForProfile(browser()->profile()).get();
198 settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
200 ui_test_utils::NavigateToURL(browser(), url);
201 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
203 settings->SetCookieSetting(
204 ContentSettingsPattern::FromURL(url),
205 ContentSettingsPattern::Wildcard(), CONTENT_SETTING_SESSION_ONLY);
206 ui_test_utils::NavigateToURL(browser(), url);
207 ASSERT_FALSE(GetCookies(browser()->profile(), url).empty());
210 IN_PROC_BROWSER_TEST_F(ContentSettingsTest,
211 AllowCookiesForASessionUsingExceptions) {
212 GURL url = URLRequestMockHTTPJob::GetMockUrl(
213 base::FilePath(FILE_PATH_LITERAL("setcookie.html")));
214 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
217 #endif // !CHROME_OS
219 // Regression test for http://crbug.com/63649.
220 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectLoopCookies) {
221 ASSERT_TRUE(test_server()->Start());
223 GURL test_url = test_server()->GetURL("files/redirect-loop.html");
225 CookieSettingsFactory::GetForProfile(browser()->profile())
226 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
228 ui_test_utils::NavigateToURL(browser(), test_url);
230 content::WebContents* web_contents =
231 browser()->tab_strip_model()->GetActiveWebContents();
232 ASSERT_EQ(base::UTF8ToUTF16(test_url.spec() + " failed to load"),
233 web_contents->GetTitle());
235 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents)->
236 IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
239 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, ContentSettingsBlockDataURLs) {
240 GURL url("data:text/html,<title>Data URL</title><script>alert(1)</script>");
242 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
243 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
245 ui_test_utils::NavigateToURL(browser(), url);
247 content::WebContents* web_contents =
248 browser()->tab_strip_model()->GetActiveWebContents();
249 ASSERT_EQ(base::UTF8ToUTF16("Data URL"), web_contents->GetTitle());
251 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents)->
252 IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT));
255 // Tests that if redirect across origins occurs, the new process still gets the
256 // content settings before the resource headers.
257 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectCrossOrigin) {
258 ASSERT_TRUE(test_server()->Start());
260 net::HostPortPair host_port = test_server()->host_port_pair();
261 DCHECK_EQ(host_port.host(), std::string("127.0.0.1"));
263 std::string redirect(base::StringPrintf(
264 "http://localhost:%d/files/redirect-cross-origin.html",
265 host_port.port()));
266 GURL test_url = test_server()->GetURL("server-redirect?" + redirect);
268 CookieSettingsFactory::GetForProfile(browser()->profile())
269 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
271 ui_test_utils::NavigateToURL(browser(), test_url);
273 content::WebContents* web_contents =
274 browser()->tab_strip_model()->GetActiveWebContents();
276 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents)->
277 IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
280 #if defined(ENABLE_PLUGINS)
281 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest {
282 protected:
283 static const char* const kExternalClearKeyMimeType;
285 // Registers any CDM plugins not registered by default.
286 void SetUpCommandLine(base::CommandLine* command_line) override {
287 #if defined(ENABLE_PEPPER_CDMS)
288 // Platform-specific filename relative to the chrome executable.
289 #if defined(OS_WIN)
290 const char kLibraryName[] = "clearkeycdmadapter.dll";
291 #else // !defined(OS_WIN)
292 #if defined(OS_MACOSX)
293 const char kLibraryName[] = "clearkeycdmadapter.plugin";
294 #elif defined(OS_POSIX)
295 const char kLibraryName[] = "libclearkeycdmadapter.so";
296 #endif // defined(OS_MACOSX)
297 #endif // defined(OS_WIN)
299 // Append the switch to register the External Clear Key CDM.
300 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration(
301 kLibraryName, "Clear Key CDM", kExternalClearKeyMimeType);
302 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
303 // The CDM must be registered when it is a component.
304 pepper_plugins.append(FILE_PATH_LITERAL(","));
305 pepper_plugins.append(
306 BuildPepperPluginRegistration(kWidevineCdmAdapterFileName,
307 kWidevineCdmDisplayName,
308 kWidevineCdmPluginMimeType));
309 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
310 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
311 pepper_plugins);
312 #endif // defined(ENABLE_PEPPER_CDMS)
314 #if !defined(DISABLE_NACL)
315 // Ensure NaCl can run.
316 command_line->AppendSwitch(switches::kEnableNaCl);
317 #endif
320 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) {
321 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded";
322 content::WebContents* web_contents =
323 browser()->tab_strip_model()->GetActiveWebContents();
325 base::string16 expected_title(base::ASCIIToUTF16(expected_result));
326 content::TitleWatcher title_watcher(web_contents, expected_title);
328 // GetTestUrl assumes paths, so we must append query parameters to result.
329 GURL file_url = ui_test_utils::GetTestUrl(
330 base::FilePath(),
331 base::FilePath().AppendASCII("load_pepper_plugin.html"));
332 GURL url(file_url.spec() +
333 base::StringPrintf("?mimetype=%s", mime_type));
334 ui_test_utils::NavigateToURL(browser(), url);
336 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
337 EXPECT_EQ(!expect_loaded,
338 TabSpecificContentSettings::FromWebContents(web_contents)->
339 IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS));
342 void RunJavaScriptBlockedTest(const char* html_file,
343 bool expect_is_javascript_content_blocked) {
344 // Because JavaScript is blocked, <title> will be the only title set.
345 // Checking for it ensures that the page loaded, though that is not always
346 // sufficient - see below.
347 const char* const kExpectedTitle = "Initial Title";
348 content::WebContents* web_contents =
349 browser()->tab_strip_model()->GetActiveWebContents();
350 TabSpecificContentSettings* tab_settings =
351 TabSpecificContentSettings::FromWebContents(web_contents);
352 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle));
353 content::TitleWatcher title_watcher(web_contents, expected_title);
355 // Because JavaScript is blocked, we cannot rely on JavaScript to set a
356 // title, telling us the test is complete.
357 // As a result, it is possible to reach the IsContentBlocked() checks below
358 // before the blocked content can be reported to the browser process.
359 // See http://crbug.com/306702.
360 // Therefore, when expecting blocked content, we must wait until it has been
361 // reported by checking IsContentBlocked() when notified that
362 // NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED. (It is not sufficient to wait
363 // for just the notification because the same notification is reported for
364 // other reasons and the notification contains no indication of what
365 // caused it.)
366 content::WindowedNotificationObserver javascript_content_blocked_observer(
367 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
368 base::Bind(&TabSpecificContentSettings::IsContentBlocked,
369 base::Unretained(tab_settings),
370 CONTENT_SETTINGS_TYPE_JAVASCRIPT));
372 GURL url = ui_test_utils::GetTestUrl(
373 base::FilePath(), base::FilePath().AppendASCII(html_file));
374 ui_test_utils::NavigateToURL(browser(), url);
376 // Always wait for the page to load.
377 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
379 if (expect_is_javascript_content_blocked) {
380 javascript_content_blocked_observer.Wait();
381 } else {
382 // Since there is no notification that content is not blocked and no
383 // content is blocked when |expect_is_javascript_content_blocked| is
384 // false, javascript_content_blocked_observer would never succeed.
385 // There is no way to ensure blocked content would not have been reported
386 // after the check below. For coverage of this scenario, we must rely on
387 // the TitleWatcher adding sufficient delay most of the time.
390 EXPECT_EQ(expect_is_javascript_content_blocked,
391 tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT));
392 EXPECT_FALSE(tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS));
395 private:
396 // Builds the string to pass to kRegisterPepperPlugins for a single
397 // plugin using the provided parameters and a dummy version.
398 // Multiple results may be passed to kRegisterPepperPlugins, separated by ",".
399 base::FilePath::StringType BuildPepperPluginRegistration(
400 const char* library_name,
401 const char* display_name,
402 const char* mime_type) {
403 base::FilePath plugin_dir;
404 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
406 base::FilePath plugin_lib = plugin_dir.AppendASCII(library_name);
407 EXPECT_TRUE(base::PathExists(plugin_lib));
409 base::FilePath::StringType pepper_plugin = plugin_lib.value();
410 std::string string_to_append = "#";
411 string_to_append.append(display_name);
412 string_to_append.append("#A CDM#0.1.0.0;");
413 string_to_append.append(mime_type);
415 #if defined(OS_WIN)
416 pepper_plugin.append(base::ASCIIToUTF16(string_to_append));
417 #else
418 pepper_plugin.append(string_to_append);
419 #endif
421 return pepper_plugin;
425 const char* const
426 PepperContentSettingsSpecialCasesTest::kExternalClearKeyMimeType =
427 "application/x-ppapi-clearkey-cdm";
429 class PepperContentSettingsSpecialCasesPluginsBlockedTest
430 : public PepperContentSettingsSpecialCasesTest {
431 public:
432 void SetUpOnMainThread() override {
433 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread();
434 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
435 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
439 class PepperContentSettingsSpecialCasesJavaScriptBlockedTest
440 : public PepperContentSettingsSpecialCasesTest {
441 public:
442 void SetUpOnMainThread() override {
443 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread();
444 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
445 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
446 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
447 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
451 #if defined(ENABLE_PEPPER_CDMS)
452 // A sanity check to verify that the plugin that is used as a baseline below
453 // can be loaded.
454 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesTest, Baseline) {
455 #if defined(OS_WIN) && defined(USE_ASH)
456 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
457 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
458 switches::kAshBrowserTests))
459 return;
460 #endif
461 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
462 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
464 RunLoadPepperPluginTest(kExternalClearKeyMimeType, true);
466 #endif // defined(ENABLE_PEPPER_CDMS)
468 // The following tests verify that Pepper plugins that use JavaScript settings
469 // instead of Plugins settings still work when Plugins are blocked.
471 #if defined(ENABLE_PEPPER_CDMS)
472 // The plugin successfully loaded above is blocked.
473 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
474 Normal) {
475 #if defined(OS_WIN) && defined(USE_ASH)
476 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
477 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
478 switches::kAshBrowserTests))
479 return;
480 #endif
481 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false);
484 #if defined(WIDEVINE_CDM_AVAILABLE)
485 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
486 WidevineCdm) {
487 #if defined(OS_WIN) && defined(USE_ASH)
488 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
489 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
490 switches::kAshBrowserTests))
491 return;
492 #endif
493 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true);
495 #endif // defined(WIDEVINE_CDM_AVAILABLE)
496 #endif // defined(ENABLE_PEPPER_CDMS)
498 #if !defined(DISABLE_NACL)
499 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
500 NaCl) {
501 #if defined(OS_WIN) && defined(USE_ASH)
502 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
503 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
504 switches::kAshBrowserTests))
505 return;
506 #endif
507 RunLoadPepperPluginTest("application/x-nacl", true);
509 #endif // !defined(DISABLE_NACL)
511 // The following tests verify that those same Pepper plugins do not work when
512 // JavaScript is blocked.
514 #if defined(ENABLE_PEPPER_CDMS)
515 // A plugin with no special behavior is not blocked when JavaScript is blocked.
516 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
517 Normal) {
518 #if defined(OS_WIN) && defined(USE_ASH)
519 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
520 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
521 switches::kAshBrowserTests))
522 return;
523 #endif
524 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false);
527 #if defined(WIDEVINE_CDM_AVAILABLE)
528 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
529 WidevineCdm) {
530 #if defined(OS_WIN) && defined(USE_ASH)
531 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
532 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
533 switches::kAshBrowserTests))
534 return;
535 #endif
536 RunJavaScriptBlockedTest("load_widevine_no_js.html", true);
538 #endif // defined(WIDEVINE_CDM_AVAILABLE)
539 #endif // defined(ENABLE_PEPPER_CDMS)
541 #if !defined(DISABLE_NACL)
542 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
543 NaCl) {
544 #if defined(OS_WIN) && defined(USE_ASH)
545 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
546 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
547 switches::kAshBrowserTests))
548 return;
549 #endif
550 RunJavaScriptBlockedTest("load_nacl_no_js.html", true);
552 #endif // !defined(DISABLE_NACL)
554 #endif // defined(ENABLE_PLUGINS)