Commit 445c45ec authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Update OffTheRecord profile API in net tests.

Profile API is being updated (issue 1033903) and the usage of
GetOffTheRecordProfile and HasOffTheRecordProfile without argument is
getting deprecated. Use cases of this call that ONLY refer to incognito
or guest mode can use [Get/Has]PrimaryOTRProfile() instead.

c/b/net tests are updated to use the new API, and a test is expanded
to cover non-primary OTRs.

Bug: 1060940
Change-Id: I7962466b337c053c912a617e827af8008639fb69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2211345
Commit-Queue: Zhongyi Shi <zhongyi@chromium.org>
Reviewed-by: default avatarZhongyi Shi <zhongyi@chromium.org>
Auto-Submit: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772463}
parent 64a1edaf
......@@ -434,7 +434,7 @@ class NetworkContextConfigurationBrowserTest
case NetworkContextType::kOnDiskAppWithIncognitoProfile:
// Incognito actually uses the non-incognito prefs, so this should end
// up being the same pref store as in the KProfile case.
return browser()->profile()->GetOffTheRecordProfile()->GetPrefs();
return browser()->profile()->GetPrimaryOTRProfile()->GetPrefs();
}
}
......@@ -463,7 +463,7 @@ class NetworkContextConfigurationBrowserTest
case NetworkContextType::kIncognitoProfile:
case NetworkContextType::kOnDiskAppWithIncognitoProfile:
ProfileNetworkContextServiceFactory::GetForContext(
browser()->profile()->GetOffTheRecordProfile())
browser()->profile()->GetPrimaryOTRProfile())
->FlushProxyConfigMonitorForTesting();
break;
}
......
......@@ -296,10 +296,14 @@ class AmbientAuthenticationTestWithPolicy
service->GetInteger(prefs::kAmbientAuthenticationInPrivateModesEnabled);
Profile* regular_profile = browser()->profile();
Profile* incognito_profile = regular_profile->GetOffTheRecordProfile();
Profile* incognito_profile = regular_profile->GetPrimaryOTRProfile();
Profile* non_primary_otr_profile = regular_profile->GetOffTheRecordProfile(
Profile::OTRProfileID("Test::AmbientAuthentication"));
EXPECT_TRUE(AmbientAuthenticationTestHelper::IsAmbientAuthAllowedForProfile(
regular_profile));
EXPECT_TRUE(AmbientAuthenticationTestHelper::IsAmbientAuthAllowedForProfile(
non_primary_otr_profile));
EXPECT_EQ(AmbientAuthenticationTestHelper::IsAmbientAuthAllowedForProfile(
incognito_profile),
AmbientAuthenticationTestHelper::IsIncognitoAllowedInFeature(
......
......@@ -544,7 +544,7 @@ TEST_F(TrialComparisonCertVerifierControllerTest,
scoped_feature_ = std::make_unique<base::test::ScopedFeatureList>();
scoped_feature_->InitAndEnableFeature(
features::kCertDualVerificationTrialFeature);
CreateController(profile()->GetOffTheRecordProfile());
CreateController(profile()->GetPrimaryOTRProfile());
EXPECT_FALSE(trial_controller().IsAllowed());
......
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