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

Unified Diff: components/content_settings/core/test/content_settings_test_utils.cc

Issue 1873343002: [Policy] HostContentSettingsMap: Add AreUserExceptionsAllowedForType() and tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: components/content_settings/core/test/content_settings_test_utils.cc
diff --git a/components/content_settings/core/test/content_settings_test_utils.cc b/components/content_settings/core/test/content_settings_test_utils.cc
index 87207195f02851e5e1be9073e4bb820b42c65eb3..191e28e5faab05e771d410d77df97c97944a5e68 100644
--- a/components/content_settings/core/test/content_settings_test_utils.cc
+++ b/components/content_settings/core/test/content_settings_test_utils.cc
@@ -4,7 +4,9 @@
#include "components/content_settings/core/test/content_settings_test_utils.h"
+#include "components/content_settings/core/browser/content_settings_pref_provider.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/content_settings/core/common/content_settings_types.h"
namespace content_settings {
@@ -48,4 +50,16 @@ scoped_ptr<base::Value> TestUtils::GetContentSettingValueAndPatterns(
secondary_pattern);
}
+// static
+bool TestUtils::AddUserException(const std::string& pattern_string,
raymes 2016/04/12 04:52:47 Could you instead just call HostContentSettingsMap
Bernhard Bauer 2016/04/12 09:30:05 +1 (That's what I meant in my earlier comments).
huangs 2016/04/12 14:19:14 But it looks like SetContentSettingCustomScope()
huangs 2016/04/13 17:36:18 Anyway, if that's the convention then I'll use it.
Bernhard Bauer 2016/04/19 15:20:08 No, this was written to not treat the pref provide
+ ContentSettingsType content_type,
+ ContentSetting setting,
+ HostContentSettingsMap* settings_map) {
+ ContentSettingsPattern pattern =
+ ContentSettingsPattern::FromString(pattern_string);
+ base::Value* value = new base::FundamentalValue(setting);
+ return settings_map->GetPrefProvider()->SetWebsiteSetting(
+ pattern, pattern, content_type, std::string(), value);
+}
+
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698