Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc

Issue 2798983002: Introduce subresource_filter::Configuration. (Closed)
Patch Set: Rebase. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c877d3e1251e1f027cf550f510544aa4176e32ea..3d13f4125d277ec2bc5df047e89539f0ca18a8d3 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -928,12 +928,17 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SubresourceFilterEndToEndTest) {
&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.
- WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(phishing_url)));
ui_test_utils::NavigateToURL(browser(), phishing_url);
ASSERT_TRUE(Mock::VerifyAndClearExpectations(&observer_));
@@ -1996,12 +2001,17 @@ IN_PROC_BROWSER_TEST_F(V4SafeBrowsingServiceTest,
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.
- WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(phishing_url)));
ui_test_utils::NavigateToURL(browser(), phishing_url);
ASSERT_TRUE(Mock::VerifyAndClearExpectations(&observer_));

Powered by Google App Engine
This is Rietveld 408576698