Index: chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
index ab5ca80da4348a89bc77424290bfcc1f1d0548e9..400c3fe30ebe7ac50d9e6326a89f9f4052d8501d 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
@@ -903,72 +903,6 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, MainFrameHitWithReferrer) { |
EXPECT_FALSE(hit_report().is_subresource); |
} |
-IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) { |
- subresource_filter::testing::ScopedSubresourceFilterFeatureToggle |
- scoped_feature_toggle( |
- base::FeatureList::OVERRIDE_ENABLE_FEATURE, |
- subresource_filter::kActivationLevelEnabled, |
- subresource_filter::kActivationScopeActivationList, |
- subresource_filter::kActivationListSocialEngineeringAdsInterstitial); |
- |
- subresource_filter::testing::TestRulesetCreator ruleset_creator; |
- subresource_filter::testing::TestRulesetPair test_ruleset_pair; |
- ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix( |
- "included_script.js", &test_ruleset_pair); |
- subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher; |
- ASSERT_NO_FATAL_FAILURE( |
- test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed)); |
- |
- GURL phishing_url = embedded_test_server()->GetURL( |
- "/subresource_filter/frame_with_included_script.html"); |
- SBFullHashResult malware_full_hash; |
- GenUrlFullHashResultWithMetadata(phishing_url, PHISH, |
- ThreatPatternType::SOCIAL_ENGINEERING_ADS, |
- &malware_full_hash); |
- SetupResponseForUrl(phishing_url, malware_full_hash); |
- |
- WebContents* web_contents = |
- browser()->tab_strip_model()->GetActiveWebContents(); |
- |
- // Navigation to a phishing page should trigger an interstitial. If the user |
- // clicks through it, the page load should proceed, but with subresource |
- // filtering activated. This is verified by probing whether `included_script` |
- // that is disallowed above indeed fails to load. |
- EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(phishing_url))); |
- ui_test_utils::NavigateToURL(browser(), phishing_url); |
- ASSERT_TRUE(Mock::VerifyAndClearExpectations(&observer_)); |
- ASSERT_TRUE(got_hit_report()); |
- content::WaitForInterstitialAttach(web_contents); |
- ASSERT_TRUE(ShowingInterstitialPage()); |
- |
- content::WindowedNotificationObserver load_stop_observer( |
- content::NOTIFICATION_LOAD_STOP, |
- content::Source<content::NavigationController>( |
- &web_contents->GetController())); |
- InterstitialPage* interstitial_page = web_contents->GetInterstitialPage(); |
- ASSERT_TRUE(interstitial_page); |
- interstitial_page->Proceed(); |
- load_stop_observer.Wait(); |
- ASSERT_FALSE(ShowingInterstitialPage()); |
- EXPECT_FALSE(WasSubresourceFilterProbeScriptLoaded()); |
- |
- // Navigate to a page that loads the same script, but is not a phishing page. |
- // The load should be allowed. |
- GURL safe_url = embedded_test_server()->GetURL( |
- "/subresource_filter/frame_with_allowed_script.html"); |
- ui_test_utils::NavigateToURL(browser(), safe_url); |
- EXPECT_FALSE(ShowingInterstitialPage()); |
- EXPECT_TRUE(WasSubresourceFilterProbeScriptLoaded()); |
- |
- // Navigate to the phishing page again -- should be no interstitial shown, but |
- // subresource filtering should still be activated. |
- EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(phishing_url))) |
- .Times(0); |
- ui_test_utils::NavigateToURL(browser(), phishing_url); |
- EXPECT_FALSE(ShowingInterstitialPage()); |
- EXPECT_FALSE(WasSubresourceFilterProbeScriptLoaded()); |
-} |
- |
IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, |
SubResourceHitWithMainFrameReferrer) { |
GURL first_url = embedded_test_server()->GetURL(kEmptyPage); |
@@ -1976,70 +1910,6 @@ IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest, MainFrameHitWithReferrer) { |
} |
IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest, |
- SubresourceFilterEndToEndTest) { |
- subresource_filter::testing::ScopedSubresourceFilterFeatureToggle |
- scoped_feature_toggle( |
- base::FeatureList::OVERRIDE_ENABLE_FEATURE, |
- subresource_filter::kActivationLevelEnabled, |
- subresource_filter::kActivationScopeActivationList, |
- subresource_filter::kActivationListSocialEngineeringAdsInterstitial); |
- |
- subresource_filter::testing::TestRulesetCreator ruleset_creator; |
- subresource_filter::testing::TestRulesetPair test_ruleset_pair; |
- ruleset_creator.CreateRulesetToDisallowURLsWithPathSuffix( |
- "included_script.js", &test_ruleset_pair); |
- subresource_filter::testing::TestRulesetPublisher test_ruleset_publisher; |
- ASSERT_NO_FATAL_FAILURE( |
- test_ruleset_publisher.SetRuleset(test_ruleset_pair.unindexed)); |
- |
- GURL phishing_url = embedded_test_server()->GetURL( |
- "/subresource_filter/frame_with_included_script.html"); |
- MarkUrlForPhishingUnexpired(phishing_url, |
- ThreatPatternType::SOCIAL_ENGINEERING_ADS); |
- |
- WebContents* web_contents = |
- browser()->tab_strip_model()->GetActiveWebContents(); |
- |
- // Navigation to a phishing page should trigger an interstitial. If the user |
- // clicks through it, the page load should proceed, but with subresource |
- // filtering activated. This is verified by probing whether `included_script` |
- // that is disallowed above indeed fails to load. |
- EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(phishing_url))); |
- ui_test_utils::NavigateToURL(browser(), phishing_url); |
- ASSERT_TRUE(Mock::VerifyAndClearExpectations(&observer_)); |
- ASSERT_TRUE(got_hit_report()); |
- content::WaitForInterstitialAttach(web_contents); |
- ASSERT_TRUE(ShowingInterstitialPage()); |
- |
- content::WindowedNotificationObserver load_stop_observer( |
- content::NOTIFICATION_LOAD_STOP, |
- content::Source<content::NavigationController>( |
- &web_contents->GetController())); |
- InterstitialPage* interstitial_page = web_contents->GetInterstitialPage(); |
- ASSERT_TRUE(interstitial_page); |
- interstitial_page->Proceed(); |
- load_stop_observer.Wait(); |
- ASSERT_FALSE(ShowingInterstitialPage()); |
- EXPECT_FALSE(WasSubresourceFilterProbeScriptLoaded()); |
- |
- // Navigate to a page that loads the same script, but is not a phishing page. |
- // The load should be allowed. |
- GURL safe_url = embedded_test_server()->GetURL( |
- "/subresource_filter/frame_with_allowed_script.html"); |
- ui_test_utils::NavigateToURL(browser(), safe_url); |
- EXPECT_FALSE(ShowingInterstitialPage()); |
- EXPECT_TRUE(WasSubresourceFilterProbeScriptLoaded()); |
- |
- // Navigate to the phishing page again -- should be no interstitial shown, but |
- // subresource filtering should still be activated. |
- EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(phishing_url))) |
- .Times(0); |
- ui_test_utils::NavigateToURL(browser(), phishing_url); |
- EXPECT_FALSE(ShowingInterstitialPage()); |
- EXPECT_FALSE(WasSubresourceFilterProbeScriptLoaded()); |
-} |
- |
-IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest, |
SubResourceHitWithMainFrameReferrer) { |
GURL first_url = embedded_test_server()->GetURL(kEmptyPage); |
GURL second_url = embedded_test_server()->GetURL(kMalwarePage); |