Index: chrome/browser/prefs/pref_functional_browsertest.cc |
diff --git a/chrome/browser/prefs/pref_functional_browsertest.cc b/chrome/browser/prefs/pref_functional_browsertest.cc |
index 856dea7b1752ceed276399a0ee699571f97a7223..45a2cb34b3a9168f59fae3b4edc228b12f32f59a 100644 |
--- a/chrome/browser/prefs/pref_functional_browsertest.cc |
+++ b/chrome/browser/prefs/pref_functional_browsertest.cc |
@@ -65,7 +65,7 @@ IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestDownloadDirPref) { |
EXPECT_TRUE(base::PathExists(downloaded_pkg)); |
} |
-// Verify image content settings show or hide images. |
+// Verify that image content settings show or hide images. |
IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestImageContentSettings) { |
ASSERT_TRUE(test_server()->Start()); |
@@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestImageContentSettings) { |
bool result = false; |
std::string script = |
- "for (i=0; i < document.images.length; i++) {" |
+ "for (var i = 0; i < document.images.length; ++i) {" |
" if ((document.images[i].naturalWidth != 0) &&" |
" (document.images[i].naturalHeight != 0)) {" |
" window.domAutomationController.send(true);" |
@@ -89,9 +89,8 @@ IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestImageContentSettings) { |
EXPECT_TRUE(result); |
base::DictionaryValue value; |
- value.SetInteger("images", 2); |
- browser()->profile()->GetPrefs()->Set(prefs::kDefaultContentSettings, |
- value); |
+ value.SetInteger("images", CONTENT_SETTING_BLOCK); |
+ browser()->profile()->GetPrefs()->Set(prefs::kDefaultContentSettings, value); |
ui_test_utils::NavigateToURL( |
browser(), |
@@ -125,6 +124,53 @@ IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestJavascriptEnableDisable) { |
browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); |
} |
+// Verify that media content settings allow or block <video> content. |
+IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestMediaContentSettings) { |
+ ASSERT_TRUE(test_server()->Start()); |
+ |
+ EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean( |
Bernhard Bauer
2014/07/01 09:12:50
I would probably use ASSERT_TRUE, because if Javas
|
+ prefs::kWebKitJavascriptEnabled)); |
+ ui_test_utils::NavigateToURL( |
+ browser(), |
+ test_server()->GetURL("files/settings/video_page.html")); |
+ |
+ bool result = false; |
+ std::string script = |
+ "(function() {" |
+ " var checkVideo = function() {" |
+ " window.domAutomationController.send(" |
+ " document.querySelector('video').readyState > 0);" |
+ " };" |
+ " if (document.readyState == 'complete') {" |
+ " checkVideo();" |
+ " } else {" |
+ " document.body.addEventListener('load', checkVideo);" |
+ " }" |
+ "})();"; |
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
+ browser()->tab_strip_model()->GetActiveWebContents(), |
+ script, |
+ &result)); |
+ EXPECT_TRUE(result); |
+ |
+ base::DictionaryValue value; |
+ value.SetInteger("media", CONTENT_SETTING_BLOCK); |
+ browser()->profile()->GetPrefs()->Set(prefs::kDefaultContentSettings, value); |
+ |
+ EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean( |
+ prefs::kWebKitJavascriptEnabled)); |
+ ui_test_utils::NavigateToURL( |
+ browser(), |
+ test_server()->GetURL("files/settings/video_page.html")); |
+ |
+ result = false; |
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
+ browser()->tab_strip_model()->GetActiveWebContents(), |
+ script, |
+ &result)); |
+ EXPECT_FALSE(result); |
+} |
+ |
// Verify DNS prefetching pref. |
IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestNetworkPredictionEnabledPref) { |
EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean( |