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

Unified Diff: content/browser/cross_site_transfer_browsertest.cc

Issue 1384113002: CrossSiteResourceHandler: cancel request if the RFH is gone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_isolate_apps
Patch Set: Fix comment. Created 5 years, 2 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/cross_site_transfer_browsertest.cc
diff --git a/content/browser/cross_site_transfer_browsertest.cc b/content/browser/cross_site_transfer_browsertest.cc
index 0ce755c21b069ce60a4f8caf9fec5d69f6682ae0..1bca396fd1a177809fd87714a41aa670df9208ae 100644
--- a/content/browser/cross_site_transfer_browsertest.cc
+++ b/content/browser/cross_site_transfer_browsertest.cc
@@ -64,11 +64,10 @@ class TrackingResourceDispatcherHostDelegate
BrowserThread::IO, FROM_HERE,
base::Bind(
&TrackingResourceDispatcherHostDelegate::SetTrackedURLOnIOThread,
- base::Unretained(this),
- tracked_url));
+ base::Unretained(this), tracked_url, run_loop_->QuitClosure()));
}
- // Waits until the tracked URL has been requests, and the request for it has
+ // Waits until the tracked URL has been requested, and the request for it has
// been destroyed.
bool WaitForTrackedURLAndGetCompleted() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -107,10 +106,12 @@ class TrackingResourceDispatcherHostDelegate
DISALLOW_COPY_AND_ASSIGN(TrackingThrottle);
};
- void SetTrackedURLOnIOThread(const GURL& tracked_url) {
+ void SetTrackedURLOnIOThread(const GURL& tracked_url,
+ const base::Closure& run_loop_quit_closure) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
throttle_created_ = false;
tracked_url_ = tracked_url;
+ run_loop_quit_closure_ = run_loop_quit_closure;
}
void OnTrackedRequestDestroyed(bool completed) {
@@ -118,16 +119,16 @@ class TrackingResourceDispatcherHostDelegate
tracked_request_completed_ = completed;
tracked_url_ = GURL();
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE, run_loop_->QuitClosure());
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ run_loop_quit_closure_);
}
// These live on the IO thread.
GURL tracked_url_;
bool throttle_created_;
+ base::Closure run_loop_quit_closure_;
- // This is created and destroyed on the UI thread, but stopped on the IO
- // thread.
+ // This lives on the UI thread.
scoped_ptr<base::RunLoop> run_loop_;
// Set on the IO thread while |run_loop_| is non-NULL, read on the UI thread
@@ -174,9 +175,8 @@ class CrossSiteTransferTest : public ContentBrowserTest {
void SetUpOnMainThread() override {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(
- &CrossSiteTransferTest::InjectResourceDisptcherHostDelegate,
- base::Unretained(this)));
+ base::Bind(&CrossSiteTransferTest::InjectResourceDispatcherHostDelegate,
+ base::Unretained(this)));
host_resolver()->AddRule("*", "127.0.0.1");
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
content::SetupCrossSiteRedirector(embedded_test_server());
@@ -211,7 +211,7 @@ class CrossSiteTransferTest : public ContentBrowserTest {
IsolateAllSitesForTesting(command_line);
}
- void InjectResourceDisptcherHostDelegate() {
+ void InjectResourceDispatcherHostDelegate() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
old_delegate_ = ResourceDispatcherHostImpl::Get()->delegate();
ResourceDispatcherHostImpl::Get()->SetDelegate(&tracking_delegate_);

Powered by Google App Engine
This is Rietveld 408576698