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 c92e98cf8e1640a9e6246e131840611a8b82df14..2fb5e0590b4911f0565b10795e18024955a37f9e 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc |
@@ -41,7 +41,6 @@ |
#include "chrome/browser/safe_browsing/test_safe_browsing_service.h" |
#include "chrome/browser/safe_browsing/ui_manager.h" |
#include "chrome/browser/safe_browsing/v4_test_utils.h" |
-#include "chrome/browser/subresource_filter/test_ruleset_publisher.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_navigator_params.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
@@ -61,12 +60,6 @@ |
#include "components/safe_browsing_db/v4_feature_list.h" |
#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" |
#include "components/safe_browsing_db/v4_protocol_manager_util.h" |
-#include "components/subresource_filter/core/browser/subresource_filter_features.h" |
-#include "components/subresource_filter/core/browser/subresource_filter_features_test_support.h" |
-#include "components/subresource_filter/core/common/activation_level.h" |
-#include "components/subresource_filter/core/common/activation_list.h" |
-#include "components/subresource_filter/core/common/activation_state.h" |
-#include "components/subresource_filter/core/common/test_ruleset_creator.h" |
#include "content/public/browser/interstitial_page.h" |
#include "content/public/browser/navigation_entry.h" |
#include "content/public/browser/render_frame_host.h" |
@@ -543,9 +536,6 @@ class SafeBrowsingServiceTest : public InProcessBrowserTest { |
// This test will fill up the database using testing prefixes |
// and urls. |
command_line->AppendSwitch(safe_browsing::switches::kSbDisableAutoUpdate); |
- command_line->AppendSwitchASCII( |
- ::switches::kEnableFeatures, |
- subresource_filter::kSafeBrowsingSubresourceFilter.name); |
#if defined(OS_CHROMEOS) |
command_line->AppendSwitch( |
chromeos::switches::kIgnoreUserProfileMappingForTests); |
@@ -596,17 +586,6 @@ class SafeBrowsingServiceTest : public InProcessBrowserTest { |
return interstitial_page != nullptr; |
} |
- bool WasSubresourceFilterProbeScriptLoaded() { |
- bool script_resource_was_loaded = false; |
- WebContents* web_contents = |
- browser()->tab_strip_model()->GetActiveWebContents(); |
- EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
- web_contents->GetMainFrame(), |
- "domAutomationController.send(!!document.scriptExecuted)", |
- &script_resource_was_loaded)); |
- return script_resource_was_loaded; |
- } |
- |
void IntroduceGetHashDelay(const base::TimeDelta& delay) { |
pm_factory_.GetProtocolManager()->IntroduceDelay(delay); |
} |
@@ -907,69 +886,6 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, MainFrameHitWithReferrer) { |
EXPECT_FALSE(hit_report().is_subresource); |
} |
-IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) { |
- subresource_filter::testing::ScopedSubresourceFilterConfigurator |
- scoped_configuration(subresource_filter::Configuration:: |
- MakePresetForLiveRunOnPhishingSites()); |
- |
- 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); |
@@ -1981,67 +1897,6 @@ IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest, MainFrameHitWithReferrer) { |
} |
IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest, |
- SubresourceFilterEndToEndTest) { |
- subresource_filter::testing::ScopedSubresourceFilterConfigurator |
- scoped_configuration(subresource_filter::Configuration:: |
- MakePresetForLiveRunOnPhishingSites()); |
- |
- 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); |