Chromium Code Reviews| 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 3d13f4125d277ec2bc5df047e89539f0ca18a8d3..5d742896b4cf45a5f022d26a22dd8eb232b612b9 100644 |
| --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
| +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
| @@ -904,76 +904,6 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, MainFrameHitWithReferrer) { |
| EXPECT_FALSE(hit_report().is_subresource); |
| } |
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) { |
|
engedy
2017/04/20 11:16:10
Would it be possible to move these tests to the Su
melandory
2017/04/25 13:48:13
Hm, I thought that we have them there in a bit dif
engedy
2017/04/26 13:47:09
That's a fair point. In that case, could we just r
|
| - 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(); |
| - auto* driver_factory = subresource_filter:: |
| - ContentSubresourceFilterDriverFactory::FromWebContents(web_contents); |
| - driver_factory->set_configuration_for_testing( |
| - subresource_filter::GetActiveConfiguration()); |
| - |
| - // 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); |
| @@ -1980,74 +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(); |
| - auto* driver_factory = subresource_filter:: |
| - ContentSubresourceFilterDriverFactory::FromWebContents(web_contents); |
| - driver_factory->set_configuration_for_testing( |
| - subresource_filter::GetActiveConfiguration()); |
| - |
| - // 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); |