Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: chrome/browser/content_settings/tab_specific_content_settings_unittest.cc

Issue 11896028: Add an location bar icon and a content settings bubble for media settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser test Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
diff --git a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
index e0bbb45c8282211db3221f53ca4c0182163cd5ba..9b28d9b46b50dde86f7554debab900342a01027b 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc
@@ -68,8 +68,11 @@ TEST_F(TabSpecificContentSettingsTest, BlockedContent) {
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_FALSE(
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
+ EXPECT_FALSE(
+ content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
- // Set a cookie, block access to images, block a popup.
+ // Set a cookie, block access to images, block mediastream access and block a
+ // popup.
content_settings->OnCookieChanged(GURL("http://google.com"),
GURL("http://google.com"),
"A=B",
@@ -78,6 +81,8 @@ TEST_F(TabSpecificContentSettingsTest, BlockedContent) {
content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES,
std::string());
content_settings->SetPopupsBlocked(true);
+ content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM,
+ std::string());
// Check that only the respective content types are affected.
EXPECT_TRUE(content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES));
@@ -88,6 +93,8 @@ TEST_F(TabSpecificContentSettingsTest, BlockedContent) {
EXPECT_FALSE(
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_TRUE(content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
+ EXPECT_TRUE(
+ content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
content_settings->OnCookieChanged(GURL("http://google.com"),
GURL("http://google.com"),
"A=B",
@@ -115,6 +122,8 @@ TEST_F(TabSpecificContentSettingsTest, BlockedContent) {
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_FALSE(
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
+ EXPECT_FALSE(
+ content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
content_settings->ClearCookieSpecificContentSettings();
EXPECT_FALSE(
@@ -127,6 +136,8 @@ TEST_F(TabSpecificContentSettingsTest, BlockedContent) {
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
EXPECT_FALSE(
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
+ EXPECT_FALSE(
+ content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
}
TEST_F(TabSpecificContentSettingsTest, BlockedFileSystems) {
@@ -149,12 +160,17 @@ TEST_F(TabSpecificContentSettingsTest, AllowedContent) {
TabSpecificContentSettings::FromWebContents(web_contents());
net::CookieOptions options;
+ // Test default settings.
ASSERT_FALSE(
content_settings->IsContentAccessed(CONTENT_SETTINGS_TYPE_IMAGES));
ASSERT_FALSE(
content_settings->IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
+ ASSERT_FALSE(
+ content_settings->IsContentAccessed(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
+
+ // Record a cookie.
content_settings->OnCookieChanged(GURL("http://google.com"),
GURL("http://google.com"),
"A=B",
@@ -164,6 +180,8 @@ TEST_F(TabSpecificContentSettingsTest, AllowedContent) {
content_settings->IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_FALSE(
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
+
+ // Record a blocked cookie.
content_settings->OnCookieChanged(GURL("http://google.com"),
GURL("http://google.com"),
"C=D",
@@ -173,6 +191,21 @@ TEST_F(TabSpecificContentSettingsTest, AllowedContent) {
content_settings->IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
ASSERT_TRUE(
content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
+
+ // Record mediastream access.
+ content_settings->OnMediaStreamAccessed();
+ ASSERT_TRUE(
+ content_settings->IsContentAccessed(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
+ ASSERT_FALSE(
+ content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
+
+ // Record a blocked mediastream access request.
+ content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM,
+ std::string());
+ ASSERT_TRUE(
+ content_settings->IsContentAccessed(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
+ ASSERT_TRUE(
+ content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
}
TEST_F(TabSpecificContentSettingsTest, EmptyCookieList) {

Powered by Google App Engine
This is Rietveld 408576698