| 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 592d21f5d4c49963d34c9d1c7816778e3d8c9630..4ab2b904b53189d6e8ed82178f2e30e47b67907b 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
|
| @@ -51,26 +51,17 @@ const char kUrlD[] = "https://example_d.com";
|
| const char kSubframeName[] = "Child";
|
| const char kDisallowedUrl[] = "https://example.com/disallowed.html";
|
|
|
| -const char kMatchesPatternHistogramName[] =
|
| - "SubresourceFilter.PageLoad.RedirectChainMatchPattern.";
|
| +const char kMatchesHistogramName[] =
|
| + "SubresourecFilter.PageLoad.FinalURLMatch.";
|
| const char kNavigationChainSize[] =
|
| "SubresourceFilter.PageLoad.RedirectChainLength.";
|
|
|
| -// Human readable representation of expected redirect chain match patterns.
|
| -// The explanations for the buckets given for the following redirect chain:
|
| -// A->B->C->D, where A is initial URL and D is a final URL.
|
| -enum RedirectChainMatchPattern {
|
| - EMPTY, // No histograms were recorded.
|
| - F0M0L1, // D is a Safe Browsing match.
|
| - F0M1L0, // B or C, or both are Safe Browsing matches.
|
| - F0M1L1, // B or C, or both and D are Safe Browsing matches.
|
| - F1M0L0, // A is Safe Browsing match
|
| - F1M0L1, // A and D are Safe Browsing matches.
|
| - F1M1L0, // B and/or C and A are Safe Browsing matches.
|
| - F1M1L1, // B and/or C and A and D are Safe Browsing matches.
|
| - NO_REDIRECTS_HIT, // Redirect chain consists of single URL, aka no redirects
|
| - // has happened, and this URL was a Safe Browsing hit.
|
| - NUM_HIT_PATTERNS,
|
| +// Enum helps to setup test cases. In future, when checking first URL in the
|
| +// redirect chain is implemented, the enum will be expanded.
|
| +enum RecordedHistograms {
|
| + EMPTY,
|
| + EMPTY_REDIRECTS,
|
| + MATCH_REDIRECTS,
|
| };
|
|
|
| std::string GetSuffixForList(const ActivationList& type) {
|
| @@ -154,6 +145,15 @@ const ActivationListTestData kActivationListTestData[] = {
|
| subresource_filter::kActivationListPhishingInterstitial,
|
| safe_browsing::SB_THREAT_TYPE_URL_PHISHING,
|
| safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS},
|
| + {ActivationDecision::ACTIVATED,
|
| + subresource_filter::kActivationListSubresourceFilter,
|
| + safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER,
|
| + safe_browsing::ThreatPatternType::NONE},
|
| + {ActivationDecision::ACTIVATION_LIST_NOT_MATCHED,
|
| + subresource_filter::kActivationListPhishingInterstitial,
|
| + safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER,
|
| + safe_browsing::ThreatPatternType::NONE},
|
| +
|
| };
|
|
|
| struct ActivationScopeTestData {
|
| @@ -219,6 +219,13 @@ class MockSubresourceFilterClient : public SubresourceFilterClient {
|
| DISALLOW_COPY_AND_ASSIGN(MockSubresourceFilterClient);
|
| };
|
|
|
| +void ExpectSampleForSuffix(const std::string& suffix_to_check,
|
| + const std::string& suffix,
|
| + const base::HistogramTester& tester) {
|
| + tester.ExpectUniqueSample(kMatchesHistogramName + suffix_to_check,
|
| + (suffix_to_check == suffix), 1);
|
| +}
|
| +
|
| } // namespace
|
|
|
| class ContentSubresourceFilterDriverFactoryTest
|
| @@ -299,7 +306,7 @@ class ContentSubresourceFilterDriverFactoryTest
|
| safe_browsing::ThreatPatternType threat_type_metadata,
|
| const content::Referrer& referrer,
|
| ui::PageTransition transition,
|
| - RedirectChainMatchPattern expected_pattern,
|
| + RecordedHistograms expected_histograms,
|
| ActivationDecision expected_activation_decision) {
|
| const bool expected_activation =
|
| expected_activation_decision == ActivationDecision::ACTIVATED;
|
| @@ -328,6 +335,11 @@ class ContentSubresourceFilterDriverFactoryTest
|
| }
|
| navigation_simulator->Redirect(url);
|
| }
|
| + std::string suffix;
|
| + ActivationList activation_list =
|
| + GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata);
|
| + suffix = blacklisted_urls.back() ? GetSuffixForList(activation_list)
|
| + : std::string();
|
|
|
| navigation_simulator->Commit();
|
| ExpectActivationSignalForFrame(main_rfh(), expected_activation);
|
| @@ -338,26 +350,27 @@ class ContentSubresourceFilterDriverFactoryTest
|
| content::RenderFrameHostTester* rfh_tester =
|
| content::RenderFrameHostTester::For(main_rfh());
|
| rfh_tester->AppendChild(kSubframeName);
|
| - ActivationList activation_list =
|
| - GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata);
|
| -
|
| - const std::string suffix(GetSuffixForList(activation_list));
|
| size_t all_pattern =
|
| - tester.GetTotalCountsForPrefix(kMatchesPatternHistogramName).size();
|
| + tester.GetTotalCountsForPrefix(kMatchesHistogramName).size();
|
| size_t all_chain_size =
|
| tester.GetTotalCountsForPrefix(kNavigationChainSize).size();
|
| - if (expected_pattern != EMPTY) {
|
| - EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName + suffix),
|
| - ::testing::ElementsAre(base::Bucket(expected_pattern, 1)));
|
| - EXPECT_THAT(
|
| - tester.GetAllSamples(kNavigationChainSize + suffix),
|
| - ::testing::ElementsAre(base::Bucket(navigation_chain.size(), 1)));
|
| - // Check that we recorded only what is needed.
|
| - EXPECT_EQ(1u, all_pattern);
|
| + // Check that we recorded only what is needed.
|
| + if (expected_histograms == EMPTY) {
|
| + EXPECT_EQ(0u, all_pattern);
|
| + EXPECT_EQ(0U, all_chain_size);
|
| + } else {
|
| + EXPECT_EQ(3u, all_pattern);
|
| + ExpectSampleForSuffix("SocialEngineeringAdsInterstitial", suffix, tester);
|
| + ExpectSampleForSuffix("PhishingInterstital", suffix, tester);
|
| + ExpectSampleForSuffix("SubresourceFilterOnly", suffix, tester);
|
| + }
|
| +
|
| + if (expected_histograms == MATCH_REDIRECTS) {
|
| + tester.ExpectUniqueSample(kNavigationChainSize + suffix,
|
| + navigation_chain.size(), 1);
|
| EXPECT_EQ(1u, all_chain_size);
|
| } else {
|
| - EXPECT_EQ(0u, all_pattern);
|
| - EXPECT_EQ(0u, all_chain_size);
|
| + EXPECT_EQ(0U, all_chain_size);
|
| }
|
| }
|
|
|
| @@ -393,13 +406,14 @@ class ContentSubresourceFilterDriverFactoryTest
|
| safe_browsing::ThreatPatternType threat_type_metadata,
|
| const content::Referrer& referrer,
|
| ui::PageTransition transition,
|
| - RedirectChainMatchPattern expected_pattern,
|
| + RecordedHistograms expected_histograms,
|
| ActivationDecision expected_activation_decision) {
|
| const bool expected_activation =
|
| expected_activation_decision == ActivationDecision::ACTIVATED;
|
| BlacklistURLWithRedirectsNavigateAndCommit(
|
| blacklisted_urls, navigation_chain, threat_type, threat_type_metadata,
|
| - referrer, transition, expected_pattern, expected_activation_decision);
|
| + referrer, transition, expected_histograms,
|
| + expected_activation_decision);
|
|
|
| NavigateAndCommitSubframe(GURL(kExampleLoginUrl), expected_activation);
|
| }
|
| @@ -407,13 +421,13 @@ class ContentSubresourceFilterDriverFactoryTest
|
| void NavigateAndExpectActivation(
|
| const std::vector<bool>& blacklisted_urls,
|
| const std::vector<GURL>& navigation_chain,
|
| - RedirectChainMatchPattern expected_pattern,
|
| + RecordedHistograms expected_histograms,
|
| ActivationDecision expected_activation_decision) {
|
| NavigateAndExpectActivation(
|
| blacklisted_urls, navigation_chain,
|
| safe_browsing::SB_THREAT_TYPE_URL_PHISHING,
|
| safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS,
|
| - content::Referrer(), ui::PAGE_TRANSITION_LINK, expected_pattern,
|
| + content::Referrer(), ui::PAGE_TRANSITION_LINK, expected_histograms,
|
| expected_activation_decision);
|
| }
|
|
|
| @@ -432,7 +446,7 @@ class ContentSubresourceFilterDriverFactoryTest
|
|
|
| void EmulateInPageNavigation(
|
| const std::vector<bool>& blacklisted_urls,
|
| - RedirectChainMatchPattern expected_pattern,
|
| + RecordedHistograms expected_histograms,
|
| ActivationDecision expected_activation_decision) {
|
| // This test examines the navigation with the following sequence of events:
|
| // DidStartProvisional(main, "example.com")
|
| @@ -443,7 +457,8 @@ class ContentSubresourceFilterDriverFactoryTest
|
| // DidCommitProvisional(main, "example.com#ref")
|
|
|
| NavigateAndExpectActivation(blacklisted_urls, {GURL(kExampleUrl)},
|
| - expected_pattern, expected_activation_decision);
|
| + expected_histograms,
|
| + expected_activation_decision);
|
| EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0);
|
| std::unique_ptr<content::NavigationSimulator> navigation_simulator =
|
| content::NavigationSimulator::CreateRendererInitiated(GURL(kExampleUrl),
|
| @@ -533,10 +548,10 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| kActivationScopeAllSites,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| const GURL url(kExampleUrlWithParams);
|
| - NavigateAndExpectActivation({true}, {url}, NO_REDIRECTS_HIT,
|
| + NavigateAndExpectActivation({true}, {url}, MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATION_DISABLED);
|
| factory()->client()->WhitelistInCurrentWebContents(url);
|
| - NavigateAndExpectActivation({true}, {url}, NO_REDIRECTS_HIT,
|
| + NavigateAndExpectActivation({true}, {url}, MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATION_DISABLED);
|
| }
|
|
|
| @@ -546,7 +561,7 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, NoActivationWhenNoMatch) {
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
|
| + NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED);
|
| }
|
|
|
| @@ -558,7 +573,8 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeAllSites);
|
| - EmulateInPageNavigation({false}, EMPTY, ActivationDecision::ACTIVATED);
|
| + EmulateInPageNavigation({false}, EMPTY_REDIRECTS,
|
| + ActivationDecision::ACTIVATED);
|
| }
|
|
|
| TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| @@ -568,7 +584,7 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
| - EmulateInPageNavigation({true}, NO_REDIRECTS_HIT,
|
| + EmulateInPageNavigation({true}, MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED);
|
| }
|
|
|
| @@ -580,7 +596,7 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| kActivationScopeActivationList,
|
| kActivationListSocialEngineeringAdsInterstitial,
|
| "1" /* performance_measurement_rate */);
|
| - EmulateInPageNavigation({true}, NO_REDIRECTS_HIT,
|
| + EmulateInPageNavigation({true}, MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED);
|
| }
|
|
|
| @@ -590,7 +606,7 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, FailedNavigation) {
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeAllSites);
|
| const GURL url(kExampleUrl);
|
| - NavigateAndExpectActivation({false}, {url}, EMPTY,
|
| + NavigateAndExpectActivation({false}, {url}, EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATED);
|
| EmulateFailedNavigationAndExpectNoActivation(url);
|
| }
|
| @@ -606,88 +622,85 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, RedirectPatternTest) {
|
| struct RedirectRedirectChainMatchPatternTestData {
|
| std::vector<bool> blacklisted_urls;
|
| std::vector<GURL> navigation_chain;
|
| - RedirectChainMatchPattern hit_expected_pattern;
|
| + RecordedHistograms hit_expected_histograms;
|
| ActivationDecision expected_activation_decision;
|
| - } kRedirectRedirectChainMatchPatternTestData[] = {
|
| + } kRedirectRecordedHistogramsTestData[] = {
|
| {{false},
|
| {GURL(kUrlA)},
|
| - EMPTY,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| - {{true}, {GURL(kUrlA)}, NO_REDIRECTS_HIT, ActivationDecision::ACTIVATED},
|
| + {{true}, {GURL(kUrlA)}, MATCH_REDIRECTS, ActivationDecision::ACTIVATED},
|
| {{false, false},
|
| {GURL(kUrlA), GURL(kUrlB)},
|
| - EMPTY,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| {{false, true},
|
| {GURL(kUrlA), GURL(kUrlB)},
|
| - F0M0L1,
|
| + MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED},
|
| {{true, false},
|
| {GURL(kUrlA), GURL(kUrlB)},
|
| - F1M0L0,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| {{true, true},
|
| {GURL(kUrlA), GURL(kUrlB)},
|
| - F1M0L1,
|
| + MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED},
|
| {{false, false, false},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - EMPTY,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| {{false, false, true},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - F0M0L1,
|
| + MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED},
|
| {{false, true, false},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - F0M1L0,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| {{false, true, true},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - F0M1L1,
|
| + MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED},
|
| {{true, false, false},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - F1M0L0,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| {{true, false, true},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - F1M0L1,
|
| + MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED},
|
| {{true, true, false},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - F1M1L0,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| {{true, true, true},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)},
|
| - F1M1L1,
|
| + MATCH_REDIRECTS,
|
| ActivationDecision::ACTIVATED},
|
| {{false, true, false, false},
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC), GURL(kUrlD)},
|
| - F0M1L0,
|
| + EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED},
|
| };
|
|
|
| - for (size_t i = 0U; i < arraysize(kRedirectRedirectChainMatchPatternTestData);
|
| - ++i) {
|
| - auto test_data = kRedirectRedirectChainMatchPatternTestData[i];
|
| + for (const auto& test_data : kRedirectRecordedHistogramsTestData) {
|
| NavigateAndExpectActivation(
|
| test_data.blacklisted_urls, test_data.navigation_chain,
|
| safe_browsing::SB_THREAT_TYPE_URL_PHISHING,
|
| safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS,
|
| content::Referrer(), ui::PAGE_TRANSITION_LINK,
|
| - test_data.hit_expected_pattern, test_data.expected_activation_decision);
|
| + test_data.hit_expected_histograms,
|
| + test_data.expected_activation_decision);
|
| NavigateAndExpectActivation(
|
| - {false}, {GURL("https://dummy.com")}, EMPTY,
|
| + {false}, {GURL("https://dummy.com")}, EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED);
|
| -#if defined(GOOGLE_CHROME_BUILD)
|
| NavigateAndExpectActivation(
|
| test_data.blacklisted_urls, test_data.navigation_chain,
|
| safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER,
|
| safe_browsing::ThreatPatternType::NONE, content::Referrer(),
|
| - ui::PAGE_TRANSITION_LINK, test_data.hit_expected_pattern,
|
| + ui::PAGE_TRANSITION_LINK, test_data.hit_expected_histograms,
|
| ActivationDecision::ACTIVATION_LIST_NOT_MATCHED);
|
| -#endif
|
| }
|
| }
|
|
|
| @@ -696,7 +709,7 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, NotificationVisibility) {
|
| testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
|
| base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
|
| kActivationScopeAllSites);
|
| - NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
|
| + NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATED);
|
| EXPECT_CALL(*client(), ToggleNotificationVisibility(true)).Times(1);
|
| NavigateSubframeAndExpectCheckResult(GURL(kDisallowedUrl),
|
| @@ -711,7 +724,7 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| kActivationScopeAllSites, "" /* activation_lists */,
|
| "" /* performance_measurement_rate */,
|
| "true" /* suppress_notifications */);
|
| - NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
|
| + NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATED);
|
| EXPECT_CALL(*client(), ToggleNotificationVisibility(::testing::_)).Times(0);
|
| NavigateSubframeAndExpectCheckResult(GURL(kDisallowedUrl),
|
| @@ -721,7 +734,7 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| TEST_F(ContentSubresourceFilterDriverFactoryTest,
|
| InactiveMainFrame_SubframeNotFiltered) {
|
| GURL url(kExampleUrl);
|
| - NavigateAndExpectActivation({false}, {url}, EMPTY,
|
| + NavigateAndExpectActivation({false}, {url}, EMPTY_REDIRECTS,
|
| ActivationDecision::ACTIVATION_DISABLED);
|
| NavigateSubframeAndExpectCheckResult(url, false /* expect_cancelled */);
|
| }
|
| @@ -757,11 +770,12 @@ TEST_F(ContentSubresourceFilterDriverFactoryTest, WhitelistSiteOnReload) {
|
| {false}, {GURL(kExampleUrl)},
|
| safe_browsing::SB_THREAT_TYPE_URL_PHISHING,
|
| safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS,
|
| - test_case.referrer, test_case.transition, EMPTY,
|
| + test_case.referrer, test_case.transition, EMPTY_REDIRECTS,
|
| test_case.expected_activation_decision);
|
| // Verify that if the first URL failed to activate, subsequent same-origin
|
| // navigations also fail to activate.
|
| - NavigateAndExpectActivation({false}, {GURL(kExampleUrlWithParams)}, EMPTY,
|
| + NavigateAndExpectActivation({false}, {GURL(kExampleUrlWithParams)},
|
| + EMPTY_REDIRECTS,
|
| test_case.expected_activation_decision);
|
| }
|
| }
|
| @@ -776,11 +790,11 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationLevelTest,
|
| kActivationListSocialEngineeringAdsInterstitial);
|
|
|
| const GURL url(kExampleUrlWithParams);
|
| - NavigateAndExpectActivation({true}, {url}, NO_REDIRECTS_HIT,
|
| + NavigateAndExpectActivation({true}, {url}, MATCH_REDIRECTS,
|
| test_data.expected_activation_decision);
|
| factory()->client()->WhitelistInCurrentWebContents(url);
|
| NavigateAndExpectActivation(
|
| - {true}, {GURL(kExampleUrlWithParams)}, NO_REDIRECTS_HIT,
|
| + {true}, {GURL(kExampleUrlWithParams)}, MATCH_REDIRECTS,
|
| GetActiveConfigurations()->the_one_and_only().activation_level ==
|
| ActivationLevel::DISABLED
|
| ? ActivationDecision::ACTIVATION_DISABLED
|
| @@ -807,7 +821,8 @@ TEST_P(ContentSubresourceFilterDriverFactoryThreatTypeTest,
|
| {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC), test_url}, test_data.threat_type,
|
| test_data.threat_type_metadata, content::Referrer(),
|
| ui::PAGE_TRANSITION_LINK,
|
| - effective_list != ActivationList::NONE ? F0M0L1 : EMPTY,
|
| + effective_list != ActivationList::NONE ? MATCH_REDIRECTS
|
| + : EMPTY_REDIRECTS,
|
| test_data.expected_activation_decision);
|
| };
|
|
|
| @@ -822,16 +837,16 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
|
|
|
| const GURL test_url(kExampleUrlWithParams);
|
|
|
| - RedirectChainMatchPattern expected_pattern =
|
| - test_data.url_matches_activation_list ? NO_REDIRECTS_HIT : EMPTY;
|
| + RecordedHistograms expected_histograms =
|
| + test_data.url_matches_activation_list ? MATCH_REDIRECTS : EMPTY_REDIRECTS;
|
| NavigateAndExpectActivation({test_data.url_matches_activation_list},
|
| - {test_url}, expected_pattern,
|
| + {test_url}, expected_histograms,
|
| test_data.expected_activation_decision);
|
| if (test_data.url_matches_activation_list) {
|
| factory()->client()->WhitelistInCurrentWebContents(test_url);
|
| NavigateAndExpectActivation(
|
| {test_data.url_matches_activation_list}, {GURL(kExampleUrlWithParams)},
|
| - expected_pattern,
|
| + expected_histograms,
|
| GetActiveConfigurations()->the_one_and_only().activation_scope ==
|
| ActivationScope::NO_SITES
|
| ? ActivationDecision::ACTIVATION_DISABLED
|
| @@ -859,9 +874,8 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
|
| "https://example.test"};
|
| for (auto* url : unsupported_urls) {
|
| SCOPED_TRACE(url);
|
| - RedirectChainMatchPattern expected_pattern = EMPTY;
|
| NavigateAndExpectActivation(
|
| - {test_data.url_matches_activation_list}, {GURL(url)}, expected_pattern,
|
| + {test_data.url_matches_activation_list}, {GURL(url)}, EMPTY,
|
| GetActiveConfigurations()->the_one_and_only().activation_scope ==
|
| ActivationScope::NO_SITES
|
| ? ActivationDecision::ACTIVATION_DISABLED
|
| @@ -869,10 +883,11 @@ TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest,
|
| }
|
| for (auto* url : supported_urls) {
|
| SCOPED_TRACE(url);
|
| - RedirectChainMatchPattern expected_pattern =
|
| - test_data.url_matches_activation_list ? NO_REDIRECTS_HIT : EMPTY;
|
| + RecordedHistograms expected_histograms =
|
| + test_data.url_matches_activation_list ? MATCH_REDIRECTS
|
| + : EMPTY_REDIRECTS;
|
| NavigateAndExpectActivation({test_data.url_matches_activation_list},
|
| - {GURL(url)}, expected_pattern,
|
| + {GURL(url)}, expected_histograms,
|
| test_data.expected_activation_decision);
|
| }
|
| };
|
|
|