Index: net/http/http_network_transaction_unittest.cc |
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc |
index 40db29e09a11794dbe3787a0e0892ae17baf3a2d..e6cf60f5d3af21f6ff991f89fd210e2495343698 100644 |
--- a/net/http/http_network_transaction_unittest.cc |
+++ b/net/http/http_network_transaction_unittest.cc |
@@ -60,6 +60,7 @@ |
#include "net/proxy/proxy_service.h" |
#include "net/socket/client_socket_factory.h" |
#include "net/socket/client_socket_pool_manager.h" |
+#include "net/socket/connection_attempts.h" |
#include "net/socket/mock_client_socket_pool_manager.h" |
#include "net/socket/next_proto.h" |
#include "net/socket/socket_test_util.h" |
@@ -261,6 +262,7 @@ class HttpNetworkTransactionTest |
std::string response_data; |
int64 totalReceivedBytes; |
LoadTimingInfo load_timing_info; |
+ ConnectionAttempts connection_attempts; |
}; |
void SetUp() override { |
@@ -382,6 +384,7 @@ class HttpNetworkTransactionTest |
response_headers); |
out.totalReceivedBytes = trans->GetTotalReceivedBytes(); |
+ trans->GetConnectionAttempts(&out.connection_attempts); |
return out; |
} |
@@ -666,6 +669,7 @@ TEST_P(HttpNetworkTransactionTest, SimpleGET) { |
EXPECT_EQ("hello world", out.response_data); |
int64 reads_size = ReadsSize(data_reads, arraysize(data_reads)); |
EXPECT_EQ(reads_size, out.totalReceivedBytes); |
+ EXPECT_EQ(0u, out.connection_attempts.size()); |
} |
// Response with no status line. |
@@ -12363,6 +12367,11 @@ TEST_P(HttpNetworkTransactionTest, HttpSyncConnectError) { |
// We don't care whether this succeeds or fails, but it shouldn't crash. |
HttpRequestHeaders request_headers; |
trans->GetFullRequestHeaders(&request_headers); |
+ |
+ ConnectionAttempts attempts; |
+ trans->GetConnectionAttempts(&attempts); |
+ ASSERT_EQ(1u, attempts.size()); |
+ EXPECT_EQ(ERR_CONNECTION_REFUSED, attempts[0].result); |
} |
TEST_P(HttpNetworkTransactionTest, HttpAsyncConnectError) { |
@@ -12393,6 +12402,11 @@ TEST_P(HttpNetworkTransactionTest, HttpAsyncConnectError) { |
// We don't care whether this succeeds or fails, but it shouldn't crash. |
HttpRequestHeaders request_headers; |
trans->GetFullRequestHeaders(&request_headers); |
+ |
+ ConnectionAttempts attempts; |
+ trans->GetConnectionAttempts(&attempts); |
+ ASSERT_EQ(1u, attempts.size()); |
+ EXPECT_EQ(ERR_CONNECTION_REFUSED, attempts[0].result); |
} |
TEST_P(HttpNetworkTransactionTest, HttpSyncWriteError) { |
@@ -12738,6 +12752,11 @@ class FakeStreamRequest : public HttpStreamRequest, |
bool using_spdy() const override { return false; } |
+ const ConnectionAttempts& connection_attempts() const override { |
+ static ConnectionAttempts no_attempts; |
+ return no_attempts; |
+ } |
+ |
private: |
RequestPriority priority_; |
HttpStreamRequest::Delegate* const delegate_; |