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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 2334623003: Store net::ProxyServer in HttpResponseInfo object (Closed)
Patch Set: Rebased, fix compile error 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
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ac8a4d1f2b12b6b64bb357f890e800af10c5612d..2dc84be8023286a9848670db1f34173af507baf8 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"
@@ -2160,7 +2161,7 @@ TEST_F(URLRequestTest, MAYBE_NetworkDelegateProxyError) {
// Check we see a failed request.
// The proxy server is not set before failure.
- EXPECT_TRUE(req->proxy_server().IsEmpty());
+ EXPECT_FALSE(req->proxy_server().is_valid());
EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, d.request_status());
EXPECT_EQ(1, network_delegate.error_count());
@@ -3604,7 +3605,7 @@ TEST_F(URLRequestTestHTTP, ProxyTunnelRedirectTest) {
base::RunLoop().Run();
// The proxy server is not set before failure.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, d.request_status());
EXPECT_EQ(1, d.response_started_count());
// We should not have followed the redirect.
@@ -3631,7 +3632,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) {
base::RunLoop().Run();
// The proxy server is not set before failure.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_EQ(1, d.response_started_count());
EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, d.request_status());
// We should not have followed the redirect.
@@ -3707,7 +3708,7 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequest) {
base::RunLoop().Run();
// The proxy server is not set before cancellation.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_EQ(ERR_EMPTY_RESPONSE, d.request_status());
EXPECT_EQ(1, network_delegate.created_requests());
EXPECT_EQ(0, network_delegate.destroyed_requests());
@@ -3739,7 +3740,14 @@ void NetworkDelegateCancelRequest(BlockingNetworkDelegate::BlockMode block_mode,
base::RunLoop().Run();
// The proxy server is not set before cancellation.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ if (stage == BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST ||
+ stage == BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS) {
+ EXPECT_FALSE(r->proxy_server().is_valid());
+ } else if (stage == BlockingNetworkDelegate::ON_HEADERS_RECEIVED) {
+ EXPECT_TRUE(r->proxy_server().is_direct());
+ } else {
+ NOTREACHED();
+ }
EXPECT_EQ(ERR_BLOCKED_BY_CLIENT, d.request_status());
EXPECT_EQ(1, network_delegate.created_requests());
EXPECT_EQ(0, network_delegate.destroyed_requests());
@@ -3830,7 +3838,9 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequest) {
r->FollowDeferredRedirect();
base::RunLoop().Run();
EXPECT_EQ(OK, d.request_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());
@@ -3884,7 +3894,9 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestSynchronously) {
base::RunLoop().Run();
EXPECT_EQ(OK, d.request_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());
@@ -3981,7 +3993,9 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestOnHeadersReceived) {
base::RunLoop().Run();
EXPECT_EQ(OK, d.request_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());
@@ -4462,7 +4476,7 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) {
base::RunLoop().Run();
// The proxy server is not set before failure.
- EXPECT_TRUE(r->proxy_server().IsEmpty());
+ EXPECT_FALSE(r->proxy_server().is_valid());
EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, d.request_status());
}
}
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698