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

Unified Diff: chrome/browser/push_messaging/push_messaging_permission_context_unittest.cc

Issue 1690043004: Use GURLs instead of patterns in SetContentSetting() in geolocation and push_messaging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scoping_set_content_setting
Patch Set: Created 4 years, 10 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/push_messaging/push_messaging_permission_context_unittest.cc
diff --git a/chrome/browser/push_messaging/push_messaging_permission_context_unittest.cc b/chrome/browser/push_messaging/push_messaging_permission_context_unittest.cc
index 6a8e1ac400e01c4377b54ef4250c5c2f7bfad243..30972d2d2d8d8be9344e02cdc7f704787329b3d3 100644
--- a/chrome/browser/push_messaging/push_messaging_permission_context_unittest.cc
+++ b/chrome/browser/push_messaging/push_messaging_permission_context_unittest.cc
@@ -65,16 +65,22 @@ class PushMessagingPermissionContextTest
// PermissionContextBase::UpdateContentSetting, since the tests below use
// this method to overwrite patterns set as a result of
// PushMessagingPermissionContext::NotifyPermissionSet.
- ContentSettingsPattern pattern_a =
- ContentSettingsPattern::FromURLNoWildcard(GURL(kOriginA));
- ContentSettingsPattern insecure_pattern =
- ContentSettingsPattern::FromURLNoWildcard(GURL(kInsecureOrigin));
+ GURL url_a = GURL(kOriginA);
+ GURL insecure_url = GURL(kInsecureOrigin);
HostContentSettingsMap* host_content_settings_map =
HostContentSettingsMapFactory::GetForProfile(profile);
- host_content_settings_map->SetContentSetting(pattern_a, pattern_a, setting,
- std::string(), value);
- host_content_settings_map->SetContentSetting(
- insecure_pattern, insecure_pattern, setting, std::string(), value);
+
+ if (setting == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
Michael van Ouwerkerk 2016/02/17 11:19:26 Why is this branching needed, just to pass a blank
lshang 2016/02/18 00:23:53 It will fail in DCHECK in: https://codereview.chro
Michael van Ouwerkerk 2016/02/18 09:42:44 I see, thank you!
+ host_content_settings_map->SetContentSettingDefaultScope(
+ url_a, GURL(), setting, std::string(), value);
+ host_content_settings_map->SetContentSettingDefaultScope(
+ insecure_url, GURL(), setting, std::string(), value);
+ } else if (setting == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) {
+ host_content_settings_map->SetContentSettingDefaultScope(
+ url_a, url_a, setting, std::string(), value);
+ host_content_settings_map->SetContentSettingDefaultScope(
+ insecure_url, insecure_url, setting, std::string(), value);
+ }
}
};

Powered by Google App Engine
This is Rietveld 408576698