Commit fc6a6f88 authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Update TestingProfile for ephemeral Guest profiles.

Updates TestingProfile for better support of ephemeral Guest profiles.

Please see go/ephemeral-guest-profiles for more context.

Bug: 1125474
Change-Id: Ibfce3a9df1ab3b17a517b05635c11a4d4dce86b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494721Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820800}
parent 7f3e4855
......@@ -617,7 +617,13 @@ TEST_P(ProfileManagerGuestTest, GetLastUsedProfileAllowedByPolicy) {
Profile* profile = profile_manager->GetLastUsedProfileAllowedByPolicy();
ASSERT_TRUE(profile);
EXPECT_TRUE(profile->IsOffTheRecord());
if (IsEphemeral()) {
EXPECT_TRUE(profile->IsEphemeralGuestProfile());
EXPECT_FALSE(profile->IsOffTheRecord());
} else {
EXPECT_TRUE(profile->IsGuestSession());
EXPECT_TRUE(profile->IsOffTheRecord());
}
}
#if defined(OS_CHROMEOS)
......
......@@ -640,6 +640,10 @@ Profile* TestingProfile::GetOffTheRecordProfile(
if (IsOffTheRecord())
return original_profile_->GetOffTheRecordProfile(otr_profile_id);
// Ephemeral Guest profiles do not support Incognito.
if (IsEphemeralGuestProfile() && otr_profile_id == OTRProfileID::PrimaryID())
return nullptr;
if (!HasOffTheRecordProfile(otr_profile_id)) {
TestingProfile::Builder builder;
if (IsGuestSession() && otr_profile_id == OTRProfileID::PrimaryID())
......@@ -979,7 +983,11 @@ bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) {
}
bool TestingProfile::IsGuestSession() const {
return guest_session_;
return guest_session_ && !IsEphemeralGuestProfileEnabled();
}
bool TestingProfile::IsEphemeralGuestProfile() const {
return guest_session_ && IsEphemeralGuestProfileEnabled();
}
bool TestingProfile::IsNewProfile() const {
......
......@@ -367,6 +367,7 @@ class TestingProfile : public Profile {
void set_last_selected_directory(const base::FilePath& path) override;
bool WasCreatedByVersionOrLater(const std::string& version) override;
bool IsGuestSession() const override;
bool IsEphemeralGuestProfile() const override;
bool IsNewProfile() const override;
void SetExitType(ExitType exit_type) override {}
ExitType GetLastSessionExitType() const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment