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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 2109503009: Refactor net tests to use GMock matchers for checking net::Error results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes to contents.txt files Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "net/socket/ssl_client_socket.h" 86 #include "net/socket/ssl_client_socket.h"
87 #include "net/ssl/channel_id_service.h" 87 #include "net/ssl/channel_id_service.h"
88 #include "net/ssl/default_channel_id_store.h" 88 #include "net/ssl/default_channel_id_store.h"
89 #include "net/ssl/ssl_connection_status_flags.h" 89 #include "net/ssl/ssl_connection_status_flags.h"
90 #include "net/ssl/ssl_server_config.h" 90 #include "net/ssl/ssl_server_config.h"
91 #include "net/ssl/token_binding.h" 91 #include "net/ssl/token_binding.h"
92 #include "net/test/cert_test_util.h" 92 #include "net/test/cert_test_util.h"
93 #include "net/test/embedded_test_server/embedded_test_server.h" 93 #include "net/test/embedded_test_server/embedded_test_server.h"
94 #include "net/test/embedded_test_server/http_request.h" 94 #include "net/test/embedded_test_server/http_request.h"
95 #include "net/test/embedded_test_server/http_response.h" 95 #include "net/test/embedded_test_server/http_response.h"
96 #include "net/test/gtest_util.h"
96 #include "net/test/spawned_test_server/spawned_test_server.h" 97 #include "net/test/spawned_test_server/spawned_test_server.h"
97 #include "net/test/test_data_directory.h" 98 #include "net/test/test_data_directory.h"
98 #include "net/test/url_request/url_request_failed_job.h" 99 #include "net/test/url_request/url_request_failed_job.h"
99 #include "net/url_request/data_protocol_handler.h" 100 #include "net/url_request/data_protocol_handler.h"
100 #include "net/url_request/static_http_user_agent_settings.h" 101 #include "net/url_request/static_http_user_agent_settings.h"
101 #include "net/url_request/url_request.h" 102 #include "net/url_request/url_request.h"
102 #include "net/url_request/url_request_filter.h" 103 #include "net/url_request/url_request_filter.h"
103 #include "net/url_request/url_request_http_job.h" 104 #include "net/url_request/url_request_http_job.h"
104 #include "net/url_request/url_request_intercepting_job_factory.h" 105 #include "net/url_request/url_request_intercepting_job_factory.h"
105 #include "net/url_request/url_request_interceptor.h" 106 #include "net/url_request/url_request_interceptor.h"
106 #include "net/url_request/url_request_job_factory_impl.h" 107 #include "net/url_request/url_request_job_factory_impl.h"
107 #include "net/url_request/url_request_redirect_job.h" 108 #include "net/url_request/url_request_redirect_job.h"
108 #include "net/url_request/url_request_test_job.h" 109 #include "net/url_request/url_request_test_job.h"
109 #include "net/url_request/url_request_test_util.h" 110 #include "net/url_request/url_request_test_util.h"
111 #include "testing/gmock/include/gmock/gmock.h"
110 #include "testing/gtest/include/gtest/gtest.h" 112 #include "testing/gtest/include/gtest/gtest.h"
111 #include "testing/platform_test.h" 113 #include "testing/platform_test.h"
112 114
113 #if !defined(DISABLE_FILE_SUPPORT) 115 #if !defined(DISABLE_FILE_SUPPORT)
114 #include "net/base/filename_util.h" 116 #include "net/base/filename_util.h"
115 #include "net/url_request/file_protocol_handler.h" 117 #include "net/url_request/file_protocol_handler.h"
116 #include "net/url_request/url_request_file_dir_job.h" 118 #include "net/url_request/url_request_file_dir_job.h"
117 #endif 119 #endif
118 120
119 #if !defined(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID) 121 #if !defined(DISABLE_FTP_SUPPORT) && !defined(OS_ANDROID)
120 #include "net/ftp/ftp_network_layer.h" 122 #include "net/ftp/ftp_network_layer.h"
121 #include "net/url_request/ftp_protocol_handler.h" 123 #include "net/url_request/ftp_protocol_handler.h"
122 #endif 124 #endif
123 125
124 #if defined(OS_WIN) 126 #if defined(OS_WIN)
125 #include "base/win/scoped_com_initializer.h" 127 #include "base/win/scoped_com_initializer.h"
126 #include "base/win/scoped_comptr.h" 128 #include "base/win/scoped_comptr.h"
127 #endif 129 #endif
128 130
131 using net::test::IsError;
132 using net::test::IsOk;
133
129 using base::ASCIIToUTF16; 134 using base::ASCIIToUTF16;
130 using base::Time; 135 using base::Time;
131 using std::string; 136 using std::string;
132 137
133 namespace net { 138 namespace net {
134 139
135 namespace { 140 namespace {
136 141
137 const base::string16 kChrome(ASCIIToUTF16("chrome")); 142 const base::string16 kChrome(ASCIIToUTF16("chrome"));
138 const base::string16 kSecret(ASCIIToUTF16("secret")); 143 const base::string16 kSecret(ASCIIToUTF16("secret"));
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 req->set_method("GET"); 2127 req->set_method("GET");
2123 2128
2124 req->Start(); 2129 req->Start();
2125 base::RunLoop().Run(); 2130 base::RunLoop().Run();
2126 2131
2127 // Check we see a failed request. 2132 // Check we see a failed request.
2128 EXPECT_FALSE(req->status().is_success()); 2133 EXPECT_FALSE(req->status().is_success());
2129 // The proxy server is not set before failure. 2134 // The proxy server is not set before failure.
2130 EXPECT_TRUE(req->proxy_server().IsEmpty()); 2135 EXPECT_TRUE(req->proxy_server().IsEmpty());
2131 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status()); 2136 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status());
2132 EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, req->status().error()); 2137 EXPECT_THAT(req->status().error(), IsError(ERR_PROXY_CONNECTION_FAILED));
2133 2138
2134 EXPECT_EQ(1, network_delegate.error_count()); 2139 EXPECT_EQ(1, network_delegate.error_count());
2135 EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED, network_delegate.last_error()); 2140 EXPECT_THAT(network_delegate.last_error(),
2141 IsError(ERR_PROXY_CONNECTION_FAILED));
2136 EXPECT_EQ(1, network_delegate.completed_requests()); 2142 EXPECT_EQ(1, network_delegate.completed_requests());
2137 } 2143 }
2138 2144
2139 // Make sure that NetworkDelegate::NotifyCompleted is called if 2145 // Make sure that NetworkDelegate::NotifyCompleted is called if
2140 // content is empty. 2146 // content is empty.
2141 TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) { 2147 TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) {
2142 TestDelegate d; 2148 TestDelegate d;
2143 std::unique_ptr<URLRequest> req( 2149 std::unique_ptr<URLRequest> req(
2144 default_context_.CreateRequest(GURL("data:,"), DEFAULT_PRIORITY, &d)); 2150 default_context_.CreateRequest(GURL("data:,"), DEFAULT_PRIORITY, &d));
2145 req->Start(); 2151 req->Start();
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
3160 HttpRequestHeaders headers; 3166 HttpRequestHeaders headers;
3161 headers.SetHeader(HttpRequestHeaders::kContentLength, 3167 headers.SetHeader(HttpRequestHeaders::kContentLength,
3162 base::SizeTToString(arraysize(kData) - 1)); 3168 base::SizeTToString(arraysize(kData) - 1));
3163 headers.SetHeader(HttpRequestHeaders::kContentType, "text/plain"); 3169 headers.SetHeader(HttpRequestHeaders::kContentType, "text/plain");
3164 req->SetExtraRequestHeaders(headers); 3170 req->SetExtraRequestHeaders(headers);
3165 } 3171 }
3166 req->Start(); 3172 req->Start();
3167 base::RunLoop().Run(); 3173 base::RunLoop().Run();
3168 EXPECT_EQ(redirect_method, req->method()); 3174 EXPECT_EQ(redirect_method, req->method());
3169 EXPECT_EQ(URLRequestStatus::SUCCESS, req->status().status()); 3175 EXPECT_EQ(URLRequestStatus::SUCCESS, req->status().status());
3170 EXPECT_EQ(OK, req->status().error()); 3176 EXPECT_THAT(req->status().error(), IsOk());
3171 if (include_data) { 3177 if (include_data) {
3172 if (request_method == redirect_method) { 3178 if (request_method == redirect_method) {
3173 EXPECT_TRUE(req->extra_request_headers().HasHeader( 3179 EXPECT_TRUE(req->extra_request_headers().HasHeader(
3174 HttpRequestHeaders::kContentLength)); 3180 HttpRequestHeaders::kContentLength));
3175 EXPECT_TRUE(req->extra_request_headers().HasHeader( 3181 EXPECT_TRUE(req->extra_request_headers().HasHeader(
3176 HttpRequestHeaders::kContentType)); 3182 HttpRequestHeaders::kContentType));
3177 EXPECT_EQ(kData, d.data_received()); 3183 EXPECT_EQ(kData, d.data_received());
3178 } else { 3184 } else {
3179 EXPECT_FALSE(req->extra_request_headers().HasHeader( 3185 EXPECT_FALSE(req->extra_request_headers().HasHeader(
3180 HttpRequestHeaders::kContentLength)); 3186 HttpRequestHeaders::kContentLength));
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
3564 std::unique_ptr<URLRequest> r(context.CreateRequest( 3570 std::unique_ptr<URLRequest> r(context.CreateRequest(
3565 GURL("https://www.redirect.com/"), DEFAULT_PRIORITY, &d)); 3571 GURL("https://www.redirect.com/"), DEFAULT_PRIORITY, &d));
3566 r->Start(); 3572 r->Start();
3567 EXPECT_TRUE(r->is_pending()); 3573 EXPECT_TRUE(r->is_pending());
3568 3574
3569 base::RunLoop().Run(); 3575 base::RunLoop().Run();
3570 3576
3571 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 3577 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
3572 // The proxy server is not set before failure. 3578 // The proxy server is not set before failure.
3573 EXPECT_TRUE(r->proxy_server().IsEmpty()); 3579 EXPECT_TRUE(r->proxy_server().IsEmpty());
3574 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r->status().error()); 3580 EXPECT_THAT(r->status().error(), IsError(ERR_TUNNEL_CONNECTION_FAILED));
3575 EXPECT_EQ(1, d.response_started_count()); 3581 EXPECT_EQ(1, d.response_started_count());
3576 // We should not have followed the redirect. 3582 // We should not have followed the redirect.
3577 EXPECT_EQ(0, d.received_redirect_count()); 3583 EXPECT_EQ(0, d.received_redirect_count());
3578 } 3584 }
3579 } 3585 }
3580 3586
3581 // This is the same as the previous test, but checks that the network delegate 3587 // This is the same as the previous test, but checks that the network delegate
3582 // registers the error. 3588 // registers the error.
3583 TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) { 3589 TEST_F(URLRequestTestHTTP, NetworkDelegateTunnelConnectionFailed) {
3584 ASSERT_TRUE(http_test_server()->Start()); 3590 ASSERT_TRUE(http_test_server()->Start());
3585 3591
3586 TestNetworkDelegate network_delegate; // Must outlive URLRequest. 3592 TestNetworkDelegate network_delegate; // Must outlive URLRequest.
3587 TestURLRequestContextWithProxy context( 3593 TestURLRequestContextWithProxy context(
3588 http_test_server()->host_port_pair().ToString(), &network_delegate); 3594 http_test_server()->host_port_pair().ToString(), &network_delegate);
3589 3595
3590 TestDelegate d; 3596 TestDelegate d;
3591 { 3597 {
3592 std::unique_ptr<URLRequest> r(context.CreateRequest( 3598 std::unique_ptr<URLRequest> r(context.CreateRequest(
3593 GURL("https://www.redirect.com/"), DEFAULT_PRIORITY, &d)); 3599 GURL("https://www.redirect.com/"), DEFAULT_PRIORITY, &d));
3594 r->Start(); 3600 r->Start();
3595 EXPECT_TRUE(r->is_pending()); 3601 EXPECT_TRUE(r->is_pending());
3596 3602
3597 base::RunLoop().Run(); 3603 base::RunLoop().Run();
3598 3604
3599 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 3605 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
3600 // The proxy server is not set before failure. 3606 // The proxy server is not set before failure.
3601 EXPECT_TRUE(r->proxy_server().IsEmpty()); 3607 EXPECT_TRUE(r->proxy_server().IsEmpty());
3602 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r->status().error()); 3608 EXPECT_THAT(r->status().error(), IsError(ERR_TUNNEL_CONNECTION_FAILED));
3603 EXPECT_EQ(1, d.response_started_count()); 3609 EXPECT_EQ(1, d.response_started_count());
3604 // We should not have followed the redirect. 3610 // We should not have followed the redirect.
3605 EXPECT_EQ(0, d.received_redirect_count()); 3611 EXPECT_EQ(0, d.received_redirect_count());
3606 3612
3607 EXPECT_EQ(1, network_delegate.error_count()); 3613 EXPECT_EQ(1, network_delegate.error_count());
3608 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, network_delegate.last_error()); 3614 EXPECT_THAT(network_delegate.last_error(),
3615 IsError(ERR_TUNNEL_CONNECTION_FAILED));
3609 } 3616 }
3610 } 3617 }
3611 3618
3612 // Tests that we can block and asynchronously return OK in various stages. 3619 // Tests that we can block and asynchronously return OK in various stages.
3613 TEST_F(URLRequestTestHTTP, NetworkDelegateBlockAsynchronously) { 3620 TEST_F(URLRequestTestHTTP, NetworkDelegateBlockAsynchronously) {
3614 static const BlockingNetworkDelegate::Stage blocking_stages[] = { 3621 static const BlockingNetworkDelegate::Stage blocking_stages[] = {
3615 BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, 3622 BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST,
3616 BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, 3623 BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS,
3617 BlockingNetworkDelegate::ON_HEADERS_RECEIVED 3624 BlockingNetworkDelegate::ON_HEADERS_RECEIVED
3618 }; 3625 };
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3668 { 3675 {
3669 std::unique_ptr<URLRequest> r(context.CreateRequest( 3676 std::unique_ptr<URLRequest> r(context.CreateRequest(
3670 http_test_server()->GetURL("/"), DEFAULT_PRIORITY, &d)); 3677 http_test_server()->GetURL("/"), DEFAULT_PRIORITY, &d));
3671 3678
3672 r->Start(); 3679 r->Start();
3673 base::RunLoop().Run(); 3680 base::RunLoop().Run();
3674 3681
3675 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 3682 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
3676 // The proxy server is not set before cancellation. 3683 // The proxy server is not set before cancellation.
3677 EXPECT_TRUE(r->proxy_server().IsEmpty()); 3684 EXPECT_TRUE(r->proxy_server().IsEmpty());
3678 EXPECT_EQ(ERR_EMPTY_RESPONSE, r->status().error()); 3685 EXPECT_THAT(r->status().error(), IsError(ERR_EMPTY_RESPONSE));
3679 EXPECT_EQ(1, network_delegate.created_requests()); 3686 EXPECT_EQ(1, network_delegate.created_requests());
3680 EXPECT_EQ(0, network_delegate.destroyed_requests()); 3687 EXPECT_EQ(0, network_delegate.destroyed_requests());
3681 } 3688 }
3682 EXPECT_EQ(1, network_delegate.destroyed_requests()); 3689 EXPECT_EQ(1, network_delegate.destroyed_requests());
3683 } 3690 }
3684 3691
3685 // Helper function for NetworkDelegateCancelRequestAsynchronously and 3692 // Helper function for NetworkDelegateCancelRequestAsynchronously and
3686 // NetworkDelegateCancelRequestSynchronously. Sets up a blocking network 3693 // NetworkDelegateCancelRequestSynchronously. Sets up a blocking network
3687 // delegate operating in |block_mode| and a request for |url|. It blocks the 3694 // delegate operating in |block_mode| and a request for |url|. It blocks the
3688 // request in |stage| and cancels it with ERR_BLOCKED_BY_CLIENT. 3695 // request in |stage| and cancels it with ERR_BLOCKED_BY_CLIENT.
(...skipping 12 matching lines...) Expand all
3701 { 3708 {
3702 std::unique_ptr<URLRequest> r( 3709 std::unique_ptr<URLRequest> r(
3703 context.CreateRequest(url, DEFAULT_PRIORITY, &d)); 3710 context.CreateRequest(url, DEFAULT_PRIORITY, &d));
3704 3711
3705 r->Start(); 3712 r->Start();
3706 base::RunLoop().Run(); 3713 base::RunLoop().Run();
3707 3714
3708 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 3715 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
3709 // The proxy server is not set before cancellation. 3716 // The proxy server is not set before cancellation.
3710 EXPECT_TRUE(r->proxy_server().IsEmpty()); 3717 EXPECT_TRUE(r->proxy_server().IsEmpty());
3711 EXPECT_EQ(ERR_BLOCKED_BY_CLIENT, r->status().error()); 3718 EXPECT_THAT(r->status().error(), IsError(ERR_BLOCKED_BY_CLIENT));
3712 EXPECT_EQ(1, network_delegate.created_requests()); 3719 EXPECT_EQ(1, network_delegate.created_requests());
3713 EXPECT_EQ(0, network_delegate.destroyed_requests()); 3720 EXPECT_EQ(0, network_delegate.destroyed_requests());
3714 } 3721 }
3715 EXPECT_EQ(1, network_delegate.destroyed_requests()); 3722 EXPECT_EQ(1, network_delegate.destroyed_requests());
3716 } 3723 }
3717 3724
3718 // The following 3 tests check that the network delegate can cancel a request 3725 // The following 3 tests check that the network delegate can cancel a request
3719 // synchronously in various stages of the request. 3726 // synchronously in various stages of the request.
3720 TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestSynchronously1) { 3727 TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestSynchronously1) {
3721 ASSERT_TRUE(http_test_server()->Start()); 3728 ASSERT_TRUE(http_test_server()->Start());
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
3953 base::RunLoop().Run(); 3960 base::RunLoop().Run();
3954 3961
3955 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 3962 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
3956 EXPECT_TRUE(r->proxy_server().Equals(http_test_server()->host_port_pair())); 3963 EXPECT_TRUE(r->proxy_server().Equals(http_test_server()->host_port_pair()));
3957 // before_send_headers_with_proxy_count only increments for headers sent 3964 // before_send_headers_with_proxy_count only increments for headers sent
3958 // through an untunneled proxy. 3965 // through an untunneled proxy.
3959 EXPECT_EQ(2, network_delegate.before_send_headers_with_proxy_count()); 3966 EXPECT_EQ(2, network_delegate.before_send_headers_with_proxy_count());
3960 EXPECT_TRUE(network_delegate.last_observed_proxy().Equals( 3967 EXPECT_TRUE(network_delegate.last_observed_proxy().Equals(
3961 http_test_server()->host_port_pair())); 3968 http_test_server()->host_port_pair()));
3962 3969
3963 EXPECT_EQ(OK, r->status().error()); 3970 EXPECT_THAT(r->status().error(), IsOk());
3964 EXPECT_EQ(redirect_url, r->url()); 3971 EXPECT_EQ(redirect_url, r->url());
3965 EXPECT_EQ(original_url, r->original_url()); 3972 EXPECT_EQ(original_url, r->original_url());
3966 EXPECT_EQ(2U, r->url_chain().size()); 3973 EXPECT_EQ(2U, r->url_chain().size());
3967 EXPECT_EQ(2, network_delegate.created_requests()); 3974 EXPECT_EQ(2, network_delegate.created_requests());
3968 EXPECT_EQ(0, network_delegate.destroyed_requests()); 3975 EXPECT_EQ(0, network_delegate.destroyed_requests());
3969 } 3976 }
3970 EXPECT_EQ(1, network_delegate.destroyed_requests()); 3977 EXPECT_EQ(1, network_delegate.destroyed_requests());
3971 } 3978 }
3972 3979
3973 // Tests that the network delegate can synchronously complete OnAuthRequired 3980 // Tests that the network delegate can synchronously complete OnAuthRequired
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
4137 context.Init(); 4144 context.Init();
4138 4145
4139 { 4146 {
4140 GURL url(http_test_server()->GetURL("/auth-basic")); 4147 GURL url(http_test_server()->GetURL("/auth-basic"));
4141 std::unique_ptr<URLRequest> r( 4148 std::unique_ptr<URLRequest> r(
4142 context.CreateRequest(url, DEFAULT_PRIORITY, &d)); 4149 context.CreateRequest(url, DEFAULT_PRIORITY, &d));
4143 r->Start(); 4150 r->Start();
4144 base::RunLoop().Run(); 4151 base::RunLoop().Run();
4145 4152
4146 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4153 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4147 EXPECT_EQ(OK, r->status().error()); 4154 EXPECT_THAT(r->status().error(), IsOk());
4148 EXPECT_EQ(401, r->GetResponseCode()); 4155 EXPECT_EQ(401, r->GetResponseCode());
4149 EXPECT_FALSE(d.auth_required_called()); 4156 EXPECT_FALSE(d.auth_required_called());
4150 EXPECT_EQ(1, network_delegate.created_requests()); 4157 EXPECT_EQ(1, network_delegate.created_requests());
4151 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4158 EXPECT_EQ(0, network_delegate.destroyed_requests());
4152 } 4159 }
4153 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4160 EXPECT_EQ(1, network_delegate.destroyed_requests());
4154 } 4161 }
4155 4162
4156 // Tests that the network delegate can asynchronously complete OnAuthRequired 4163 // Tests that the network delegate can asynchronously complete OnAuthRequired
4157 // by taking no action. This indicates that the NetworkDelegate does not want 4164 // by taking no action. This indicates that the NetworkDelegate does not want
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
4242 context.Init(); 4249 context.Init();
4243 4250
4244 { 4251 {
4245 GURL url(http_test_server()->GetURL("/auth-basic")); 4252 GURL url(http_test_server()->GetURL("/auth-basic"));
4246 std::unique_ptr<URLRequest> r( 4253 std::unique_ptr<URLRequest> r(
4247 context.CreateRequest(url, DEFAULT_PRIORITY, &d)); 4254 context.CreateRequest(url, DEFAULT_PRIORITY, &d));
4248 r->Start(); 4255 r->Start();
4249 base::RunLoop().Run(); 4256 base::RunLoop().Run();
4250 4257
4251 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 4258 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
4252 EXPECT_EQ(OK, r->status().error()); 4259 EXPECT_THAT(r->status().error(), IsOk());
4253 EXPECT_EQ(401, r->GetResponseCode()); 4260 EXPECT_EQ(401, r->GetResponseCode());
4254 EXPECT_FALSE(d.auth_required_called()); 4261 EXPECT_FALSE(d.auth_required_called());
4255 EXPECT_EQ(1, network_delegate.created_requests()); 4262 EXPECT_EQ(1, network_delegate.created_requests());
4256 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4263 EXPECT_EQ(0, network_delegate.destroyed_requests());
4257 } 4264 }
4258 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4265 EXPECT_EQ(1, network_delegate.destroyed_requests());
4259 } 4266 }
4260 4267
4261 // Tests that we can handle when a network request was canceled while we were 4268 // Tests that we can handle when a network request was canceled while we were
4262 // waiting for the network delegate. 4269 // waiting for the network delegate.
(...skipping 17 matching lines...) Expand all
4280 r->Start(); 4287 r->Start();
4281 base::RunLoop().Run(); 4288 base::RunLoop().Run();
4282 EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST, 4289 EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_URL_REQUEST,
4283 network_delegate.stage_blocked_for_callback()); 4290 network_delegate.stage_blocked_for_callback());
4284 EXPECT_EQ(0, network_delegate.completed_requests()); 4291 EXPECT_EQ(0, network_delegate.completed_requests());
4285 // Cancel before callback. 4292 // Cancel before callback.
4286 r->Cancel(); 4293 r->Cancel();
4287 // Ensure that network delegate is notified. 4294 // Ensure that network delegate is notified.
4288 EXPECT_EQ(1, network_delegate.completed_requests()); 4295 EXPECT_EQ(1, network_delegate.completed_requests());
4289 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status()); 4296 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status());
4290 EXPECT_EQ(ERR_ABORTED, r->status().error()); 4297 EXPECT_THAT(r->status().error(), IsError(ERR_ABORTED));
4291 EXPECT_EQ(1, network_delegate.created_requests()); 4298 EXPECT_EQ(1, network_delegate.created_requests());
4292 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4299 EXPECT_EQ(0, network_delegate.destroyed_requests());
4293 } 4300 }
4294 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4301 EXPECT_EQ(1, network_delegate.destroyed_requests());
4295 } 4302 }
4296 4303
4297 // Tests that we can handle when a network request was canceled while we were 4304 // Tests that we can handle when a network request was canceled while we were
4298 // waiting for the network delegate. 4305 // waiting for the network delegate.
4299 // Part 2: Request is cancelled while waiting for OnBeforeStartTransaction 4306 // Part 2: Request is cancelled while waiting for OnBeforeStartTransaction
4300 // callback. 4307 // callback.
(...skipping 17 matching lines...) Expand all
4318 r->Start(); 4325 r->Start();
4319 base::RunLoop().Run(); 4326 base::RunLoop().Run();
4320 EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS, 4327 EXPECT_EQ(BlockingNetworkDelegate::ON_BEFORE_SEND_HEADERS,
4321 network_delegate.stage_blocked_for_callback()); 4328 network_delegate.stage_blocked_for_callback());
4322 EXPECT_EQ(0, network_delegate.completed_requests()); 4329 EXPECT_EQ(0, network_delegate.completed_requests());
4323 // Cancel before callback. 4330 // Cancel before callback.
4324 r->Cancel(); 4331 r->Cancel();
4325 // Ensure that network delegate is notified. 4332 // Ensure that network delegate is notified.
4326 EXPECT_EQ(1, network_delegate.completed_requests()); 4333 EXPECT_EQ(1, network_delegate.completed_requests());
4327 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status()); 4334 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status());
4328 EXPECT_EQ(ERR_ABORTED, r->status().error()); 4335 EXPECT_THAT(r->status().error(), IsError(ERR_ABORTED));
4329 EXPECT_EQ(1, network_delegate.created_requests()); 4336 EXPECT_EQ(1, network_delegate.created_requests());
4330 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4337 EXPECT_EQ(0, network_delegate.destroyed_requests());
4331 } 4338 }
4332 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4339 EXPECT_EQ(1, network_delegate.destroyed_requests());
4333 } 4340 }
4334 4341
4335 // Tests that we can handle when a network request was canceled while we were 4342 // Tests that we can handle when a network request was canceled while we were
4336 // waiting for the network delegate. 4343 // waiting for the network delegate.
4337 // Part 3: Request is cancelled while waiting for OnHeadersReceived callback. 4344 // Part 3: Request is cancelled while waiting for OnHeadersReceived callback.
4338 TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting3) { 4345 TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting3) {
(...skipping 15 matching lines...) Expand all
4354 r->Start(); 4361 r->Start();
4355 base::RunLoop().Run(); 4362 base::RunLoop().Run();
4356 EXPECT_EQ(BlockingNetworkDelegate::ON_HEADERS_RECEIVED, 4363 EXPECT_EQ(BlockingNetworkDelegate::ON_HEADERS_RECEIVED,
4357 network_delegate.stage_blocked_for_callback()); 4364 network_delegate.stage_blocked_for_callback());
4358 EXPECT_EQ(0, network_delegate.completed_requests()); 4365 EXPECT_EQ(0, network_delegate.completed_requests());
4359 // Cancel before callback. 4366 // Cancel before callback.
4360 r->Cancel(); 4367 r->Cancel();
4361 // Ensure that network delegate is notified. 4368 // Ensure that network delegate is notified.
4362 EXPECT_EQ(1, network_delegate.completed_requests()); 4369 EXPECT_EQ(1, network_delegate.completed_requests());
4363 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status()); 4370 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status());
4364 EXPECT_EQ(ERR_ABORTED, r->status().error()); 4371 EXPECT_THAT(r->status().error(), IsError(ERR_ABORTED));
4365 EXPECT_EQ(1, network_delegate.created_requests()); 4372 EXPECT_EQ(1, network_delegate.created_requests());
4366 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4373 EXPECT_EQ(0, network_delegate.destroyed_requests());
4367 } 4374 }
4368 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4375 EXPECT_EQ(1, network_delegate.destroyed_requests());
4369 } 4376 }
4370 4377
4371 // Tests that we can handle when a network request was canceled while we were 4378 // Tests that we can handle when a network request was canceled while we were
4372 // waiting for the network delegate. 4379 // waiting for the network delegate.
4373 // Part 4: Request is cancelled while waiting for OnAuthRequired callback. 4380 // Part 4: Request is cancelled while waiting for OnAuthRequired callback.
4374 TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting4) { 4381 TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting4) {
(...skipping 15 matching lines...) Expand all
4390 r->Start(); 4397 r->Start();
4391 base::RunLoop().Run(); 4398 base::RunLoop().Run();
4392 EXPECT_EQ(BlockingNetworkDelegate::ON_AUTH_REQUIRED, 4399 EXPECT_EQ(BlockingNetworkDelegate::ON_AUTH_REQUIRED,
4393 network_delegate.stage_blocked_for_callback()); 4400 network_delegate.stage_blocked_for_callback());
4394 EXPECT_EQ(0, network_delegate.completed_requests()); 4401 EXPECT_EQ(0, network_delegate.completed_requests());
4395 // Cancel before callback. 4402 // Cancel before callback.
4396 r->Cancel(); 4403 r->Cancel();
4397 // Ensure that network delegate is notified. 4404 // Ensure that network delegate is notified.
4398 EXPECT_EQ(1, network_delegate.completed_requests()); 4405 EXPECT_EQ(1, network_delegate.completed_requests());
4399 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status()); 4406 EXPECT_EQ(URLRequestStatus::CANCELED, r->status().status());
4400 EXPECT_EQ(ERR_ABORTED, r->status().error()); 4407 EXPECT_THAT(r->status().error(), IsError(ERR_ABORTED));
4401 EXPECT_EQ(1, network_delegate.created_requests()); 4408 EXPECT_EQ(1, network_delegate.created_requests());
4402 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4409 EXPECT_EQ(0, network_delegate.destroyed_requests());
4403 } 4410 }
4404 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4411 EXPECT_EQ(1, network_delegate.destroyed_requests());
4405 } 4412 }
4406 4413
4407 namespace { 4414 namespace {
4408 4415
4409 std::unique_ptr<test_server::HttpResponse> HandleServerAuthConnect( 4416 std::unique_ptr<test_server::HttpResponse> HandleServerAuthConnect(
4410 const test_server::HttpRequest& request) { 4417 const test_server::HttpRequest& request) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4442 GURL("https://www.server-auth.com/"), DEFAULT_PRIORITY, &d)); 4449 GURL("https://www.server-auth.com/"), DEFAULT_PRIORITY, &d));
4443 4450
4444 r->Start(); 4451 r->Start();
4445 EXPECT_TRUE(r->is_pending()); 4452 EXPECT_TRUE(r->is_pending());
4446 4453
4447 base::RunLoop().Run(); 4454 base::RunLoop().Run();
4448 4455
4449 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 4456 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
4450 // The proxy server is not set before failure. 4457 // The proxy server is not set before failure.
4451 EXPECT_TRUE(r->proxy_server().IsEmpty()); 4458 EXPECT_TRUE(r->proxy_server().IsEmpty());
4452 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, r->status().error()); 4459 EXPECT_THAT(r->status().error(), IsError(ERR_TUNNEL_CONNECTION_FAILED));
4453 } 4460 }
4454 } 4461 }
4455 4462
4456 TEST_F(URLRequestTestHTTP, GetTest_NoCache) { 4463 TEST_F(URLRequestTestHTTP, GetTest_NoCache) {
4457 ASSERT_TRUE(http_test_server()->Start()); 4464 ASSERT_TRUE(http_test_server()->Start());
4458 4465
4459 TestDelegate d; 4466 TestDelegate d;
4460 { 4467 {
4461 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( 4468 std::unique_ptr<URLRequest> r(default_context_.CreateRequest(
4462 http_test_server()->GetURL("/defaultresponse"), DEFAULT_PRIORITY, &d)); 4469 http_test_server()->GetURL("/defaultresponse"), DEFAULT_PRIORITY, &d));
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
5755 5762
5756 r->Start(); 5763 r->Start();
5757 EXPECT_TRUE(r->is_pending()); 5764 EXPECT_TRUE(r->is_pending());
5758 5765
5759 base::RunLoop().Run(); 5766 base::RunLoop().Run();
5760 5767
5761 EXPECT_TRUE(d.request_failed()); 5768 EXPECT_TRUE(d.request_failed());
5762 EXPECT_FALSE(d.received_data_before_response()); 5769 EXPECT_FALSE(d.received_data_before_response());
5763 EXPECT_EQ(0, d.bytes_received()); 5770 EXPECT_EQ(0, d.bytes_received());
5764 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 5771 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
5765 EXPECT_EQ(ERR_FILE_NOT_FOUND, r->status().error()); 5772 EXPECT_THAT(r->status().error(), IsError(ERR_FILE_NOT_FOUND));
5766 } 5773 }
5767 } 5774 }
5768 5775
5769 namespace { 5776 namespace {
5770 5777
5771 // Adds a standard set of data to an upload for chunked upload integration 5778 // Adds a standard set of data to an upload for chunked upload integration
5772 // tests. 5779 // tests.
5773 void AddDataToUpload(ChunkedUploadDataStream::Writer* writer) { 5780 void AddDataToUpload(ChunkedUploadDataStream::Writer* writer) {
5774 writer->AppendData("a", 1, false); 5781 writer->AppendData("a", 1, false);
5775 writer->AppendData("bcd", 3, false); 5782 writer->AppendData("bcd", 3, false);
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
6549 ASSERT_TRUE(http_test_server()->Start()); 6556 ASSERT_TRUE(http_test_server()->Start());
6550 6557
6551 TestDelegate d; 6558 TestDelegate d;
6552 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( 6559 std::unique_ptr<URLRequest> req(default_context_.CreateRequest(
6553 http_test_server()->GetURL("/redirect-to-file.html"), DEFAULT_PRIORITY, 6560 http_test_server()->GetURL("/redirect-to-file.html"), DEFAULT_PRIORITY,
6554 &d)); 6561 &d));
6555 req->Start(); 6562 req->Start();
6556 base::RunLoop().Run(); 6563 base::RunLoop().Run();
6557 6564
6558 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status()); 6565 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status());
6559 EXPECT_EQ(ERR_UNSAFE_REDIRECT, req->status().error()); 6566 EXPECT_THAT(req->status().error(), IsError(ERR_UNSAFE_REDIRECT));
6560 } 6567 }
6561 #endif // !defined(DISABLE_FILE_SUPPORT) 6568 #endif // !defined(DISABLE_FILE_SUPPORT)
6562 6569
6563 TEST_F(URLRequestTestHTTP, RestrictDataRedirects) { 6570 TEST_F(URLRequestTestHTTP, RestrictDataRedirects) {
6564 ASSERT_TRUE(http_test_server()->Start()); 6571 ASSERT_TRUE(http_test_server()->Start());
6565 6572
6566 TestDelegate d; 6573 TestDelegate d;
6567 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( 6574 std::unique_ptr<URLRequest> req(default_context_.CreateRequest(
6568 http_test_server()->GetURL("/redirect-to-data.html"), DEFAULT_PRIORITY, 6575 http_test_server()->GetURL("/redirect-to-data.html"), DEFAULT_PRIORITY,
6569 &d)); 6576 &d));
6570 req->Start(); 6577 req->Start();
6571 base::RunLoop().Run(); 6578 base::RunLoop().Run();
6572 6579
6573 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status()); 6580 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status());
6574 EXPECT_EQ(ERR_UNSAFE_REDIRECT, req->status().error()); 6581 EXPECT_THAT(req->status().error(), IsError(ERR_UNSAFE_REDIRECT));
6575 } 6582 }
6576 6583
6577 TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) { 6584 TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) {
6578 ASSERT_TRUE(http_test_server()->Start()); 6585 ASSERT_TRUE(http_test_server()->Start());
6579 6586
6580 TestDelegate d; 6587 TestDelegate d;
6581 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( 6588 std::unique_ptr<URLRequest> req(default_context_.CreateRequest(
6582 http_test_server()->GetURL("/redirect-to-invalid-url.html"), 6589 http_test_server()->GetURL("/redirect-to-invalid-url.html"),
6583 DEFAULT_PRIORITY, &d)); 6590 DEFAULT_PRIORITY, &d));
6584 req->Start(); 6591 req->Start();
6585 base::RunLoop().Run(); 6592 base::RunLoop().Run();
6586 6593
6587 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status()); 6594 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status());
6588 EXPECT_EQ(ERR_INVALID_URL, req->status().error()); 6595 EXPECT_THAT(req->status().error(), IsError(ERR_INVALID_URL));
6589 } 6596 }
6590 6597
6591 // Make sure redirects are cached, despite not reading their bodies. 6598 // Make sure redirects are cached, despite not reading their bodies.
6592 TEST_F(URLRequestTestHTTP, CacheRedirect) { 6599 TEST_F(URLRequestTestHTTP, CacheRedirect) {
6593 ASSERT_TRUE(http_test_server()->Start()); 6600 ASSERT_TRUE(http_test_server()->Start());
6594 GURL redirect_url = 6601 GURL redirect_url =
6595 http_test_server()->GetURL("/redirect302-to-echo-cacheable"); 6602 http_test_server()->GetURL("/redirect302-to-echo-cacheable");
6596 6603
6597 { 6604 {
6598 TestDelegate d; 6605 TestDelegate d;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
6676 { 6683 {
6677 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( 6684 std::unique_ptr<URLRequest> r(default_context_.CreateRequest(
6678 http_test_server()->GetURL("/whatever"), DEFAULT_PRIORITY, &d)); 6685 http_test_server()->GetURL("/whatever"), DEFAULT_PRIORITY, &d));
6679 6686
6680 r->Start(); 6687 r->Start();
6681 base::RunLoop().Run(); 6688 base::RunLoop().Run();
6682 6689
6683 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 6690 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
6684 6691
6685 EXPECT_EQ(2U, r->url_chain().size()); 6692 EXPECT_EQ(2U, r->url_chain().size());
6686 EXPECT_EQ(OK, r->status().error()); 6693 EXPECT_THAT(r->status().error(), IsOk());
6687 EXPECT_EQ(unsafe_url, r->url()); 6694 EXPECT_EQ(unsafe_url, r->url());
6688 EXPECT_EQ("this-is-considered-an-unsafe-url", d.data_received()); 6695 EXPECT_EQ("this-is-considered-an-unsafe-url", d.data_received());
6689 } 6696 }
6690 } 6697 }
6691 6698
6692 // Tests that a redirect to a different unsafe URL is blocked, even after adding 6699 // Tests that a redirect to a different unsafe URL is blocked, even after adding
6693 // some other URL to the whitelist. 6700 // some other URL to the whitelist.
6694 TEST_F(URLRequestTestHTTP, UnsafeRedirectToDifferentUnsafeURL) { 6701 TEST_F(URLRequestTestHTTP, UnsafeRedirectToDifferentUnsafeURL) {
6695 ASSERT_TRUE(http_test_server()->Start()); 6702 ASSERT_TRUE(http_test_server()->Start());
6696 6703
6697 GURL unsafe_url("data:text/html,something"); 6704 GURL unsafe_url("data:text/html,something");
6698 GURL different_unsafe_url("data:text/html,something-else"); 6705 GURL different_unsafe_url("data:text/html,something-else");
6699 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url); 6706 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url);
6700 default_network_delegate_.set_allowed_unsafe_redirect_url( 6707 default_network_delegate_.set_allowed_unsafe_redirect_url(
6701 different_unsafe_url); 6708 different_unsafe_url);
6702 6709
6703 TestDelegate d; 6710 TestDelegate d;
6704 { 6711 {
6705 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( 6712 std::unique_ptr<URLRequest> r(default_context_.CreateRequest(
6706 http_test_server()->GetURL("/whatever"), DEFAULT_PRIORITY, &d)); 6713 http_test_server()->GetURL("/whatever"), DEFAULT_PRIORITY, &d));
6707 6714
6708 r->Start(); 6715 r->Start();
6709 base::RunLoop().Run(); 6716 base::RunLoop().Run();
6710 6717
6711 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 6718 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
6712 EXPECT_EQ(ERR_UNSAFE_REDIRECT, r->status().error()); 6719 EXPECT_THAT(r->status().error(), IsError(ERR_UNSAFE_REDIRECT));
6713 } 6720 }
6714 } 6721 }
6715 6722
6716 // Redirects from an URL with fragment to an unsafe URL with fragment should 6723 // Redirects from an URL with fragment to an unsafe URL with fragment should
6717 // be allowed, and the reference fragment of the target URL should be preserved. 6724 // be allowed, and the reference fragment of the target URL should be preserved.
6718 TEST_F(URLRequestTestHTTP, UnsafeRedirectWithDifferentReferenceFragment) { 6725 TEST_F(URLRequestTestHTTP, UnsafeRedirectWithDifferentReferenceFragment) {
6719 ASSERT_TRUE(http_test_server()->Start()); 6726 ASSERT_TRUE(http_test_server()->Start());
6720 6727
6721 GURL original_url(http_test_server()->GetURL("/original#fragment1")); 6728 GURL original_url(http_test_server()->GetURL("/original#fragment1"));
6722 GURL unsafe_url("data:,url-marked-safe-and-used-in-redirect#fragment2"); 6729 GURL unsafe_url("data:,url-marked-safe-and-used-in-redirect#fragment2");
6723 GURL expected_url("data:,url-marked-safe-and-used-in-redirect#fragment2"); 6730 GURL expected_url("data:,url-marked-safe-and-used-in-redirect#fragment2");
6724 6731
6725 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url); 6732 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url);
6726 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url); 6733 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url);
6727 6734
6728 TestDelegate d; 6735 TestDelegate d;
6729 { 6736 {
6730 std::unique_ptr<URLRequest> r( 6737 std::unique_ptr<URLRequest> r(
6731 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d)); 6738 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d));
6732 6739
6733 r->Start(); 6740 r->Start();
6734 base::RunLoop().Run(); 6741 base::RunLoop().Run();
6735 6742
6736 EXPECT_EQ(2U, r->url_chain().size()); 6743 EXPECT_EQ(2U, r->url_chain().size());
6737 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 6744 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
6738 EXPECT_EQ(OK, r->status().error()); 6745 EXPECT_THAT(r->status().error(), IsOk());
6739 EXPECT_EQ(original_url, r->original_url()); 6746 EXPECT_EQ(original_url, r->original_url());
6740 EXPECT_EQ(expected_url, r->url()); 6747 EXPECT_EQ(expected_url, r->url());
6741 } 6748 }
6742 } 6749 }
6743 6750
6744 // When a delegate has specified a safe redirect URL, but it does not match the 6751 // When a delegate has specified a safe redirect URL, but it does not match the
6745 // redirect target, then do not prevent the reference fragment from being added. 6752 // redirect target, then do not prevent the reference fragment from being added.
6746 TEST_F(URLRequestTestHTTP, RedirectWithReferenceFragmentAndUnrelatedUnsafeUrl) { 6753 TEST_F(URLRequestTestHTTP, RedirectWithReferenceFragmentAndUnrelatedUnsafeUrl) {
6747 ASSERT_TRUE(http_test_server()->Start()); 6754 ASSERT_TRUE(http_test_server()->Start());
6748 6755
6749 GURL original_url(http_test_server()->GetURL("/original#expected-fragment")); 6756 GURL original_url(http_test_server()->GetURL("/original#expected-fragment"));
6750 GURL unsafe_url("data:text/html,this-url-does-not-match-redirect-url"); 6757 GURL unsafe_url("data:text/html,this-url-does-not-match-redirect-url");
6751 GURL redirect_url(http_test_server()->GetURL("/target")); 6758 GURL redirect_url(http_test_server()->GetURL("/target"));
6752 GURL expected_redirect_url( 6759 GURL expected_redirect_url(
6753 http_test_server()->GetURL("/target#expected-fragment")); 6760 http_test_server()->GetURL("/target#expected-fragment"));
6754 6761
6755 default_network_delegate_.set_redirect_on_headers_received_url(redirect_url); 6762 default_network_delegate_.set_redirect_on_headers_received_url(redirect_url);
6756 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url); 6763 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url);
6757 6764
6758 TestDelegate d; 6765 TestDelegate d;
6759 { 6766 {
6760 std::unique_ptr<URLRequest> r( 6767 std::unique_ptr<URLRequest> r(
6761 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d)); 6768 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d));
6762 6769
6763 r->Start(); 6770 r->Start();
6764 base::RunLoop().Run(); 6771 base::RunLoop().Run();
6765 6772
6766 EXPECT_EQ(2U, r->url_chain().size()); 6773 EXPECT_EQ(2U, r->url_chain().size());
6767 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 6774 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
6768 EXPECT_EQ(OK, r->status().error()); 6775 EXPECT_THAT(r->status().error(), IsOk());
6769 EXPECT_EQ(original_url, r->original_url()); 6776 EXPECT_EQ(original_url, r->original_url());
6770 EXPECT_EQ(expected_redirect_url, r->url()); 6777 EXPECT_EQ(expected_redirect_url, r->url());
6771 } 6778 }
6772 } 6779 }
6773 6780
6774 // When a delegate has specified a safe redirect URL, assume that the redirect 6781 // When a delegate has specified a safe redirect URL, assume that the redirect
6775 // URL should not be changed. In particular, the reference fragment should not 6782 // URL should not be changed. In particular, the reference fragment should not
6776 // be modified. 6783 // be modified.
6777 TEST_F(URLRequestTestHTTP, RedirectWithReferenceFragment) { 6784 TEST_F(URLRequestTestHTTP, RedirectWithReferenceFragment) {
6778 ASSERT_TRUE(http_test_server()->Start()); 6785 ASSERT_TRUE(http_test_server()->Start());
6779 6786
6780 GURL original_url( 6787 GURL original_url(
6781 http_test_server()->GetURL("/original#should-not-be-appended")); 6788 http_test_server()->GetURL("/original#should-not-be-appended"));
6782 GURL redirect_url("data:text/html,expect-no-reference-fragment"); 6789 GURL redirect_url("data:text/html,expect-no-reference-fragment");
6783 6790
6784 default_network_delegate_.set_redirect_on_headers_received_url(redirect_url); 6791 default_network_delegate_.set_redirect_on_headers_received_url(redirect_url);
6785 default_network_delegate_.set_allowed_unsafe_redirect_url(redirect_url); 6792 default_network_delegate_.set_allowed_unsafe_redirect_url(redirect_url);
6786 6793
6787 TestDelegate d; 6794 TestDelegate d;
6788 { 6795 {
6789 std::unique_ptr<URLRequest> r( 6796 std::unique_ptr<URLRequest> r(
6790 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d)); 6797 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d));
6791 6798
6792 r->Start(); 6799 r->Start();
6793 base::RunLoop().Run(); 6800 base::RunLoop().Run();
6794 6801
6795 EXPECT_EQ(2U, r->url_chain().size()); 6802 EXPECT_EQ(2U, r->url_chain().size());
6796 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 6803 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
6797 EXPECT_EQ(OK, r->status().error()); 6804 EXPECT_THAT(r->status().error(), IsOk());
6798 EXPECT_EQ(original_url, r->original_url()); 6805 EXPECT_EQ(original_url, r->original_url());
6799 EXPECT_EQ(redirect_url, r->url()); 6806 EXPECT_EQ(redirect_url, r->url());
6800 } 6807 }
6801 } 6808 }
6802 6809
6803 // When a URLRequestRedirectJob is created, the redirection must be followed and 6810 // When a URLRequestRedirectJob is created, the redirection must be followed and
6804 // the reference fragment of the target URL must not be modified. 6811 // the reference fragment of the target URL must not be modified.
6805 TEST_F(URLRequestTestHTTP, RedirectJobWithReferenceFragment) { 6812 TEST_F(URLRequestTestHTTP, RedirectJobWithReferenceFragment) {
6806 ASSERT_TRUE(http_test_server()->Start()); 6813 ASSERT_TRUE(http_test_server()->Start());
6807 6814
6808 GURL original_url( 6815 GURL original_url(
6809 http_test_server()->GetURL("/original#should-not-be-appended")); 6816 http_test_server()->GetURL("/original#should-not-be-appended"));
6810 GURL redirect_url(http_test_server()->GetURL("/echo")); 6817 GURL redirect_url(http_test_server()->GetURL("/echo"));
6811 6818
6812 TestDelegate d; 6819 TestDelegate d;
6813 std::unique_ptr<URLRequest> r( 6820 std::unique_ptr<URLRequest> r(
6814 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d)); 6821 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d));
6815 6822
6816 std::unique_ptr<URLRequestRedirectJob> job(new URLRequestRedirectJob( 6823 std::unique_ptr<URLRequestRedirectJob> job(new URLRequestRedirectJob(
6817 r.get(), &default_network_delegate_, redirect_url, 6824 r.get(), &default_network_delegate_, redirect_url,
6818 URLRequestRedirectJob::REDIRECT_302_FOUND, "Very Good Reason")); 6825 URLRequestRedirectJob::REDIRECT_302_FOUND, "Very Good Reason"));
6819 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 6826 AddTestInterceptor()->set_main_intercept_job(std::move(job));
6820 6827
6821 r->Start(); 6828 r->Start();
6822 base::RunLoop().Run(); 6829 base::RunLoop().Run();
6823 6830
6824 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 6831 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
6825 EXPECT_EQ(OK, r->status().error()); 6832 EXPECT_THAT(r->status().error(), IsOk());
6826 EXPECT_EQ(original_url, r->original_url()); 6833 EXPECT_EQ(original_url, r->original_url());
6827 EXPECT_EQ(redirect_url, r->url()); 6834 EXPECT_EQ(redirect_url, r->url());
6828 } 6835 }
6829 6836
6830 TEST_F(URLRequestTestHTTP, UnsupportedReferrerScheme) { 6837 TEST_F(URLRequestTestHTTP, UnsupportedReferrerScheme) {
6831 ASSERT_TRUE(http_test_server()->Start()); 6838 ASSERT_TRUE(http_test_server()->Start());
6832 6839
6833 const std::string referrer("foobar://totally.legit.referrer"); 6840 const std::string referrer("foobar://totally.legit.referrer");
6834 TestDelegate d; 6841 TestDelegate d;
6835 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( 6842 std::unique_ptr<URLRequest> req(default_context_.CreateRequest(
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
7456 7463
7457 TestDelegate d; 7464 TestDelegate d;
7458 const GURL url = http_test_server()->GetURL("/308-without-location-header"); 7465 const GURL url = http_test_server()->GetURL("/308-without-location-header");
7459 7466
7460 std::unique_ptr<URLRequest> request( 7467 std::unique_ptr<URLRequest> request(
7461 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d)); 7468 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d));
7462 7469
7463 request->Start(); 7470 request->Start();
7464 base::RunLoop().Run(); 7471 base::RunLoop().Run();
7465 EXPECT_EQ(URLRequestStatus::SUCCESS, request->status().status()); 7472 EXPECT_EQ(URLRequestStatus::SUCCESS, request->status().status());
7466 EXPECT_EQ(OK, request->status().error()); 7473 EXPECT_THAT(request->status().error(), IsOk());
7467 EXPECT_EQ(0, d.received_redirect_count()); 7474 EXPECT_EQ(0, d.received_redirect_count());
7468 EXPECT_EQ(308, request->response_headers()->response_code()); 7475 EXPECT_EQ(308, request->response_headers()->response_code());
7469 EXPECT_EQ("This is not a redirect.", d.data_received()); 7476 EXPECT_EQ("This is not a redirect.", d.data_received());
7470 } 7477 }
7471 7478
7472 TEST_F(URLRequestTestHTTP, Redirect302PreserveReferenceFragment) { 7479 TEST_F(URLRequestTestHTTP, Redirect302PreserveReferenceFragment) {
7473 ASSERT_TRUE(http_test_server()->Start()); 7480 ASSERT_TRUE(http_test_server()->Start());
7474 7481
7475 GURL original_url( 7482 GURL original_url(
7476 http_test_server()->GetURL("/redirect302-to-echo#fragment")); 7483 http_test_server()->GetURL("/redirect302-to-echo#fragment"));
7477 GURL expected_url(http_test_server()->GetURL("/echo#fragment")); 7484 GURL expected_url(http_test_server()->GetURL("/echo#fragment"));
7478 7485
7479 TestDelegate d; 7486 TestDelegate d;
7480 { 7487 {
7481 std::unique_ptr<URLRequest> r( 7488 std::unique_ptr<URLRequest> r(
7482 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d)); 7489 default_context_.CreateRequest(original_url, DEFAULT_PRIORITY, &d));
7483 7490
7484 r->Start(); 7491 r->Start();
7485 base::RunLoop().Run(); 7492 base::RunLoop().Run();
7486 7493
7487 EXPECT_EQ(2U, r->url_chain().size()); 7494 EXPECT_EQ(2U, r->url_chain().size());
7488 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 7495 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
7489 EXPECT_EQ(OK, r->status().error()); 7496 EXPECT_THAT(r->status().error(), IsOk());
7490 EXPECT_EQ(original_url, r->original_url()); 7497 EXPECT_EQ(original_url, r->original_url());
7491 EXPECT_EQ(expected_url, r->url()); 7498 EXPECT_EQ(expected_url, r->url());
7492 } 7499 }
7493 } 7500 }
7494 7501
7495 TEST_F(URLRequestTestHTTP, RedirectPreserveFirstPartyURL) { 7502 TEST_F(URLRequestTestHTTP, RedirectPreserveFirstPartyURL) {
7496 ASSERT_TRUE(http_test_server()->Start()); 7503 ASSERT_TRUE(http_test_server()->Start());
7497 7504
7498 GURL url(http_test_server()->GetURL("/redirect302-to-echo")); 7505 GURL url(http_test_server()->GetURL("/redirect302-to-echo"));
7499 GURL first_party_url("http://example.com"); 7506 GURL first_party_url("http://example.com");
7500 7507
7501 TestDelegate d; 7508 TestDelegate d;
7502 { 7509 {
7503 std::unique_ptr<URLRequest> r( 7510 std::unique_ptr<URLRequest> r(
7504 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d)); 7511 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d));
7505 r->set_first_party_for_cookies(first_party_url); 7512 r->set_first_party_for_cookies(first_party_url);
7506 7513
7507 r->Start(); 7514 r->Start();
7508 base::RunLoop().Run(); 7515 base::RunLoop().Run();
7509 7516
7510 EXPECT_EQ(2U, r->url_chain().size()); 7517 EXPECT_EQ(2U, r->url_chain().size());
7511 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 7518 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
7512 EXPECT_EQ(OK, r->status().error()); 7519 EXPECT_THAT(r->status().error(), IsOk());
7513 EXPECT_EQ(first_party_url, r->first_party_for_cookies()); 7520 EXPECT_EQ(first_party_url, r->first_party_for_cookies());
7514 } 7521 }
7515 } 7522 }
7516 7523
7517 TEST_F(URLRequestTestHTTP, RedirectUpdateFirstPartyURL) { 7524 TEST_F(URLRequestTestHTTP, RedirectUpdateFirstPartyURL) {
7518 ASSERT_TRUE(http_test_server()->Start()); 7525 ASSERT_TRUE(http_test_server()->Start());
7519 7526
7520 GURL url(http_test_server()->GetURL("/redirect302-to-echo")); 7527 GURL url(http_test_server()->GetURL("/redirect302-to-echo"));
7521 GURL original_first_party_url("http://example.com"); 7528 GURL original_first_party_url("http://example.com");
7522 GURL expected_first_party_url(http_test_server()->GetURL("/echo")); 7529 GURL expected_first_party_url(http_test_server()->GetURL("/echo"));
7523 7530
7524 TestDelegate d; 7531 TestDelegate d;
7525 { 7532 {
7526 std::unique_ptr<URLRequest> r( 7533 std::unique_ptr<URLRequest> r(
7527 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d)); 7534 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d));
7528 r->set_first_party_for_cookies(original_first_party_url); 7535 r->set_first_party_for_cookies(original_first_party_url);
7529 r->set_first_party_url_policy( 7536 r->set_first_party_url_policy(
7530 URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); 7537 URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT);
7531 7538
7532 r->Start(); 7539 r->Start();
7533 base::RunLoop().Run(); 7540 base::RunLoop().Run();
7534 7541
7535 EXPECT_EQ(2U, r->url_chain().size()); 7542 EXPECT_EQ(2U, r->url_chain().size());
7536 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status()); 7543 EXPECT_EQ(URLRequestStatus::SUCCESS, r->status().status());
7537 EXPECT_EQ(OK, r->status().error()); 7544 EXPECT_THAT(r->status().error(), IsOk());
7538 EXPECT_EQ(expected_first_party_url, r->first_party_for_cookies()); 7545 EXPECT_EQ(expected_first_party_url, r->first_party_for_cookies());
7539 } 7546 }
7540 } 7547 }
7541 7548
7542 TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) { 7549 TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) {
7543 ASSERT_TRUE(http_test_server()->Start()); 7550 ASSERT_TRUE(http_test_server()->Start());
7544 7551
7545 const char kData[] = "hello world"; 7552 const char kData[] = "hello world";
7546 7553
7547 TestDelegate d; 7554 TestDelegate d;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
7818 context.Init(); 7825 context.Init();
7819 7826
7820 TestDelegate d; 7827 TestDelegate d;
7821 std::unique_ptr<URLRequest> req( 7828 std::unique_ptr<URLRequest> req(
7822 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d)); 7829 context.CreateRequest(GURL("http://127.0.0.1/"), DEFAULT_PRIORITY, &d));
7823 req->Start(); 7830 req->Start();
7824 base::RunLoop().Run(); 7831 base::RunLoop().Run();
7825 7832
7826 EXPECT_TRUE(d.request_failed()); 7833 EXPECT_TRUE(d.request_failed());
7827 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status()); 7834 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status());
7828 EXPECT_EQ(ERR_NETWORK_IO_SUSPENDED, req->status().error()); 7835 EXPECT_THAT(req->status().error(), IsError(ERR_NETWORK_IO_SUSPENDED));
7829 } 7836 }
7830 7837
7831 namespace { 7838 namespace {
7832 7839
7833 // HttpTransactionFactory that synchronously fails to create transactions. 7840 // HttpTransactionFactory that synchronously fails to create transactions.
7834 class FailingHttpTransactionFactory : public HttpTransactionFactory { 7841 class FailingHttpTransactionFactory : public HttpTransactionFactory {
7835 public: 7842 public:
7836 explicit FailingHttpTransactionFactory(HttpNetworkSession* network_session) 7843 explicit FailingHttpTransactionFactory(HttpNetworkSession* network_session)
7837 : network_session_(network_session) {} 7844 : network_session_(network_session) {}
7838 7845
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
8662 test_server.GetURL("/defaultresponse"), DEFAULT_PRIORITY, &d)); 8669 test_server.GetURL("/defaultresponse"), DEFAULT_PRIORITY, &d));
8663 8670
8664 r->Start(); 8671 r->Start();
8665 EXPECT_TRUE(r->is_pending()); 8672 EXPECT_TRUE(r->is_pending());
8666 8673
8667 base::RunLoop().Run(); 8674 base::RunLoop().Run();
8668 8675
8669 EXPECT_EQ(1, d.response_started_count()); 8676 EXPECT_EQ(1, d.response_started_count());
8670 EXPECT_FALSE(r->status().is_success()); 8677 EXPECT_FALSE(r->status().is_success());
8671 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 8678 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
8672 EXPECT_EQ(ERR_SSL_OBSOLETE_CIPHER, r->status().error()); 8679 EXPECT_THAT(r->status().error(), IsError(ERR_SSL_OBSOLETE_CIPHER));
8673 } 8680 }
8674 } 8681 }
8675 8682
8676 namespace { 8683 namespace {
8677 8684
8678 class SSLClientAuthTestDelegate : public TestDelegate { 8685 class SSLClientAuthTestDelegate : public TestDelegate {
8679 public: 8686 public:
8680 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) { 8687 SSLClientAuthTestDelegate() : on_certificate_requested_count_(0) {
8681 } 8688 }
8682 void OnCertificateRequested(URLRequest* request, 8689 void OnCertificateRequested(URLRequest* request,
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
9650 { 9657 {
9651 std::unique_ptr<URLRequest> r( 9658 std::unique_ptr<URLRequest> r(
9652 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d)); 9659 default_context_.CreateRequest(url, DEFAULT_PRIORITY, &d));
9653 r->Start(); 9660 r->Start();
9654 EXPECT_TRUE(r->is_pending()); 9661 EXPECT_TRUE(r->is_pending());
9655 9662
9656 base::RunLoop().Run(); 9663 base::RunLoop().Run();
9657 9664
9658 EXPECT_FALSE(r->is_pending()); 9665 EXPECT_FALSE(r->is_pending());
9659 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); 9666 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status());
9660 EXPECT_EQ(ERR_UNSAFE_PORT, r->status().error()); 9667 EXPECT_THAT(r->status().error(), IsError(ERR_UNSAFE_PORT));
9661 } 9668 }
9662 } 9669 }
9663 9670
9664 TEST_F(URLRequestTestFTP, FTPDirectoryListing) { 9671 TEST_F(URLRequestTestFTP, FTPDirectoryListing) {
9665 ASSERT_TRUE(ftp_test_server_.Start()); 9672 ASSERT_TRUE(ftp_test_server_.Start());
9666 9673
9667 TestDelegate d; 9674 TestDelegate d;
9668 { 9675 {
9669 std::unique_ptr<URLRequest> r(default_context_.CreateRequest( 9676 std::unique_ptr<URLRequest> r(default_context_.CreateRequest(
9670 ftp_test_server_.GetURL("/"), DEFAULT_PRIORITY, &d)); 9677 ftp_test_server_.GetURL("/"), DEFAULT_PRIORITY, &d));
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
9988 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 9995 AddTestInterceptor()->set_main_intercept_job(std::move(job));
9989 9996
9990 req->Start(); 9997 req->Start();
9991 req->Cancel(); 9998 req->Cancel();
9992 base::RunLoop().RunUntilIdle(); 9999 base::RunLoop().RunUntilIdle();
9993 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); 10000 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status());
9994 EXPECT_EQ(0, d.received_redirect_count()); 10001 EXPECT_EQ(0, d.received_redirect_count());
9995 } 10002 }
9996 10003
9997 } // namespace net 10004 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_simple_job_unittest.cc ('k') | net/url_request/view_cache_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698