Commit 0aa7262e authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Remove extra IsSameProfile check and add browser_test.

Extra IsSameProfile is removed from ChromeExtensionsBrowserClient and
a browser test is added to ensure it's working as expected.

Bug: 1033903, 727487
Change-Id: I7245f8b9491582674a1428d0f09500e4e443ba39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2164627Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarBrandon Tolsch <btolsch@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762724}
parent 4423a3b1
......@@ -130,13 +130,7 @@ bool ChromeExtensionsBrowserClient::IsSameContext(
content::BrowserContext* second) {
Profile* first_profile = Profile::FromBrowserContext(first);
Profile* second_profile = Profile::FromBrowserContext(second);
// TODO(crbug.com/727487): We need to check both ways because of offscreen
// presentation profiles, which are not registered with the original profile.
// This can be reverted to check just first->IsSameProfile(second) when Bug
// 727487 is fixed and presentations have a proper profile type. See Bug
// 664351 for background.
return first_profile->IsSameProfile(second_profile) ||
second_profile->IsSameProfile(first_profile);
return first_profile->IsSameProfile(second_profile);
}
bool ChromeExtensionsBrowserClient::HasOffTheRecordContext(
......
......@@ -816,3 +816,22 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, TestGetAllOffTheRecordProfiles) {
EXPECT_TRUE(base::Contains(all_otrs, otr_profile2));
EXPECT_TRUE(base::Contains(all_otrs, incognito_profile));
}
// Tests Profile::IsSameProfile
IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, TestIsSameProfile) {
Profile::OTRProfileID otr_profile_id("profile::otr");
Profile* regular_profile = browser()->profile();
Profile* otr_profile =
regular_profile->GetOffTheRecordProfile(otr_profile_id);
Profile* incognito_profile = regular_profile->GetPrimaryOTRProfile();
EXPECT_TRUE(regular_profile->IsSameProfile(otr_profile));
EXPECT_TRUE(otr_profile->IsSameProfile(regular_profile));
EXPECT_TRUE(regular_profile->IsSameProfile(incognito_profile));
EXPECT_TRUE(incognito_profile->IsSameProfile(regular_profile));
EXPECT_FALSE(incognito_profile->IsSameProfile(otr_profile));
EXPECT_FALSE(otr_profile->IsSameProfile(incognito_profile));
}
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