Update V8 to version 4.6.22.
[chromium-blink-merge.git] / chrome / browser / content_settings / content_settings_browsertest.cc
blob776cd501fb7d1cb762d73a40afc066ef9f263cf3
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/common/render_messages.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"
43 #endif
45 using content::BrowserThread;
46 using net::URLRequestMockHTTPJob;
48 class ContentSettingsTest : public InProcessBrowserTest {
49 public:
50 ContentSettingsTest()
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");
106 PreBasic(http_url);
109 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookies) {
110 ASSERT_TRUE(test_server()->Start());
111 GURL http_url = test_server()->GetURL("files/setcookie.html");
112 Basic(http_url);
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");
118 PreBasic(https_url);
121 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, BasicCookiesHttps) {
122 ASSERT_TRUE(https_server_.Start());
123 GURL https_url = https_server_.GetURL("files/setcookie.html");
124 Basic(https_url);
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());
218 #endif // !CHROME_OS
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 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
244 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
246 ui_test_utils::NavigateToURL(browser(), url);
248 content::WebContents* web_contents =
249 browser()->tab_strip_model()->GetActiveWebContents();
250 ASSERT_EQ(base::UTF8ToUTF16("Data URL"), web_contents->GetTitle());
252 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents)->
253 IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT));
256 // Tests that if redirect across origins occurs, the new process still gets the
257 // content settings before the resource headers.
258 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectCrossOrigin) {
259 ASSERT_TRUE(test_server()->Start());
261 net::HostPortPair host_port = test_server()->host_port_pair();
262 DCHECK_EQ(host_port.host(), std::string("127.0.0.1"));
264 std::string redirect(base::StringPrintf(
265 "http://localhost:%d/files/redirect-cross-origin.html",
266 host_port.port()));
267 GURL test_url = test_server()->GetURL("server-redirect?" + redirect);
269 CookieSettingsFactory::GetForProfile(browser()->profile())
270 ->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
272 ui_test_utils::NavigateToURL(browser(), test_url);
274 content::WebContents* web_contents =
275 browser()->tab_strip_model()->GetActiveWebContents();
277 EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents)->
278 IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
281 #if defined(ENABLE_PLUGINS)
282 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest {
283 protected:
284 static const char* const kExternalClearKeyMimeType;
286 // Registers any CDM plugins not registered by default.
287 void SetUpCommandLine(base::CommandLine* command_line) override {
288 #if defined(ENABLE_PEPPER_CDMS)
289 // Platform-specific filename relative to the chrome executable.
290 #if defined(OS_WIN)
291 const char kLibraryName[] = "clearkeycdmadapter.dll";
292 #else // !defined(OS_WIN)
293 #if defined(OS_MACOSX)
294 const char kLibraryName[] = "clearkeycdmadapter.plugin";
295 #elif defined(OS_POSIX)
296 const char kLibraryName[] = "libclearkeycdmadapter.so";
297 #endif // defined(OS_MACOSX)
298 #endif // defined(OS_WIN)
300 // Append the switch to register the External Clear Key CDM.
301 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration(
302 kLibraryName, "Clear Key CDM", kExternalClearKeyMimeType);
303 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
304 // The CDM must be registered when it is a component.
305 pepper_plugins.append(FILE_PATH_LITERAL(","));
306 pepper_plugins.append(
307 BuildPepperPluginRegistration(kWidevineCdmAdapterFileName,
308 kWidevineCdmDisplayName,
309 kWidevineCdmPluginMimeType));
310 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
311 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
312 pepper_plugins);
313 #endif // defined(ENABLE_PEPPER_CDMS)
315 #if !defined(DISABLE_NACL)
316 // Ensure NaCl can run.
317 command_line->AppendSwitch(switches::kEnableNaCl);
318 #endif
321 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) {
322 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded";
323 content::WebContents* web_contents =
324 browser()->tab_strip_model()->GetActiveWebContents();
326 base::string16 expected_title(base::ASCIIToUTF16(expected_result));
327 content::TitleWatcher title_watcher(web_contents, expected_title);
329 // GetTestUrl assumes paths, so we must append query parameters to result.
330 GURL file_url = ui_test_utils::GetTestUrl(
331 base::FilePath(),
332 base::FilePath().AppendASCII("load_pepper_plugin.html"));
333 GURL url(file_url.spec() +
334 base::StringPrintf("?mimetype=%s", mime_type));
335 ui_test_utils::NavigateToURL(browser(), url);
337 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
338 EXPECT_EQ(!expect_loaded,
339 TabSpecificContentSettings::FromWebContents(web_contents)->
340 IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS));
343 void RunJavaScriptBlockedTest(const char* html_file,
344 bool expect_is_javascript_content_blocked) {
345 // Because JavaScript is blocked, <title> will be the only title set.
346 // Checking for it ensures that the page loaded, though that is not always
347 // sufficient - see below.
348 const char* const kExpectedTitle = "Initial Title";
349 content::WebContents* web_contents =
350 browser()->tab_strip_model()->GetActiveWebContents();
351 TabSpecificContentSettings* tab_settings =
352 TabSpecificContentSettings::FromWebContents(web_contents);
353 base::string16 expected_title(base::ASCIIToUTF16(kExpectedTitle));
354 content::TitleWatcher title_watcher(web_contents, expected_title);
356 // Because JavaScript is blocked, we cannot rely on JavaScript to set a
357 // title, telling us the test is complete.
358 // As a result, it is possible to reach the IsContentBlocked() checks below
359 // before the blocked content can be reported to the browser process.
360 // See http://crbug.com/306702.
361 // Therefore, when expecting blocked content, we must wait until it has been
362 // reported by checking IsContentBlocked() when notified that
363 // NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED. (It is not sufficient to wait
364 // for just the notification because the same notification is reported for
365 // other reasons and the notification contains no indication of what
366 // caused it.)
367 content::WindowedNotificationObserver javascript_content_blocked_observer(
368 chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED,
369 base::Bind(&TabSpecificContentSettings::IsContentBlocked,
370 base::Unretained(tab_settings),
371 CONTENT_SETTINGS_TYPE_JAVASCRIPT));
373 GURL url = ui_test_utils::GetTestUrl(
374 base::FilePath(), base::FilePath().AppendASCII(html_file));
375 ui_test_utils::NavigateToURL(browser(), url);
377 // Always wait for the page to load.
378 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
380 if (expect_is_javascript_content_blocked) {
381 javascript_content_blocked_observer.Wait();
382 } else {
383 // Since there is no notification that content is not blocked and no
384 // content is blocked when |expect_is_javascript_content_blocked| is
385 // false, javascript_content_blocked_observer would never succeed.
386 // There is no way to ensure blocked content would not have been reported
387 // after the check below. For coverage of this scenario, we must rely on
388 // the TitleWatcher adding sufficient delay most of the time.
391 EXPECT_EQ(expect_is_javascript_content_blocked,
392 tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT));
393 EXPECT_FALSE(tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS));
396 private:
397 // Builds the string to pass to kRegisterPepperPlugins for a single
398 // plugin using the provided parameters and a dummy version.
399 // Multiple results may be passed to kRegisterPepperPlugins, separated by ",".
400 base::FilePath::StringType BuildPepperPluginRegistration(
401 const char* library_name,
402 const char* display_name,
403 const char* mime_type) {
404 base::FilePath plugin_dir;
405 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
407 base::FilePath plugin_lib = plugin_dir.AppendASCII(library_name);
408 EXPECT_TRUE(base::PathExists(plugin_lib));
410 base::FilePath::StringType pepper_plugin = plugin_lib.value();
411 std::string string_to_append = "#";
412 string_to_append.append(display_name);
413 string_to_append.append("#A CDM#0.1.0.0;");
414 string_to_append.append(mime_type);
416 #if defined(OS_WIN)
417 pepper_plugin.append(base::ASCIIToUTF16(string_to_append));
418 #else
419 pepper_plugin.append(string_to_append);
420 #endif
422 return pepper_plugin;
426 const char* const
427 PepperContentSettingsSpecialCasesTest::kExternalClearKeyMimeType =
428 "application/x-ppapi-clearkey-cdm";
430 class PepperContentSettingsSpecialCasesPluginsBlockedTest
431 : public PepperContentSettingsSpecialCasesTest {
432 public:
433 void SetUpOnMainThread() override {
434 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread();
435 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
436 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
440 class PepperContentSettingsSpecialCasesJavaScriptBlockedTest
441 : public PepperContentSettingsSpecialCasesTest {
442 public:
443 void SetUpOnMainThread() override {
444 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread();
445 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
446 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
447 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
448 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
452 #if defined(ENABLE_PEPPER_CDMS)
453 // A sanity check to verify that the plugin that is used as a baseline below
454 // can be loaded.
455 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesTest, Baseline) {
456 #if defined(OS_WIN) && defined(USE_ASH)
457 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
458 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
459 switches::kAshBrowserTests))
460 return;
461 #endif
462 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
463 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
465 RunLoadPepperPluginTest(kExternalClearKeyMimeType, true);
467 #endif // defined(ENABLE_PEPPER_CDMS)
469 // The following tests verify that Pepper plugins that use JavaScript settings
470 // instead of Plugins settings still work when Plugins are blocked.
472 #if defined(ENABLE_PEPPER_CDMS)
473 // The plugin successfully loaded above is blocked.
474 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
475 Normal) {
476 #if defined(OS_WIN) && defined(USE_ASH)
477 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
478 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
479 switches::kAshBrowserTests))
480 return;
481 #endif
482 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false);
485 #if defined(WIDEVINE_CDM_AVAILABLE)
486 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
487 WidevineCdm) {
488 #if defined(OS_WIN) && defined(USE_ASH)
489 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
490 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
491 switches::kAshBrowserTests))
492 return;
493 #endif
494 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true);
496 #endif // defined(WIDEVINE_CDM_AVAILABLE)
497 #endif // defined(ENABLE_PEPPER_CDMS)
499 #if !defined(DISABLE_NACL)
500 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
501 NaCl) {
502 #if defined(OS_WIN) && defined(USE_ASH)
503 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
504 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
505 switches::kAshBrowserTests))
506 return;
507 #endif
508 RunLoadPepperPluginTest("application/x-nacl", true);
510 #endif // !defined(DISABLE_NACL)
512 // The following tests verify that those same Pepper plugins do not work when
513 // JavaScript is blocked.
515 #if defined(ENABLE_PEPPER_CDMS)
516 // A plugin with no special behavior is not blocked when JavaScript is blocked.
517 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
518 Normal) {
519 #if defined(OS_WIN) && defined(USE_ASH)
520 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
521 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
522 switches::kAshBrowserTests))
523 return;
524 #endif
525 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false);
528 #if defined(WIDEVINE_CDM_AVAILABLE)
529 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
530 WidevineCdm) {
531 #if defined(OS_WIN) && defined(USE_ASH)
532 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
533 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
534 switches::kAshBrowserTests))
535 return;
536 #endif
537 RunJavaScriptBlockedTest("load_widevine_no_js.html", true);
539 #endif // defined(WIDEVINE_CDM_AVAILABLE)
540 #endif // defined(ENABLE_PEPPER_CDMS)
542 #if !defined(DISABLE_NACL)
543 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
544 NaCl) {
545 #if defined(OS_WIN) && defined(USE_ASH)
546 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
547 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
548 switches::kAshBrowserTests))
549 return;
550 #endif
551 RunJavaScriptBlockedTest("load_nacl_no_js.html", true);
553 #endif // !defined(DISABLE_NACL)
555 #endif // defined(ENABLE_PLUGINS)