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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 13 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
14 #include "chrome/browser/content_settings/content_settings_utils.h" | 14 #include "chrome/browser/content_settings/content_settings_utils.h" |
15 #include "chrome/browser/prefs/browser_prefs.h" | 15 #include "chrome/browser/prefs/browser_prefs.h" |
16 #include "chrome/browser/prefs/default_pref_store.h" | 16 #include "chrome/browser/prefs/default_pref_store.h" |
17 #include "chrome/browser/prefs/incognito_user_pref_store.h" | 17 #include "chrome/browser/prefs/overlay_user_pref_store.h" |
18 #include "chrome/browser/prefs/pref_change_registrar.h" | 18 #include "chrome/browser/prefs/pref_change_registrar.h" |
19 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
20 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 20 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
21 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
22 #include "chrome/browser/prefs/testing_pref_store.h" | 22 #include "chrome/browser/prefs/testing_pref_store.h" |
23 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
27 #include "chrome/test/base/testing_pref_service.h" | 27 #include "chrome/test/base/testing_pref_service.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 "", | 142 "", |
143 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); | 143 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); |
144 | 144 |
145 pref_content_settings_provider.ShutdownOnUIThread(); | 145 pref_content_settings_provider.ShutdownOnUIThread(); |
146 } | 146 } |
147 | 147 |
148 // Test for regression in which the PrefProvider modified the user pref store | 148 // Test for regression in which the PrefProvider modified the user pref store |
149 // of the OTR unintentionally: http://crbug.com/74466. | 149 // of the OTR unintentionally: http://crbug.com/74466. |
150 TEST_F(PrefProviderTest, Incognito) { | 150 TEST_F(PrefProviderTest, Incognito) { |
151 PersistentPrefStore* user_prefs = new TestingPrefStore(); | 151 PersistentPrefStore* user_prefs = new TestingPrefStore(); |
152 IncognitoUserPrefStore* otr_user_prefs = | 152 OverlayUserPrefStore* otr_user_prefs = |
153 new IncognitoUserPrefStore(user_prefs); | 153 new OverlayUserPrefStore(user_prefs); |
154 | 154 |
155 PrefServiceMockBuilder builder; | 155 PrefServiceMockBuilder builder; |
156 PrefService* regular_prefs = builder.WithUserPrefs(user_prefs).Create(); | 156 PrefService* regular_prefs = builder.WithUserPrefs(user_prefs).Create(); |
157 | 157 |
158 Profile::RegisterUserPrefs(regular_prefs); | 158 Profile::RegisterUserPrefs(regular_prefs); |
159 browser::RegisterUserPrefs(regular_prefs); | 159 browser::RegisterUserPrefs(regular_prefs); |
160 | 160 |
161 PrefService* otr_prefs = builder.WithUserPrefs(otr_user_prefs).Create(); | 161 PrefService* otr_prefs = builder.WithUserPrefs(otr_user_prefs).Create(); |
162 | 162 |
163 Profile::RegisterUserPrefs(otr_prefs); | 163 Profile::RegisterUserPrefs(otr_prefs); |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 DictionaryValue* mutable_settings = update.Get(); | 865 DictionaryValue* mutable_settings = update.Get(); |
866 mutable_settings->SetWithoutPathExpansion("www.example.com,*", | 866 mutable_settings->SetWithoutPathExpansion("www.example.com,*", |
867 new base::DictionaryValue()); | 867 new base::DictionaryValue()); |
868 } | 868 } |
869 EXPECT_TRUE(observer.notification_received()); | 869 EXPECT_TRUE(observer.notification_received()); |
870 | 870 |
871 provider.ShutdownOnUIThread(); | 871 provider.ShutdownOnUIThread(); |
872 } | 872 } |
873 | 873 |
874 } // namespace content_settings | 874 } // namespace content_settings |
OLD | NEW |