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

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

Issue 556173002: Ensure incognito TestingProfiles are incognito for their whole lifetime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments Created 6 years, 3 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
OLDNEW
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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 PrefServiceSyncable* otr_prefs = 151 PrefServiceSyncable* otr_prefs =
152 otr_factory.CreateSyncable(otr_registry.get()).release(); 152 otr_factory.CreateSyncable(otr_registry.get()).release();
153 153
154 chrome::RegisterUserProfilePrefs(otr_registry.get()); 154 chrome::RegisterUserProfilePrefs(otr_registry.get());
155 155
156 TestingProfile::Builder profile_builder; 156 TestingProfile::Builder profile_builder;
157 profile_builder.SetPrefService(make_scoped_ptr(regular_prefs)); 157 profile_builder.SetPrefService(make_scoped_ptr(regular_prefs));
158 scoped_ptr<TestingProfile> profile = profile_builder.Build(); 158 scoped_ptr<TestingProfile> profile = profile_builder.Build();
159 159
160 TestingProfile::Builder otr_profile_builder; 160 TestingProfile::Builder otr_profile_builder;
161 otr_profile_builder.SetIncognito();
162 otr_profile_builder.SetPrefService(make_scoped_ptr(otr_prefs)); 161 otr_profile_builder.SetPrefService(make_scoped_ptr(otr_prefs));
163 scoped_ptr<TestingProfile> otr_profile(otr_profile_builder.Build()); 162 otr_profile_builder.BuildIncognito(profile.get());
164 profile->SetOffTheRecordProfile(otr_profile.PassAs<Profile>());
165 163
166 PrefProvider pref_content_settings_provider(regular_prefs, false); 164 PrefProvider pref_content_settings_provider(regular_prefs, false);
167 PrefProvider pref_content_settings_provider_incognito(otr_prefs, true); 165 PrefProvider pref_content_settings_provider_incognito(otr_prefs, true);
168 ContentSettingsPattern pattern = 166 ContentSettingsPattern pattern =
169 ContentSettingsPattern::FromString("[*.]example.com"); 167 ContentSettingsPattern::FromString("[*.]example.com");
170 pref_content_settings_provider.SetWebsiteSetting( 168 pref_content_settings_provider.SetWebsiteSetting(
171 pattern, 169 pattern,
172 pattern, 170 pattern,
173 CONTENT_SETTINGS_TYPE_IMAGES, 171 CONTENT_SETTINGS_TYPE_IMAGES,
174 std::string(), 172 std::string(),
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 base::Time second = pref_content_settings_provider.GetLastUsage( 470 base::Time second = pref_content_settings_provider.GetLastUsage(
473 pattern, pattern, CONTENT_SETTINGS_TYPE_GEOLOCATION); 471 pattern, pattern, CONTENT_SETTINGS_TYPE_GEOLOCATION);
474 472
475 base::TimeDelta delta = second - first; 473 base::TimeDelta delta = second - first;
476 EXPECT_EQ(delta.InSeconds(), 10); 474 EXPECT_EQ(delta.InSeconds(), 10);
477 475
478 pref_content_settings_provider.ShutdownOnUIThread(); 476 pref_content_settings_provider.ShutdownOnUIThread();
479 } 477 }
480 478
481 } // namespace content_settings 479 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698