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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 2334623003: Store net::ProxyServer in HttpResponseInfo object (Closed)
Patch Set: PS Created 4 years, 3 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/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 057900a9c7b392bc2ae4c5f47f7051a813d7700a..bce408853afc5592154ec555f0243a6073a49427 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -83,6 +83,7 @@
#include "net/log/test_net_log_entry.h"
#include "net/log/test_net_log_util.h"
#include "net/nqe/external_estimate_provider.h"
+#include "net/proxy/proxy_server.h"
#include "net/proxy/proxy_service.h"
#include "net/socket/ssl_client_socket.h"
#include "net/ssl/channel_id_service.h"
@@ -2158,7 +2159,7 @@ TEST_F(URLRequestTest, MAYBE_NetworkDelegateProxyError) {
// Check we see a failed request.
EXPECT_FALSE(req->status().is_success());
// The proxy server is not set before failure.
- EXPECT_TRUE(req->proxy_server().IsEmpty());
+ EXPECT_FALSE(req->proxy_server().is_valid());
EXPECT_EQ(URLRequestStatus::FAILED, req->status().status());
EXPECT_THAT(req->status().error(), IsError(ERR_PROXY_CONNECTION_FAILED));
@@ -3602,7 +3603,7 @@ TEST_F(URLRequestTestHTTP, ProxyTunnelRedirectTest) {
EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
// The proxy server is not set before failure.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_THAT(r->status().error(), IsError(ERR_TUNNEL_CONNECTION_FAILED));
EXPECT_EQ(1, d.response_started_count());
// We should not have followed the redirect.
@@ -3630,7 +3631,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) {
EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
// The proxy server is not set before failure.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_THAT(r->status().error(), IsError(ERR_TUNNEL_CONNECTION_FAILED));
EXPECT_EQ(1, d.response_started_count());
// We should not have followed the redirect.
@@ -3707,7 +3708,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequest) {
EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
// The proxy server is not set before cancellation.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_THAT(r->status().error(), IsError(ERR_EMPTY_RESPONSE));
EXPECT_EQ(1, network_delegate.created_requests());
EXPECT_EQ(0, network_delegate.destroyed_requests());
@@ -3740,7 +3741,7 @@ void NetworkDelegateCancelRequest(BlockingNetworkDelegate::BlockMode block_mode,
EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
// The proxy server is not set before cancellation.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_THAT(r->status().error(), IsError(ERR_BLOCKED_BY_CLIENT));
EXPECT_EQ(1, network_delegate.created_requests());
EXPECT_EQ(0, network_delegate.destroyed_requests());
@@ -3832,7 +3833,9 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequest) {
r->FollowDeferredRedirect();
base::RunLoop().Run();
EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
- EXPECT_TRUE(r->proxy_server().Equals(http_test_server()->host_port_pair()));
+ EXPECT_EQ(ProxyServer(ProxyServer::SCHEME_HTTP,
+ http_test_server()->host_port_pair()),
+ r->proxy_server());
// before_send_headers_with_proxy_count only increments for headers sent
// through an untunneled proxy.
EXPECT_EQ(1, network_delegate.before_send_headers_with_proxy_count());
@@ -3887,7 +3890,9 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestSynchronously) {
base::RunLoop().Run();
EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
- EXPECT_TRUE(r->proxy_server().Equals(http_test_server()->host_port_pair()));
+ EXPECT_EQ(ProxyServer(ProxyServer::SCHEME_HTTP,
+ http_test_server()->host_port_pair()),
+ r->proxy_server());
// before_send_headers_with_proxy_count only increments for headers sent
// through an untunneled proxy.
EXPECT_EQ(1, network_delegate.before_send_headers_with_proxy_count());
@@ -3986,7 +3991,9 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestOnHeadersReceived) {
base::RunLoop().Run();
EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
- EXPECT_TRUE(r->proxy_server().Equals(http_test_server()->host_port_pair()));
+ EXPECT_EQ(ProxyServer(ProxyServer::SCHEME_HTTP,
+ http_test_server()->host_port_pair()),
+ r->proxy_server());
// before_send_headers_with_proxy_count only increments for headers sent
// through an untunneled proxy.
EXPECT_EQ(2, network_delegate.before_send_headers_with_proxy_count());
@@ -4481,7 +4488,7 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) {
EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
// The proxy server is not set before failure.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_THAT(r->status().error(), IsError(ERR_TUNNEL_CONNECTION_FAILED));
}
}

Powered by Google App Engine
This is Rietveld 408576698