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

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

Issue 2078903002: Set custom-scoped patterns in HostContentSettingsMapTest to keep test coverage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/content_settings/host_content_settings_map_unittest.cc
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
index 4573d3d95e49b64b4a43fbdf751c69ff77f3f5ba..1ffe60f775bcb759c80ad3ace2fc39219d4a9d5e 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -301,12 +301,16 @@ TEST_F(HostContentSettingsMapTest, Patterns) {
GURL host1("http://example.com/");
GURL host2("http://www.example.com/");
GURL host3("http://example.org/");
+ ContentSettingsPattern pattern1 =
+ ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern pattern2 =
+ ContentSettingsPattern::FromString("example.org");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host1, host1, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
- host_content_settings_map->SetContentSettingDefaultScope(
- host1, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
- CONTENT_SETTING_BLOCK);
+ host_content_settings_map->SetContentSettingCustomScope(
+ pattern1, ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host1, host1, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
@@ -316,9 +320,9 @@ TEST_F(HostContentSettingsMapTest, Patterns) {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host3, host3, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
- host_content_settings_map->SetContentSettingDefaultScope(
- host3, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
- CONTENT_SETTING_BLOCK);
+ host_content_settings_map->SetContentSettingCustomScope(
+ pattern2, ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host3, host3, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
@@ -577,19 +581,24 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
HostContentSettingsMapFactory::GetForProfile(&profile);
GURL host("http://a.b.example.com/");
- GURL host1("http://example.com/");
- GURL host2("http://b.example.com/");
+ ContentSettingsPattern pattern1 =
+ ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern pattern2 =
+ ContentSettingsPattern::FromString("[*.]b.example.com");
+ ContentSettingsPattern pattern3 =
+ ContentSettingsPattern::FromString("a.b.example.com");
- host_content_settings_map->SetContentSettingDefaultScope(
- host1, GURL(), CONTENT_SETTINGS_TYPE_POPUPS, std::string(),
- CONTENT_SETTING_BLOCK);
+ host_content_settings_map->SetContentSettingCustomScope(
+ pattern1, ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_POPUPS, std::string(), CONTENT_SETTING_BLOCK);
- host_content_settings_map->SetContentSettingDefaultScope(
- host2, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
- CONTENT_SETTING_BLOCK);
+ host_content_settings_map->SetContentSettingCustomScope(
+ pattern2, ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_COOKIES, std::string(), CONTENT_SETTING_BLOCK);
- host_content_settings_map->SetContentSettingDefaultScope(
- host, GURL(), CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, std::string(),
+ host_content_settings_map->SetContentSettingCustomScope(
+ pattern3, ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, std::string(),
CONTENT_SETTING_BLOCK);
host_content_settings_map->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698