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

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: 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
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/mock_settings_observer.h" 9 #include "chrome/browser/content_settings/mock_settings_observer.h"
10 #include "chrome/browser/prefs/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
11 #include "chrome/browser/prefs/default_pref_store.h" 11 #include "chrome/browser/prefs/default_pref_store.h"
12 #include "chrome/browser/prefs/overlay_persistent_pref_store.h" 12 #include "chrome/browser/prefs/incognito_user_pref_store.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/prefs/pref_service_mock_builder.h" 14 #include "chrome/browser/prefs/pref_service_mock_builder.h"
15 #include "chrome/browser/prefs/testing_pref_store.h" 15 #include "chrome/browser/prefs/testing_pref_store.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "chrome/test/testing_browser_process_test.h" 19 #include "chrome/test/testing_browser_process_test.h"
20 #include "chrome/test/testing_pref_service.h" 20 #include "chrome/test/testing_pref_service.h"
21 #include "chrome/test/testing_profile.h" 21 #include "chrome/test/testing_profile.h"
22 #include "content/browser/browser_thread.h" 22 #include "content/browser/browser_thread.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 "", 189 "",
190 CONTENT_SETTING_ALLOW); 190 CONTENT_SETTING_ALLOW);
191 191
192 pref_content_settings_provider.ShutdownOnUIThread(); 192 pref_content_settings_provider.ShutdownOnUIThread();
193 } 193 }
194 194
195 // Test for regression in which the PrefProvider modified the user pref store 195 // Test for regression in which the PrefProvider modified the user pref store
196 // of the OTR unintentionally: http://crbug.com/74466. 196 // of the OTR unintentionally: http://crbug.com/74466.
197 TEST_F(PrefProviderTest, Incognito) { 197 TEST_F(PrefProviderTest, Incognito) {
198 PersistentPrefStore* user_prefs = new TestingPrefStore(); 198 PersistentPrefStore* user_prefs = new TestingPrefStore();
199 OverlayPersistentPrefStore* otr_user_prefs = 199 IncognitoUserPrefStore* otr_user_prefs =
200 new OverlayPersistentPrefStore(user_prefs); 200 new IncognitoUserPrefStore(user_prefs);
201 201
202 PrefServiceMockBuilder builder; 202 PrefServiceMockBuilder builder;
203 PrefService* regular_prefs = builder.WithUserPrefs(user_prefs).Create(); 203 PrefService* regular_prefs = builder.WithUserPrefs(user_prefs).Create();
204 204
205 Profile::RegisterUserPrefs(regular_prefs); 205 Profile::RegisterUserPrefs(regular_prefs);
206 browser::RegisterUserPrefs(regular_prefs); 206 browser::RegisterUserPrefs(regular_prefs);
207 207
208 PrefService* otr_prefs = builder.WithUserPrefs(otr_user_prefs).Create(); 208 PrefService* otr_prefs = builder.WithUserPrefs(otr_user_prefs).Create();
209 209
210 Profile::RegisterUserPrefs(otr_prefs); 210 Profile::RegisterUserPrefs(otr_prefs);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 EXPECT_EQ(CONTENT_SETTING_BLOCK, provider.GetContentSetting( 386 EXPECT_EQ(CONTENT_SETTING_BLOCK, provider.GetContentSetting(
387 GURL("http://www.example.com"), 387 GURL("http://www.example.com"),
388 GURL("http://www.example.com"), 388 GURL("http://www.example.com"),
389 CONTENT_SETTINGS_TYPE_POPUPS, 389 CONTENT_SETTINGS_TYPE_POPUPS,
390 "")); 390 ""));
391 391
392 provider.ShutdownOnUIThread(); 392 provider.ShutdownOnUIThread();
393 } 393 }
394 394
395 } // namespace content_settings 395 } // namespace content_settings
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/incognito_user_pref_store.h » ('j') | chrome/browser/prefs/incognito_user_pref_store.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698