Index: net/url_request/url_request_unittest.cc |
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc |
index 64f5ac1d477564c919086b72b468cc1a1c22242f..faef46c85b3c0fb61c0833dbddc2972d9ef1354b 100644 |
--- a/net/url_request/url_request_unittest.cc |
+++ b/net/url_request/url_request_unittest.cc |
@@ -20,6 +20,7 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/path_service.h" |
+#include "base/run_loop.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_piece.h" |
#include "base/strings/string_split.h" |
@@ -591,7 +592,8 @@ class URLRequestTest : public PlatformTest { |
default_context_.set_network_delegate(&default_network_delegate_); |
default_context_.set_net_log(&net_log_); |
job_factory_.SetProtocolHandler("data", new DataProtocolHandler); |
- job_factory_.SetProtocolHandler("file", new FileProtocolHandler); |
+ job_factory_.SetProtocolHandler( |
+ "file", new FileProtocolHandler(base::MessageLoopProxy::current())); |
akalin
2013/08/16 21:22:20
#include for message_loop_proxy
|
default_context_.set_job_factory(&job_factory_); |
default_context_.Init(); |
} |
@@ -620,7 +622,7 @@ TEST_F(URLRequestTest, AboutBlankTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(!r.is_pending()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -663,7 +665,7 @@ TEST_F(URLRequestTest, DataURLImageTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(!r.is_pending()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -688,7 +690,7 @@ TEST_F(URLRequestTest, FileTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = -1; |
EXPECT_TRUE(file_util::GetFileSize(app_path, &file_size)); |
@@ -720,7 +722,7 @@ TEST_F(URLRequestTest, FileTestCancel) { |
} |
// Async cancellation should be safe even when URLRequest has been already |
// destroyed. |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
} |
TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { |
@@ -755,7 +757,7 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(!r.is_pending()); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -798,7 +800,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(!r.is_pending()); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -834,7 +836,7 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.request_failed()); |
} |
@@ -849,7 +851,7 @@ TEST_F(URLRequestTest, InvalidUrlTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.request_failed()); |
} |
} |
@@ -887,7 +889,7 @@ TEST_F(URLRequestTest, ResolveShortcutTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
WIN32_FILE_ATTRIBUTE_DATA data; |
GetFileAttributesEx(app_path.value().c_str(), |
@@ -931,7 +933,7 @@ TEST_F(URLRequestTest, FileDirCancelTest) { |
d.set_cancel_in_received_data_pending(true); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
} |
// Take out mock resource provider. |
@@ -952,7 +954,7 @@ TEST_F(URLRequestTest, FileDirRedirectNoCrash) { |
TestDelegate d; |
URLRequest req(FilePathToFileURL(path), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
ASSERT_EQ(1, d.received_redirect_count()); |
ASSERT_LT(0, d.bytes_received()); |
@@ -966,7 +968,7 @@ TEST_F(URLRequestTest, FileDirRedirectSingleSlash) { |
TestDelegate d; |
URLRequest req(GURL("file:///"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
ASSERT_EQ(1, d.received_redirect_count()); |
ASSERT_FALSE(req.status().is_success()); |
@@ -1194,7 +1196,7 @@ TEST_F(URLRequestTest, Intercept) { |
req.SetUserData(&user_data2, user_data2); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Make sure we can retrieve our specific user data |
EXPECT_EQ(user_data0, req.GetUserData(NULL)); |
@@ -1229,7 +1231,7 @@ TEST_F(URLRequestTest, InterceptRedirect) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_intercept_main_); |
@@ -1262,7 +1264,7 @@ TEST_F(URLRequestTest, InterceptServerError) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_intercept_main_); |
@@ -1291,7 +1293,7 @@ TEST_F(URLRequestTest, InterceptNetworkError) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_simulate_error_main_); |
@@ -1320,7 +1322,7 @@ TEST_F(URLRequestTest, InterceptRestartRequired) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_restart_main_); |
@@ -1351,7 +1353,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelMain) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_cancel_main_); |
@@ -1382,7 +1384,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelRedirect) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_intercept_main_); |
@@ -1407,7 +1409,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelFinal) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_simulate_error_main_); |
@@ -1433,7 +1435,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelInRestart) { |
URLRequest req(GURL("http://test_intercept/foo"), &d, &default_context_); |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check the interceptor got called as expected |
EXPECT_TRUE(interceptor.did_cancel_then_restart_main_); |
@@ -1452,7 +1454,7 @@ LoadTimingInfo RunLoadTimingTest(const LoadTimingInfo& job_load_timing, |
TestDelegate d; |
URLRequest req(GURL("http://test_intercept/foo"), &d, context); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
LoadTimingInfo resulting_load_timing; |
req.GetLoadTimingInfo(&resulting_load_timing); |
@@ -1729,7 +1731,7 @@ TEST_F(URLRequestTest, NetworkDelegateProxyError) { |
req.set_method("GET"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// Check we see a failed request. |
EXPECT_FALSE(req.status().is_success()); |
@@ -1747,7 +1749,7 @@ TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) { |
TestDelegate d; |
URLRequest req(GURL("data:,"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("", d.data_received()); |
EXPECT_EQ(1, default_network_delegate_.completed_requests()); |
} |
@@ -1841,7 +1843,7 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { |
URLRequest req( |
test_server.GetURL("set-cookie?CookieToNotSend=1"), &d, &context); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
EXPECT_EQ(1, network_delegate.set_cookie_count()); |
@@ -1854,7 +1856,7 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { |
TestDelegate d; |
URLRequest req(test_server.GetURL("echoheader?Cookie"), &d, &context); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
!= std::string::npos); |
@@ -1876,7 +1878,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
@@ -1889,7 +1891,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
!= std::string::npos); |
@@ -1906,7 +1908,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.set_load_flags(LOAD_DO_NOT_SEND_COOKIES); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") |
== std::string::npos); |
@@ -1930,7 +1932,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -1949,7 +1951,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
req.set_load_flags(LOAD_DO_NOT_SAVE_COOKIES); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// LOAD_DO_NOT_SAVE_COOKIES does not trigger OnSetCookie. |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
@@ -1965,7 +1967,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") |
== std::string::npos); |
@@ -1991,7 +1993,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2005,7 +2007,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
!= std::string::npos); |
@@ -2023,7 +2025,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") |
== std::string::npos); |
@@ -2046,7 +2048,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2064,7 +2066,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(2, network_delegate.blocked_set_cookie_count()); |
@@ -2078,7 +2080,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") |
== std::string::npos); |
@@ -2101,7 +2103,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2122,7 +2124,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2136,7 +2138,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
!= std::string::npos); |
@@ -2154,7 +2156,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") |
== std::string::npos); |
@@ -2177,7 +2179,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2195,7 +2197,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(2, network_delegate.blocked_set_cookie_count()); |
@@ -2209,7 +2211,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") |
== std::string::npos); |
@@ -2278,7 +2280,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
} |
// Verify that the cookie is not set. |
{ |
@@ -2288,7 +2290,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("StillGood=1") == std::string::npos); |
} |
@@ -2302,7 +2304,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
} |
// Verify that the cookie is set. |
{ |
@@ -2312,7 +2314,7 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { |
URLRequest req( |
test_server.GetURL("echoheader?Cookie"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("StillGood=1") != std::string::npos); |
} |
@@ -2338,7 +2340,7 @@ TEST_F(URLRequestTest, DoNotOverrideReferrer) { |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("http://foo.com/", d.data_received()); |
} |
@@ -2356,7 +2358,7 @@ TEST_F(URLRequestTest, DoNotOverrideReferrer) { |
req.set_load_flags(LOAD_VALIDATE_CACHE); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("None", d.data_received()); |
} |
@@ -2393,7 +2395,7 @@ class URLRequestTestHTTP : public URLRequestTest { |
req.SetExtraRequestHeaders(headers); |
} |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(redirect_method, req.method()); |
EXPECT_EQ(URLRequestStatus::SUCCESS, req.status().status()); |
EXPECT_EQ(OK, req.status().error()); |
@@ -2436,7 +2438,7 @@ class URLRequestTestHTTP : public URLRequestTest { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
ASSERT_EQ(1, d.response_started_count()) |
<< "request failed: " << r.status().status() |
@@ -2482,7 +2484,7 @@ class URLRequestTestHTTP : public URLRequestTest { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
bool is_success = r.status().is_success(); |
@@ -2521,7 +2523,7 @@ TEST_F(URLRequestTestHTTP, ProxyTunnelRedirectTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); |
@@ -2547,7 +2549,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); |
@@ -2588,12 +2590,12 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateBlockAsynchronously) { |
r.Start(); |
for (size_t i = 0; i < blocking_stages_length; ++i) { |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(blocking_stages[i], |
network_delegate.stage_blocked_for_callback()); |
network_delegate.DoCallback(OK); |
} |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(200, r.GetResponseCode()); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(1, network_delegate.created_requests()); |
@@ -2620,7 +2622,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequest) { |
URLRequest r(test_server_.GetURL(std::string()), &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
EXPECT_EQ(ERR_EMPTY_RESPONSE, r.status().error()); |
@@ -2650,7 +2652,7 @@ void NetworkDelegateCancelRequest(BlockingNetworkDelegate::BlockMode block_mode, |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
EXPECT_EQ(ERR_BLOCKED_BY_CLIENT, r.status().error()); |
@@ -2727,7 +2729,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequest) { |
URLRequest r(original_url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -2760,7 +2762,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestSynchronously) { |
URLRequest r(original_url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -2800,7 +2802,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestPost) { |
base::UintToString(arraysize(kData) - 1)); |
r.SetExtraRequestHeaders(headers); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -2837,7 +2839,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncNoAction) { |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -2874,7 +2876,7 @@ TEST_F(URLRequestTestHTTP, |
EXPECT_FALSE(headers.HasHeader("Authorization")); |
} |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -2908,7 +2910,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncSetAuth) { |
GURL url(test_server_.GetURL("auth-basic")); |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -2943,7 +2945,7 @@ TEST_F(URLRequestTestHTTP, |
GURL url(test_server_.GetURL("auth-basic")); |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -2981,7 +2983,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncCancel) { |
GURL url(test_server_.GetURL("auth-basic")); |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(OK, r.status().error()); |
@@ -3015,7 +3017,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncNoAction) { |
GURL url(test_server_.GetURL("auth-basic")); |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -3050,7 +3052,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncSetAuth) { |
GURL url(test_server_.GetURL("auth-basic")); |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(0, r.status().error()); |
@@ -3083,7 +3085,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncCancel) { |
GURL url(test_server_.GetURL("auth-basic")); |
URLRequest r(url, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
EXPECT_EQ(OK, r.status().error()); |
@@ -3114,7 +3116,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting1) { |
URLRequest r(test_server_.GetURL(std::string()), &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, |
network_delegate.stage_blocked_for_callback()); |
EXPECT_EQ(0, network_delegate.completed_requests()); |
@@ -3150,7 +3152,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting2) { |
URLRequest r(test_server_.GetURL(std::string()), &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, |
network_delegate.stage_blocked_for_callback()); |
EXPECT_EQ(0, network_delegate.completed_requests()); |
@@ -3185,7 +3187,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting3) { |
URLRequest r(test_server_.GetURL(std::string()), &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(BlockingNetworkDelegate::ON_HEADERS_RECEIVED, |
network_delegate.stage_blocked_for_callback()); |
EXPECT_EQ(0, network_delegate.completed_requests()); |
@@ -3220,7 +3222,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting4) { |
URLRequest r(test_server_.GetURL("auth-basic"), &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(BlockingNetworkDelegate::ON_AUTH_REQUIRED, |
network_delegate.stage_blocked_for_callback()); |
EXPECT_EQ(0, network_delegate.completed_requests()); |
@@ -3254,7 +3256,7 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r.status().error()); |
@@ -3271,7 +3273,7 @@ TEST_F(URLRequestTestHTTP, GetTest_NoCache) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -3337,7 +3339,7 @@ TEST_F(URLRequestTestHTTP, GetTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -3363,7 +3365,7 @@ TEST_F(URLRequestTestHTTP, GetTest_GetFullRequestHeaders) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -3388,7 +3390,7 @@ TEST_F(URLRequestTestHTTP, GetTestLoadTiming) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
LoadTimingInfo load_timing_info; |
r.GetLoadTimingInfo(&load_timing_info); |
@@ -3437,7 +3439,7 @@ TEST_F(URLRequestTestHTTP, GetZippedTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -3473,7 +3475,7 @@ TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { |
"server-redirect?" + http_destination.spec()), &d, &default_context_); |
req.SetReferrer("https://www.referrer.com/"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_EQ(1, d.received_redirect_count()); |
@@ -3490,7 +3492,7 @@ TEST_F(URLRequestTestHTTP, RedirectLoadTiming) { |
TestDelegate d; |
URLRequest req(original_url, &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_EQ(1, d.received_redirect_count()); |
@@ -3530,7 +3532,7 @@ TEST_F(URLRequestTestHTTP, MultipleRedirectTest) { |
TestDelegate d; |
URLRequest req(original_url, &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_EQ(2, d.received_redirect_count()); |
@@ -3568,7 +3570,7 @@ TEST_F(URLRequestTestHTTP, RedirectWithAdditionalHeadersTest) { |
RedirectWithAdditionalHeadersDelegate d; |
URLRequest req(original_url, &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
std::string value; |
const HttpRequestHeaders& headers = req.extra_request_headers(); |
@@ -3605,7 +3607,7 @@ TEST_F(URLRequestTestHTTP, RedirectWithHeaderRemovalTest) { |
URLRequest req(original_url, &d, &default_context_); |
req.SetExtraRequestHeaderByName(kExtraHeaderToRemove, "dummy", false); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
std::string value; |
const HttpRequestHeaders& headers = req.extra_request_headers(); |
@@ -3625,7 +3627,7 @@ TEST_F(URLRequestTestHTTP, CancelTest) { |
r.Cancel(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// We expect to receive OnResponseStarted even though the request has been |
// cancelled. |
@@ -3647,7 +3649,7 @@ TEST_F(URLRequestTestHTTP, CancelTest2) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_EQ(0, d.bytes_received()); |
@@ -3668,7 +3670,7 @@ TEST_F(URLRequestTestHTTP, CancelTest3) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
// There is no guarantee about how much data was received |
@@ -3713,7 +3715,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { |
TestDelegate d; |
URLRequest r(test_server_.GetURL("cachetime"), &d, &default_context_); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
} |
@@ -3723,7 +3725,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { |
URLRequest r(test_server_.GetURL("cachetime"), &d, &default_context_); |
r.Start(); |
r.Cancel(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::CANCELED, r.status().status()); |
EXPECT_EQ(1, d.response_started_count()); |
@@ -3753,7 +3755,7 @@ TEST_F(URLRequestTestHTTP, PostEmptyTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
ASSERT_EQ(1, d.response_started_count()) |
<< "request failed: " << r.status().status() |
@@ -3804,7 +3806,7 @@ TEST_F(URLRequestTestHTTP, PostFileTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 size = 0; |
ASSERT_EQ(true, file_util::GetFileSize(path, &size)); |
@@ -3835,7 +3837,7 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataBeforeStart) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
VerifyReceivedDataMatchesChunks(&r, &d); |
} |
@@ -3852,7 +3854,7 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataJustAfterStart) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
AddChunksToUpload(&r); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
VerifyReceivedDataMatchesChunks(&r, &d); |
} |
@@ -3869,9 +3871,9 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataAfterStart) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->RunUntilIdle(); |
+ base::RunLoop().RunUntilIdle(); |
AddChunksToUpload(&r); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
VerifyReceivedDataMatchesChunks(&r, &d); |
} |
@@ -3884,7 +3886,7 @@ TEST_F(URLRequestTestHTTP, ResponseHeadersTest) { |
URLRequest req( |
test_server_.GetURL("files/with-headers.html"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
const HttpResponseHeaders* headers = req.response_headers(); |
@@ -3920,7 +3922,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTS) { |
&d, |
&default_context_); |
request.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
TransportSecurityState* security_state = |
default_context_.transport_security_state(); |
@@ -3964,7 +3966,7 @@ TEST_F(URLRequestTestHTTP, MAYBE_ProcessPKP) { |
&d, |
&default_context_); |
request.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
TransportSecurityState* security_state = |
default_context_.transport_security_state(); |
@@ -3995,7 +3997,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSOnce) { |
&d, |
&default_context_); |
request.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// We should have set parameters from the first header, not the second. |
TransportSecurityState* security_state = |
@@ -4024,7 +4026,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP) { |
&d, |
&default_context_); |
request.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// We should have set parameters from the first header, not the second. |
TransportSecurityState* security_state = |
@@ -4066,7 +4068,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP2) { |
&d, |
&default_context_); |
request.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
TransportSecurityState* security_state = |
default_context_.transport_security_state(); |
@@ -4095,7 +4097,7 @@ TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { |
URLRequest req(test_server_.GetURL( |
"files/content-type-normalization.html"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
std::string mime_type; |
req.GetMimeType(&mime_type); |
@@ -4111,7 +4113,7 @@ TEST_F(URLRequestTestHTTP, ProtocolHandlerAndFactoryRestrictRedirects) { |
// Test URLRequestJobFactory::ProtocolHandler::IsSafeRedirectTarget(). |
GURL file_url("file:///foo.txt"); |
GURL data_url("data:,foo"); |
- FileProtocolHandler file_protocol_handler; |
+ FileProtocolHandler file_protocol_handler(base::MessageLoopProxy::current()); |
EXPECT_FALSE(file_protocol_handler.IsSafeRedirectTarget(file_url)); |
DataProtocolHandler data_protocol_handler; |
EXPECT_TRUE(data_protocol_handler.IsSafeRedirectTarget(data_url)); |
@@ -4128,7 +4130,7 @@ TEST_F(URLRequestTestHTTP, RestrictRedirects) { |
URLRequest req(test_server_.GetURL( |
"files/redirect-to-file.html"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::FAILED, req.status().status()); |
EXPECT_EQ(ERR_UNSAFE_REDIRECT, req.status().error()); |
@@ -4141,7 +4143,7 @@ TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) { |
URLRequest req(test_server_.GetURL( |
"files/redirect-to-invalid-url.html"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(URLRequestStatus::FAILED, req.status().status()); |
EXPECT_EQ(ERR_INVALID_URL, req.status().error()); |
@@ -4155,7 +4157,7 @@ TEST_F(URLRequestTestHTTP, NoUserPassInReferrer) { |
test_server_.GetURL("echoheader?Referer"), &d, &default_context_); |
req.SetReferrer("http://user:pass@foo.com/"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(std::string("http://foo.com/"), d.data_received()); |
} |
@@ -4168,7 +4170,7 @@ TEST_F(URLRequestTestHTTP, NoFragmentInReferrer) { |
test_server_.GetURL("echoheader?Referer"), &d, &default_context_); |
req.SetReferrer("http://foo.com/test#fragment"); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(std::string("http://foo.com/test"), d.data_received()); |
} |
@@ -4182,7 +4184,7 @@ TEST_F(URLRequestTestHTTP, EmptyReferrerAfterValidReferrer) { |
req.SetReferrer("http://foo.com/test#fragment"); |
req.SetReferrer(""); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(std::string("None"), d.data_received()); |
} |
@@ -4196,7 +4198,7 @@ TEST_F(URLRequestTestHTTP, CancelRedirect) { |
URLRequest req( |
test_server_.GetURL("files/redirect-test.html"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_EQ(0, d.bytes_received()); |
@@ -4215,12 +4217,12 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect) { |
URLRequest req(test_url, &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.received_redirect_count()); |
req.FollowDeferredRedirect(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -4251,7 +4253,7 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect_GetFullRequestHeaders) { |
EXPECT_FALSE(d.have_full_request_headers()); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.received_redirect_count()); |
EXPECT_TRUE(d.have_full_request_headers()); |
@@ -4259,7 +4261,7 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect_GetFullRequestHeaders) { |
d.ClearFullRequestHeaders(); |
req.FollowDeferredRedirect(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
GURL target_url(test_server_.GetURL("files/with-headers.html")); |
EXPECT_EQ(1, d.response_started_count()); |
@@ -4290,12 +4292,12 @@ TEST_F(URLRequestTestHTTP, CancelDeferredRedirect) { |
URLRequest req( |
test_server_.GetURL("files/redirect-test.html"), &d, &default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.received_redirect_count()); |
req.Cancel(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_EQ(0, d.bytes_received()); |
@@ -4316,7 +4318,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { |
headers.SetHeader("foo", "1"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
LoadTimingInfo load_timing_info; |
req.GetLoadTimingInfo(&load_timing_info); |
@@ -4332,7 +4334,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { |
headers.SetHeader("foo", "1"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(req.was_cached()); |
@@ -4350,7 +4352,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { |
headers.SetHeader("foo", "2"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_FALSE(req.was_cached()); |
@@ -4371,7 +4373,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { |
URLRequest r(test_server_.GetURL("auth-basic"), &d, &default_context_); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); |
} |
@@ -4387,7 +4389,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { |
r.set_load_flags(LOAD_VALIDATE_CACHE); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); |
@@ -4418,7 +4420,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { |
URLRequest r(url_requiring_auth, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); |
@@ -4447,7 +4449,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { |
URLRequest r(url_with_identity, &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("user2/secret") != std::string::npos); |
@@ -4469,7 +4471,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthLoadTiming) { |
URLRequest r(test_server_.GetURL("auth-basic"), &d, &default_context_); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); |
@@ -4501,7 +4503,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthLoadTiming) { |
r.set_load_flags(LOAD_VALIDATE_CACHE); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); |
@@ -4544,7 +4546,7 @@ TEST_F(URLRequestTestHTTP, Post302RedirectGet) { |
"Origin: http://localhost:1337/"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
std::string mime_type; |
req.GetMimeType(&mime_type); |
@@ -4627,7 +4629,7 @@ TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) { |
AddTestInterceptor()->set_main_intercept_job(job); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("GET", req.method()); |
} |
@@ -4651,7 +4653,7 @@ TEST_F(URLRequestTestHTTP, InterceptPost307RedirectPost) { |
AddTestInterceptor()->set_main_intercept_job(job); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("POST", req.method()); |
EXPECT_EQ(kData, d.data_received()); |
} |
@@ -4671,7 +4673,7 @@ TEST_F(URLRequestTestHTTP, DefaultAcceptLanguage) { |
URLRequest req( |
test_server_.GetURL("echoheader?Accept-Language"), &d, &context); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("en", d.data_received()); |
} |
@@ -4692,7 +4694,7 @@ TEST_F(URLRequestTestHTTP, EmptyAcceptLanguage) { |
URLRequest req( |
test_server_.GetURL("echoheader?Accept-Language"), &d, &context); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("None", d.data_received()); |
} |
@@ -4709,7 +4711,7 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptLanguage) { |
headers.SetHeader(HttpRequestHeaders::kAcceptLanguage, "ru"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(std::string("ru"), d.data_received()); |
} |
@@ -4724,7 +4726,7 @@ TEST_F(URLRequestTestHTTP, DefaultAcceptEncoding) { |
HttpRequestHeaders headers; |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_TRUE(ContainsString(d.data_received(), "gzip")); |
} |
@@ -4741,7 +4743,7 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptEncoding) { |
headers.SetHeader(HttpRequestHeaders::kAcceptEncoding, "identity"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_FALSE(ContainsString(d.data_received(), "gzip")); |
EXPECT_TRUE(ContainsString(d.data_received(), "identity")); |
} |
@@ -4758,7 +4760,7 @@ TEST_F(URLRequestTestHTTP, SetAcceptCharset) { |
headers.SetHeader(HttpRequestHeaders::kAcceptCharset, "koi-8r"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
} |
@@ -4771,7 +4773,7 @@ TEST_F(URLRequestTestHTTP, DefaultUserAgent) { |
&d, |
&default_context_); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(req.context()->GetUserAgent(req.url()), d.data_received()); |
} |
@@ -4788,7 +4790,7 @@ TEST_F(URLRequestTestHTTP, OverrideUserAgent) { |
headers.SetHeader(HttpRequestHeaders::kUserAgent, "Lynx (textmode)"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// If the net tests are being run with ChromeFrame then we need to allow for |
// the 'chromeframe' suffix which is added to the user agent before the |
// closing parentheses. |
@@ -4820,7 +4822,7 @@ TEST_F(URLRequestTestHTTP, EmptyHttpUserAgentSettings) { |
TestDelegate d; |
URLRequest req(test_server_.GetURL(tests[i].request), &d, &context); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(tests[i].expected_response, d.data_received()) |
<< " Request = \"" << tests[i].request << "\""; |
} |
@@ -4850,7 +4852,7 @@ TEST_F(URLRequestTestHTTP, SetSubsequentJobPriority) { |
AddTestInterceptor()->set_main_intercept_job(job.get()); |
// Should trigger |job| to be started. |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(LOW, job->priority()); |
} |
@@ -4880,7 +4882,7 @@ TEST_F(HTTPSRequestTest, HTTPSGetTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -4912,7 +4914,7 @@ TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -4948,7 +4950,7 @@ TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -4991,7 +4993,7 @@ TEST_F(HTTPSRequestTest, TLSv1Fallback) { |
URLRequest r(test_server.GetURL(std::string()), &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_NE(0, d.bytes_received()); |
@@ -5035,7 +5037,7 @@ TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -5083,7 +5085,7 @@ TEST_F(HTTPSRequestTest, HTTPSErrorsNoClobberTSSTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -5154,7 +5156,7 @@ TEST_F(HTTPSRequestTest, HSTSPreservesPosts) { |
req.set_upload(make_scoped_ptr(CreateSimpleUploadData(kData))); |
req.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ("https", req.url().scheme()); |
EXPECT_EQ("POST", req.method()); |
@@ -5184,7 +5186,7 @@ TEST_F(HTTPSRequestTest, SSLv3Fallback) { |
URLRequest r(test_server.GetURL(std::string()), &d, &context); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_NE(0, d.bytes_received()); |
@@ -5235,7 +5237,7 @@ TEST_F(HTTPSRequestTest, ClientAuthTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.on_certificate_requested_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -5246,7 +5248,7 @@ TEST_F(HTTPSRequestTest, ClientAuthTest) { |
// all platforms so we can test sending a cert as well. |
r.ContinueWithCertificate(NULL); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
EXPECT_FALSE(d.received_data_before_response()); |
@@ -5275,7 +5277,7 @@ TEST_F(HTTPSRequestTest, ResumeTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
} |
@@ -5291,7 +5293,7 @@ TEST_F(HTTPSRequestTest, ResumeTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// The response will look like; |
// insert abc |
@@ -5344,7 +5346,7 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
} |
@@ -5376,7 +5378,7 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
// The response will look like; |
// insert abc |
@@ -5492,7 +5494,7 @@ class HTTPSOCSPTest : public HTTPSRequestTest { |
URLRequest r(test_server.GetURL(std::string()), &d, &context_); |
r.Start(); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_EQ(1, d.response_started_count()); |
*out_cert_status = r.ssl_info().cert_status; |
@@ -5920,7 +5922,7 @@ TEST_F(URLRequestTestFTP, UnsafePort) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_FALSE(r.is_pending()); |
EXPECT_EQ(URLRequestStatus::FAILED, r.status().status()); |
@@ -5938,7 +5940,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPDirectoryListing) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
EXPECT_FALSE(r.is_pending()); |
EXPECT_EQ(1, d.response_started_count()); |
@@ -5964,7 +5966,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPGetTestAnonymous) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -5996,7 +5998,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPGetTest) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6034,7 +6036,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPassword) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6067,7 +6069,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPasswordRestart) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6097,7 +6099,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUser) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6130,7 +6132,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUserRestart) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6162,7 +6164,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6180,7 +6182,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6214,7 +6216,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |
@@ -6235,7 +6237,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
- base::MessageLoop::current()->Run(); |
+ base::RunLoop().Run(); |
int64 file_size = 0; |
file_util::GetFileSize(app_path, &file_size); |