Commit 20d7831d authored by Ramin Halavati's avatar Ramin Halavati Committed by Commit Bot

Update OffTheRecord profile tests in LoadingPredictorConfig.

OffTheRecord profile use in LoadingPredictorConfig unittest is updated
and a test is added for non-primary OffTheRecord profiles.

Bug: 1060940
Change-Id: Ieba3efeb75e7af40b356d9e656b8d8246b4d7a80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212161
Auto-Submit: Ramin Halavati <rhalavati@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771038}
parent 990284c4
...@@ -57,15 +57,27 @@ TEST_F(LoadingPredictorConfigTest, FeatureEnabledAndPrefDisabled) { ...@@ -57,15 +57,27 @@ TEST_F(LoadingPredictorConfigTest, FeatureEnabledAndPrefDisabled) {
EXPECT_FALSE(IsPreconnectAllowed(profile())); EXPECT_FALSE(IsPreconnectAllowed(profile()));
} }
TEST_F(LoadingPredictorConfigTest, OffTheRecordProfile) { TEST_F(LoadingPredictorConfigTest, IncognitoProfile) {
base::test::ScopedFeatureList feature_list; base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(predictors::kSpeculativePreconnectFeature); feature_list.InitAndEnableFeature(predictors::kSpeculativePreconnectFeature);
SetPreference(chrome_browser_net::NETWORK_PREDICTION_ALWAYS); SetPreference(chrome_browser_net::NETWORK_PREDICTION_ALWAYS);
Profile* incognito = profile()->GetOffTheRecordProfile(); Profile* incognito = profile()->GetPrimaryOTRProfile();
EXPECT_TRUE(IsPreconnectFeatureEnabled()); EXPECT_TRUE(IsPreconnectFeatureEnabled());
EXPECT_FALSE(IsLoadingPredictorEnabled(incognito)); EXPECT_FALSE(IsLoadingPredictorEnabled(incognito));
EXPECT_TRUE(IsPreconnectAllowed(incognito)); EXPECT_TRUE(IsPreconnectAllowed(incognito));
} }
TEST_F(LoadingPredictorConfigTest, NonPrimaryOffTheRecordProfile) {
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(predictors::kSpeculativePreconnectFeature);
SetPreference(chrome_browser_net::NETWORK_PREDICTION_ALWAYS);
Profile* otr_profile = profile()->GetOffTheRecordProfile(
Profile::OTRProfileID("Test::LoadingPredictorConfigTest"));
EXPECT_TRUE(IsPreconnectFeatureEnabled());
EXPECT_FALSE(IsLoadingPredictorEnabled(otr_profile));
EXPECT_TRUE(IsPreconnectAllowed(otr_profile));
}
} // namespace predictors } // namespace predictors
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