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

Side by Side Diff: chrome/browser/content_settings/content_settings_default_provider_unittest.cc

Issue 1252073002: Move pref names and default value into WebsiteSettingsInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@website-settings-registry-simple
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_pref_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/prefs/scoped_user_pref_update.h" 8 #include "base/prefs/scoped_user_pref_update.h"
9 #include "base/prefs/testing_pref_service.h" 9 #include "base/prefs/testing_pref_service.h"
10 #include "chrome/browser/content_settings/content_settings_mock_observer.h" 10 #include "chrome/browser/content_settings/content_settings_mock_observer.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
13 #include "components/content_settings/core/browser/content_settings_default_prov ider.h" 13 #include "components/content_settings/core/browser/content_settings_default_prov ider.h"
14 #include "components/content_settings/core/browser/content_settings_utils.h" 14 #include "components/content_settings/core/browser/content_settings_utils.h"
15 #include "components/content_settings/core/browser/website_settings_info.h"
16 #include "components/content_settings/core/browser/website_settings_registry.h"
15 #include "components/content_settings/core/test/content_settings_test_utils.h" 17 #include "components/content_settings/core/test/content_settings_test_utils.h"
16 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
17 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
18 #include "url/gurl.h" 20 #include "url/gurl.h"
19 21
20 using ::testing::_; 22 using ::testing::_;
21 23
22 class DefaultProviderTest : public testing::Test { 24 class DefaultProviderTest : public testing::Test {
23 public: 25 public:
24 DefaultProviderTest() 26 DefaultProviderTest()
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 CONTENT_SETTINGS_TYPE_COOKIES, 151 CONTENT_SETTINGS_TYPE_COOKIES,
150 std::string(), 152 std::string(),
151 new base::FundamentalValue(CONTENT_SETTING_BLOCK)); 153 new base::FundamentalValue(CONTENT_SETTING_BLOCK));
152 EXPECT_EQ(CONTENT_SETTING_BLOCK, 154 EXPECT_EQ(CONTENT_SETTING_BLOCK,
153 GetContentSetting(&provider_, 155 GetContentSetting(&provider_,
154 GURL(), 156 GURL(),
155 GURL(), 157 GURL(),
156 CONTENT_SETTINGS_TYPE_COOKIES, 158 CONTENT_SETTINGS_TYPE_COOKIES,
157 std::string(), 159 std::string(),
158 false)); 160 false));
159 161 const content_settings::WebsiteSettingsInfo* info =
162 content_settings::WebsiteSettingsRegistry::GetInstance()->Get(
163 CONTENT_SETTINGS_TYPE_COOKIES);
160 // Clearing the backing pref should also clear the internal cache. 164 // Clearing the backing pref should also clear the internal cache.
161 prefs->ClearPref(prefs::kDefaultCookiesSetting); 165 prefs->ClearPref(info->default_value_pref_name());
162 EXPECT_EQ(CONTENT_SETTING_ALLOW, 166 EXPECT_EQ(CONTENT_SETTING_ALLOW,
163 GetContentSetting(&provider_, 167 GetContentSetting(&provider_,
164 GURL(), 168 GURL(),
165 GURL(), 169 GURL(),
166 CONTENT_SETTINGS_TYPE_COOKIES, 170 CONTENT_SETTINGS_TYPE_COOKIES,
167 std::string(), 171 std::string(),
168 false)); 172 false));
169 // Reseting the pref to its previous value should update the cache. 173 // Reseting the pref to its previous value should update the cache.
170 prefs->SetInteger(prefs::kDefaultCookiesSetting, CONTENT_SETTING_BLOCK); 174 prefs->SetInteger(info->default_value_pref_name(), CONTENT_SETTING_BLOCK);
171 EXPECT_EQ(CONTENT_SETTING_BLOCK, 175 EXPECT_EQ(CONTENT_SETTING_BLOCK,
172 GetContentSetting(&provider_, 176 GetContentSetting(&provider_,
173 GURL(), 177 GURL(),
174 GURL(), 178 GURL(),
175 CONTENT_SETTINGS_TYPE_COOKIES, 179 CONTENT_SETTINGS_TYPE_COOKIES,
176 std::string(), 180 std::string(),
177 false)); 181 false));
178 } 182 }
179 183
180 TEST_F(DefaultProviderTest, OffTheRecord) { 184 TEST_F(DefaultProviderTest, OffTheRecord) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 243
240 EXPECT_EQ(CONTENT_SETTING_BLOCK, 244 EXPECT_EQ(CONTENT_SETTING_BLOCK,
241 GetContentSetting(&otr_provider, 245 GetContentSetting(&otr_provider,
242 GURL(), 246 GURL(),
243 GURL(), 247 GURL(),
244 CONTENT_SETTINGS_TYPE_COOKIES, 248 CONTENT_SETTINGS_TYPE_COOKIES,
245 std::string(), 249 std::string(),
246 true)); 250 true));
247 otr_provider.ShutdownOnUIThread(); 251 otr_provider.ShutdownOnUIThread();
248 } 252 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_pref_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698