| Index: components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
|
| diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
|
| index 8f75b85f02320d7b629536c1ee901f443db8b489..592d21f5d4c49963d34c9d1c7816778e3d8c9630 100644
|
| --- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
|
| +++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
|
| @@ -469,7 +469,9 @@ class ContentSubresourceFilterDriverFactoryTest
|
|
|
| private:
|
| static bool expected_measure_performance() {
|
| - const double rate = GetActiveConfiguration().performance_measurement_rate;
|
| + const double rate = GetActiveConfigurations()
|
| + ->the_one_and_only()
|
| + .performance_measurement_rate;
|
| // Note: The case when 0 < rate < 1 is not deterministic, don't test it.
|
| EXPECT_TRUE(rate == 0 || rate == 1);
|
| return rate == 1;
|
| @@ -530,7 +532,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| base::FeatureList::OVERRIDE_DISABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeAllSites,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| const GURL url(kExampleUrlWithParams);
|
| NavigateAndExpectActivation({true}, {url}, NO_REDIRECTS_HIT,
|
| ActivationDecision::ACTIVATION_DISABLED);
|
| @@ -545,7 +546,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, NoActivationWhenNoMatch) {
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED);
|
| }
|
| @@ -558,7 +558,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeAllSites);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| EmulateInPageNavigation({false}, EMPTY, ActivationDecision::ACTIVATED);
|
| }
|
|
|
| @@ -569,7 +568,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| EmulateInPageNavigation({true}, NO_REDIRECTS_HIT,
|
| ActivationDecision::ACTIVATED);
|
| }
|
| @@ -582,7 +580,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial,
|
| "1" /* performance_measurement_rate */);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| EmulateInPageNavigation({true}, NO_REDIRECTS_HIT,
|
| ActivationDecision::ACTIVATED);
|
| }
|
| @@ -592,7 +589,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, FailedNavigation) {
|
| testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeAllSites);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| const GURL url(kExampleUrl);
|
| NavigateAndExpectActivation({false}, {url}, EMPTY,
|
| ActivationDecision::ACTIVATED);
|
| @@ -607,7 +603,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, RedirectPatternTest) {
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| struct RedirectRedirectChainMatchPatternTestData {
|
| std::vector<bool> blacklisted_urls;
|
| std::vector<GURL> navigation_chain;
|
| @@ -701,8 +696,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, NotificationVisibility) {
|
| testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeAllSites);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| -
|
| NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
|
| ActivationDecision::ACTIVATED);
|
| EXPECT_CALL(*client(), ToggleNotificationVisibility(true)).Times(1);
|
| @@ -718,8 +711,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| kActivationScopeAllSites, "" /* activation_lists */,
|
| "" /* performance_measurement_rate */,
|
| "true" /* suppress_notifications */);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
| -
|
| NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
|
| ActivationDecision::ACTIVATED);
|
| EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0);
|
| @@ -761,7 +752,6 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, WhitelistSiteOnReload) {
|
| kActivationScopeAllSites, "" /* activation_lists */,
|
| "" /* performance_measurement_rate */, "" /* suppress_notifications */,
|
| "true" /* whitelist_site_on_reload */);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
|
|
| NavigateAndExpectActivation(
|
| {false}, {GURL(kExampleUrl)},
|
| @@ -784,7 +774,6 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationLevelTest,
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, test_data.activation_level,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
|
|
| const GURL url(kExampleUrlWithParams);
|
| NavigateAndExpectActivation({true}, {url}, NO_REDIRECTS_HIT,
|
| @@ -792,7 +781,8 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationLevelTest,
|
| factory()->client()->WhitelistInCurrentWebContents(url);
|
| NavigateAndExpectActivation(
|
| {true}, {GURL(kExampleUrlWithParams)}, NO_REDIRECTS_HIT,
|
| - GetActiveConfiguration().activation_level == ActivationLevel::DISABLED
|
| + GetActiveConfigurations()->the_one_and_only().activation_level ==
|
| + ActivationLevel::DISABLED
|
| ? ActivationDecision::ACTIVATION_DISABLED
|
| : ActivationDecision::URL_WHITELISTED);
|
| }
|
| @@ -806,7 +796,6 @@ TEST_P(ContentSubresourceFilterDriverFactoryThreatTypeTest,
|
| testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeActivationList, test_data.activation_list);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
|
|
| const GURL test_url("https://example.com/nonsoceng?q=engsocnon");
|
| std::vector<GURL> navigation_chain;
|
| @@ -830,7 +819,6 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| test_data.activation_scope,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
|
|
| const GURL test_url(kExampleUrlWithParams);
|
|
|
| @@ -844,7 +832,8 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
|
| NavigateAndExpectActivation(
|
| {test_data.url_matches_activation_list}, {GURL(kExampleUrlWithParams)},
|
| expected_pattern,
|
| - GetActiveConfiguration().activation_scope == ActivationScope::NO_SITES
|
| + GetActiveConfigurations()->the_one_and_only().activation_scope ==
|
| + ActivationScope::NO_SITES
|
| ? ActivationDecision::ACTIVATION_DISABLED
|
| : ActivationDecision::URL_WHITELISTED);
|
| }
|
| @@ -860,7 +849,6 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| test_data.activation_scope,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - factory()->set_configuration_for_testing(GetActiveConfiguration());
|
|
|
| // data URLs are also not supported, but not listed here, as it's not possible
|
| // for a page to redirect to them after https://crbug.com/594215 is fixed.
|
| @@ -874,7 +862,8 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
|
| RedirectChainMatchPattern expected_pattern = EMPTY;
|
| NavigateAndExpectActivation(
|
| {test_data.url_matches_activation_list}, {GURL(url)}, expected_pattern,
|
| - GetActiveConfiguration().activation_scope == ActivationScope::NO_SITES
|
| + GetActiveConfigurations()->the_one_and_only().activation_scope ==
|
| + ActivationScope::NO_SITES
|
| ? ActivationDecision::ACTIVATION_DISABLED
|
| : ActivationDecision::UNSUPPORTED_SCHEME);
|
| }
|
|
|