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 97d36227711c38537b7ee43a4b3d7cf74498ffad..1b52bc546b883cb0d7c56c413e0b137f9604cb1f 100644 |
--- a/net/url_request/url_request_unittest.cc |
+++ b/net/url_request/url_request_unittest.cc |
@@ -158,8 +158,7 @@ void TestLoadTimingReusedWithProxy( |
load_timing_info.proxy_resolve_start); |
EXPECT_LE(load_timing_info.proxy_resolve_start, |
load_timing_info.proxy_resolve_end); |
- EXPECT_LE(load_timing_info.proxy_resolve_end, |
- load_timing_info.send_start); |
+ EXPECT_LE(load_timing_info.proxy_resolve_end, load_timing_info.send_start); |
EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end); |
EXPECT_LE(load_timing_info.send_end, load_timing_info.receive_headers_end); |
} |
@@ -205,8 +204,7 @@ void TestLoadTimingCacheHitNoNetwork( |
// Tests load timing in the case that there is no HTTP response. This can be |
// used to test in the case of errors or non-HTTP requests. |
-void TestLoadTimingNoHttpResponse( |
- const net::LoadTimingInfo& load_timing_info) { |
+void TestLoadTimingNoHttpResponse(const net::LoadTimingInfo& load_timing_info) { |
EXPECT_FALSE(load_timing_info.socket_reused); |
EXPECT_EQ(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id); |
@@ -246,8 +244,8 @@ void CheckSSLInfo(const SSLInfo& ssl_info) { |
EXPECT_GT(ssl_info.security_bits, 0); |
// The cipher suite TLS_NULL_WITH_NULL_NULL (0) must not be negotiated. |
- int cipher_suite = SSLConnectionStatusToCipherSuite( |
- ssl_info.connection_status); |
+ int cipher_suite = |
+ SSLConnectionStatusToCipherSuite(ssl_info.connection_status); |
EXPECT_NE(0, cipher_suite); |
} |
@@ -337,13 +335,9 @@ class BlockingNetworkDelegate : public TestNetworkDelegate { |
auth_credentials_ = auth_credentials; |
} |
- void set_redirect_url(const GURL& url) { |
- redirect_url_ = url; |
- } |
+ void set_redirect_url(const GURL& url) { redirect_url_ = url; } |
- void set_block_on(int block_on) { |
- block_on_ = block_on; |
- } |
+ void set_block_on(int block_on) { block_on_ = block_on; } |
// Allows the user to check in which state did we block. |
Stage stage_blocked_for_callback() const { |
@@ -394,7 +388,7 @@ class BlockingNetworkDelegate : public TestNetworkDelegate { |
AuthRequiredResponse auth_retval_; |
GURL redirect_url_; // Used if non-empty during OnBeforeURLRequest. |
- int block_on_; // Bit mask: in which stages to block. |
+ int block_on_; // Bit mask: in which stages to block. |
// |auth_credentials_| will be copied to |*target_auth_credential_| on |
// callback. |
@@ -501,8 +495,8 @@ NetworkDelegate::AuthRequiredResponse BlockingNetworkDelegate::OnAuthRequired( |
const AuthChallengeInfo& auth_info, |
const AuthCallback& callback, |
AuthCredentials* credentials) { |
- TestNetworkDelegate::OnAuthRequired(request, auth_info, callback, |
- credentials); |
+ TestNetworkDelegate::OnAuthRequired( |
+ request, auth_info, callback, credentials); |
// Check that the user has provided callback for the previous blocked stage. |
EXPECT_EQ(NOT_BLOCKED, stage_blocked_for_callback_); |
@@ -522,7 +516,9 @@ NetworkDelegate::AuthRequiredResponse BlockingNetworkDelegate::OnAuthRequired( |
base::MessageLoop::current()->PostTask( |
FROM_HERE, |
base::Bind(&BlockingNetworkDelegate::RunAuthCallback, |
- weak_factory_.GetWeakPtr(), auth_retval_, callback)); |
+ weak_factory_.GetWeakPtr(), |
+ auth_retval_, |
+ callback)); |
return AUTH_REQUIRED_RESPONSE_IO_PENDING; |
case USER_CALLBACK: |
@@ -562,7 +558,9 @@ int BlockingNetworkDelegate::MaybeBlockStage( |
base::MessageLoop::current()->PostTask( |
FROM_HERE, |
base::Bind(&BlockingNetworkDelegate::RunCallback, |
- weak_factory_.GetWeakPtr(), retval_, callback)); |
+ weak_factory_.GetWeakPtr(), |
+ retval_, |
+ callback)); |
return ERR_IO_PENDING; |
case USER_CALLBACK: |
@@ -650,25 +648,42 @@ TEST_F(URLRequestTest, DataURLImageTest) { |
// Use our nice little Chrome logo. |
URLRequest r( |
GURL( |
- "data:image/png;base64," |
- "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADVklEQVQ4jX2TfUwUBBjG3" |
- "w1y+HGcd9dxhXR8T4awOccJGgOSWclHImznLkTlSw0DDQXkrmgYgbUYnlQTqQxIEVxitD" |
- "5UMCATRA1CEEg+Qjw3bWDxIauJv/5oumqs39/P827vnucRmYN0gyF01GI5MpCVdW0gO7t" |
- "vNC+vqSEtbZefk5NuLv1jdJ46p/zw0HeH4+PHr3h7c1mjoV2t5rKzMx1+fg9bAgK6zHq9" |
- "cU5z+LpA3xOtx34+vTeT21onRuzssC3zxbbSwC13d/pFuC7CkIMDxQpF7r/MWq12UctI1" |
- "dWWm99ypqSYmRUBdKem8MkrO/kgaTt1O7YzlpzE5GIVd0WYUqt57yWf2McHTObYPbVD+Z" |
- "wbtlLTVMZ3BW+TnLyXLaWtmEq6WJVbT3HBh3Svj2HQQcm43XwmtoYM6vVKleh0uoWvnzW" |
- "3v3MpidruPTQPf0bia7sJOtBM0ufTWNvus/nkDFHF9ZS+uYVjRUasMeHUmyLYtcklTvzW" |
- "GFZnNOXczThvpKIzjcahSqIzkvDLayDq6D3eOjtBbNUEIZYyqsvj4V4wY92eNJ4IoyhTb" |
- "xXX1T5xsV9tm9r4TQwHLiZw/pdDZJea8TKmsmR/K0uLh/GwnCHghTja6lPhphezPfO5/5" |
- "MrVvMzNaI3+ERHfrFzPKQukrQGI4d/3EFD/3E2mVNYvi4at7CXWREaxZGD+3hg28zD3gV" |
- "Md6q5c8GdosynKmSeRuGzpjyl1/9UDGtPR5HeaKT8Wjo17WXk579BXVUhN64ehF9fhRtq" |
- "/uxxZKzNiZFGD0wRC3NFROZ5mwIPL/96K/rKMMLrIzF9uhHr+/sYH7DAbwlgC4J+R2Z7F" |
- "Ux1qLnV7MGF40smVSoJ/jvHRfYhQeUJd/SnYtGWhPHR0Sz+GE2F2yth0B36Vcz2KpnufB" |
- "JbsysjjW4kblBUiIjiURUWqJY65zxbnTy57GQyH58zgy0QBtTQv5gH15XMdKkYu+TGaJM" |
- "nlm2O34uI4b9tflqp1+QEFGzoW/ulmcofcpkZCYJhDfSpme7QcrHa+Xfji8paEQkTkSfm" |
- "moRWRNZr/F1KfVMjW+IKEnv2FwZfKdzt0BQR6lClcZR0EfEXEfv/G6W9iLiIyCoReV5En" |
- "hORIBHx+ufPj/gLB/zGI/G4Bk0AAAAASUVORK5CYII="), |
+ "data:image/png;base64," |
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/" |
+ "9hAAADVklEQVQ4jX2TfUwUBBjG3" |
+ "w1y+" |
+ "HGcd9dxhXR8T4awOccJGgOSWclHImznLkTlSw0DDQXkrmgYgbUYnlQTqQxIEVxitD" |
+ "5UMCATRA1CEEg+Qjw3bWDxIauJv/5oumqs39/" |
+ "P827vnucRmYN0gyF01GI5MpCVdW0gO7t" |
+ "vNC+vqSEtbZefk5NuLv1jdJ46p/" |
+ "zw0HeH4+PHr3h7c1mjoV2t5rKzMx1+fg9bAgK6zHq9" |
+ "cU5z+LpA3xOtx34+vTeT21onRuzssC3zxbbSwC13d/pFuC7CkIMDxQpF7r/" |
+ "MWq12UctI1" |
+ "dWWm99ypqSYmRUBdKem8MkrO/" |
+ "kgaTt1O7YzlpzE5GIVd0WYUqt57yWf2McHTObYPbVD+Z" |
+ "wbtlLTVMZ3BW+" |
+ "TnLyXLaWtmEq6WJVbT3HBh3Svj2HQQcm43XwmtoYM6vVKleh0uoWvnzW" |
+ "3v3MpidruPTQPf0bia7sJOtBM0ufTWNvus/" |
+ "nkDFHF9ZS+uYVjRUasMeHUmyLYtcklTvzW" |
+ "GFZnNOXczThvpKIzjcahSqIzkvDLayDq6D3eOjtBbNUEIZYyqsvj4V4wY92eNJ4Ioy" |
+ "hTb" |
+ "xXX1T5xsV9tm9r4TQwHLiZw/pdDZJea8TKmsmR/K0uLh/" |
+ "GwnCHghTja6lPhphezPfO5/5" |
+ "MrVvMzNaI3+ERHfrFzPKQukrQGI4d/3EFD/" |
+ "3E2mVNYvi4at7CXWREaxZGD+3hg28zD3gV" |
+ "Md6q5c8GdosynKmSeRuGzpjyl1/" |
+ "9UDGtPR5HeaKT8Wjo17WXk579BXVUhN64ehF9fhRtq" |
+ "/uxxZKzNiZFGD0wRC3NFROZ5mwIPL/96K/rKMMLrIzF9uhHr+/" |
+ "sYH7DAbwlgC4J+R2Z7F" |
+ "Ux1qLnV7MGF40smVSoJ/jvHRfYhQeUJd/" |
+ "SnYtGWhPHR0Sz+GE2F2yth0B36Vcz2KpnufB" |
+ "JbsysjjW4kblBUiIjiURUWqJY65zxbnTy57GQyH58zgy0QBtTQv5gH15XMdKkYu+" |
+ "TGaJM" |
+ "nlm2O34uI4b9tflqp1+QEFGzoW/" |
+ "ulmcofcpkZCYJhDfSpme7QcrHa+Xfji8paEQkTkSfm" |
+ "moRWRNZr/F1KfVMjW+IKEnv2FwZfKdzt0BQR6lClcZR0EfEXEfv/" |
+ "G6W9iLiIyCoReV5En" |
+ "hORIBHx+ufPj/gLB/zGI/G4Bk0AAAAASUVORK5CYII="), |
DEFAULT_PRIORITY, |
&d, |
&default_context_); |
@@ -762,8 +777,8 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { |
HttpRequestHeaders headers; |
headers.SetHeader( |
HttpRequestHeaders::kRange, |
- net::HttpByteRange::Bounded( |
- first_byte_position, last_byte_position).GetHeaderValue()); |
+ net::HttpByteRange::Bounded(first_byte_position, last_byte_position) |
+ .GetHeaderValue()); |
r.SetExtraRequestHeaders(headers); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -805,8 +820,8 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) { |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kRange, |
- net::HttpByteRange::RightUnbounded( |
- first_byte_position).GetHeaderValue()); |
+ net::HttpByteRange::RightUnbounded(first_byte_position) |
+ .GetHeaderValue()); |
r.SetExtraRequestHeaders(headers); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -916,8 +931,8 @@ TEST_F(URLRequestTest, ResolveShortcutTest) { |
// Temporarily create a shortcut for test |
{ |
base::win::ScopedComPtr<IShellLink> shell; |
- ASSERT_TRUE(SUCCEEDED(shell.CreateInstance(CLSID_ShellLink, NULL, |
- CLSCTX_INPROC_SERVER))); |
+ ASSERT_TRUE(SUCCEEDED( |
+ shell.CreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER))); |
base::win::ScopedComPtr<IPersistFile> persist; |
ASSERT_TRUE(SUCCEEDED(shell.QueryInterface(persist.Receive()))); |
EXPECT_TRUE(SUCCEEDED(shell->SetPath(app_path.value().c_str()))); |
@@ -938,17 +953,19 @@ TEST_F(URLRequestTest, ResolveShortcutTest) { |
base::RunLoop().Run(); |
WIN32_FILE_ATTRIBUTE_DATA data; |
- GetFileAttributesEx(app_path.value().c_str(), |
- GetFileExInfoStandard, &data); |
- HANDLE file = CreateFile(app_path.value().c_str(), GENERIC_READ, |
- FILE_SHARE_READ, NULL, OPEN_EXISTING, |
- FILE_ATTRIBUTE_NORMAL, NULL); |
+ GetFileAttributesEx(app_path.value().c_str(), GetFileExInfoStandard, &data); |
+ HANDLE file = CreateFile(app_path.value().c_str(), |
+ GENERIC_READ, |
+ FILE_SHARE_READ, |
+ NULL, |
+ OPEN_EXISTING, |
+ FILE_ATTRIBUTE_NORMAL, |
+ NULL); |
EXPECT_NE(INVALID_HANDLE_VALUE, file); |
scoped_ptr<char[]> buffer(new char[data.nFileSizeLow]); |
DWORD read_size; |
BOOL result; |
- result = ReadFile(file, buffer.get(), data.nFileSizeLow, |
- &read_size, NULL); |
+ result = ReadFile(file, buffer.get(), data.nFileSizeLow, &read_size, NULL); |
std::string content(buffer.get(), read_size); |
CloseHandle(file); |
@@ -1065,11 +1082,11 @@ TEST_F(URLRequestTest, FileDirRedirectSingleSlash) { |
class RestartTestJob : public URLRequestTestJob { |
public: |
RestartTestJob(URLRequest* request, NetworkDelegate* network_delegate) |
- : URLRequestTestJob(request, network_delegate, true) {} |
+ : URLRequestTestJob(request, network_delegate, true) {} |
+ |
protected: |
- virtual void StartAsync() OVERRIDE { |
- this->NotifyRestartRequired(); |
- } |
+ virtual void StartAsync() OVERRIDE { this->NotifyRestartRequired(); } |
+ |
private: |
virtual ~RestartTestJob() {} |
}; |
@@ -1077,11 +1094,11 @@ class RestartTestJob : public URLRequestTestJob { |
class CancelTestJob : public URLRequestTestJob { |
public: |
explicit CancelTestJob(URLRequest* request, NetworkDelegate* network_delegate) |
- : URLRequestTestJob(request, network_delegate, true) {} |
+ : URLRequestTestJob(request, network_delegate, true) {} |
+ |
protected: |
- virtual void StartAsync() OVERRIDE { |
- request_->Cancel(); |
- } |
+ virtual void StartAsync() OVERRIDE { request_->Cancel(); } |
+ |
private: |
virtual ~CancelTestJob() {} |
}; |
@@ -1090,13 +1107,14 @@ class CancelThenRestartTestJob : public URLRequestTestJob { |
public: |
explicit CancelThenRestartTestJob(URLRequest* request, |
NetworkDelegate* network_delegate) |
- : URLRequestTestJob(request, network_delegate, true) { |
- } |
+ : URLRequestTestJob(request, network_delegate, true) {} |
+ |
protected: |
virtual void StartAsync() OVERRIDE { |
request_->Cancel(); |
this->NotifyRestartRequired(); |
} |
+ |
private: |
virtual ~CancelThenRestartTestJob() {} |
}; |
@@ -1105,16 +1123,24 @@ class CancelThenRestartTestJob : public URLRequestTestJob { |
class TestInterceptor : URLRequest::Interceptor { |
public: |
TestInterceptor() |
- : intercept_main_request_(false), restart_main_request_(false), |
- cancel_main_request_(false), cancel_then_restart_main_request_(false), |
+ : intercept_main_request_(false), |
+ restart_main_request_(false), |
+ cancel_main_request_(false), |
+ cancel_then_restart_main_request_(false), |
simulate_main_network_error_(false), |
- intercept_redirect_(false), cancel_redirect_request_(false), |
- intercept_final_response_(false), cancel_final_request_(false), |
- did_intercept_main_(false), did_restart_main_(false), |
- did_cancel_main_(false), did_cancel_then_restart_main_(false), |
+ intercept_redirect_(false), |
+ cancel_redirect_request_(false), |
+ intercept_final_response_(false), |
+ cancel_final_request_(false), |
+ did_intercept_main_(false), |
+ did_restart_main_(false), |
+ did_cancel_main_(false), |
+ did_cancel_then_restart_main_(false), |
did_simulate_error_main_(false), |
- did_intercept_redirect_(false), did_cancel_redirect_(false), |
- did_intercept_final_(false), did_cancel_final_(false) { |
+ did_intercept_redirect_(false), |
+ did_cancel_redirect_(false), |
+ did_intercept_final_(false), |
+ did_cancel_final_(false) { |
URLRequest::Deprecated::RegisterRequestInterceptor(this); |
} |
@@ -1150,11 +1176,8 @@ class TestInterceptor : URLRequest::Interceptor { |
return NULL; |
intercept_main_request_ = false; |
did_intercept_main_ = true; |
- URLRequestTestJob* job = new URLRequestTestJob(request, |
- network_delegate, |
- main_headers_, |
- main_data_, |
- true); |
+ URLRequestTestJob* job = new URLRequestTestJob( |
+ request, network_delegate, main_headers_, main_data_, true); |
job->set_load_timing_info(main_request_load_timing_info_); |
return job; |
} |
@@ -1172,15 +1195,13 @@ class TestInterceptor : URLRequest::Interceptor { |
return NULL; |
intercept_redirect_ = false; |
did_intercept_redirect_ = true; |
- return new URLRequestTestJob(request, |
- network_delegate, |
- redirect_headers_, |
- redirect_data_, |
- true); |
+ return new URLRequestTestJob( |
+ request, network_delegate, redirect_headers_, redirect_data_, true); |
} |
virtual URLRequestJob* MaybeInterceptResponse( |
- URLRequest* request, NetworkDelegate* network_delegate) OVERRIDE { |
+ URLRequest* request, |
+ NetworkDelegate* network_delegate) OVERRIDE { |
if (cancel_final_request_) { |
cancel_final_request_ = false; |
did_cancel_final_ = true; |
@@ -1190,11 +1211,8 @@ class TestInterceptor : URLRequest::Interceptor { |
return NULL; |
intercept_final_response_ = false; |
did_intercept_final_ = true; |
- return new URLRequestTestJob(request, |
- network_delegate, |
- final_headers_, |
- final_data_, |
- true); |
+ return new URLRequestTestJob( |
+ request, network_delegate, final_headers_, final_data_, true); |
} |
// Whether to intercept the main request, and if so the response to return and |
@@ -1239,17 +1257,11 @@ class TestInterceptor : URLRequest::Interceptor { |
// Static getters for canned response header and data strings |
- static std::string ok_data() { |
- return URLRequestTestJob::test_data_1(); |
- } |
+ static std::string ok_data() { return URLRequestTestJob::test_data_1(); } |
- static std::string ok_headers() { |
- return URLRequestTestJob::test_headers(); |
- } |
+ static std::string ok_headers() { return URLRequestTestJob::test_headers(); } |
- static std::string redirect_data() { |
- return std::string(); |
- } |
+ static std::string redirect_data() { return std::string(); } |
static std::string redirect_headers() { |
return URLRequestTestJob::test_redirect_headers(); |
@@ -1313,7 +1325,7 @@ TEST_F(URLRequestTest, InterceptRedirect) { |
// intercept that redirect and respond a final OK response |
interceptor.intercept_redirect_ = true; |
- interceptor.redirect_headers_ = TestInterceptor::ok_headers(); |
+ interceptor.redirect_headers_ = TestInterceptor::ok_headers(); |
interceptor.redirect_data_ = TestInterceptor::ok_data(); |
TestDelegate d; |
@@ -1981,8 +1993,7 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { |
ASSERT_TRUE(test_server.Start()); |
TestURLRequestContext context; |
- scoped_refptr<DelayedCookieMonster> delayed_cm = |
- new DelayedCookieMonster(); |
+ scoped_refptr<DelayedCookieMonster> delayed_cm = new DelayedCookieMonster(); |
scoped_refptr<CookieStore> cookie_store = delayed_cm; |
context.set_cookie_store(delayed_cm.get()); |
@@ -2014,8 +2025,8 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != |
+ std::string::npos); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
@@ -2052,8 +2063,8 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != |
+ std::string::npos); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
@@ -2071,8 +2082,8 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") |
- == std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") == |
+ std::string::npos); |
// LOAD_DO_NOT_SEND_COOKIES does not trigger OnGetCookies. |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
@@ -2134,10 +2145,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") |
- == std::string::npos); |
- EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") == |
+ std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") != |
+ std::string::npos); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2177,8 +2188,8 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != |
+ std::string::npos); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2197,8 +2208,8 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") |
- == std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") == |
+ std::string::npos); |
EXPECT_EQ(1, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2256,10 +2267,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") |
- == std::string::npos); |
- EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") == |
+ std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") != |
+ std::string::npos); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2320,8 +2331,8 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotSend=1") != |
+ std::string::npos); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2340,8 +2351,8 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") |
- == std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("Cookie: CookieToNotSend=1") == |
+ std::string::npos); |
EXPECT_EQ(1, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2399,10 +2410,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
req.Start(); |
base::RunLoop().Run(); |
- EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") |
- == std::string::npos); |
- EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotSave=1") == |
+ std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("CookieToNotUpdate=2") != |
+ std::string::npos); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
@@ -2516,7 +2527,6 @@ TEST_F(URLRequestTest, AcceptClockSkewCookieWithWrongDateTimezone) { |
} |
} |
- |
// Check that it is impossible to change the referrer in the extra headers of |
// an URLRequest. |
TEST_F(URLRequestTest, DoNotOverrideReferrer) { |
@@ -2567,9 +2577,8 @@ TEST_F(URLRequestTest, DoNotOverrideReferrer) { |
class URLRequestTestHTTP : public URLRequestTest { |
public: |
URLRequestTestHTTP() |
- : test_server_(base::FilePath(FILE_PATH_LITERAL( |
- "net/data/url_request_unittest"))) { |
- } |
+ : test_server_(base::FilePath( |
+ FILE_PATH_LITERAL("net/data/url_request_unittest"))) {} |
protected: |
// Requests |redirect_url|, which must return a HTTP 3xx redirect. |
@@ -2613,10 +2622,10 @@ class URLRequestTestHTTP : public URLRequestTest { |
void HTTPUploadDataOperationTest(const std::string& method) { |
const int kMsgSize = 20000; // multiple of 10 |
const int kIterations = 50; |
- char* uploadBytes = new char[kMsgSize+1]; |
+ char* uploadBytes = new char[kMsgSize + 1]; |
char* ptr = uploadBytes; |
char marker = 'a'; |
- for (int idx = 0; idx < kMsgSize/10; idx++) { |
+ for (int idx = 0; idx < kMsgSize / 10; idx++) { |
memcpy(ptr, "----------", 10); |
ptr += 10; |
if (idx % 100 == 0) { |
@@ -2764,10 +2773,9 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) { |
// Tests that we can block and asynchronously return OK in various stages. |
TEST_F(URLRequestTestHTTP, NetworkDelegateBlockAsynchronously) { |
static const BlockingNetworkDelegate::Stage blocking_stages[] = { |
- BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, |
- BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, |
- BlockingNetworkDelegate::ON_HEADERS_RECEIVED |
- }; |
+ BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, |
+ BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, |
+ BlockingNetworkDelegate::ON_HEADERS_RECEIVED}; |
static const size_t blocking_stages_length = arraysize(blocking_stages); |
ASSERT_TRUE(test_server_.Start()); |
@@ -3083,7 +3091,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncNoAction) { |
} |
TEST_F(URLRequestTestHTTP, |
- NetworkDelegateOnAuthRequiredSyncNoAction_GetFullRequestHeaders) { |
+ NetworkDelegateOnAuthRequiredSyncNoAction_GetFullRequestHeaders) { |
ASSERT_TRUE(test_server_.Start()); |
TestDelegate d; |
@@ -3156,7 +3164,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncSetAuth) { |
// Same as above, but also tests that GetFullRequestHeaders returns the proper |
// headers (for the first or second request) when called at the proper times. |
TEST_F(URLRequestTestHTTP, |
- NetworkDelegateOnAuthRequiredSyncSetAuth_GetFullRequestHeaders) { |
+ NetworkDelegateOnAuthRequiredSyncSetAuth_GetFullRequestHeaders) { |
ASSERT_TRUE(test_server_.Start()); |
TestDelegate d; |
@@ -3660,19 +3668,17 @@ TEST_F(URLRequestTestHTTP, GetZippedTest) { |
// M - Medium length (between C & U). |
// S - Small length (smaller than both C & U). |
const char test_parameters[] = "CULMS"; |
- const int num_tests = arraysize(test_parameters)- 1; // Skip NULL. |
+ const int num_tests = arraysize(test_parameters) - 1; // Skip NULL. |
// C & U should be OK. |
// L & M are larger than the data sent, and show an error. |
// S has too little data, but we seem to accept it. |
- const bool test_expect_success[num_tests] = |
- { true, true, false, false, true }; |
+ const bool test_expect_success[num_tests] = {true, true, false, false, true}; |
- for (int i = 0; i < num_tests ; i++) { |
+ for (int i = 0; i < num_tests; i++) { |
TestDelegate d; |
{ |
- std::string test_file = |
- base::StringPrintf("compressedfiles/BullRunSpeech.txt?%c", |
- test_parameters[i]); |
+ std::string test_file = base::StringPrintf( |
+ "compressedfiles/BullRunSpeech.txt?%c", test_parameters[i]); |
TestNetworkDelegate network_delegate; // Must outlive URLRequest. |
TestURLRequestContext context(true); |
@@ -3707,7 +3713,8 @@ TEST_F(URLRequestTestHTTP, HTTPSToHTTPRedirectNoRefererTest) { |
ASSERT_TRUE(test_server_.Start()); |
SpawnedTestServer https_test_server( |
- SpawnedTestServer::TYPE_HTTPS, SpawnedTestServer::kLocalhost, |
+ SpawnedTestServer::TYPE_HTTPS, |
+ SpawnedTestServer::kLocalhost, |
base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
ASSERT_TRUE(https_test_server.Start()); |
@@ -3775,8 +3782,8 @@ TEST_F(URLRequestTestHTTP, MultipleRedirectTest) { |
GURL destination_url = test_server_.GetURL(std::string()); |
GURL middle_redirect_url = |
test_server_.GetURL("server-redirect?" + destination_url.spec()); |
- GURL original_url = test_server_.GetURL( |
- "server-redirect?" + middle_redirect_url.spec()); |
+ GURL original_url = |
+ test_server_.GetURL("server-redirect?" + middle_redirect_url.spec()); |
TestDelegate d; |
URLRequest req(original_url, DEFAULT_PRIORITY, &d, &default_context_); |
req.Start(); |
@@ -3813,12 +3820,12 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { |
LoadState expected_second_load_state, |
LoadState expected_third_load_state, |
const Callback& callback) { |
- AsyncDelegateLogger* logger = new AsyncDelegateLogger( |
- url_request, |
- expected_first_load_state, |
- expected_second_load_state, |
- expected_third_load_state, |
- callback); |
+ AsyncDelegateLogger* logger = |
+ new AsyncDelegateLogger(url_request, |
+ expected_first_load_state, |
+ expected_second_load_state, |
+ expected_third_load_state, |
+ callback); |
logger->Start(); |
} |
@@ -3827,7 +3834,8 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { |
// recorded. Returns the index of entry after the expected number of |
// events this logged, or entries.size() if there aren't enough entries. |
static size_t CheckDelegateInfo( |
- const CapturingNetLog::CapturedEntryList& entries, size_t log_position) { |
+ const CapturingNetLog::CapturedEntryList& entries, |
+ size_t log_position) { |
// There should be 4 DELEGATE_INFO events: Two begins and two ends. |
if (log_position + 3 >= entries.size()) { |
ADD_FAILURE() << "Not enough log entries"; |
@@ -3836,8 +3844,8 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { |
std::string delegate_info; |
EXPECT_EQ(NetLog::TYPE_DELEGATE_INFO, entries[log_position].type); |
EXPECT_EQ(NetLog::PHASE_BEGIN, entries[log_position].phase); |
- EXPECT_TRUE(entries[log_position].GetStringValue("delegate_info", |
- &delegate_info)); |
+ EXPECT_TRUE( |
+ entries[log_position].GetStringValue("delegate_info", &delegate_info)); |
EXPECT_EQ(kFirstDelegateInfo, delegate_info); |
++log_position; |
@@ -3847,8 +3855,8 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { |
++log_position; |
EXPECT_EQ(NetLog::TYPE_DELEGATE_INFO, entries[log_position].type); |
EXPECT_EQ(NetLog::PHASE_BEGIN, entries[log_position].phase); |
- EXPECT_TRUE(entries[log_position].GetStringValue("delegate_info", |
- &delegate_info)); |
+ EXPECT_TRUE( |
+ entries[log_position].GetStringValue("delegate_info", &delegate_info)); |
EXPECT_EQ(kSecondDelegateInfo, delegate_info); |
++log_position; |
@@ -3886,8 +3894,7 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { |
expected_first_load_state_(expected_first_load_state), |
expected_second_load_state_(expected_second_load_state), |
expected_third_load_state_(expected_third_load_state), |
- callback_(callback) { |
- } |
+ callback_(callback) {} |
~AsyncDelegateLogger() {} |
@@ -3897,8 +3904,7 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { |
EXPECT_EQ(expected_first_load_state_, load_state.state); |
EXPECT_NE(ASCIIToUTF16(kFirstDelegateInfo), load_state.param); |
base::MessageLoop::current()->PostTask( |
- FROM_HERE, |
- base::Bind(&AsyncDelegateLogger::LogSecondDelegate, this)); |
+ FROM_HERE, base::Bind(&AsyncDelegateLogger::LogSecondDelegate, this)); |
} |
void LogSecondDelegate() { |
@@ -3911,8 +3917,7 @@ class AsyncDelegateLogger : public base::RefCounted<AsyncDelegateLogger> { |
EXPECT_NE(ASCIIToUTF16(kSecondDelegateInfo), load_state.param); |
} |
base::MessageLoop::current()->PostTask( |
- FROM_HERE, |
- base::Bind(&AsyncDelegateLogger::LogComplete, this)); |
+ FROM_HERE, base::Bind(&AsyncDelegateLogger::LogComplete, this)); |
} |
void LogComplete() { |
@@ -3981,20 +3986,19 @@ class AsyncLoggingNetworkDelegate : public TestNetworkDelegate { |
LOAD_STATE_WAITING_FOR_DELEGATE, |
LOAD_STATE_WAITING_FOR_DELEGATE, |
base::Bind(&AsyncLoggingNetworkDelegate::SetAuthAndResume, |
- callback, credentials)); |
+ callback, |
+ credentials)); |
return AUTH_REQUIRED_RESPONSE_IO_PENDING; |
} |
private: |
- static int RunCallbackAsynchronously( |
- URLRequest* request, |
- const CompletionCallback& callback) { |
- AsyncDelegateLogger::Run( |
- request, |
- LOAD_STATE_WAITING_FOR_DELEGATE, |
- LOAD_STATE_WAITING_FOR_DELEGATE, |
- LOAD_STATE_WAITING_FOR_DELEGATE, |
- base::Bind(callback, OK)); |
+ static int RunCallbackAsynchronously(URLRequest* request, |
+ const CompletionCallback& callback) { |
+ AsyncDelegateLogger::Run(request, |
+ LOAD_STATE_WAITING_FOR_DELEGATE, |
+ LOAD_STATE_WAITING_FOR_DELEGATE, |
+ LOAD_STATE_WAITING_FOR_DELEGATE, |
+ base::Bind(callback, OK)); |
return ERR_IO_PENDING; |
} |
@@ -4045,22 +4049,24 @@ class AsyncLoggingUrlRequestDelegate : public TestDelegate { |
LOAD_STATE_WAITING_FOR_DELEGATE, |
base::Bind( |
&AsyncLoggingUrlRequestDelegate::OnReceivedRedirectLoggingComplete, |
- base::Unretained(this), request, new_url)); |
+ base::Unretained(this), |
+ request, |
+ new_url)); |
} |
virtual void OnResponseStarted(URLRequest* request) OVERRIDE { |
AsyncDelegateLogger::Run( |
- request, |
- LOAD_STATE_WAITING_FOR_DELEGATE, |
- LOAD_STATE_WAITING_FOR_DELEGATE, |
- LOAD_STATE_WAITING_FOR_DELEGATE, |
- base::Bind( |
- &AsyncLoggingUrlRequestDelegate::OnResponseStartedLoggingComplete, |
- base::Unretained(this), request)); |
+ request, |
+ LOAD_STATE_WAITING_FOR_DELEGATE, |
+ LOAD_STATE_WAITING_FOR_DELEGATE, |
+ LOAD_STATE_WAITING_FOR_DELEGATE, |
+ base::Bind( |
+ &AsyncLoggingUrlRequestDelegate::OnResponseStartedLoggingComplete, |
+ base::Unretained(this), |
+ request)); |
} |
- virtual void OnReadCompleted(URLRequest* request, |
- int bytes_read) OVERRIDE { |
+ virtual void OnReadCompleted(URLRequest* request, int bytes_read) OVERRIDE { |
AsyncDelegateLogger::Run( |
request, |
LOAD_STATE_IDLE, |
@@ -4068,7 +4074,9 @@ class AsyncLoggingUrlRequestDelegate : public TestDelegate { |
LOAD_STATE_IDLE, |
base::Bind( |
&AsyncLoggingUrlRequestDelegate::AfterReadCompletedLoggingComplete, |
- base::Unretained(this), request, bytes_read)); |
+ base::Unretained(this), |
+ request, |
+ bytes_read)); |
} |
private: |
@@ -4133,10 +4141,7 @@ TEST_F(URLRequestTestHTTP, DelegateInfoBeforeStart) { |
CapturingNetLog::CapturedEntryList entries; |
net_log_.GetEntries(&entries); |
size_t log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- 0, |
- NetLog::TYPE_DELEGATE_INFO, |
- NetLog::PHASE_BEGIN); |
+ entries, 0, NetLog::TYPE_DELEGATE_INFO, NetLog::PHASE_BEGIN); |
log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, log_position); |
@@ -4179,14 +4184,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateInfo) { |
CapturingNetLog::CapturedEntryList entries; |
net_log_.GetEntries(&entries); |
for (size_t i = 0; i < 3; ++i) { |
- log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- log_position + 1, |
- NetLog::TYPE_URL_REQUEST_DELEGATE, |
- NetLog::PHASE_BEGIN); |
+ log_position = |
+ ExpectLogContainsSomewhereAfter(entries, |
+ log_position + 1, |
+ NetLog::TYPE_URL_REQUEST_DELEGATE, |
+ NetLog::PHASE_BEGIN); |
- log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, |
- log_position + 1); |
+ log_position = |
+ AsyncDelegateLogger::CheckDelegateInfo(entries, log_position + 1); |
ASSERT_LT(log_position, entries.size()); |
EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, entries[log_position].type); |
@@ -4239,14 +4244,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateInfoRedirect) { |
// The NetworkDelegate logged information in OnBeforeURLRequest, |
// OnBeforeSendHeaders, and OnHeadersReceived. |
for (size_t i = 0; i < 3; ++i) { |
- log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- log_position + 1, |
- NetLog::TYPE_URL_REQUEST_DELEGATE, |
- NetLog::PHASE_BEGIN); |
+ log_position = |
+ ExpectLogContainsSomewhereAfter(entries, |
+ log_position + 1, |
+ NetLog::TYPE_URL_REQUEST_DELEGATE, |
+ NetLog::PHASE_BEGIN); |
- log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, |
- log_position + 1); |
+ log_position = |
+ AsyncDelegateLogger::CheckDelegateInfo(entries, log_position + 1); |
ASSERT_LT(log_position, entries.size()); |
EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, entries[log_position].type); |
@@ -4259,22 +4264,22 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateInfoRedirect) { |
} |
// The URLRequest::Delegate then gets informed about the redirect. |
- log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- log_position + 1, |
- NetLog::TYPE_URL_REQUEST_DELEGATE, |
- NetLog::PHASE_BEGIN); |
+ log_position = |
+ ExpectLogContainsSomewhereAfter(entries, |
+ log_position + 1, |
+ NetLog::TYPE_URL_REQUEST_DELEGATE, |
+ NetLog::PHASE_BEGIN); |
// The NetworkDelegate logged information in the same three events as before. |
for (size_t i = 0; i < 3; ++i) { |
- log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- log_position + 1, |
- NetLog::TYPE_URL_REQUEST_DELEGATE, |
- NetLog::PHASE_BEGIN); |
+ log_position = |
+ ExpectLogContainsSomewhereAfter(entries, |
+ log_position + 1, |
+ NetLog::TYPE_URL_REQUEST_DELEGATE, |
+ NetLog::PHASE_BEGIN); |
- log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, |
- log_position + 1); |
+ log_position = |
+ AsyncDelegateLogger::CheckDelegateInfo(entries, log_position + 1); |
ASSERT_LT(log_position, entries.size()); |
EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, entries[log_position].type); |
@@ -4323,14 +4328,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateInfoAuth) { |
// OnBeforeSendHeaders, OnHeadersReceived, OnAuthRequired, and then again in |
// OnBeforeURLRequest and OnBeforeSendHeaders. |
for (size_t i = 0; i < 6; ++i) { |
- log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- log_position + 1, |
- NetLog::TYPE_URL_REQUEST_DELEGATE, |
- NetLog::PHASE_BEGIN); |
+ log_position = |
+ ExpectLogContainsSomewhereAfter(entries, |
+ log_position + 1, |
+ NetLog::TYPE_URL_REQUEST_DELEGATE, |
+ NetLog::PHASE_BEGIN); |
- log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, |
- log_position + 1); |
+ log_position = |
+ AsyncDelegateLogger::CheckDelegateInfo(entries, log_position + 1); |
ASSERT_LT(log_position, entries.size()); |
EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, entries[log_position].type); |
@@ -4380,8 +4385,8 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateInfo) { |
size_t log_position = 0; |
- log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents( |
- entries, log_position); |
+ log_position = |
+ AsyncDelegateLogger::ExpectBeforeNetworkEvents(entries, log_position); |
// The delegate info should only have been logged on header complete. Other |
// times it should silently be ignored. |
@@ -4391,8 +4396,8 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateInfo) { |
NetLog::TYPE_URL_REQUEST_DELEGATE, |
NetLog::PHASE_BEGIN); |
- log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, |
- log_position + 1); |
+ log_position = |
+ AsyncDelegateLogger::CheckDelegateInfo(entries, log_position + 1); |
ASSERT_LT(log_position, entries.size()); |
EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, entries[log_position].type); |
@@ -4438,17 +4443,18 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateInfoOnRedirect) { |
for (int i = 0; i < 2; ++i) { |
if (i == 0) { |
log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents( |
- entries, log_position) + 1; |
+ entries, log_position) + |
+ 1; |
} |
- log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- log_position, |
- NetLog::TYPE_URL_REQUEST_DELEGATE, |
- NetLog::PHASE_BEGIN); |
+ log_position = |
+ ExpectLogContainsSomewhereAfter(entries, |
+ log_position, |
+ NetLog::TYPE_URL_REQUEST_DELEGATE, |
+ NetLog::PHASE_BEGIN); |
- log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, |
- log_position + 1); |
+ log_position = |
+ AsyncDelegateLogger::CheckDelegateInfo(entries, log_position + 1); |
ASSERT_LT(log_position, entries.size()); |
EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, entries[log_position].type); |
@@ -4467,9 +4473,9 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateOnRedirectCancelled) { |
ASSERT_TRUE(test_server_.Start()); |
const AsyncLoggingUrlRequestDelegate::CancelStage kCancelStages[] = { |
- AsyncLoggingUrlRequestDelegate::CANCEL_ON_RECEIVED_REDIRECT, |
- AsyncLoggingUrlRequestDelegate::CANCEL_ON_RESPONSE_STARTED, |
- AsyncLoggingUrlRequestDelegate::CANCEL_ON_READ_COMPLETED, |
+ AsyncLoggingUrlRequestDelegate::CANCEL_ON_RECEIVED_REDIRECT, |
+ AsyncLoggingUrlRequestDelegate::CANCEL_ON_RESPONSE_STARTED, |
+ AsyncLoggingUrlRequestDelegate::CANCEL_ON_READ_COMPLETED, |
}; |
for (size_t test_case = 0; test_case < arraysize(kCancelStages); |
@@ -4503,17 +4509,18 @@ TEST_F(URLRequestTestHTTP, URLRequestDelegateOnRedirectCancelled) { |
for (int i = 0; i < 2; ++i) { |
if (i == 0) { |
log_position = AsyncDelegateLogger::ExpectBeforeNetworkEvents( |
- entries, log_position) + 1; |
+ entries, log_position) + |
+ 1; |
} |
- log_position = ExpectLogContainsSomewhereAfter( |
- entries, |
- log_position, |
- NetLog::TYPE_URL_REQUEST_DELEGATE, |
- NetLog::PHASE_BEGIN); |
+ log_position = |
+ ExpectLogContainsSomewhereAfter(entries, |
+ log_position, |
+ NetLog::TYPE_URL_REQUEST_DELEGATE, |
+ NetLog::PHASE_BEGIN); |
- log_position = AsyncDelegateLogger::CheckDelegateInfo(entries, |
- log_position + 1); |
+ log_position = |
+ AsyncDelegateLogger::CheckDelegateInfo(entries, log_position + 1); |
ASSERT_LT(log_position, entries.size()); |
EXPECT_EQ(NetLog::TYPE_URL_REQUEST_DELEGATE, entries[log_position].type); |
@@ -4546,10 +4553,10 @@ class RedirectWithAdditionalHeadersDelegate : public TestDelegate { |
TEST_F(URLRequestTestHTTP, RedirectWithAdditionalHeadersTest) { |
ASSERT_TRUE(test_server_.Start()); |
- GURL destination_url = test_server_.GetURL( |
- "echoheader?" + std::string(kExtraHeader)); |
- GURL original_url = test_server_.GetURL( |
- "server-redirect?" + destination_url.spec()); |
+ GURL destination_url = |
+ test_server_.GetURL("echoheader?" + std::string(kExtraHeader)); |
+ GURL original_url = |
+ test_server_.GetURL("server-redirect?" + destination_url.spec()); |
RedirectWithAdditionalHeadersDelegate d; |
URLRequest req(original_url, DEFAULT_PRIORITY, &d, &default_context_); |
req.Start(); |
@@ -4570,8 +4577,8 @@ const char kExtraHeaderToRemove[] = "To-Be-Removed"; |
class RedirectWithHeaderRemovalDelegate : public TestDelegate { |
virtual void OnReceivedRedirect(net::URLRequest* request, |
- const GURL& new_url, |
- bool* defer_redirect) OVERRIDE { |
+ const GURL& new_url, |
+ bool* defer_redirect) OVERRIDE { |
TestDelegate::OnReceivedRedirect(request, new_url, defer_redirect); |
request->RemoveRequestHeaderByName(kExtraHeaderToRemove); |
} |
@@ -4582,10 +4589,10 @@ class RedirectWithHeaderRemovalDelegate : public TestDelegate { |
TEST_F(URLRequestTestHTTP, RedirectWithHeaderRemovalTest) { |
ASSERT_TRUE(test_server_.Start()); |
- GURL destination_url = test_server_.GetURL( |
- "echoheader?" + std::string(kExtraHeaderToRemove)); |
- GURL original_url = test_server_.GetURL( |
- "server-redirect?" + destination_url.spec()); |
+ GURL destination_url = |
+ test_server_.GetURL("echoheader?" + std::string(kExtraHeaderToRemove)); |
+ GURL original_url = |
+ test_server_.GetURL("server-redirect?" + destination_url.spec()); |
RedirectWithHeaderRemovalDelegate d; |
URLRequest req(original_url, DEFAULT_PRIORITY, &d, &default_context_); |
req.SetExtraRequestHeaderByName(kExtraHeaderToRemove, "dummy", false); |
@@ -4795,8 +4802,8 @@ TEST_F(URLRequestTestHTTP, PostFileTest) { |
0, |
kuint64max, |
base::Time())); |
- r.set_upload(make_scoped_ptr( |
- new UploadDataStream(element_readers.Pass(), 0))); |
+ r.set_upload( |
+ make_scoped_ptr(new UploadDataStream(element_readers.Pass(), 0))); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4825,8 +4832,8 @@ TEST_F(URLRequestTestHTTP, PostUnreadableFileTest) { |
TestDelegate d; |
{ |
- URLRequest r(test_server_.GetURL("echo"), DEFAULT_PRIORITY, |
- &d, &default_context_); |
+ URLRequest r( |
+ test_server_.GetURL("echo"), DEFAULT_PRIORITY, &d, &default_context_); |
r.set_method("POST"); |
ScopedVector<UploadElementReader> element_readers; |
@@ -4838,8 +4845,8 @@ TEST_F(URLRequestTestHTTP, PostUnreadableFileTest) { |
0, |
kuint64max, |
base::Time())); |
- r.set_upload(make_scoped_ptr( |
- new UploadDataStream(element_readers.Pass(), 0))); |
+ r.set_upload( |
+ make_scoped_ptr(new UploadDataStream(element_readers.Pass(), 0))); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4969,7 +4976,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTS) { |
EXPECT_TRUE(domain_state.sts_include_subdomains); |
EXPECT_FALSE(domain_state.pkp_include_subdomains); |
#if defined(OS_ANDROID) |
- // Android's CertVerifyProc does not (yet) handle pins. |
+// Android's CertVerifyProc does not (yet) handle pins. |
#else |
EXPECT_FALSE(domain_state.HasPublicKeyPins()); |
#endif |
@@ -5074,7 +5081,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP) { |
EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, |
domain_state.upgrade_mode); |
#if defined(OS_ANDROID) |
- // Android's CertVerifyProc does not (yet) handle pins. |
+// Android's CertVerifyProc does not (yet) handle pins. |
#else |
EXPECT_TRUE(domain_state.HasPublicKeyPins()); |
#endif |
@@ -5116,7 +5123,7 @@ TEST_F(URLRequestTestHTTP, ProcessSTSAndPKP2) { |
EXPECT_EQ(TransportSecurityState::DomainState::MODE_FORCE_HTTPS, |
domain_state.upgrade_mode); |
#if defined(OS_ANDROID) |
- // Android's CertVerifyProc does not (yet) handle pins. |
+// Android's CertVerifyProc does not (yet) handle pins. |
#else |
EXPECT_TRUE(domain_state.HasPublicKeyPins()); |
#endif |
@@ -5425,9 +5432,12 @@ TEST_F(URLRequestTestHTTP, RedirectJobWithReferenceFragment) { |
TestDelegate d; |
URLRequest r(original_url, DEFAULT_PRIORITY, &d, &default_context_); |
- URLRequestRedirectJob* job = new URLRequestRedirectJob( |
- &r, &default_network_delegate_, redirect_url, |
- URLRequestRedirectJob::REDIRECT_302_FOUND, "Very Good Reason"); |
+ URLRequestRedirectJob* job = |
+ new URLRequestRedirectJob(&r, |
+ &default_network_delegate_, |
+ redirect_url, |
+ URLRequestRedirectJob::REDIRECT_302_FOUND, |
+ "Very Good Reason"); |
AddTestInterceptor()->set_main_intercept_job(job); |
r.Start(); |
@@ -5826,8 +5836,8 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { |
EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); |
// Make sure we sent the cookie in the restarted transaction. |
- EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") != |
+ std::string::npos); |
} |
// Same test as above, except this time the restart is initiated earlier |
@@ -5855,8 +5865,8 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { |
EXPECT_TRUE(d.data_received().find("user2/secret") != std::string::npos); |
// Make sure we sent the cookie in the restarted transaction. |
- EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") |
- != std::string::npos); |
+ EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") != |
+ std::string::npos); |
} |
} |
@@ -5945,14 +5955,14 @@ TEST_F(URLRequestTestHTTP, Post302RedirectGet) { |
// Set headers (some of which are specific to the POST). |
HttpRequestHeaders headers; |
headers.AddHeadersFromString( |
- "Content-Type: multipart/form-data; " |
- "boundary=----WebKitFormBoundaryAADeAA+NAAWMAAwZ\r\n" |
- "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9," |
- "text/plain;q=0.8,image/png,*/*;q=0.5\r\n" |
- "Accept-Language: en-US,en\r\n" |
- "Accept-Charset: ISO-8859-1,*,utf-8\r\n" |
- "Content-Length: 11\r\n" |
- "Origin: http://localhost:1337/"); |
+ "Content-Type: multipart/form-data; " |
+ "boundary=----WebKitFormBoundaryAADeAA+NAAWMAAwZ\r\n" |
+ "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9," |
+ "text/plain;q=0.8,image/png,*/*;q=0.5\r\n" |
+ "Accept-Language: en-US,en\r\n" |
+ "Accept-Charset: ISO-8859-1,*,utf-8\r\n" |
+ "Content-Length: 11\r\n" |
+ "Origin: http://localhost:1337/"); |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
base::RunLoop().Run(); |
@@ -6086,9 +6096,12 @@ TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) { |
base::UintToString(arraysize(kData) - 1)); |
req.SetExtraRequestHeaders(headers); |
- URLRequestRedirectJob* job = new URLRequestRedirectJob( |
- &req, &default_network_delegate_, test_server_.GetURL("echo"), |
- URLRequestRedirectJob::REDIRECT_302_FOUND, "Very Good Reason"); |
+ URLRequestRedirectJob* job = |
+ new URLRequestRedirectJob(&req, |
+ &default_network_delegate_, |
+ test_server_.GetURL("echo"), |
+ URLRequestRedirectJob::REDIRECT_302_FOUND, |
+ "Very Good Reason"); |
AddTestInterceptor()->set_main_intercept_job(job); |
req.Start(); |
@@ -6114,7 +6127,9 @@ TEST_F(URLRequestTestHTTP, InterceptPost307RedirectPost) { |
req.SetExtraRequestHeaders(headers); |
URLRequestRedirectJob* job = new URLRequestRedirectJob( |
- &req, &default_network_delegate_, test_server_.GetURL("echo"), |
+ &req, |
+ &default_network_delegate_, |
+ test_server_.GetURL("echo"), |
URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, |
"Very Good Reason"); |
AddTestInterceptor()->set_main_intercept_job(job); |
@@ -6290,9 +6305,9 @@ TEST_F(URLRequestTestHTTP, EmptyHttpUserAgentSettings) { |
struct { |
const char* request; |
const char* expected_response; |
- } tests[] = { { "echoheader?Accept-Language", "None" }, |
- { "echoheader?Accept-Charset", "None" }, |
- { "echoheader?User-Agent", "" } }; |
+ } tests[] = {{"echoheader?Accept-Language", "None"}, |
+ {"echoheader?Accept-Charset", "None"}, |
+ {"echoheader?User-Agent", ""}}; |
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); i++) { |
TestDelegate d; |
@@ -6318,9 +6333,11 @@ TEST_F(URLRequestTestHTTP, SetSubsequentJobPriority) { |
EXPECT_EQ(DEFAULT_PRIORITY, req.priority()); |
scoped_refptr<URLRequestRedirectJob> redirect_job = |
- new URLRequestRedirectJob( |
- &req, &default_network_delegate_, test_server_.GetURL("echo"), |
- URLRequestRedirectJob::REDIRECT_302_FOUND, "Very Good Reason"); |
+ new URLRequestRedirectJob(&req, |
+ &default_network_delegate_, |
+ test_server_.GetURL("echo"), |
+ URLRequestRedirectJob::REDIRECT_302_FOUND, |
+ "Very Good Reason"); |
AddTestInterceptor()->set_main_intercept_job(redirect_job.get()); |
req.SetPriority(LOW); |
@@ -6355,7 +6372,8 @@ TEST_F(URLRequestTestHTTP, NetworkSuspendTest) { |
new HttpNetworkLayer(new HttpNetworkSession(params))); |
network_layer->OnSuspend(); |
- HttpCache http_cache(network_layer.release(), default_context_.net_log(), |
+ HttpCache http_cache(network_layer.release(), |
+ default_context_.net_log(), |
HttpCache::DefaultBackend::InMemory(0)); |
TestURLRequestContext context(true); |
@@ -6363,10 +6381,7 @@ TEST_F(URLRequestTestHTTP, NetworkSuspendTest) { |
context.Init(); |
TestDelegate d; |
- URLRequest req(GURL("http://127.0.0.1/"), |
- DEFAULT_PRIORITY, |
- &d, |
- &context); |
+ URLRequest req(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d, &context); |
req.Start(); |
base::RunLoop().Run(); |
@@ -6398,10 +6413,7 @@ TEST_F(URLRequestTestHTTP, NetworkSuspendTestNoCache) { |
context.Init(); |
TestDelegate d; |
- URLRequest req(GURL("http://127.0.0.1/"), |
- DEFAULT_PRIORITY, |
- &d, |
- &context); |
+ URLRequest req(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d, &context); |
req.Start(); |
base::RunLoop().Run(); |
@@ -6445,10 +6457,8 @@ TEST_F(HTTPSRequestTest, HTTPSGetTest) { |
EXPECT_FALSE(d.received_data_before_response()); |
EXPECT_NE(0, d.bytes_received()); |
CheckSSLInfo(r.ssl_info()); |
- EXPECT_EQ(test_server.host_port_pair().host(), |
- r.GetSocketAddress().host()); |
- EXPECT_EQ(test_server.host_port_pair().port(), |
- r.GetSocketAddress().port()); |
+ EXPECT_EQ(test_server.host_port_pair().host(), r.GetSocketAddress().host()); |
+ EXPECT_EQ(test_server.host_port_pair().port(), r.GetSocketAddress().port()); |
} |
} |
@@ -6462,7 +6472,7 @@ TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) { |
ASSERT_TRUE(test_server.Start()); |
bool err_allowed = true; |
- for (int i = 0; i < 2 ; i++, err_allowed = !err_allowed) { |
+ for (int i = 0; i < 2; i++, err_allowed = !err_allowed) { |
TestDelegate d; |
{ |
d.set_allow_certificate_errors(err_allowed); |
@@ -6501,7 +6511,7 @@ TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { |
// Iterate from false to true, just so that we do the opposite of the |
// previous test in order to increase test coverage. |
bool err_allowed = false; |
- for (int i = 0; i < 2 ; i++, err_allowed = !err_allowed) { |
+ for (int i = 0; i < 2; i++, err_allowed = !err_allowed) { |
TestDelegate d; |
{ |
d.set_allow_certificate_errors(err_allowed); |
@@ -6531,7 +6541,7 @@ TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { |
// Tests TLSv1.1 -> TLSv1 fallback. Verifies that we don't fall back more |
// than necessary. |
TEST_F(HTTPSRequestTest, TLSv1Fallback) { |
- // The OpenSSL library in use may not support TLS 1.1. |
+// The OpenSSL library in use may not support TLS 1.1. |
#if !defined(USE_OPENSSL) |
EXPECT_GT(kDefaultSSLVersionMax, SSL_PROTOCOL_VERSION_TLS1); |
#endif |
@@ -6675,8 +6685,8 @@ TEST_F(HTTPSRequestTest, HTTPSErrorsNoClobberTSSTest) { |
context.set_host_resolver(&host_resolver); |
TransportSecurityState transport_security_state; |
TransportSecurityState::DomainState domain_state; |
- EXPECT_TRUE(transport_security_state.GetDomainState("www.google.com", true, |
- &domain_state)); |
+ EXPECT_TRUE(transport_security_state.GetDomainState( |
+ "www.google.com", true, &domain_state)); |
context.set_transport_security_state(&transport_security_state); |
context.Init(); |
@@ -6699,8 +6709,8 @@ TEST_F(HTTPSRequestTest, HTTPSErrorsNoClobberTSSTest) { |
// Get a fresh copy of the state, and check that it hasn't been updated. |
TransportSecurityState::DomainState new_domain_state; |
- EXPECT_TRUE(transport_security_state.GetDomainState("www.google.com", true, |
- &new_domain_state)); |
+ EXPECT_TRUE(transport_security_state.GetDomainState( |
+ "www.google.com", true, &new_domain_state)); |
EXPECT_EQ(new_domain_state.upgrade_mode, domain_state.upgrade_mode); |
EXPECT_EQ(new_domain_state.sts_include_subdomains, |
domain_state.sts_include_subdomains); |
@@ -6726,7 +6736,6 @@ TEST_F(HTTPSRequestTest, HSTSPreservesPosts) { |
base::FilePath(FILE_PATH_LITERAL("net/data/ssl"))); |
ASSERT_TRUE(test_server.Start()); |
- |
// Per spec, TransportSecurityState expects a domain name, rather than an IP |
// address, so a MockHostResolver is needed to redirect www.somewhere.com to |
// the SpawnedTestServer. By default, MockHostResolver maps all hosts |
@@ -6737,8 +6746,8 @@ TEST_F(HTTPSRequestTest, HSTSPreservesPosts) { |
TransportSecurityState transport_security_state; |
base::Time expiry = base::Time::Now() + base::TimeDelta::FromDays(1000); |
bool include_subdomains = false; |
- transport_security_state.AddHSTS("www.somewhere.com", expiry, |
- include_subdomains); |
+ transport_security_state.AddHSTS( |
+ "www.somewhere.com", expiry, include_subdomains); |
TestNetworkDelegate network_delegate; // Must outlive URLRequest. |
@@ -6806,8 +6815,7 @@ namespace { |
class SSLClientAuthTestDelegate : public TestDelegate { |
public: |
- SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { |
- } |
+ SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) {} |
virtual void OnCertificateRequested( |
URLRequest* request, |
SSLCertRequestInfo* cert_request_info) OVERRIDE { |
@@ -6817,6 +6825,7 @@ class SSLClientAuthTestDelegate : public TestDelegate { |
int on_certificate_requested_count() { |
return on_certificate_requested_count_; |
} |
+ |
private: |
int on_certificate_requested_count_; |
}; |
@@ -6894,8 +6903,8 @@ TEST_F(HTTPSRequestTest, ResumeTest) { |
EXPECT_EQ(1, d.response_started_count()); |
} |
- reinterpret_cast<HttpCache*>(default_context_.http_transaction_factory())-> |
- CloseAllConnections(); |
+ reinterpret_cast<HttpCache*>(default_context_.http_transaction_factory()) |
+ ->CloseAllConnections(); |
{ |
TestDelegate d; |
@@ -6980,9 +6989,9 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { |
params.http_server_properties = default_context_.http_server_properties(); |
params.ssl_session_cache_shard = "alternate"; |
- scoped_ptr<net::HttpCache> cache(new net::HttpCache( |
- new net::HttpNetworkSession(params), |
- net::HttpCache::DefaultBackend::InMemory(0))); |
+ scoped_ptr<net::HttpCache> cache( |
+ new net::HttpCache(new net::HttpNetworkSession(params), |
+ net::HttpCache::DefaultBackend::InMemory(0))); |
default_context_.set_http_transaction_factory(cache.get()); |
@@ -7072,8 +7081,8 @@ TEST_F(HTTPSSessionTest, DontResumeSessionsForInvalidCertificates) { |
EXPECT_EQ(1, d.response_started_count()); |
} |
- reinterpret_cast<HttpCache*>(default_context_.http_transaction_factory())-> |
- CloseAllConnections(); |
+ reinterpret_cast<HttpCache*>(default_context_.http_transaction_factory()) |
+ ->CloseAllConnections(); |
// Now change the certificate to be acceptable (so that the response is |
// loaded), and ensure that no session id is presented to the peer. |
@@ -7153,18 +7162,17 @@ class TestSSLConfigService : public SSLConfigService { |
// This the fingerprint of the "Testing CA" certificate used by the testserver. |
// See net/data/ssl/certificates/ocsp-test-root.pem. |
-static const SHA1HashValue kOCSPTestCertFingerprint = |
- { { 0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24, |
- 0xdb, 0x1a, 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c } }; |
+static const SHA1HashValue kOCSPTestCertFingerprint = { |
+ {0xf1, 0xad, 0xf6, 0xce, 0x42, 0xac, 0xe7, 0xb4, 0xf4, 0x24, 0xdb, 0x1a, |
+ 0xf7, 0xa0, 0x9f, 0x09, 0xa1, 0xea, 0xf1, 0x5c}}; |
// This is the SHA256, SPKI hash of the "Testing CA" certificate used by the |
// testserver. |
-static const SHA256HashValue kOCSPTestCertSPKI = { { |
- 0xee, 0xe6, 0x51, 0x2d, 0x4c, 0xfa, 0xf7, 0x3e, |
- 0x6c, 0xd8, 0xca, 0x67, 0xed, 0xb5, 0x5d, 0x49, |
- 0x76, 0xe1, 0x52, 0xa7, 0x6e, 0x0e, 0xa0, 0x74, |
- 0x09, 0x75, 0xe6, 0x23, 0x24, 0xbd, 0x1b, 0x28, |
-} }; |
+static const SHA256HashValue kOCSPTestCertSPKI = {{ |
+ 0xee, 0xe6, 0x51, 0x2d, 0x4c, 0xfa, 0xf7, 0x3e, 0x6c, 0xd8, 0xca, 0x67, |
+ 0xed, 0xb5, 0x5d, 0x49, 0x76, 0xe1, 0x52, 0xa7, 0x6e, 0x0e, 0xa0, 0x74, |
+ 0x09, 0x75, 0xe6, 0x23, 0x24, 0xbd, 0x1b, 0x28, |
+}}; |
// This is the policy OID contained in the certificates that testserver |
// generates. |
@@ -7174,11 +7182,9 @@ class HTTPSOCSPTest : public HTTPSRequestTest { |
public: |
HTTPSOCSPTest() |
: context_(true), |
- ev_test_policy_( |
- new ScopedTestEVPolicy(EVRootCAMetadata::GetInstance(), |
- kOCSPTestCertFingerprint, |
- kOCSPTestCertPolicy)) { |
- } |
+ ev_test_policy_(new ScopedTestEVPolicy(EVRootCAMetadata::GetInstance(), |
+ kOCSPTestCertFingerprint, |
+ kOCSPTestCertPolicy)) {} |
virtual void SetUp() OVERRIDE { |
SetupContext(&context_); |
@@ -7273,7 +7279,7 @@ static bool SystemUsesChromiumEVMetadata() { |
#if defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID) |
// http://crbug.com/117478 - OpenSSL does not support EV validation. |
return false; |
-#elif (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID) |
+#elif(defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_ANDROID) |
// On OS X and Android, we use the system to tell us whether a certificate is |
// EV or not and the system won't recognise our testing root. |
return false; |
@@ -7370,7 +7376,6 @@ class HTTPSHardFailTest : public HTTPSOCSPTest { |
} |
}; |
- |
TEST_F(HTTPSHardFailTest, FailsOnOCSPInvalid) { |
if (!SystemSupportsOCSP()) { |
LOG(WARNING) << "Skipping test because system doesn't support OCSP"; |
@@ -7390,8 +7395,7 @@ TEST_F(HTTPSHardFailTest, FailsOnOCSPInvalid) { |
CertStatus cert_status; |
DoConnection(ssl_options, &cert_status); |
- EXPECT_EQ(CERT_STATUS_REVOKED, |
- cert_status & CERT_STATUS_REVOKED); |
+ EXPECT_EQ(CERT_STATUS_REVOKED, cert_status & CERT_STATUS_REVOKED); |
// Without a positive OCSP response, we shouldn't show the EV status. |
EXPECT_TRUE(cert_status & CERT_STATUS_REV_CHECKING_ENABLED); |
@@ -7444,9 +7448,9 @@ TEST_F(HTTPSEVCRLSetTest, MissingCRLSetAndRevokedOCSP) { |
CertStatus cert_status; |
DoConnection(ssl_options, &cert_status); |
- // Currently only works for Windows. When using NSS or OS X, it's not |
- // possible to determine whether the check failed because of actual |
- // revocation or because there was an OCSP failure. |
+// Currently only works for Windows. When using NSS or OS X, it's not |
+// possible to determine whether the check failed because of actual |
+// revocation or because there was an OCSP failure. |
#if defined(OS_WIN) |
EXPECT_EQ(CERT_STATUS_REVOKED, cert_status & CERT_STATUS_ALL_ERRORS); |
#else |
@@ -7513,8 +7517,7 @@ TEST_F(HTTPSEVCRLSetTest, FreshCRLSetCovered) { |
SpawnedTestServer::SSLOptions::CERT_AUTO); |
ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_INVALID; |
SSLConfigService::SetCRLSet( |
- scoped_refptr<CRLSet>(CRLSet::ForTesting( |
- false, &kOCSPTestCertSPKI, ""))); |
+ scoped_refptr<CRLSet>(CRLSet::ForTesting(false, &kOCSPTestCertSPKI, ""))); |
CertStatus cert_status; |
DoConnection(ssl_options, &cert_status); |
@@ -7620,9 +7623,8 @@ TEST_F(HTTPSCRLSetTest, CRLSetRevoked) { |
SpawnedTestServer::SSLOptions::CERT_AUTO); |
ssl_options.ocsp_status = SpawnedTestServer::SSLOptions::OCSP_OK; |
ssl_options.cert_serial = 10; |
- SSLConfigService::SetCRLSet( |
- scoped_refptr<CRLSet>(CRLSet::ForTesting( |
- false, &kOCSPTestCertSPKI, "\x0a"))); |
+ SSLConfigService::SetCRLSet(scoped_refptr<CRLSet>( |
+ CRLSet::ForTesting(false, &kOCSPTestCertSPKI, "\x0a"))); |
CertStatus cert_status = 0; |
DoConnection(ssl_options, &cert_status); |
@@ -7640,9 +7642,9 @@ TEST_F(HTTPSCRLSetTest, CRLSetRevoked) { |
class URLRequestTestFTP : public URLRequestTest { |
public: |
URLRequestTestFTP() |
- : test_server_(SpawnedTestServer::TYPE_FTP, SpawnedTestServer::kLocalhost, |
- base::FilePath()) { |
- } |
+ : test_server_(SpawnedTestServer::TYPE_FTP, |
+ SpawnedTestServer::kLocalhost, |
+ base::FilePath()) {} |
protected: |
SpawnedTestServer test_server_; |
@@ -7657,8 +7659,7 @@ TEST_F(URLRequestTestFTP, UnsafePort) { |
GURL url("ftp://127.0.0.1:7"); |
job_factory.SetProtocolHandler( |
- "ftp", |
- new FtpProtocolHandler(&ftp_transaction_factory)); |
+ "ftp", new FtpProtocolHandler(&ftp_transaction_factory)); |
default_context_.set_job_factory(&job_factory); |
TestDelegate d; |