OLD | NEW |
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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 331 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
332 } | 332 } |
333 | 333 |
334 // Verify that plugins can be allowed on a domain by adding an exception | 334 // Verify that plugins can be allowed on a domain by adding an exception |
335 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, AllowException) { | 335 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, AllowException) { |
336 GURL url = ui_test_utils::GetTestUrl( | 336 GURL url = ui_test_utils::GetTestUrl( |
337 base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); | 337 base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); |
338 | 338 |
339 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 339 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
340 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); | 340 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); |
341 browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( | 341 browser()->profile()->GetHostContentSettingsMap() |
342 ContentSettingsPattern::FromURL(url), | 342 ->SetContentSetting(ContentSettingsPattern::FromURL(url), |
343 ContentSettingsPattern::Wildcard(), | 343 ContentSettingsPattern::Wildcard(), |
344 CONTENT_SETTINGS_TYPE_PLUGINS, | 344 CONTENT_SETTINGS_TYPE_PLUGINS, |
345 "", | 345 std::string(), |
346 CONTENT_SETTING_ALLOW); | 346 CONTENT_SETTING_ALLOW); |
347 | 347 |
348 string16 expected_title(ASCIIToUTF16("OK")); | 348 string16 expected_title(ASCIIToUTF16("OK")); |
349 content::TitleWatcher title_watcher( | 349 content::TitleWatcher title_watcher( |
350 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); | 350 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); |
351 ui_test_utils::NavigateToURL(browser(), url); | 351 ui_test_utils::NavigateToURL(browser(), url); |
352 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 352 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
353 } | 353 } |
354 | 354 |
355 // Verify that plugins can be blocked on a domain by adding an exception. | 355 // Verify that plugins can be blocked on a domain by adding an exception. |
356 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, BlockException) { | 356 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, BlockException) { |
357 GURL url = ui_test_utils::GetTestUrl( | 357 GURL url = ui_test_utils::GetTestUrl( |
358 base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); | 358 base::FilePath(), base::FilePath().AppendASCII("clicktoplay.html")); |
359 | 359 |
360 browser()->profile()->GetHostContentSettingsMap()->SetContentSetting( | 360 browser()->profile()->GetHostContentSettingsMap() |
361 ContentSettingsPattern::FromURL(url), | 361 ->SetContentSetting(ContentSettingsPattern::FromURL(url), |
362 ContentSettingsPattern::Wildcard(), | 362 ContentSettingsPattern::Wildcard(), |
363 CONTENT_SETTINGS_TYPE_PLUGINS, | 363 CONTENT_SETTINGS_TYPE_PLUGINS, |
364 "", | 364 std::string(), |
365 CONTENT_SETTING_BLOCK); | 365 CONTENT_SETTING_BLOCK); |
366 | 366 |
367 string16 expected_title(ASCIIToUTF16("Click To Play")); | 367 string16 expected_title(ASCIIToUTF16("Click To Play")); |
368 content::TitleWatcher title_watcher( | 368 content::TitleWatcher title_watcher( |
369 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); | 369 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); |
370 ui_test_utils::NavigateToURL(browser(), url); | 370 ui_test_utils::NavigateToURL(browser(), url); |
371 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 371 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
372 } | 372 } |
373 | 373 |
374 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, LoadAllBlockedPlugins) { | 374 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, LoadAllBlockedPlugins) { |
375 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 375 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 #if defined(WIDEVINE_CDM_AVAILABLE) | 583 #if defined(WIDEVINE_CDM_AVAILABLE) |
584 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); | 584 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); |
585 #endif | 585 #endif |
586 | 586 |
587 #if !defined(DISABLE_NACL) | 587 #if !defined(DISABLE_NACL) |
588 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 588 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
589 #endif | 589 #endif |
590 } | 590 } |
591 | 591 |
592 #endif // defined(ENABLE_PLUGINS) | 592 #endif // defined(ENABLE_PLUGINS) |
OLD | NEW |