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

Side by Side Diff: chrome/browser/content_settings/content_settings_default_provider_unittest.cc

Issue 1605453003: Ensure content settings aren't persisted in the guest profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698