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

Unified Diff: chrome/browser/password_manager/password_manager_internals_service_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_manager_internals_service_unittest.cc
diff --git a/chrome/browser/password_manager/password_manager_internals_service_unittest.cc b/chrome/browser/password_manager/password_manager_internals_service_unittest.cc
index 472b11797d6f35fc4e48d0d503bcf0aabb468dcd..82b7ffe9c49d7dd4c324316abf3a345534855c8b 100644
--- a/chrome/browser/password_manager/password_manager_internals_service_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_internals_service_unittest.cc
@@ -29,8 +29,6 @@ enum ProfileType { NORMAL_PROFILE, INCOGNITO_PROFILE };
scoped_ptr<TestingProfile> CreateProfile(ProfileType type) {
TestingProfile::Builder builder;
- if (type == INCOGNITO_PROFILE)
- builder.SetIncognito();
scoped_ptr<TestingProfile> profile(builder.Build());
#if !defined(NDEBUG)
// During the test cases, the profiles may get created on the same address. To
@@ -38,6 +36,10 @@ scoped_ptr<TestingProfile> CreateProfile(ProfileType type) {
// See declaration of MarkBrowserContextLiveForTesting for more details.
BrowserContextDependencyManager::GetInstance()
->MarkBrowserContextLiveForTesting(profile.get());
+ if (type == INCOGNITO_PROFILE) {
+ BrowserContextDependencyManager::GetInstance()
+ ->MarkBrowserContextLiveForTesting(profile->GetOffTheRecordProfile());
+ }
#endif
return profile.Pass();
}
@@ -69,9 +71,11 @@ TEST(PasswordManagerInternalsServiceTest, ServiceActiveNonIncognito) {
TEST(PasswordManagerInternalsServiceTest, ServiceNotActiveIncognito) {
scoped_ptr<TestingProfile> profile(CreateProfile(INCOGNITO_PROFILE));
ASSERT_TRUE(profile);
+
+ Profile* incognito_profile = profile->GetOffTheRecordProfile();
PasswordManagerInternalsService* service =
PasswordManagerInternalsServiceFactory::GetForBrowserContext(
- profile.get());
+ incognito_profile);
// BrowserContextKeyedBaseFactory::GetBrowserContextToUse should return NULL
// for |profile|, because |profile| is incognito. Therefore the returned
// |service| should also be NULL.

Powered by Google App Engine
This is Rietveld 408576698