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

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

Issue 2951293002: NetworkService: Destroy URLLoaders when a NetworkContext is destroyed. (Closed)
Patch Set: Response to comment, change why destruction is safe Created 3 years, 6 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
« no previous file with comments | « content/browser/loader/test_url_loader_client.h ('k') | content/network/network_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/test_url_loader_client.cc
diff --git a/content/browser/loader/test_url_loader_client.cc b/content/browser/loader/test_url_loader_client.cc
index 7bee53631b757c612ef6c629ac77ea94b3cd4726..569500206d8cfdd078b3aefbde69dc0e731a3d83 100644
--- a/content/browser/loader/test_url_loader_client.cc
+++ b/content/browser/loader/test_url_loader_client.cc
@@ -25,6 +25,8 @@ void TestURLLoaderClient::OnReceiveResponse(
ssl_info_ = ssl_info;
if (quit_closure_for_on_receive_response_)
quit_closure_for_on_receive_response_.Run();
+ binding_.set_connection_error_handler(base::Bind(
+ &TestURLLoaderClient::OnConnectionError, base::Unretained(this)));
}
void TestURLLoaderClient::OnReceiveRedirect(
@@ -176,4 +178,19 @@ void TestURLLoaderClient::RunUntilComplete() {
quit_closure_for_on_complete_.Reset();
}
+void TestURLLoaderClient::RunUntilConnectionError() {
+ if (has_received_connection_error_)
+ return;
+ base::RunLoop run_loop;
+ quit_closure_for_on_connection_error_ = run_loop.QuitClosure();
+ run_loop.Run();
+ quit_closure_for_on_connection_error_.Reset();
+}
+
+void TestURLLoaderClient::OnConnectionError() {
+ has_received_connection_error_ = true;
+ if (quit_closure_for_on_connection_error_)
+ quit_closure_for_on_connection_error_.Run();
+}
+
} // namespace content
« no previous file with comments | « content/browser/loader/test_url_loader_client.h ('k') | content/network/network_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698