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

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

Issue 7342043: Fixed regression: various preferences were not persisted when changed from incognito window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/policy/configuration_policy_pref_store.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 "chrome/browser/content_settings/content_settings_pref_provider.h" 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/content_settings/content_settings_mock_observer.h" 9 #include "chrome/browser/content_settings/content_settings_mock_observer.h"
10 #include "chrome/browser/content_settings/mock_settings_observer.h" 10 #include "chrome/browser/content_settings/mock_settings_observer.h"
11 #include "chrome/browser/prefs/browser_prefs.h" 11 #include "chrome/browser/prefs/browser_prefs.h"
12 #include "chrome/browser/prefs/default_pref_store.h" 12 #include "chrome/browser/prefs/default_pref_store.h"
13 #include "chrome/browser/prefs/overlay_persistent_pref_store.h" 13 #include "chrome/browser/prefs/incognito_user_pref_store.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/prefs/pref_service_mock_builder.h" 15 #include "chrome/browser/prefs/pref_service_mock_builder.h"
16 #include "chrome/browser/prefs/testing_pref_store.h" 16 #include "chrome/browser/prefs/testing_pref_store.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "chrome/test/testing_browser_process_test.h" 20 #include "chrome/test/testing_browser_process_test.h"
21 #include "chrome/test/testing_pref_service.h" 21 #include "chrome/test/testing_pref_service.h"
22 #include "chrome/test/testing_profile.h" 22 #include "chrome/test/testing_profile.h"
23 #include "content/browser/browser_thread.h" 23 #include "content/browser/browser_thread.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 "", 180 "",
181 CONTENT_SETTING_ALLOW); 181 CONTENT_SETTING_ALLOW);
182 182
183 pref_content_settings_provider.ShutdownOnUIThread(); 183 pref_content_settings_provider.ShutdownOnUIThread();
184 } 184 }
185 185
186 // Test for regression in which the PrefProvider modified the user pref store 186 // Test for regression in which the PrefProvider modified the user pref store
187 // of the OTR unintentionally: http://crbug.com/74466. 187 // of the OTR unintentionally: http://crbug.com/74466.
188 TEST_F(PrefProviderTest, Incognito) { 188 TEST_F(PrefProviderTest, Incognito) {
189 PersistentPrefStore* user_prefs = new TestingPrefStore(); 189 PersistentPrefStore* user_prefs = new TestingPrefStore();
190 OverlayPersistentPrefStore* otr_user_prefs = 190 IncognitoUserPrefStore* otr_user_prefs =
191 new OverlayPersistentPrefStore(user_prefs); 191 new IncognitoUserPrefStore(user_prefs);
192 192
193 PrefServiceMockBuilder builder; 193 PrefServiceMockBuilder builder;
194 PrefService* regular_prefs = builder.WithUserPrefs(user_prefs).Create(); 194 PrefService* regular_prefs = builder.WithUserPrefs(user_prefs).Create();
195 195
196 Profile::RegisterUserPrefs(regular_prefs); 196 Profile::RegisterUserPrefs(regular_prefs);
197 browser::RegisterUserPrefs(regular_prefs); 197 browser::RegisterUserPrefs(regular_prefs);
198 198
199 PrefService* otr_prefs = builder.WithUserPrefs(otr_user_prefs).Create(); 199 PrefService* otr_prefs = builder.WithUserPrefs(otr_user_prefs).Create();
200 200
201 Profile::RegisterUserPrefs(otr_prefs); 201 Profile::RegisterUserPrefs(otr_prefs);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 EXPECT_EQ(CONTENT_SETTING_BLOCK, provider.GetContentSetting( 371 EXPECT_EQ(CONTENT_SETTING_BLOCK, provider.GetContentSetting(
372 GURL("http://www.example.com"), 372 GURL("http://www.example.com"),
373 GURL("http://www.example.com"), 373 GURL("http://www.example.com"),
374 CONTENT_SETTINGS_TYPE_POPUPS, 374 CONTENT_SETTINGS_TYPE_POPUPS,
375 "")); 375 ""));
376 376
377 provider.ShutdownOnUIThread(); 377 provider.ShutdownOnUIThread();
378 } 378 }
379 379
380 } // namespace content_settings 380 } // namespace content_settings
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/configuration_policy_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698