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

Unified Diff: components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc

Issue 2897613002: Revert of [subresource_filter] Remove Forwarding NavigationThrottles (Closed)
Patch Set: Created 3 years, 7 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: components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
index 364a3af6271c78887d7362beb6ef5b8045270a5c..20804b31a9afaf9f1beb4733dec749802a18f984 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle_unittest.cc
@@ -82,6 +82,31 @@
DISALLOW_COPY_AND_ASSIGN(MockSubresourceFilterClient);
};
+// Throttle to call WillProcessResponse on the factory, which is otherwise
+// called by the ThrottleManager.
+class TestForwardingNavigationThrottle : public content::NavigationThrottle {
+ public:
+ explicit TestForwardingNavigationThrottle(content::NavigationHandle* handle)
+ : content::NavigationThrottle(handle) {}
+ ~TestForwardingNavigationThrottle() override {}
+
+ // content::NavigationThrottle:
+ content::NavigationThrottle::ThrottleCheckResult WillProcessResponse()
+ override {
+ content::WebContents* web_contents = navigation_handle()->GetWebContents();
+ ContentSubresourceFilterDriverFactory* factory =
+ ContentSubresourceFilterDriverFactory::FromWebContents(web_contents);
+ factory->WillProcessResponse(navigation_handle());
+ return content::NavigationThrottle::PROCEED;
+ }
+ const char* GetNameForLogging() override {
+ return "TestForwardingNavigationThrottle";
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestForwardingNavigationThrottle);
+};
+
std::string GetSuffixForList(const ActivationList& type) {
switch (type) {
case ActivationList::SOCIAL_ENG_ADS_INTERSTITIAL:
@@ -173,6 +198,8 @@
base::MakeUnique<SubresourceFilterSafeBrowsingActivationThrottle>(
navigation_handle, test_io_task_runner_,
fake_safe_browsing_database_));
+ navigation_handle->RegisterThrottleForTesting(
+ base::MakeUnique<TestForwardingNavigationThrottle>(navigation_handle));
}
content::NavigationThrottle::ThrottleCheckResult SimulateStart() {

Powered by Google App Engine
This is Rietveld 408576698