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

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

Issue 1865803002: [Policy Experimental] Add policies to allow Cookies and Pop-ups exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add another test to exercise main logic; renames from review. 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..116813f2c7bbfe5833090129797211fcf993bf9a 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::AddPrefException(const std::string& pattern_string,
+ ContentSettingsType content_type,
+ ContentSetting setting,
+ HostContentSettingsMap* settings_map) {
+ ContentSettingsPattern pattern =
+ ContentSettingsPattern::FromString(pattern_string);
+ base::Value* value = new base::FundamentalValue(setting);
+ return settings_map->pref_provider_->SetWebsiteSetting(
Bernhard Bauer 2016/04/07 09:11:08 Use an accessor. Also, why does this directly acce
huangs 2016/04/07 21:44:07 An accessor invites usage, but currently direct ac
Bernhard Bauer 2016/04/08 14:44:35 I still think you could go through HCSM, no?
huangs 2016/04/11 19:01:03 Don't know what you mean; in the latest version I
+ pattern, pattern, content_type, std::string(), value);
+}
+
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698