diff options
author | tapted <tapted@chromium.org> | 2014-09-15 16:49:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-15 23:51:58 +0000 |
commit | 1ab9b709cb4d691f667c843040b65b46a9c82ebd (patch) | |
tree | 21cfd5195a404967e7cadb577dccd23c3210cefb /chrome/browser/chromeos/power | |
parent | 24f900df2092632a68d22f06d61ac828ea6b6d63 (diff) | |
download | chromium_src-1ab9b709cb4d691f667c843040b65b46a9c82ebd.zip chromium_src-1ab9b709cb4d691f667c843040b65b46a9c82ebd.tar.gz chromium_src-1ab9b709cb4d691f667c843040b65b46a9c82ebd.tar.bz2 |
Ensure incognito TestingProfiles are incognito for their whole lifetime.
Otherwise keyed services see different profiles in unit_tests at
different times since the incognito->GetOriginalProfile() changes. This
is causing release code to pick up unnecessary workarounds to keep
unit_tests green in try runs.
The fix is achieved by adding `TestingProfile::Builder::BuildIncognito`,
which differs from `Build` by requiring an |original_profile| argument,
which will own the incognito profile (so no need to return scoped_ptr).
This simplifies a lot of call sites, since they no longer need to do a
scoped_ptr dance of their own.
BUG=277296
Review URL: https://codereview.chromium.org/556173002
Cr-Commit-Position: refs/heads/master@{#294931}
Diffstat (limited to 'chrome/browser/chromeos/power')
-rw-r--r-- | chrome/browser/chromeos/power/power_prefs_unittest.cc | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/chrome/browser/chromeos/power/power_prefs_unittest.cc b/chrome/browser/chromeos/power/power_prefs_unittest.cc index 061dfbf..4a46b491 100644 --- a/chrome/browser/chromeos/power/power_prefs_unittest.cc +++ b/chrome/browser/chromeos/power/power_prefs_unittest.cc @@ -167,15 +167,8 @@ TEST_F(PowerPrefsTest, LoginScreen) { builder.SetPath( profile_manager_.profiles_dir().AppendASCII(chrome::kInitialProfile)); builder.SetPrefService(login_profile_prefs.PassAs<PrefServiceSyncable>()); - builder.SetIncognito(); - scoped_ptr<TestingProfile> login_profile_owner(builder.Build()); - - TestingProfile* login_profile = login_profile_owner.get(); - TestingProfile* login_profile_parent = profile_manager_.CreateTestingProfile( - chrome::kInitialProfile); - login_profile_parent->SetOffTheRecordProfile( - login_profile_owner.PassAs<Profile>()); - login_profile->SetOriginalProfile(login_profile_parent); + TestingProfile* login_profile = builder.BuildIncognito( + profile_manager_.CreateTestingProfile(chrome::kInitialProfile)); // Inform power_prefs_ that the login screen is being shown. power_prefs_->Observe(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |