OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 138 |
139 Profile::RegisterUserPrefs(regular_prefs); | 139 Profile::RegisterUserPrefs(regular_prefs); |
140 chrome::RegisterUserPrefs(regular_prefs); | 140 chrome::RegisterUserPrefs(regular_prefs); |
141 | 141 |
142 builder.WithUserPrefs(otr_user_prefs); | 142 builder.WithUserPrefs(otr_user_prefs); |
143 PrefServiceSyncable* otr_prefs = builder.CreateSyncable(); | 143 PrefServiceSyncable* otr_prefs = builder.CreateSyncable(); |
144 | 144 |
145 Profile::RegisterUserPrefs(otr_prefs); | 145 Profile::RegisterUserPrefs(otr_prefs); |
146 chrome::RegisterUserPrefs(otr_prefs); | 146 chrome::RegisterUserPrefs(otr_prefs); |
147 | 147 |
148 TestingProfile profile; | 148 TestingProfile::Builder profile_builder; |
149 TestingProfile* otr_profile = new TestingProfile; | 149 profile_builder.SetPrefService(make_scoped_ptr(regular_prefs).Pass()); |
battre
2013/02/07 09:45:08
No need for calling ".Pass()"
Joe Thomas
2013/02/07 18:30:30
Done.
| |
150 profile.SetOffTheRecordProfile(otr_profile); | 150 scoped_ptr<TestingProfile> profile = profile_builder.Build(); |
151 profile.SetPrefService(regular_prefs); | 151 |
152 TestingProfile::Builder otr_profile_builder; | |
153 otr_profile_builder.SetPrefService(make_scoped_ptr(otr_prefs).Pass()); | |
battre
2013/02/07 09:45:08
No need for calling ".Pass()"
Joe Thomas
2013/02/07 18:30:30
Done.
| |
154 TestingProfile* otr_profile = otr_profile_builder.Build().release(); | |
155 | |
152 otr_profile->set_incognito(true); | 156 otr_profile->set_incognito(true); |
153 otr_profile->SetPrefService(otr_prefs); | 157 profile->SetOffTheRecordProfile(otr_profile); |
battre
2013/02/07 09:45:08
I think that this would be slightly cleaner:
Test
Joe Thomas
2013/02/07 14:22:54
I had tried it already and it was causing a DCHECK
| |
154 | 158 |
155 PrefProvider pref_content_settings_provider(regular_prefs, false); | 159 PrefProvider pref_content_settings_provider(regular_prefs, false); |
156 PrefProvider pref_content_settings_provider_incognito(otr_prefs, true); | 160 PrefProvider pref_content_settings_provider_incognito(otr_prefs, true); |
157 ContentSettingsPattern pattern = | 161 ContentSettingsPattern pattern = |
158 ContentSettingsPattern::FromString("[*.]example.com"); | 162 ContentSettingsPattern::FromString("[*.]example.com"); |
159 pref_content_settings_provider.SetWebsiteSetting( | 163 pref_content_settings_provider.SetWebsiteSetting( |
160 pattern, | 164 pattern, |
161 pattern, | 165 pattern, |
162 CONTENT_SETTINGS_TYPE_IMAGES, | 166 CONTENT_SETTINGS_TYPE_IMAGES, |
163 "", | 167 "", |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 DictionaryValue* mutable_settings = update.Get(); | 387 DictionaryValue* mutable_settings = update.Get(); |
384 mutable_settings->SetWithoutPathExpansion("www.example.com,*", | 388 mutable_settings->SetWithoutPathExpansion("www.example.com,*", |
385 new base::DictionaryValue()); | 389 new base::DictionaryValue()); |
386 } | 390 } |
387 EXPECT_TRUE(observer.notification_received()); | 391 EXPECT_TRUE(observer.notification_received()); |
388 | 392 |
389 provider.ShutdownOnUIThread(); | 393 provider.ShutdownOnUIThread(); |
390 } | 394 } |
391 | 395 |
392 } // namespace content_settings | 396 } // namespace content_settings |
OLD | NEW |