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/host_content_settings_map_factory.h"
12 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
13 #include "chrome/browser/net/url_request_mock_util.h"
14 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_commands.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/test/base/in_process_browser_test.h"
21 #include "chrome/test/base/test_switches.h"
22 #include "chrome/test/base/ui_test_utils.h"
23 #include "components/content_settings/core/browser/cookie_settings.h"
24 #include "components/content_settings/core/browser/host_content_settings_map.h"
25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/plugin_service.h"
29 #include "content/public/browser/render_frame_host.h"
30 #include "content/public/browser/render_process_host.h"
31 #include "content/public/browser/render_view_host.h"
32 #include "content/public/browser/web_contents.h"
33 #include "content/public/common/content_switches.h"
34 #include "content/public/test/browser_test_utils.h"
35 #include "content/public/test/test_utils.h"
36 #include "net/test/spawned_test_server/spawned_test_server.h"
37 #include "net/test/url_request/url_request_mock_http_job.h"
39 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
41 #if defined(OS_MACOSX)
42 #include "base/mac/scoped_nsautorelease_pool.h"
45 using content::BrowserThread
;
46 using net::URLRequestMockHTTPJob
;
48 class ContentSettingsTest
: public InProcessBrowserTest
{
51 : https_server_(net::SpawnedTestServer::TYPE_HTTPS
,
52 net::SpawnedTestServer::SSLOptions(
53 net::SpawnedTestServer::SSLOptions::CERT_OK
),
54 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) {
57 void SetUpOnMainThread() override
{
58 BrowserThread::PostTask(
59 BrowserThread::IO
, FROM_HERE
,
60 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled
, true));
63 // Check the cookie for the given URL in an incognito window.
64 void CookieCheckIncognitoWindow(const GURL
& url
, bool cookies_enabled
) {
65 ASSERT_TRUE(content::GetCookies(browser()->profile(), url
).empty());
67 Browser
* incognito
= CreateIncognitoBrowser();
68 ASSERT_TRUE(content::GetCookies(incognito
->profile(), url
).empty());
69 ui_test_utils::NavigateToURL(incognito
, url
);
70 ASSERT_EQ(cookies_enabled
,
71 !content::GetCookies(incognito
->profile(), url
).empty());
73 // Ensure incognito cookies don't leak to regular profile.
74 ASSERT_TRUE(content::GetCookies(browser()->profile(), url
).empty());
76 // Ensure cookies get wiped after last incognito window closes.
77 CloseBrowserSynchronously(incognito
);
79 incognito
= CreateIncognitoBrowser();
80 ASSERT_TRUE(content::GetCookies(incognito
->profile(), url
).empty());
81 CloseBrowserSynchronously(incognito
);
84 void PreBasic(const GURL
& url
) {
85 ASSERT_TRUE(GetCookies(browser()->profile(), url
).empty());
87 CookieCheckIncognitoWindow(url
, true);
89 ui_test_utils::NavigateToURL(browser(), url
);
90 ASSERT_FALSE(GetCookies(browser()->profile(), url
).empty());
93 void Basic(const GURL
& url
) {
94 ASSERT_FALSE(GetCookies(browser()->profile(), url
).empty());
97 net::SpawnedTestServer https_server_
;
100 // Sanity check on cookies before we do other tests. While these can be written
101 // in content_browsertests, we want to verify Chrome's cookie storage and how it
102 // handles incognito windows.
103 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, PRE_BasicCookies
) {
104 ASSERT_TRUE(test_server()->Start());
105 GURL http_url
= test_server()->GetURL("files/setcookie.html");
109 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, BasicCookies
) {
110 ASSERT_TRUE(test_server()->Start());
111 GURL http_url
= test_server()->GetURL("files/setcookie.html");
115 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, PRE_BasicCookiesHttps
) {
116 ASSERT_TRUE(https_server_
.Start());
117 GURL https_url
= https_server_
.GetURL("files/setcookie.html");
121 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, BasicCookiesHttps
) {
122 ASSERT_TRUE(https_server_
.Start());
123 GURL https_url
= https_server_
.GetURL("files/setcookie.html");
127 // Verify that cookies are being blocked.
128 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, PRE_BlockCookies
) {
129 ASSERT_TRUE(test_server()->Start());
130 CookieSettingsFactory::GetForProfile(browser()->profile())
131 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK
);
132 GURL url
= test_server()->GetURL("files/setcookie.html");
133 ui_test_utils::NavigateToURL(browser(), url
);
134 ASSERT_TRUE(GetCookies(browser()->profile(), url
).empty());
135 CookieCheckIncognitoWindow(url
, false);
138 // Ensure that the setting persists.
139 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, BlockCookies
) {
140 ASSERT_EQ(CONTENT_SETTING_BLOCK
,
141 CookieSettingsFactory::GetForProfile(browser()->profile())
142 ->GetDefaultCookieSetting(NULL
));
145 // Verify that cookies can be allowed and set using exceptions for particular
146 // website(s) when all others are blocked.
147 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, AllowCookiesUsingExceptions
) {
148 ASSERT_TRUE(test_server()->Start());
149 GURL url
= test_server()->GetURL("files/setcookie.html");
150 content_settings::CookieSettings
* settings
=
151 CookieSettingsFactory::GetForProfile(browser()->profile()).get();
152 settings
->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK
);
154 ui_test_utils::NavigateToURL(browser(), url
);
155 ASSERT_TRUE(GetCookies(browser()->profile(), url
).empty());
157 settings
->SetCookieSetting(
158 ContentSettingsPattern::FromURL(url
),
159 ContentSettingsPattern::Wildcard(), CONTENT_SETTING_ALLOW
);
161 ui_test_utils::NavigateToURL(browser(), url
);
162 ASSERT_FALSE(GetCookies(browser()->profile(), url
).empty());
165 // Verify that cookies can be blocked for a specific website using exceptions.
166 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, BlockCookiesUsingExceptions
) {
167 ASSERT_TRUE(test_server()->Start());
168 GURL url
= test_server()->GetURL("files/setcookie.html");
169 content_settings::CookieSettings
* settings
=
170 CookieSettingsFactory::GetForProfile(browser()->profile()).get();
171 settings
->SetCookieSetting(ContentSettingsPattern::FromURL(url
),
172 ContentSettingsPattern::Wildcard(),
173 CONTENT_SETTING_BLOCK
);
175 ui_test_utils::NavigateToURL(browser(), url
);
176 ASSERT_TRUE(GetCookies(browser()->profile(), url
).empty());
178 ASSERT_TRUE(https_server_
.Start());
179 GURL unblocked_url
= https_server_
.GetURL("files/cookie1.html");
181 ui_test_utils::NavigateToURL(browser(), unblocked_url
);
182 ASSERT_FALSE(GetCookies(browser()->profile(), unblocked_url
).empty());
185 // This fails on ChromeOS because kRestoreOnStartup is ignored and the startup
186 // preference is always "continue where I left off.
187 #if !defined(OS_CHROMEOS)
189 // Verify that cookies can be allowed and set using exceptions for particular
190 // website(s) only for a session when all others are blocked.
191 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
,
192 PRE_AllowCookiesForASessionUsingExceptions
) {
193 // NOTE: don't use test_server here, since we need the port to be the same
194 // across the restart.
195 GURL url
= URLRequestMockHTTPJob::GetMockUrl(
196 base::FilePath(FILE_PATH_LITERAL("setcookie.html")));
197 content_settings::CookieSettings
* settings
=
198 CookieSettingsFactory::GetForProfile(browser()->profile()).get();
199 settings
->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK
);
201 ui_test_utils::NavigateToURL(browser(), url
);
202 ASSERT_TRUE(GetCookies(browser()->profile(), url
).empty());
204 settings
->SetCookieSetting(
205 ContentSettingsPattern::FromURL(url
),
206 ContentSettingsPattern::Wildcard(), CONTENT_SETTING_SESSION_ONLY
);
207 ui_test_utils::NavigateToURL(browser(), url
);
208 ASSERT_FALSE(GetCookies(browser()->profile(), url
).empty());
211 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
,
212 AllowCookiesForASessionUsingExceptions
) {
213 GURL url
= URLRequestMockHTTPJob::GetMockUrl(
214 base::FilePath(FILE_PATH_LITERAL("setcookie.html")));
215 ASSERT_TRUE(GetCookies(browser()->profile(), url
).empty());
220 // Regression test for http://crbug.com/63649.
221 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, RedirectLoopCookies
) {
222 ASSERT_TRUE(test_server()->Start());
224 GURL test_url
= test_server()->GetURL("files/redirect-loop.html");
226 CookieSettingsFactory::GetForProfile(browser()->profile())
227 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK
);
229 ui_test_utils::NavigateToURL(browser(), test_url
);
231 content::WebContents
* web_contents
=
232 browser()->tab_strip_model()->GetActiveWebContents();
233 ASSERT_EQ(base::UTF8ToUTF16(test_url
.spec() + " failed to load"),
234 web_contents
->GetTitle());
236 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents
)->
237 IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES
));
240 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, ContentSettingsBlockDataURLs
) {
241 GURL
url("data:text/html,<title>Data URL</title><script>alert(1)</script>");
243 HostContentSettingsMapFactory::GetForProfile(browser()->profile())
244 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT
,
245 CONTENT_SETTING_BLOCK
);
247 ui_test_utils::NavigateToURL(browser(), url
);
249 content::WebContents
* web_contents
=
250 browser()->tab_strip_model()->GetActiveWebContents();
251 ASSERT_EQ(base::UTF8ToUTF16("Data URL"), web_contents
->GetTitle());
253 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents
)->
254 IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT
));
257 // Tests that if redirect across origins occurs, the new process still gets the
258 // content settings before the resource headers.
259 IN_PROC_BROWSER_TEST_F(ContentSettingsTest
, RedirectCrossOrigin
) {
260 ASSERT_TRUE(test_server()->Start());
262 net::HostPortPair host_port
= test_server()->host_port_pair();
263 DCHECK_EQ(host_port
.host(), std::string("127.0.0.1"));
265 std::string
redirect(base::StringPrintf(
266 "http://localhost:%d/files/redirect-cross-origin.html",
268 GURL test_url
= test_server()->GetURL("server-redirect?" + redirect
);
270 CookieSettingsFactory::GetForProfile(browser()->profile())
271 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK
);
273 ui_test_utils::NavigateToURL(browser(), test_url
);
275 content::WebContents
* web_contents
=
276 browser()->tab_strip_model()->GetActiveWebContents();
278 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents
)->
279 IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES
));
282 #if defined(ENABLE_PLUGINS)
283 class PepperContentSettingsSpecialCasesTest
: public ContentSettingsTest
{
285 static const char* const kExternalClearKeyMimeType
;
287 // Registers any CDM plugins not registered by default.
288 void SetUpCommandLine(base::CommandLine
* command_line
) override
{
289 #if defined(ENABLE_PEPPER_CDMS)
290 // Platform-specific filename relative to the chrome executable.
292 const char kLibraryName
[] = "clearkeycdmadapter.dll";
293 #else // !defined(OS_WIN)
294 #if defined(OS_MACOSX)
295 const char kLibraryName
[] = "clearkeycdmadapter.plugin";
296 #elif defined(OS_POSIX)
297 const char kLibraryName
[] = "libclearkeycdmadapter.so";
298 #endif // defined(OS_MACOSX)
299 #endif // defined(OS_WIN)
301 // Append the switch to register the External Clear Key CDM.
302 base::FilePath::StringType pepper_plugins
= BuildPepperPluginRegistration(
303 kLibraryName
, "Clear Key CDM", kExternalClearKeyMimeType
);
304 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
305 // The CDM must be registered when it is a component.
306 pepper_plugins
.append(FILE_PATH_LITERAL(","));
307 pepper_plugins
.append(
308 BuildPepperPluginRegistration(kWidevineCdmAdapterFileName
,
309 kWidevineCdmDisplayName
,
310 kWidevineCdmPluginMimeType
));
311 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
312 command_line
->AppendSwitchNative(switches::kRegisterPepperPlugins
,
314 #endif // defined(ENABLE_PEPPER_CDMS)
316 #if !defined(DISABLE_NACL)
317 // Ensure NaCl can run.
318 command_line
->AppendSwitch(switches::kEnableNaCl
);
322 void RunLoadPepperPluginTest(const char* mime_type
, bool expect_loaded
) {
323 const char* expected_result
= expect_loaded
? "Loaded" : "Not Loaded";
324 content::WebContents
* web_contents
=
325 browser()->tab_strip_model()->GetActiveWebContents();
327 base::string16
expected_title(base::ASCIIToUTF16(expected_result
));
328 content::TitleWatcher
title_watcher(web_contents
, expected_title
);
330 // GetTestUrl assumes paths, so we must append query parameters to result.
331 GURL file_url
= ui_test_utils::GetTestUrl(
333 base::FilePath().AppendASCII("load_pepper_plugin.html"));
334 GURL
url(file_url
.spec() +
335 base::StringPrintf("?mimetype=%s", mime_type
));
336 ui_test_utils::NavigateToURL(browser(), url
);
338 EXPECT_EQ(expected_title
, title_watcher
.WaitAndGetTitle());
339 EXPECT_EQ(!expect_loaded
,
340 TabSpecificContentSettings::FromWebContents(web_contents
)->
341 IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS
));
344 void RunJavaScriptBlockedTest(const char* html_file
,
345 bool expect_is_javascript_content_blocked
) {
346 // Because JavaScript is blocked, <title> will be the only title set.
347 // Checking for it ensures that the page loaded, though that is not always
348 // sufficient - see below.
349 const char* const kExpectedTitle
= "Initial Title";
350 content::WebContents
* web_contents
=
351 browser()->tab_strip_model()->GetActiveWebContents();
352 TabSpecificContentSettings
* tab_settings
=
353 TabSpecificContentSettings::FromWebContents(web_contents
);
354 base::string16
expected_title(base::ASCIIToUTF16(kExpectedTitle
));
355 content::TitleWatcher
title_watcher(web_contents
, expected_title
);
357 // Because JavaScript is blocked, we cannot rely on JavaScript to set a
358 // title, telling us the test is complete.
359 // As a result, it is possible to reach the IsContentBlocked() checks below
360 // before the blocked content can be reported to the browser process.
361 // See http://crbug.com/306702.
362 // Therefore, when expecting blocked content, we must wait until it has been
363 // reported by checking IsContentBlocked() when notified that
364 // NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED. (It is not sufficient to wait
365 // for just the notification because the same notification is reported for
366 // other reasons and the notification contains no indication of what
368 content::WindowedNotificationObserver
javascript_content_blocked_observer(
369 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED
,
370 base::Bind(&TabSpecificContentSettings::IsContentBlocked
,
371 base::Unretained(tab_settings
),
372 CONTENT_SETTINGS_TYPE_JAVASCRIPT
));
374 GURL url
= ui_test_utils::GetTestUrl(
375 base::FilePath(), base::FilePath().AppendASCII(html_file
));
376 ui_test_utils::NavigateToURL(browser(), url
);
378 // Always wait for the page to load.
379 EXPECT_EQ(expected_title
, title_watcher
.WaitAndGetTitle());
381 if (expect_is_javascript_content_blocked
) {
382 javascript_content_blocked_observer
.Wait();
384 // Since there is no notification that content is not blocked and no
385 // content is blocked when |expect_is_javascript_content_blocked| is
386 // false, javascript_content_blocked_observer would never succeed.
387 // There is no way to ensure blocked content would not have been reported
388 // after the check below. For coverage of this scenario, we must rely on
389 // the TitleWatcher adding sufficient delay most of the time.
392 EXPECT_EQ(expect_is_javascript_content_blocked
,
393 tab_settings
->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT
));
394 EXPECT_FALSE(tab_settings
->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS
));
398 // Builds the string to pass to kRegisterPepperPlugins for a single
399 // plugin using the provided parameters and a dummy version.
400 // Multiple results may be passed to kRegisterPepperPlugins, separated by ",".
401 base::FilePath::StringType
BuildPepperPluginRegistration(
402 const char* library_name
,
403 const char* display_name
,
404 const char* mime_type
) {
405 base::FilePath plugin_dir
;
406 EXPECT_TRUE(PathService::Get(base::DIR_MODULE
, &plugin_dir
));
408 base::FilePath plugin_lib
= plugin_dir
.AppendASCII(library_name
);
409 EXPECT_TRUE(base::PathExists(plugin_lib
));
411 base::FilePath::StringType pepper_plugin
= plugin_lib
.value();
412 std::string string_to_append
= "#";
413 string_to_append
.append(display_name
);
414 string_to_append
.append("#A CDM#0.1.0.0;");
415 string_to_append
.append(mime_type
);
418 pepper_plugin
.append(base::ASCIIToUTF16(string_to_append
));
420 pepper_plugin
.append(string_to_append
);
423 return pepper_plugin
;
428 PepperContentSettingsSpecialCasesTest::kExternalClearKeyMimeType
=
429 "application/x-ppapi-clearkey-cdm";
431 class PepperContentSettingsSpecialCasesPluginsBlockedTest
432 : public PepperContentSettingsSpecialCasesTest
{
434 void SetUpOnMainThread() override
{
435 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread();
436 HostContentSettingsMapFactory::GetForProfile(browser()->profile())
437 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS
,
438 CONTENT_SETTING_BLOCK
);
442 class PepperContentSettingsSpecialCasesJavaScriptBlockedTest
443 : public PepperContentSettingsSpecialCasesTest
{
445 void SetUpOnMainThread() override
{
446 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread();
447 HostContentSettingsMapFactory::GetForProfile(browser()->profile())
448 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS
,
449 CONTENT_SETTING_ALLOW
);
450 HostContentSettingsMapFactory::GetForProfile(browser()->profile())
451 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT
,
452 CONTENT_SETTING_BLOCK
);
456 #if defined(ENABLE_PEPPER_CDMS)
457 // A sanity check to verify that the plugin that is used as a baseline below
459 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesTest
, Baseline
) {
460 #if defined(OS_WIN) && defined(USE_ASH)
461 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
462 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
463 switches::kAshBrowserTests
))
466 HostContentSettingsMapFactory::GetForProfile(browser()->profile())
467 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS
,
468 CONTENT_SETTING_ALLOW
);
470 RunLoadPepperPluginTest(kExternalClearKeyMimeType
, true);
472 #endif // defined(ENABLE_PEPPER_CDMS)
474 // The following tests verify that Pepper plugins that use JavaScript settings
475 // instead of Plugins settings still work when Plugins are blocked.
477 #if defined(ENABLE_PEPPER_CDMS)
478 // The plugin successfully loaded above is blocked.
479 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest
,
481 #if defined(OS_WIN) && defined(USE_ASH)
482 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
483 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
484 switches::kAshBrowserTests
))
487 RunLoadPepperPluginTest(kExternalClearKeyMimeType
, false);
490 #if defined(WIDEVINE_CDM_AVAILABLE)
491 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest
,
493 #if defined(OS_WIN) && defined(USE_ASH)
494 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
495 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
496 switches::kAshBrowserTests
))
499 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType
, true);
501 #endif // defined(WIDEVINE_CDM_AVAILABLE)
502 #endif // defined(ENABLE_PEPPER_CDMS)
504 #if !defined(DISABLE_NACL)
505 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest
,
507 #if defined(OS_WIN) && defined(USE_ASH)
508 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
509 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
510 switches::kAshBrowserTests
))
513 RunLoadPepperPluginTest("application/x-nacl", true);
515 #endif // !defined(DISABLE_NACL)
517 // The following tests verify that those same Pepper plugins do not work when
518 // JavaScript is blocked.
520 #if defined(ENABLE_PEPPER_CDMS)
521 // A plugin with no special behavior is not blocked when JavaScript is blocked.
522 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest
,
524 #if defined(OS_WIN) && defined(USE_ASH)
525 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
526 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
527 switches::kAshBrowserTests
))
530 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false);
533 #if defined(WIDEVINE_CDM_AVAILABLE)
534 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest
,
536 #if defined(OS_WIN) && defined(USE_ASH)
537 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
538 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
539 switches::kAshBrowserTests
))
542 RunJavaScriptBlockedTest("load_widevine_no_js.html", true);
544 #endif // defined(WIDEVINE_CDM_AVAILABLE)
545 #endif // defined(ENABLE_PEPPER_CDMS)
547 #if !defined(DISABLE_NACL)
548 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest
,
550 #if defined(OS_WIN) && defined(USE_ASH)
551 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
552 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
553 switches::kAshBrowserTests
))
556 RunJavaScriptBlockedTest("load_nacl_no_js.html", true);
558 #endif // !defined(DISABLE_NACL)
560 #endif // defined(ENABLE_PLUGINS)