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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
9 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
10 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 10 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 std::string(), true /* include_incognito */)); | 182 std::string(), true /* include_incognito */)); |
183 | 183 |
184 // Changing content settings on the incognito provider should be ignored. | 184 // Changing content settings on the incognito provider should be ignored. |
185 scoped_ptr<base::Value> value( | 185 scoped_ptr<base::Value> value( |
186 new base::FundamentalValue(CONTENT_SETTING_ALLOW)); | 186 new base::FundamentalValue(CONTENT_SETTING_ALLOW)); |
187 bool owned = otr_provider.SetWebsiteSetting( | 187 bool owned = otr_provider.SetWebsiteSetting( |
188 ContentSettingsPattern::Wildcard(), | 188 ContentSettingsPattern::Wildcard(), |
189 ContentSettingsPattern::Wildcard(), | 189 ContentSettingsPattern::Wildcard(), |
190 CONTENT_SETTINGS_TYPE_COOKIES, | 190 CONTENT_SETTINGS_TYPE_COOKIES, |
191 std::string(), | 191 std::string(), |
192 value.get()); | 192 value.release()); |
193 EXPECT_FALSE(owned); | 193 EXPECT_TRUE(owned); |
194 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 194 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
195 TestUtils::GetContentSetting( | 195 TestUtils::GetContentSetting( |
196 &provider_, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, | 196 &provider_, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, |
197 std::string(), false /* include_incognito */)); | 197 std::string(), false /* include_incognito */)); |
198 | 198 |
199 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 199 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
200 TestUtils::GetContentSetting( | 200 TestUtils::GetContentSetting( |
201 &otr_provider, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, | 201 &otr_provider, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, |
202 std::string(), true /* include_incognito */)); | 202 std::string(), true /* include_incognito */)); |
203 | 203 |
204 // Check that new OTR DefaultProviders also inherit the correct value. | 204 // Check that new OTR DefaultProviders also inherit the correct value. |
205 DefaultProvider otr_provider2(profile_.GetPrefs(), true /* incognito */); | 205 DefaultProvider otr_provider2(profile_.GetPrefs(), true /* incognito */); |
206 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 206 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
207 TestUtils::GetContentSetting( | 207 TestUtils::GetContentSetting( |
208 &otr_provider2, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, | 208 &otr_provider2, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, |
209 std::string(), true /* include_incognito */)); | 209 std::string(), true /* include_incognito */)); |
210 | 210 |
211 otr_provider.ShutdownOnUIThread(); | 211 otr_provider.ShutdownOnUIThread(); |
212 otr_provider2.ShutdownOnUIThread(); | 212 otr_provider2.ShutdownOnUIThread(); |
213 } | 213 } |
214 | 214 |
215 } // namespace content_settings | 215 } // namespace content_settings |
OLD | NEW |