| OLD | NEW |
| 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 4120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4131 context.Init(); | 4131 context.Init(); |
| 4132 | 4132 |
| 4133 d.set_credentials(AuthCredentials(kUser, kSecret)); | 4133 d.set_credentials(AuthCredentials(kUser, kSecret)); |
| 4134 | 4134 |
| 4135 { | 4135 { |
| 4136 GURL url(http_test_server()->GetURL("/auth-basic")); | 4136 GURL url(http_test_server()->GetURL("/auth-basic")); |
| 4137 std::unique_ptr<URLRequest> r( | 4137 std::unique_ptr<URLRequest> r( |
| 4138 context.CreateRequest(url, DEFAULT_PRIORITY, &d)); | 4138 context.CreateRequest(url, DEFAULT_PRIORITY, &d)); |
| 4139 r->Start(); | 4139 r->Start(); |
| 4140 | 4140 |
| 4141 base::RunLoop().Run(); | |
| 4142 | |
| 4143 { | 4141 { |
| 4144 HttpRequestHeaders headers; | 4142 HttpRequestHeaders headers; |
| 4145 EXPECT_TRUE(r->GetFullRequestHeaders(&headers)); | 4143 EXPECT_TRUE(r->GetFullRequestHeaders(&headers)); |
| 4146 EXPECT_TRUE(headers.HasHeader("Authorization")); | 4144 EXPECT_FALSE(headers.HasHeader("Authorization")); |
| 4147 } | 4145 } |
| 4148 | 4146 |
| 4147 base::RunLoop().Run(); |
| 4148 |
| 4149 EXPECT_EQ(OK, d.request_status()); | 4149 EXPECT_EQ(OK, d.request_status()); |
| 4150 EXPECT_EQ(200, r->GetResponseCode()); | 4150 EXPECT_EQ(200, r->GetResponseCode()); |
| 4151 EXPECT_TRUE(d.auth_required_called()); | 4151 EXPECT_TRUE(d.auth_required_called()); |
| 4152 EXPECT_EQ(1, network_delegate.created_requests()); | 4152 EXPECT_EQ(1, network_delegate.created_requests()); |
| 4153 EXPECT_EQ(0, network_delegate.destroyed_requests()); | 4153 EXPECT_EQ(0, network_delegate.destroyed_requests()); |
| 4154 } | 4154 } |
| 4155 EXPECT_EQ(1, network_delegate.destroyed_requests()); | 4155 EXPECT_EQ(1, network_delegate.destroyed_requests()); |
| 4156 } | 4156 } |
| 4157 | 4157 |
| 4158 // Tests that the network delegate can synchronously complete OnAuthRequired | 4158 // Tests that the network delegate can synchronously complete OnAuthRequired |
| (...skipping 6769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10928 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 10928 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
| 10929 | 10929 |
| 10930 req->Start(); | 10930 req->Start(); |
| 10931 req->Cancel(); | 10931 req->Cancel(); |
| 10932 base::RunLoop().RunUntilIdle(); | 10932 base::RunLoop().RunUntilIdle(); |
| 10933 EXPECT_EQ(ERR_ABORTED, d.request_status()); | 10933 EXPECT_EQ(ERR_ABORTED, d.request_status()); |
| 10934 EXPECT_EQ(0, d.received_redirect_count()); | 10934 EXPECT_EQ(0, d.received_redirect_count()); |
| 10935 } | 10935 } |
| 10936 | 10936 |
| 10937 } // namespace net | 10937 } // namespace net |
| OLD | NEW |