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

Unified Diff: chrome/browser/ui/browser_command_controller_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: Fix CrOS 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/ui/browser_command_controller_unittest.cc
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc
index 9fe9857ce6165963628a0991d75ae39189b87c40..a7964372f2f877dd543fc2d6187d1475df07fdda 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -246,16 +246,19 @@ TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledInGuestMode) {
ASSERT_TRUE(testing_profile_manager.SetUp());
// Set up guest a profile.
+ scoped_ptr<TestingProfile> original_profile =
+ TestingProfile::Builder().Build();
TestingProfile::Builder guest_builder;
- guest_builder.SetIncognito(); // Guest profiles are off the record.
guest_builder.SetGuestSession();
guest_builder.SetPath(ProfileManager::GetGuestProfilePath());
- scoped_ptr<TestingProfile>guest_profile = guest_builder.Build();
+ // Browsers in Guest mode must be off the record profiles.
+ TestingProfile* guest_profile =
+ guest_builder.BuildIncognito(original_profile.get());
ASSERT_TRUE(guest_profile->IsGuestSession());
// Create a new browser based on the guest profile.
- Browser::CreateParams profile_params(guest_profile.get(),
+ Browser::CreateParams profile_params(guest_profile,
chrome::GetActiveDesktop());
scoped_ptr<Browser> guest_browser(
chrome::CreateBrowserWithTestWindowForParams(&profile_params));
@@ -430,14 +433,10 @@ TEST_F(BrowserCommandControllerFullscreenTest,
TEST_F(BrowserCommandControllerTest, IncognitoModeOnSigninAllowedPrefChange) {
// Set up a profile with an off the record profile.
- TestingProfile::Builder builder;
- builder.SetIncognito();
- scoped_ptr<TestingProfile> profile2(builder.Build());
- TestingProfile::Builder builder2;
- scoped_ptr<TestingProfile> profile1 = builder2.Build();
- profile2->SetOriginalProfile(profile1.get());
+ scoped_ptr<TestingProfile> profile1 = TestingProfile::Builder().Build();
+ Profile* profile2 = profile1->GetOffTheRecordProfile();
+
EXPECT_EQ(profile2->GetOriginalProfile(), profile1.get());
- profile1->SetOffTheRecordProfile(profile2.PassAs<Profile>());
// Create a new browser based on the off the record profile.
Browser::CreateParams profile_params(profile1->GetOffTheRecordProfile(),

Powered by Google App Engine
This is Rietveld 408576698