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 aff0952bcce9f98ca39facfada6f3eec34e52f44..ad070e8403d04130e4f69eca498da5140a1898f3 100644 |
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc |
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc |
@@ -57,6 +57,7 @@ |
#include "content/public/test/test_browser_context.h" |
#include "content/public/test/test_browser_thread_bundle.h" |
#include "content/public/test/test_renderer_host.h" |
+#include "content/public/test/test_utils.h" |
#include "content/test/test_content_browser_client.h" |
#include "content/test/test_navigation_url_loader_delegate.h" |
#include "net/base/chunked_upload_data_stream.h" |
@@ -176,7 +177,8 @@ static ResourceRequest CreateResourceRequest(const char* method, |
// Spin up the message loop to kick off the request. |
static void KickOffRequest() { |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
mmenke
2017/04/04 22:47:16
I think you have a few extra semi-colons in this f
fdoray
2017/04/05 12:34:21
Done.
|
} |
// We may want to move this to a shared space if it is useful for something else |
@@ -855,7 +857,8 @@ class ResourceDispatcherHostTest : public testing::Test, public IPC::Sender { |
host_.SetLoaderDelegate(&loader_delegate_); |
browser_context_.reset(new TestBrowserContext()); |
BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
filter_ = MakeForwardingFilter(); |
// TODO(cbentzel): Better way to get URLRequestContext? |
net::URLRequestContext* request_context = |
@@ -930,7 +933,8 @@ class ResourceDispatcherHostTest : public testing::Test, public IPC::Sender { |
browser_context_->GetResourceContext()); |
browser_context_.reset(); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
} |
// Creates a new ForwardingFilter and registers it with |child_ids_| so as not |
@@ -1089,7 +1093,8 @@ class ResourceDispatcherHostTest : public testing::Test, public IPC::Sender { |
// Flush all pending requests. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) { |
} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Sorts out all the messages we saw by request. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -1349,7 +1354,8 @@ TEST_F(ResourceDispatcherHostTest, TestMany) { |
// Finish the redirection |
ResourceHostMsg_FollowRedirect redirect_msg(5); |
OnMessageReceived(redirect_msg, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// flush all the pending requests |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
@@ -1393,7 +1399,8 @@ TEST_F(ResourceDispatcherHostTest, Cancel) { |
// flush all the pending requests |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Everything should be out now. |
EXPECT_EQ(0, host_.pending_requests()); |
@@ -1445,7 +1452,8 @@ TEST_F(ResourceDispatcherHostTest, DownloadToNetworkCache) { |
// Flush all the pending requests. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) { |
} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Everything should be out now. |
EXPECT_EQ(0, host_.pending_requests()); |
@@ -1481,7 +1489,8 @@ TEST_F(ResourceDispatcherHostTest, DetachedResourceTimesOut) { |
ASSERT_TRUE(info->detachable_handler()); |
info->detachable_handler()->set_cancel_delay( |
base::TimeDelta::FromMilliseconds(200)); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
RendererCancelRequest(1); |
@@ -1520,7 +1529,8 @@ TEST_F(ResourceDispatcherHostTest, SyncLoadSuccess) { |
std::tuple<SyncLoadResult> result; |
ResourceHostMsg_SyncLoad sync_load_msg(0, 1, request, &std::get<0>(result)); |
OnMessageReceived(sync_load_msg, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
const IPC::Message* reply = accum_.GetReply(sync_load_msg); |
ASSERT_TRUE(reply); |
@@ -1538,7 +1548,8 @@ TEST_F(ResourceDispatcherHostTest, SyncLoadError) { |
std::tuple<SyncLoadResult> result; |
ResourceHostMsg_SyncLoad sync_load_msg(0, 1, request, &std::get<0>(result)); |
OnMessageReceived(sync_load_msg, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
const IPC::Message* reply = accum_.GetReply(sync_load_msg); |
ASSERT_TRUE(reply); |
@@ -1558,7 +1569,8 @@ TEST_F(ResourceDispatcherHostTest, SyncLoadCancel) { |
OnMessageReceived(sync_load_msg, filter_.get()); |
host_.CancelRequestsForProcess(filter_->child_id()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
const IPC::Message* reply = accum_.GetReply(sync_load_msg); |
ASSERT_TRUE(reply); |
@@ -1607,7 +1619,8 @@ TEST_F(ResourceDispatcherHostTest, DeletedFilterDetached) { |
EXPECT_EQ(2, host_.pending_requests()); |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(0, host_.pending_requests()); |
EXPECT_EQ(2, network_delegate()->completed_requests()); |
@@ -1655,7 +1668,8 @@ TEST_F(ResourceDispatcherHostTest, DeletedFilterDetachedRedirect) { |
// Finish up the request. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(0, host_.pending_requests()); |
EXPECT_EQ(1, network_delegate()->completed_requests()); |
@@ -1682,7 +1696,8 @@ TEST_F(ResourceDispatcherHostTest, CancelWhileStartIsDeferred) { |
// calling CancelRequest. |
EXPECT_FALSE(was_deleted); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_TRUE(was_deleted); |
} |
@@ -1709,7 +1724,8 @@ TEST_F(ResourceDispatcherHostTest, DetachWhileStartIsDeferred) { |
// However, it is still throttled because the defer happened above the |
// DetachableResourceHandler. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_FALSE(was_deleted); |
// Resume the request. |
@@ -1720,7 +1736,8 @@ TEST_F(ResourceDispatcherHostTest, DetachWhileStartIsDeferred) { |
// Now, the request completes. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_TRUE(was_deleted); |
EXPECT_EQ(1, network_delegate()->completed_requests()); |
EXPECT_EQ(0, network_delegate()->canceled_requests()); |
@@ -1738,7 +1755,8 @@ TEST_F(ResourceDispatcherHostTest, CancelInResourceThrottleWillStartRequest) { |
// flush all the pending requests |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
accum_.GetClassifiedMessages(&msgs); |
@@ -1763,7 +1781,8 @@ TEST_F(ResourceDispatcherHostTest, PausedStartError) { |
// flush all the pending requests |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(0, host_.pending_requests()); |
} |
@@ -1790,7 +1809,8 @@ TEST_F(ResourceDispatcherHostTest, ThrottleAndResumeTwice) { |
ASSERT_FALSE(GenericResourceThrottle::active_throttle()); |
// The request is started asynchronously. |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Flush all the pending requests. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
@@ -1817,7 +1837,8 @@ TEST_F(ResourceDispatcherHostTest, CancelInDelegate) { |
// flush all the pending requests |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
accum_.GetClassifiedMessages(&msgs); |
@@ -1856,7 +1877,8 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) { |
// Make sure all requests have finished stage one. test_url_1 will have |
// finished. |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// TODO(mbelshe): |
// Now that the async IO path is in place, the IO always completes on the |
@@ -1948,7 +1970,8 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsOnRenderFrameDeleted) { |
DeleteRenderFrame(GlobalFrameRoutingId(filter_->child_id(), 10)); |
DeleteRenderFrame(GlobalFrameRoutingId(filter_->child_id(), 11)); |
host_.OnRenderViewHostDeleted(filter_->child_id(), 0); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(3, network_delegate_.created_requests()); |
EXPECT_EQ(4, network_delegate_.canceled_requests()); |
@@ -1969,7 +1992,8 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancelDetachedTimesOut) { |
ASSERT_TRUE(info->detachable_handler()); |
info->detachable_handler()->set_cancel_delay( |
base::TimeDelta::FromMilliseconds(200)); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Cancel the requests to the test process. |
host_.CancelRequestsForProcess(filter_->child_id()); |
@@ -1987,7 +2011,8 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancelDetachedTimesOut) { |
// In case any messages are still to be processed. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
accum_.GetClassifiedMessages(&msgs); |
@@ -2279,7 +2304,8 @@ TEST_F(ResourceDispatcherHostTest, TooMuchOutstandingRequestsMemory) { |
// Flush all the pending requests. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Sorts out all the messages we saw by request. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -2350,7 +2376,8 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) { |
// Flush all the pending requests. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Sorts out all the messages we saw by request. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -2539,7 +2566,8 @@ TEST_F(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::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// And now simulate a cancellation coming from the renderer. |
ResourceHostMsg_CancelRequest msg(request_id); |
@@ -2551,7 +2579,8 @@ TEST_F(ResourceDispatcherHostTest, IgnoreCancelForDownloads) { |
EXPECT_EQ(1, host_.pending_requests()); |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
} |
TEST_F(ResourceDispatcherHostTest, CancelRequestsForContext) { |
@@ -2599,7 +2628,8 @@ TEST_F(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::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// The UI thread will be informed that the navigation failed with an error |
// code of ERR_ABORTED because the navigation turns out to be a download. |
@@ -2612,7 +2642,8 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContext) { |
host_.CancelRequestsForContext(browser_context_->GetResourceContext()); |
EXPECT_EQ(0, host_.pending_requests()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
} else { |
MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id, |
download_url, RESOURCE_TYPE_MAIN_FRAME); |
@@ -2620,7 +2651,8 @@ TEST_F(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::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// And now simulate a cancellation coming from the renderer. |
ResourceHostMsg_CancelRequest msg(request_id); |
@@ -2641,7 +2673,8 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContext) { |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) { |
} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
} |
} |
@@ -2752,7 +2785,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationHtml) { |
kResponseBody); |
ResourceHostMsg_FollowRedirect redirect_msg(request_id); |
OnMessageReceived(redirect_msg, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Flush all the pending requests to get the response through the |
// MimeTypeResourceHandler. |
@@ -2772,7 +2806,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationHtml) { |
ResourceHostMsg_RequestResource transfer_request_msg( |
new_render_view_id, new_request_id, request); |
OnMessageReceived(transfer_request_msg, second_filter.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Check generated messages. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -2841,7 +2876,8 @@ TEST_F(ResourceDispatcherHostTest, TransferTwoNavigationsHtml) { |
ResourceHostMsg_RequestResource transfer_request_msg( |
new_render_view_id, new_request_id, request); |
OnMessageReceived(transfer_request_msg, second_filter.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Transfer the second request. |
int new_second_request_id = 6; |
@@ -2853,7 +2889,8 @@ TEST_F(ResourceDispatcherHostTest, TransferTwoNavigationsHtml) { |
ResourceHostMsg_RequestResource second_transfer_request_msg( |
new_render_view_id, new_second_request_id, second_request); |
OnMessageReceived(second_transfer_request_msg, second_filter.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Check generated messages. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -2902,12 +2939,14 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationText) { |
kResponseBody); |
ResourceHostMsg_FollowRedirect redirect_msg(request_id); |
OnMessageReceived(redirect_msg, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Flush all the pending requests to get the response through the |
// MimeTypeResourceHandler. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// This second filter is used to emulate a second process. |
scoped_refptr<ForwardingFilter> second_filter = MakeForwardingFilter(); |
@@ -2923,7 +2962,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationText) { |
ResourceHostMsg_RequestResource transfer_request_msg( |
new_render_view_id, new_request_id, request); |
OnMessageReceived(transfer_request_msg, second_filter.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Check generated messages. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -2969,7 +3009,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithProcessCrash) { |
ResourceHostMsg_RequestResource first_request_msg( |
render_view_id, request_id, first_request); |
OnMessageReceived(first_request_msg, first_filter.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Now that we're blocked on the redirect, update the response and unblock |
// by telling the AsyncResourceHandler to follow the redirect. |
@@ -2978,7 +3019,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithProcessCrash) { |
kResponseBody); |
ResourceHostMsg_FollowRedirect redirect_msg(request_id); |
OnMessageReceived(redirect_msg, first_filter.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Flush all the pending requests to get the response through the |
// MimeTypeResourceHandler. |
@@ -3007,7 +3049,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithProcessCrash) { |
ResourceHostMsg_RequestResource transfer_request_msg( |
new_render_view_id, new_request_id, request); |
OnMessageReceived(transfer_request_msg, second_filter.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Check generated messages. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -3049,7 +3092,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithTwoRedirects) { |
"Location: http://other.com/blerg\n\n"); |
ResourceHostMsg_FollowRedirect redirect_msg(request_id); |
OnMessageReceived(redirect_msg, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Now that we're blocked on the second redirect, update the response and |
// unblock by telling the AsyncResourceHandler to follow the redirect. |
@@ -3061,12 +3105,14 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithTwoRedirects) { |
kResponseBody); |
ResourceHostMsg_FollowRedirect redirect_msg2(request_id); |
OnMessageReceived(redirect_msg2, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Flush all the pending requests to get the response through the |
// MimeTypeResourceHandler. |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// This second filter is used to emulate a second process. |
scoped_refptr<ForwardingFilter> second_filter = MakeForwardingFilter(); |
@@ -3095,7 +3141,8 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationWithTwoRedirects) { |
EXPECT_EQ(second_filter.get(), info->requester_info()->filter()); |
// Let request complete. |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Check generated messages. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -3128,7 +3175,7 @@ TEST_F(ResourceDispatcherHostTest, DataReceivedACKs) { |
HandleScheme("big-job"); |
MakeTestRequest(0, 1, GURL("big-job:0123456789,1000000")); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
// Sort all the messages we saw by request. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -3207,7 +3254,7 @@ TEST_F(ResourceDispatcherHostTest, DelayedDataReceivedACKs) { |
HandleScheme("big-job"); |
MakeTestRequest(0, 1, GURL("big-job:0123456789,1000000")); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
// Sort all the messages we saw by request. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -3241,7 +3288,7 @@ TEST_F(ResourceDispatcherHostTest, DelayedDataReceivedACKs) { |
OnMessageReceived(msg, filter_.get()); |
} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
msgs.clear(); |
accum_.GetClassifiedMessages(&msgs); |
@@ -3256,7 +3303,7 @@ TEST_F(ResourceDispatcherHostTest, DataReceivedUnexpectedACKs) { |
HandleScheme("big-job"); |
MakeTestRequest(0, 1, GURL("big-job:0123456789,1000000")); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
// Sort all the messages we saw by request. |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -3295,7 +3342,7 @@ TEST_F(ResourceDispatcherHostTest, DataReceivedUnexpectedACKs) { |
OnMessageReceived(msg, filter_.get()); |
} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
msgs.clear(); |
accum_.GetClassifiedMessages(&msgs); |
@@ -3339,7 +3386,8 @@ TEST_F(ResourceDispatcherHostTest, RegisterDownloadedTempFile) { |
// on the delete happening on the FILE thread which is mapped to main thread |
// in this test.) |
deletable_file = nullptr; |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// The file is no longer readable to the child and has been deleted. |
EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
@@ -3378,7 +3426,8 @@ TEST_F(ResourceDispatcherHostTest, RegisterDownloadedTempFileWithMojo) { |
// The child releases from the request. |
downloaded_file_ptr = nullptr; |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// Still readable because there is another reference to the file. (The child |
// may take additional blob references.) |
@@ -3389,7 +3438,8 @@ TEST_F(ResourceDispatcherHostTest, RegisterDownloadedTempFileWithMojo) { |
// on the delete happening on the FILE thread which is mapped to main thread |
// in this test.) |
deletable_file = nullptr; |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// The file is no longer readable to the child and has been deleted. |
EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
@@ -3420,7 +3470,8 @@ TEST_F(ResourceDispatcherHostTest, ReleaseTemporiesOnProcessExit) { |
// Let the process die. |
filter_->OnChannelClosing(); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
// The file is no longer readable to the child and has been deleted. |
EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
@@ -3441,7 +3492,8 @@ TEST_F(ResourceDispatcherHostTest, DownloadToFile) { |
// wait for the ResourceMsg_RequestComplete to go out. Then run the event loop |
// until idle so the loader is gone. |
WaitForRequestComplete(); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(0, host_.pending_requests()); |
ResourceIPCAccumulator::ClassifiedMessages msgs; |
@@ -3494,7 +3546,8 @@ TEST_F(ResourceDispatcherHostTest, DownloadToFile) { |
// The release callback runs before the delete is scheduled, so pump the |
// message loop for the delete itself. (This relies on the delete happening on |
// the FILE thread which is mapped to main thread in this test.) |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_FALSE(base::PathExists(response_head.download_file_path)); |
EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( |
@@ -3670,7 +3723,8 @@ TEST_F(ResourceDispatcherHostTest, TransferResponseStarted) { |
int initial_count = web_contents_observer_->resource_response_start_count(); |
MakeWebContentsAssociatedTestRequest(1, net::URLRequestTestJob::test_url_1()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(initial_count + 1, |
web_contents_observer_->resource_response_start_count()); |
@@ -3683,7 +3737,8 @@ TEST_F(ResourceDispatcherHostTest, TransferRequestRedirected) { |
MakeWebContentsAssociatedTestRequest( |
1, net::URLRequestTestJob::test_url_redirect_to_url_2()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(initial_count + 1, |
web_contents_observer_->resource_request_redirect_count()); |
@@ -3716,7 +3771,8 @@ TEST_F(ResourceDispatcherHostTest, DidChangePriority) { |
// scheduled later, so it is not currently running. |
ResourceHostMsg_DidChangePriority priority_msg(3, net::MAXIMUM_PRIORITY, 0); |
OnMessageReceived(priority_msg, filter_.get()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(3, job_factory_->url_request_jobs_created_count()); |
@@ -3732,7 +3788,8 @@ TEST_F(ResourceDispatcherHostTest, TransferResponseStartedDownload) { |
MakeWebContentsAssociatedDownloadRequest( |
1, net::URLRequestTestJob::test_url_1()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(initial_count, |
web_contents_observer_->resource_response_start_count()); |
} |
@@ -3744,7 +3801,8 @@ TEST_F(ResourceDispatcherHostTest, TransferRequestRedirectedDownload) { |
MakeWebContentsAssociatedDownloadRequest( |
1, net::URLRequestTestJob::test_url_redirect_to_url_2()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_EQ(initial_count, |
web_contents_observer_->resource_request_redirect_count()); |
} |
@@ -3778,7 +3836,8 @@ TEST_F(ResourceDispatcherHostTest, ThrottleMustProcessResponseBeforeRead) { |
while (net::URLRequestTestJob::ProcessOnePendingMessage()) { |
} |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
} |
namespace { |
@@ -3807,7 +3866,8 @@ TEST_F(ResourceDispatcherHostTest, SyncLoadWithMojoSuccess) { |
host_.OnSyncLoadWithMojo( |
GetResourceRequesterInfo(filter_.get()), 0, 1, request, |
base::Bind(&StoreSyncLoadResult, &called, &was_null, &result)); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_TRUE(called); |
EXPECT_FALSE(was_null); |
EXPECT_EQ(net::OK, result.error_code); |
@@ -3824,7 +3884,8 @@ TEST_F(ResourceDispatcherHostTest, SyncLoadWithMojoError) { |
host_.OnSyncLoadWithMojo( |
GetResourceRequesterInfo(filter_.get()), 0, 1, request, |
base::Bind(&StoreSyncLoadResult, &called, &was_null, &result)); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_TRUE(called); |
EXPECT_FALSE(was_null); |
EXPECT_EQ(net::ERR_INVALID_URL, result.error_code); |
@@ -3842,7 +3903,8 @@ TEST_F(ResourceDispatcherHostTest, SyncLoadWithMojoCancel) { |
GetResourceRequesterInfo(filter_.get()), 0, 1, request, |
base::Bind(&StoreSyncLoadResult, &called, &was_null, &result)); |
host_.CancelRequestsForProcess(filter_->child_id()); |
- base::RunLoop().RunUntilIdle(); |
+ content::RunAllBlockingPoolTasksUntilIdle(); |
+ ; |
EXPECT_TRUE(called); |
EXPECT_TRUE(was_null); |
} |