OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |