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

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

Issue 440423003: Clean content_settings_pattern_parser.* from unnecessary dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/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 f2c60c4f9ed415b462c7221950da06f418a2272e..f7d78aed7730705b7f03ae8875b7e58bbf301665 100644
--- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc
+++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/mock_settings_observer.h"
+#include "chrome/common/chrome_content_settings_client.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -32,9 +33,14 @@ class HostContentSettingsMapTest : public testing::Test {
HostContentSettingsMapTest() : ui_thread_(BrowserThread::UI, &message_loop_) {
}
+ content_settings::ContentSettingsClient* client() {
+ return &client_;
+ }
+
protected:
base::MessageLoop message_loop_;
content::TestBrowserThread ui_thread_;
+ content_settings::ChromeContentSettingsClient client_;
};
TEST_F(HostContentSettingsMapTest, DefaultValues) {
@@ -78,7 +84,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
// Check returning individual settings.
GURL host("http://example.com/");
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
@@ -151,7 +157,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
// Check returning all hosts for a setting.
ContentSettingsPattern pattern2 =
- ContentSettingsPattern::FromString("[*.]example.org");
+ ContentSettingsPattern::FromString(client(), "[*.]example.org");
host_content_settings_map->SetContentSetting(
pattern2,
ContentSettingsPattern::Wildcard(),
@@ -186,9 +192,9 @@ TEST_F(HostContentSettingsMapTest, Clear) {
// Check clearing one type.
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.org");
+ ContentSettingsPattern::FromString(client(), "[*.]example.org");
ContentSettingsPattern pattern2 =
- ContentSettingsPattern::FromString("[*.]example.net");
+ ContentSettingsPattern::FromString(client(), "[*.]example.net");
host_content_settings_map->SetContentSetting(
pattern2,
ContentSettingsPattern::Wildcard(),
@@ -235,9 +241,9 @@ TEST_F(HostContentSettingsMapTest, Patterns) {
GURL host2("http://www.example.com/");
GURL host3("http://example.org/");
ContentSettingsPattern pattern1 =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
ContentSettingsPattern pattern2 =
- ContentSettingsPattern::FromString("example.org");
+ ContentSettingsPattern::FromString(client(), "example.org");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
@@ -274,7 +280,7 @@ TEST_F(HostContentSettingsMapTest, Observer) {
MockSettingsObserver observer;
ContentSettingsPattern primary_pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
ContentSettingsPattern secondary_pattern =
ContentSettingsPattern::Wildcard();
EXPECT_CALL(observer,
@@ -356,7 +362,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) {
prefs::kContentSettingsPatternPairs)->GetValue()->DeepCopy());
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
GURL host("http://example.com");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
@@ -398,7 +404,7 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
CookieSettings::Factory::GetForProfile(&profile).get();
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
GURL host_ending_with_dot("http://example.com./");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
@@ -552,11 +558,11 @@ TEST_F(HostContentSettingsMapTest, NestedSettings) {
GURL host("http://a.b.example.com/");
ContentSettingsPattern pattern1 =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
ContentSettingsPattern pattern2 =
- ContentSettingsPattern::FromString("[*.]b.example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]b.example.com");
ContentSettingsPattern pattern3 =
- ContentSettingsPattern::FromString("a.b.example.com");
+ ContentSettingsPattern::FromString(client(), "a.b.example.com");
host_content_settings_map->SetContentSetting(
pattern1,
@@ -621,7 +627,7 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) {
GURL host("http://example.com/");
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
EXPECT_EQ(CONTENT_SETTING_ALLOW,
host_content_settings_map->GetContentSetting(
@@ -763,7 +769,7 @@ TEST_F(HostContentSettingsMapTest,
// Set pattern for JavaScript setting.
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),
@@ -803,7 +809,7 @@ TEST_F(HostContentSettingsMapTest,
// Set an exception to allow "[*.]example.com"
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
host_content_settings_map->SetContentSetting(
pattern,
@@ -898,7 +904,7 @@ TEST_F(HostContentSettingsMapTest, GetContentSetting) {
GURL host("http://example.com/");
GURL embedder("chrome://foo");
ContentSettingsPattern pattern =
- ContentSettingsPattern::FromString("[*.]example.com");
+ ContentSettingsPattern::FromString(client(), "[*.]example.com");
host_content_settings_map->SetContentSetting(
pattern,
ContentSettingsPattern::Wildcard(),

Powered by Google App Engine
This is Rietveld 408576698