Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: net/http/http_network_transaction_unittest.cc

Issue 2334623003: Store net::ProxyServer in HttpResponseInfo object (Closed)
Patch Set: Rebased Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2feb044001d4f25851240319593098658758203f..343fe8f299c6657016cc7afeeb8fe43c3f92029a 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -1072,7 +1072,7 @@ TEST_F(HttpNetworkTransactionTest, TwoIdenticalLocationHeaders) {
std::string url;
EXPECT_TRUE(response->headers->IsRedirect(&url));
EXPECT_EQ("http://good.com/", url);
- EXPECT_TRUE(response->proxy_server.IsEmpty());
+ EXPECT_TRUE(response->proxy_server.is_direct());
}
// Checks that two distinct Location headers result in an error.
@@ -1136,7 +1136,7 @@ TEST_F(HttpNetworkTransactionTest, Head) {
EXPECT_TRUE(response->headers);
EXPECT_EQ(1234, response->headers->GetContentLength());
EXPECT_EQ("HTTP/1.1 404 Not Found", response->headers->GetStatusLine());
- EXPECT_TRUE(response->proxy_server.IsEmpty());
+ EXPECT_TRUE(response->proxy_server.is_direct());
EXPECT_TRUE(headers_handler.observed_before_headers_sent());
EXPECT_FALSE(headers_handler.observed_before_headers_sent_with_proxy());
@@ -1193,7 +1193,7 @@ TEST_F(HttpNetworkTransactionTest, ReuseConnection) {
EXPECT_TRUE(response->headers);
EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
- EXPECT_TRUE(response->proxy_server.IsEmpty());
+ EXPECT_TRUE(response->proxy_server.is_direct());
std::string response_data;
rv = ReadTransaction(&trans, &response_data);
@@ -1425,6 +1425,7 @@ void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest(
ASSERT_TRUE(response);
EXPECT_TRUE(response->headers);
+ EXPECT_TRUE(response->proxy_server.is_direct());
EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
std::string response_data;
@@ -4197,6 +4198,7 @@ TEST_F(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) {
const HttpResponseInfo* response1 = trans1->GetResponseInfo();
ASSERT_TRUE(response1);
+ EXPECT_TRUE(response1->proxy_server.is_http());
ASSERT_TRUE(response1->headers);
EXPECT_EQ(1, response1->headers->GetContentLength());
@@ -4218,6 +4220,7 @@ TEST_F(HttpNetworkTransactionTest, HttpProxyLoadTimingNoPacTwoRequests) {
const HttpResponseInfo* response2 = trans2->GetResponseInfo();
ASSERT_TRUE(response2);
+ EXPECT_TRUE(response2->proxy_server.is_http());
ASSERT_TRUE(response2->headers);
EXPECT_EQ(2, response2->headers->GetContentLength());
@@ -4381,6 +4384,7 @@ TEST_F(HttpNetworkTransactionTest, HttpsProxyGet) {
const HttpResponseInfo* response = trans.GetResponseInfo();
ASSERT_TRUE(response);
+ EXPECT_TRUE(response->proxy_server.is_https());
EXPECT_TRUE(response->headers->IsKeepAlive());
EXPECT_EQ(200, response->headers->response_code());
EXPECT_EQ(100, response->headers->GetContentLength());
@@ -4439,6 +4443,7 @@ TEST_F(HttpNetworkTransactionTest, HttpsProxySpdyGet) {
const HttpResponseInfo* response = trans.GetResponseInfo();
ASSERT_TRUE(response);
+ EXPECT_TRUE(response->proxy_server.is_https());
ASSERT_TRUE(response->headers);
EXPECT_EQ("HTTP/1.1 200", response->headers->GetStatusLine());
@@ -7556,6 +7561,7 @@ TEST_F(HttpNetworkTransactionTest, HTTPSViaHttpsProxy) {
ASSERT_TRUE(response);
+ EXPECT_TRUE(response->proxy_server.is_https());
EXPECT_TRUE(response->headers->IsKeepAlive());
EXPECT_EQ(200, response->headers->response_code());
EXPECT_EQ(100, response->headers->GetContentLength());
@@ -8719,6 +8725,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS4_HTTP_GET) {
const HttpResponseInfo* response = trans.GetResponseInfo();
ASSERT_TRUE(response);
+ EXPECT_TRUE(response->proxy_server.is_socks());
LoadTimingInfo load_timing_info;
EXPECT_TRUE(trans.GetLoadTimingInfo(&load_timing_info));
TestLoadTimingNotReusedWithPac(load_timing_info,
@@ -8786,6 +8793,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS4_SSL_GET) {
const HttpResponseInfo* response = trans.GetResponseInfo();
ASSERT_TRUE(response);
+ EXPECT_TRUE(response->proxy_server.is_socks());
std::string response_text;
rv = ReadTransaction(&trans, &response_text);
@@ -8910,6 +8918,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS5_HTTP_GET) {
const HttpResponseInfo* response = trans.GetResponseInfo();
ASSERT_TRUE(response);
+ EXPECT_TRUE(response->proxy_server.is_socks());
LoadTimingInfo load_timing_info;
EXPECT_TRUE(trans.GetLoadTimingInfo(&load_timing_info));
@@ -8986,6 +8995,7 @@ TEST_F(HttpNetworkTransactionTest, SOCKS5_SSL_GET) {
const HttpResponseInfo* response = trans.GetResponseInfo();
ASSERT_TRUE(response);
+ EXPECT_TRUE(response->proxy_server.is_socks());
LoadTimingInfo load_timing_info;
EXPECT_TRUE(trans.GetLoadTimingInfo(&load_timing_info));
@@ -12120,8 +12130,9 @@ TEST_F(HttpNetworkTransactionTest, ProxyGet) {
EXPECT_EQ(200, response->headers->response_code());
EXPECT_EQ(100, response->headers->GetContentLength());
EXPECT_TRUE(response->was_fetched_via_proxy);
- EXPECT_TRUE(
- response->proxy_server.Equals(HostPortPair::FromString("myproxy:70")));
+ EXPECT_EQ(ProxyServer(ProxyServer::SCHEME_HTTP,
+ HostPortPair::FromString("myproxy:70")),
+ response->proxy_server);
EXPECT_TRUE(headers_handler.observed_before_headers_sent());
EXPECT_TRUE(headers_handler.observed_before_headers_sent_with_proxy());
EXPECT_EQ("myproxy:70", headers_handler.observed_proxy_server_uri());
@@ -12202,8 +12213,9 @@ TEST_F(HttpNetworkTransactionTest, ProxyTunnelGet) {
EXPECT_EQ(100, response->headers->GetContentLength());
EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
EXPECT_TRUE(response->was_fetched_via_proxy);
- EXPECT_TRUE(
- response->proxy_server.Equals(HostPortPair::FromString("myproxy:70")));
+ EXPECT_EQ(ProxyServer(ProxyServer::SCHEME_HTTP,
+ HostPortPair::FromString("myproxy:70")),
+ response->proxy_server);
EXPECT_TRUE(headers_handler.observed_before_headers_sent());
EXPECT_TRUE(headers_handler.observed_before_headers_sent_with_proxy());
EXPECT_EQ("myproxy:70", headers_handler.observed_proxy_server_uri());
@@ -12280,8 +12292,9 @@ TEST_F(HttpNetworkTransactionTest, ProxyTunnelGetIPv6) {
EXPECT_EQ(100, response->headers->GetContentLength());
EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion());
EXPECT_TRUE(response->was_fetched_via_proxy);
- EXPECT_TRUE(
- response->proxy_server.Equals(HostPortPair::FromString("myproxy:70")));
+ EXPECT_EQ(ProxyServer(ProxyServer::SCHEME_HTTP,
+ HostPortPair::FromString("myproxy:70")),
+ response->proxy_server);
LoadTimingInfo load_timing_info;
EXPECT_TRUE(trans.GetLoadTimingInfo(&load_timing_info));

Powered by Google App Engine
This is Rietveld 408576698