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 bc8a81fff6da03d3e6fa7bdb0be9cfbdb54e5041..8a42deade379817bb2149f33ed43b35ea40c5196 100644 |
--- a/net/http/http_network_transaction_unittest.cc |
+++ b/net/http/http_network_transaction_unittest.cc |
@@ -61,6 +61,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" |
@@ -262,6 +263,7 @@ class HttpNetworkTransactionTest |
std::string response_data; |
int64 totalReceivedBytes; |
LoadTimingInfo load_timing_info; |
+ ConnectionAttempts connection_attempts; |
}; |
void SetUp() override { |
@@ -383,6 +385,7 @@ class HttpNetworkTransactionTest |
response_headers); |
out.totalReceivedBytes = trans->GetTotalReceivedBytes(); |
+ trans->GetConnectionAttempts(&out.connection_attempts); |
return out; |
} |
@@ -667,6 +670,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. |
@@ -12353,6 +12357,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) { |
@@ -12383,6 +12392,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) { |
@@ -12728,6 +12742,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_; |