Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" | 5 #include "components/subresource_filter/content/browser/content_subresource_filt er_driver_factory.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 namespace subresource_filter { | 28 namespace subresource_filter { |
| 29 | 29 |
| 30 using ActivationDecision = | 30 using ActivationDecision = |
| 31 ContentSubresourceFilterDriverFactory::ActivationDecision; | 31 ContentSubresourceFilterDriverFactory::ActivationDecision; |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 const char kExampleUrlWithParams[] = "https://example.com/soceng?q=engsoc"; | 35 const char kExampleUrlWithParams[] = "https://example.com/soceng?q=engsoc"; |
| 36 const char kExampleUrl[] = "https://example.com"; | 36 const char kExampleUrl[] = "https://example.com"; |
| 37 const char kExampleLoginUrl[] = "https://example.com/login"; | 37 const char kExampleLoginUrl[] = "https://example.com/login"; |
| 38 const char kMatchesPatternHistogramName[] = | |
| 39 "SubresourceFilter.PageLoad.RedirectChainMatchPattern"; | |
| 40 const char kNavigationChainSize[] = | |
| 41 "SubresourceFilter.PageLoad.RedirectChainLength"; | |
| 42 const char kUrlA[] = "https://example_a.com"; | 38 const char kUrlA[] = "https://example_a.com"; |
| 43 const char kUrlB[] = "https://example_b.com"; | 39 const char kUrlB[] = "https://example_b.com"; |
| 44 const char kUrlC[] = "https://example_c.com"; | 40 const char kUrlC[] = "https://example_c.com"; |
| 45 const char kUrlD[] = "https://example_d.com"; | 41 const char kUrlD[] = "https://example_d.com"; |
| 46 const char kSubframeName[] = "Child"; | 42 const char kSubframeName[] = "Child"; |
| 47 | 43 |
| 44 const char kMatchesPatternHistogramName[] = | |
| 45 "SubresourceFilter.PageLoad.RedirectChainMatchPattern"; | |
| 46 const char kNavigationChainSize[] = | |
| 47 "SubresourceFilter.PageLoad.RedirectChainLength"; | |
| 48 | |
| 49 #if defined(GOOGLE_CHROME_BUILD) | |
| 50 const char kSubresourceFilterSuffix[] = ".SubresourceFilter"; | |
| 51 #endif | |
| 52 | |
| 48 // Human readable representation of expected redirect chain match patterns. | 53 // Human readable representation of expected redirect chain match patterns. |
| 49 // The explanations for the buckets given for the following redirect chain: | 54 // The explanations for the buckets given for the following redirect chain: |
| 50 // A->B->C->D, where A is initial URL and D is a final URL. | 55 // A->B->C->D, where A is initial URL and D is a final URL. |
| 51 enum RedirectChainMatchPattern { | 56 enum RedirectChainMatchPattern { |
| 52 EMPTY, // No histograms were recorded. | 57 EMPTY, // No histograms were recorded. |
| 53 F0M0L1, // D is a Safe Browsing match. | 58 F0M0L1, // D is a Safe Browsing match. |
| 54 F0M1L0, // B or C, or both are Safe Browsing matches. | 59 F0M1L0, // B or C, or both are Safe Browsing matches. |
| 55 F0M1L1, // B or C, or both and D are Safe Browsing matches. | 60 F0M1L1, // B or C, or both and D are Safe Browsing matches. |
| 56 F1M0L0, // A is Safe Browsing match | 61 F1M0L0, // A is Safe Browsing match |
| 57 F1M0L1, // A and D are Safe Browsing matches. | 62 F1M0L1, // A and D are Safe Browsing matches. |
| 58 F1M1L0, // B and/or C and A are Safe Browsing matches. | 63 F1M1L0, // B and/or C and A are Safe Browsing matches. |
| 59 F1M1L1, // B and/or C and A and D are Safe Browsing matches. | 64 F1M1L1, // B and/or C and A and D are Safe Browsing matches. |
| 60 NO_REDIRECTS_HIT, // Redirect chain consists of single URL, aka no redirects | 65 NO_REDIRECTS_HIT, // Redirect chain consists of single URL, aka no redirects |
| 61 // has happened, and this URL was a Safe Browsing hit. | 66 // has happened, and this URL was a Safe Browsing hit. |
| 62 NUM_HIT_PATTERNS, | 67 NUM_HIT_PATTERNS, |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 std::string GetSuffixForList(const ActivationList& type) { | 70 std::string GetSuffixForList(const ActivationList& type) { |
| 66 switch (type) { | 71 switch (type) { |
| 67 case ActivationList::SOCIAL_ENG_ADS_INTERSTITIAL: | 72 case ActivationList::SOCIAL_ENG_ADS_INTERSTITIAL: |
| 68 return ".SocialEngineeringAdsInterstitial"; | 73 return ".SocialEngineeringAdsInterstitial"; |
| 69 case ActivationList::PHISHING_INTERSTITIAL: | 74 case ActivationList::PHISHING_INTERSTITIAL: |
| 70 return ".PhishingInterstital"; | 75 return ".PhishingInterstital"; |
| 76 case ActivationList::SUBRESOURCE_FILTER: | |
| 77 return ".SubresourceFilterOnly"; | |
| 71 case ActivationList::NONE: | 78 case ActivationList::NONE: |
| 72 return std::string(); | 79 return std::string(); |
| 73 } | 80 } |
| 74 return std::string(); | 81 return std::string(); |
| 75 } | 82 } |
| 76 | 83 |
| 77 struct ActivationListTestData { | 84 struct ActivationListTestData { |
| 78 ActivationDecision expected_activation_decision; | 85 ActivationDecision expected_activation_decision; |
| 79 const char* const activation_list; | 86 const char* const activation_list; |
| 80 safe_browsing::SBThreatType threat_type; | 87 safe_browsing::SBThreatType threat_type; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 } | 247 } |
| 241 | 248 |
| 242 void BlacklistURLWithRedirectsNavigateAndCommit( | 249 void BlacklistURLWithRedirectsNavigateAndCommit( |
| 243 const std::vector<bool>& blacklisted_urls, | 250 const std::vector<bool>& blacklisted_urls, |
| 244 const std::vector<GURL>& navigation_chain, | 251 const std::vector<GURL>& navigation_chain, |
| 245 safe_browsing::SBThreatType threat_type, | 252 safe_browsing::SBThreatType threat_type, |
| 246 safe_browsing::ThreatPatternType threat_type_metadata, | 253 safe_browsing::ThreatPatternType threat_type_metadata, |
| 247 const content::Referrer& referrer, | 254 const content::Referrer& referrer, |
| 248 ui::PageTransition transition, | 255 ui::PageTransition transition, |
| 249 RedirectChainMatchPattern expected_pattern, | 256 RedirectChainMatchPattern expected_pattern, |
| 257 const std::string& histogram_suffix, | |
|
engedy
2017/03/21 13:44:16
Note that this is not used.
melandory
2017/03/24 15:49:28
Done.
| |
| 250 ActivationDecision expected_activation_decision) { | 258 ActivationDecision expected_activation_decision) { |
| 251 const bool expected_activation = | 259 const bool expected_activation = |
| 252 expected_activation_decision == ActivationDecision::ACTIVATED; | 260 expected_activation_decision == ActivationDecision::ACTIVATED; |
| 253 base::HistogramTester tester; | 261 base::HistogramTester tester; |
| 254 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); | 262 EXPECT_CALL(*client(), ToggleNotificationVisibility(false)).Times(1); |
| 255 | 263 |
| 256 std::unique_ptr<content::NavigationSimulator> navigation_simulator = | 264 std::unique_ptr<content::NavigationSimulator> navigation_simulator = |
| 257 content::NavigationSimulator::CreateRendererInitiated( | 265 content::NavigationSimulator::CreateRendererInitiated( |
| 258 navigation_chain.front(), main_rfh()); | 266 navigation_chain.front(), main_rfh()); |
| 259 navigation_simulator->SetReferrer(referrer); | 267 navigation_simulator->SetReferrer(referrer); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 282 factory()->GetActivationDecisionForLastCommittedPageLoad()); | 290 factory()->GetActivationDecisionForLastCommittedPageLoad()); |
| 283 | 291 |
| 284 // Re-create a subframe now that the frame has navigated. | 292 // Re-create a subframe now that the frame has navigated. |
| 285 content::RenderFrameHostTester* rfh_tester = | 293 content::RenderFrameHostTester* rfh_tester = |
| 286 content::RenderFrameHostTester::For(main_rfh()); | 294 content::RenderFrameHostTester::For(main_rfh()); |
| 287 rfh_tester->AppendChild(kSubframeName); | 295 rfh_tester->AppendChild(kSubframeName); |
| 288 ActivationList activation_list = | 296 ActivationList activation_list = |
| 289 GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata); | 297 GetListForThreatTypeAndMetadata(threat_type, threat_type_metadata); |
| 290 | 298 |
| 291 const std::string suffix(GetSuffixForList(activation_list)); | 299 const std::string suffix(GetSuffixForList(activation_list)); |
| 292 if (expected_pattern != EMPTY) { | 300 if (expected_pattern != EMPTY) { |
|
engedy
2017/03/21 13:44:16
nit: If |suffix| is empty, can we make some strong
melandory
2017/03/24 15:49:27
Done.
| |
| 293 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName + suffix), | 301 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName + suffix), |
| 294 ::testing::ElementsAre(base::Bucket(expected_pattern, 1))); | 302 ::testing::ElementsAre(base::Bucket(expected_pattern, 1))); |
| 295 EXPECT_THAT( | 303 EXPECT_THAT( |
| 296 tester.GetAllSamples(kNavigationChainSize + suffix), | 304 tester.GetAllSamples(kNavigationChainSize + suffix), |
| 297 ::testing::ElementsAre(base::Bucket(navigation_chain.size(), 1))); | 305 ::testing::ElementsAre(base::Bucket(navigation_chain.size(), 1))); |
| 298 } else { | 306 } else { |
| 299 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName + suffix), | 307 EXPECT_THAT(tester.GetAllSamples(kMatchesPatternHistogramName + suffix), |
| 300 ::testing::IsEmpty()); | 308 ::testing::IsEmpty()); |
| 301 EXPECT_THAT(tester.GetAllSamples(kNavigationChainSize + suffix), | 309 EXPECT_THAT(tester.GetAllSamples(kNavigationChainSize + suffix), |
| 302 ::testing::IsEmpty()); | 310 ::testing::IsEmpty()); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 313 } | 321 } |
| 314 | 322 |
| 315 void NavigateAndExpectActivation( | 323 void NavigateAndExpectActivation( |
| 316 const std::vector<bool>& blacklisted_urls, | 324 const std::vector<bool>& blacklisted_urls, |
| 317 const std::vector<GURL>& navigation_chain, | 325 const std::vector<GURL>& navigation_chain, |
| 318 safe_browsing::SBThreatType threat_type, | 326 safe_browsing::SBThreatType threat_type, |
| 319 safe_browsing::ThreatPatternType threat_type_metadata, | 327 safe_browsing::ThreatPatternType threat_type_metadata, |
| 320 const content::Referrer& referrer, | 328 const content::Referrer& referrer, |
| 321 ui::PageTransition transition, | 329 ui::PageTransition transition, |
| 322 RedirectChainMatchPattern expected_pattern, | 330 RedirectChainMatchPattern expected_pattern, |
| 331 const std::string& histogram_suffix, | |
| 323 ActivationDecision expected_activation_decision) { | 332 ActivationDecision expected_activation_decision) { |
| 324 const bool expected_activation = | 333 const bool expected_activation = |
| 325 expected_activation_decision == ActivationDecision::ACTIVATED; | 334 expected_activation_decision == ActivationDecision::ACTIVATED; |
| 326 BlacklistURLWithRedirectsNavigateAndCommit( | 335 BlacklistURLWithRedirectsNavigateAndCommit( |
| 327 blacklisted_urls, navigation_chain, threat_type, threat_type_metadata, | 336 blacklisted_urls, navigation_chain, threat_type, threat_type_metadata, |
| 328 referrer, transition, expected_pattern, expected_activation_decision); | 337 referrer, transition, expected_pattern, histogram_suffix, |
| 338 expected_activation_decision); | |
| 329 | 339 |
| 330 NavigateAndCommitSubframe(GURL(kExampleLoginUrl), expected_activation); | 340 NavigateAndCommitSubframe(GURL(kExampleLoginUrl), expected_activation); |
| 331 } | 341 } |
| 332 | 342 |
| 333 void NavigateAndExpectActivation( | 343 void NavigateAndExpectActivation( |
| 334 const std::vector<bool>& blacklisted_urls, | 344 const std::vector<bool>& blacklisted_urls, |
| 335 const std::vector<GURL>& navigation_chain, | 345 const std::vector<GURL>& navigation_chain, |
| 336 RedirectChainMatchPattern expected_pattern, | 346 RedirectChainMatchPattern expected_pattern, |
| 337 ActivationDecision expected_activation_decision) { | 347 ActivationDecision expected_activation_decision) { |
| 338 NavigateAndExpectActivation( | 348 NavigateAndExpectActivation( |
| 339 blacklisted_urls, navigation_chain, | 349 blacklisted_urls, navigation_chain, |
| 340 safe_browsing::SB_THREAT_TYPE_URL_PHISHING, | 350 safe_browsing::SB_THREAT_TYPE_URL_PHISHING, |
| 341 safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS, | 351 safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS, |
| 342 content::Referrer(), ui::PAGE_TRANSITION_LINK, expected_pattern, | 352 content::Referrer(), ui::PAGE_TRANSITION_LINK, expected_pattern, |
| 343 expected_activation_decision); | 353 std::string(), expected_activation_decision); |
| 344 } | 354 } |
| 345 | 355 |
| 346 void EmulateDidDisallowFirstSubresourceMessage() { | 356 void EmulateDidDisallowFirstSubresourceMessage() { |
| 347 factory()->OnMessageReceived( | 357 factory()->OnMessageReceived( |
| 348 SubresourceFilterHostMsg_DidDisallowFirstSubresource( | 358 SubresourceFilterHostMsg_DidDisallowFirstSubresource( |
| 349 main_rfh()->GetRoutingID()), | 359 main_rfh()->GetRoutingID()), |
| 350 main_rfh()); | 360 main_rfh()); |
| 351 } | 361 } |
| 352 | 362 |
| 353 void EmulateFailedNavigationAndExpectNoActivation(const GURL& url) { | 363 void EmulateFailedNavigationAndExpectNoActivation(const GURL& url) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 F0M0L1, | 545 F0M0L1, |
| 536 ActivationDecision::ACTIVATED}, | 546 ActivationDecision::ACTIVATED}, |
| 537 {{true, false}, | 547 {{true, false}, |
| 538 {GURL(kUrlA), GURL(kUrlB)}, | 548 {GURL(kUrlA), GURL(kUrlB)}, |
| 539 F1M0L0, | 549 F1M0L0, |
| 540 ActivationDecision::ACTIVATION_LIST_NOT_MATCHED}, | 550 ActivationDecision::ACTIVATION_LIST_NOT_MATCHED}, |
| 541 {{true, true}, | 551 {{true, true}, |
| 542 {GURL(kUrlA), GURL(kUrlB)}, | 552 {GURL(kUrlA), GURL(kUrlB)}, |
| 543 F1M0L1, | 553 F1M0L1, |
| 544 ActivationDecision::ACTIVATED}, | 554 ActivationDecision::ACTIVATED}, |
| 545 | |
| 546 {{false, false, false}, | 555 {{false, false, false}, |
| 547 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)}, | 556 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)}, |
| 548 EMPTY, | 557 EMPTY, |
| 549 ActivationDecision::ACTIVATION_LIST_NOT_MATCHED}, | 558 ActivationDecision::ACTIVATION_LIST_NOT_MATCHED}, |
| 550 {{false, false, true}, | 559 {{false, false, true}, |
| 551 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)}, | 560 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)}, |
| 552 F0M0L1, | 561 F0M0L1, |
| 553 ActivationDecision::ACTIVATED}, | 562 ActivationDecision::ACTIVATED}, |
| 554 {{false, true, false}, | 563 {{false, true, false}, |
| 555 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)}, | 564 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC)}, |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 582 }; | 591 }; |
| 583 | 592 |
| 584 for (size_t i = 0U; i < arraysize(kRedirectRedirectChainMatchPatternTestData); | 593 for (size_t i = 0U; i < arraysize(kRedirectRedirectChainMatchPatternTestData); |
| 585 ++i) { | 594 ++i) { |
| 586 auto test_data = kRedirectRedirectChainMatchPatternTestData[i]; | 595 auto test_data = kRedirectRedirectChainMatchPatternTestData[i]; |
| 587 NavigateAndExpectActivation( | 596 NavigateAndExpectActivation( |
| 588 test_data.blacklisted_urls, test_data.navigation_chain, | 597 test_data.blacklisted_urls, test_data.navigation_chain, |
| 589 safe_browsing::SB_THREAT_TYPE_URL_PHISHING, | 598 safe_browsing::SB_THREAT_TYPE_URL_PHISHING, |
| 590 safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS, | 599 safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS, |
| 591 content::Referrer(), ui::PAGE_TRANSITION_LINK, | 600 content::Referrer(), ui::PAGE_TRANSITION_LINK, |
| 592 test_data.hit_expected_pattern, test_data.expected_activation_decision); | 601 test_data.hit_expected_pattern, std::string(), |
| 602 test_data.expected_activation_decision); | |
| 593 NavigateAndExpectActivation( | 603 NavigateAndExpectActivation( |
| 594 {false}, {GURL("https://dummy.com")}, EMPTY, | 604 {false}, {GURL("https://dummy.com")}, EMPTY, |
| 595 ActivationDecision::ACTIVATION_LIST_NOT_MATCHED); | 605 ActivationDecision::ACTIVATION_LIST_NOT_MATCHED); |
| 606 #if defined(GOOGLE_CHROME_BUILD) | |
| 607 NavigateAndExpectActivation( | |
| 608 test_data.blacklisted_urls, test_data.navigation_chain, | |
| 609 safe_browsing::SB_THREAT_TYPE_SUBRESOURCE_FILTER, | |
| 610 safe_browsing::ThreatPatternType::NONE, content::Referrer(), | |
| 611 ui::PAGE_TRANSITION_LINK, EMPTY, test_data.hit_expected_pattern, | |
| 612 kSubresourceFilterSuffix, | |
| 613 ActivationDecision::ACTIVATION_LIST_NOT_MATCHED); | |
| 614 #endif | |
| 596 } | 615 } |
| 597 } | 616 } |
| 598 | 617 |
| 599 TEST_F(ContentSubresourceFilterDriverFactoryTest, NotificationVisibility) { | 618 TEST_F(ContentSubresourceFilterDriverFactoryTest, NotificationVisibility) { |
| 600 base::FieldTrialList field_trial_list(nullptr); | 619 base::FieldTrialList field_trial_list(nullptr); |
| 601 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( | 620 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( |
| 602 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, | 621 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, |
| 603 kActivationScopeAllSites); | 622 kActivationScopeAllSites); |
| 604 | 623 |
| 605 NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY, | 624 NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 647 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( | 666 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( |
| 648 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, | 667 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, |
| 649 kActivationScopeAllSites, "" /* activation_lists */, | 668 kActivationScopeAllSites, "" /* activation_lists */, |
| 650 "" /* performance_measurement_rate */, "" /* suppress_notifications */, | 669 "" /* performance_measurement_rate */, "" /* suppress_notifications */, |
| 651 "true" /* whitelist_site_on_reload */); | 670 "true" /* whitelist_site_on_reload */); |
| 652 | 671 |
| 653 NavigateAndExpectActivation( | 672 NavigateAndExpectActivation( |
| 654 {false}, {GURL(kExampleUrl)}, | 673 {false}, {GURL(kExampleUrl)}, |
| 655 safe_browsing::SB_THREAT_TYPE_URL_PHISHING, | 674 safe_browsing::SB_THREAT_TYPE_URL_PHISHING, |
| 656 safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS, | 675 safe_browsing::ThreatPatternType::SOCIAL_ENGINEERING_ADS, |
| 657 test_case.referrer, test_case.transition, EMPTY, | 676 test_case.referrer, test_case.transition, EMPTY, std::string(), |
| 658 test_case.expected_activation_decision); | 677 test_case.expected_activation_decision); |
| 659 // Verify that if the first URL failed to activate, subsequent same-origin | 678 // Verify that if the first URL failed to activate, subsequent same-origin |
| 660 // navigations also fail to activate. | 679 // navigations also fail to activate. |
| 661 NavigateAndExpectActivation({false}, {GURL(kExampleUrlWithParams)}, EMPTY, | 680 NavigateAndExpectActivation({false}, {GURL(kExampleUrlWithParams)}, EMPTY, |
| 662 test_case.expected_activation_decision); | 681 test_case.expected_activation_decision); |
| 663 } | 682 } |
| 664 } | 683 } |
| 665 | 684 |
| 666 TEST_P(ContentSubresourceFilterDriverFactoryActivationLevelTest, | 685 TEST_P(ContentSubresourceFilterDriverFactoryActivationLevelTest, |
| 667 ActivateForFrameState) { | 686 ActivateForFrameState) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 696 const GURL test_url("https://example.com/nonsoceng?q=engsocnon"); | 715 const GURL test_url("https://example.com/nonsoceng?q=engsocnon"); |
| 697 std::vector<GURL> navigation_chain; | 716 std::vector<GURL> navigation_chain; |
| 698 | 717 |
| 699 ActivationList effective_list = GetListForThreatTypeAndMetadata( | 718 ActivationList effective_list = GetListForThreatTypeAndMetadata( |
| 700 test_data.threat_type, test_data.threat_type_metadata); | 719 test_data.threat_type, test_data.threat_type_metadata); |
| 701 NavigateAndExpectActivation( | 720 NavigateAndExpectActivation( |
| 702 {false, false, false, true}, | 721 {false, false, false, true}, |
| 703 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC), test_url}, test_data.threat_type, | 722 {GURL(kUrlA), GURL(kUrlB), GURL(kUrlC), test_url}, test_data.threat_type, |
| 704 test_data.threat_type_metadata, content::Referrer(), | 723 test_data.threat_type_metadata, content::Referrer(), |
| 705 ui::PAGE_TRANSITION_LINK, | 724 ui::PAGE_TRANSITION_LINK, |
| 706 effective_list != ActivationList::NONE ? F0M0L1 : EMPTY, | 725 effective_list != ActivationList::NONE ? F0M0L1 : EMPTY, std::string(), |
| 707 test_data.expected_activation_decision); | 726 test_data.expected_activation_decision); |
| 708 }; | 727 }; |
| 709 | 728 |
| 710 TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest, | 729 TEST_P(ContentSubresourceFilterDriverFactoryActivationScopeTest, |
| 711 ActivateForScopeType) { | 730 ActivateForScopeType) { |
| 712 const ActivationScopeTestData& test_data = GetParam(); | 731 const ActivationScopeTestData& test_data = GetParam(); |
| 713 base::FieldTrialList field_trial_list(nullptr); | 732 base::FieldTrialList field_trial_list(nullptr); |
| 714 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( | 733 testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle( |
| 715 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, | 734 base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled, |
| 716 test_data.activation_scope, | 735 test_data.activation_scope, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 777 ActivationScopeTest, | 796 ActivationScopeTest, |
| 778 ContentSubresourceFilterDriverFactoryActivationScopeTest, | 797 ContentSubresourceFilterDriverFactoryActivationScopeTest, |
| 779 ::testing::ValuesIn(kActivationScopeTestData)); | 798 ::testing::ValuesIn(kActivationScopeTestData)); |
| 780 | 799 |
| 781 INSTANTIATE_TEST_CASE_P( | 800 INSTANTIATE_TEST_CASE_P( |
| 782 ActivationLevelTest, | 801 ActivationLevelTest, |
| 783 ContentSubresourceFilterDriverFactoryActivationLevelTest, | 802 ContentSubresourceFilterDriverFactoryActivationLevelTest, |
| 784 ::testing::ValuesIn(kActivationLevelTestData)); | 803 ::testing::ValuesIn(kActivationLevelTestData)); |
| 785 | 804 |
| 786 } // namespace subresource_filter | 805 } // namespace subresource_filter |
| OLD | NEW |