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

Unified Diff: content/browser/loader/cross_site_resource_handler_browsertest.cc

Issue 1542743002: [RDHI] Refactored blocked_loaders_map_ to key by render frame route id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nasko nit Created 4 years, 11 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: content/browser/loader/cross_site_resource_handler_browsertest.cc
diff --git a/content/browser/loader/cross_site_resource_handler_browsertest.cc b/content/browser/loader/cross_site_resource_handler_browsertest.cc
index a6df689d032693e6930450e01ee57d234f1fb782..dd26035eb83727dc44989f3b04d8eb92d6387b30 100644
--- a/content/browser/loader/cross_site_resource_handler_browsertest.cc
+++ b/content/browser/loader/cross_site_resource_handler_browsertest.cc
@@ -97,7 +97,8 @@ class TestResourceDispatcherHostDelegate
CallbackRunningResourceThrottle(net::URLRequest* request,
TestResourceDispatcherHostDelegate* tracker,
const RequestDeferredHook& run_on_start)
- : request_(request),
+ : resumed_(false),
+ request_(request),
tracker_(tracker),
run_on_start_(run_on_start),
weak_factory_(this) {}
@@ -116,9 +117,12 @@ class TestResourceDispatcherHostDelegate
~CallbackRunningResourceThrottle() override {
// If the request is deleted without being cancelled, its status will
// indicate it succeeded, so have to check if the request is still pending
- // as well.
+ // as well. If the request never even started, the throttle will never
+ // resume it. Check this condition as well to allow for early
+ // cancellation.
tracker_->OnTrackedRequestDestroyed(!request_->is_pending() &&
- request_->status().is_success());
+ request_->status().is_success() &&
+ resumed_);
}
// ResourceThrottle implementation:
@@ -127,7 +131,12 @@ class TestResourceDispatcherHostDelegate
}
private:
- void Resume() { controller()->Resume(); }
+ void Resume() {
+ resumed_ = true;
+ controller()->Resume();
+ }
+
+ bool resumed_;
net::URLRequest* request_;
TestResourceDispatcherHostDelegate* tracker_;
RequestDeferredHook run_on_start_;

Powered by Google App Engine
This is Rietveld 408576698