Index: content/browser/loader/resource_dispatcher_host_unittest.cc |
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc |
index a1b1f7b1df531921974518a8956c6588f6e0651d..a4fbf84e22f40975ac3a7fd5e28fe0995b625ff9 100644 |
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc |
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc |
@@ -2502,6 +2502,7 @@ TEST_P(ResourceDispatcherHostTest, IgnoreCancelForDownloads) { |
// Return some data so that the request is identified as a download |
// and the proper resource handlers are created. |
EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
+ base::MessageLoop::current()->RunUntilIdle(); |
// And now simulate a cancellation coming from the renderer. |
ResourceHostMsg_CancelRequest msg(request_id); |
@@ -2513,6 +2514,7 @@ TEST_P(ResourceDispatcherHostTest, IgnoreCancelForDownloads) { |
EXPECT_EQ(1, host_.pending_requests()); |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
+ base::MessageLoop::current()->RunUntilIdle(); |
} |
TEST_P(ResourceDispatcherHostTest, CancelRequestsForContext) { |
@@ -2573,6 +2575,7 @@ TEST_P(ResourceDispatcherHostTest, CancelRequestsForContext) { |
// Return some data so that the request is identified as a download |
// and the proper resource handlers are created. |
EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); |
+ base::MessageLoop::current()->RunUntilIdle(); |
// And now simulate a cancellation coming from the renderer. |
ResourceHostMsg_CancelRequest msg(request_id); |
@@ -2590,6 +2593,10 @@ TEST_P(ResourceDispatcherHostTest, CancelRequestsForContext) { |
// Cancelling by context should work. |
host_.CancelRequestsForContext(filter_->resource_context()); |
EXPECT_EQ(0, host_.pending_requests()); |
+ |
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) { |
+ } |
+ base::RunLoop().RunUntilIdle(); |
} |
} |
@@ -2961,6 +2968,7 @@ TEST_P(ResourceDispatcherHostTest, TransferNavigationText) { |
// Flush all the pending requests to get the response through the |
// MimeTypeResourceHandler. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
+ base::MessageLoop::current()->RunUntilIdle(); |
// Restore, now that we've set up a transfer. |
SetBrowserClientForTesting(old_client); |
@@ -3129,6 +3137,7 @@ TEST_P(ResourceDispatcherHostTest, TransferNavigationWithTwoRedirects) { |
// Flush all the pending requests to get the response through the |
// MimeTypeResourceHandler. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
+ base::MessageLoop::current()->RunUntilIdle(); |
// Restore. |
SetBrowserClientForTesting(old_client); |