| 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 "net/http/http_proxy_client_socket_pool.h" | 5 #include "net/http/http_proxy_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/callback.h" | 9 #include "base/callback.h" |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 11 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
| 12 #include "net/base/proxy_delegate.h" | 14 #include "net/base/proxy_delegate.h" |
| 13 #include "net/base/test_completion_callback.h" | 15 #include "net/base/test_completion_callback.h" |
| 14 #include "net/base/test_proxy_delegate.h" | 16 #include "net/base/test_proxy_delegate.h" |
| 15 #include "net/http/http_network_session.h" | 17 #include "net/http/http_network_session.h" |
| 16 #include "net/http/http_proxy_client_socket.h" | 18 #include "net/http/http_proxy_client_socket.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 MockWrite spdy_writes[] = { | 297 MockWrite spdy_writes[] = { |
| 296 CreateMockWrite(*req, 0, ASYNC), | 298 CreateMockWrite(*req, 0, ASYNC), |
| 297 CreateMockWrite(*rst, 2, ASYNC), | 299 CreateMockWrite(*rst, 2, ASYNC), |
| 298 }; | 300 }; |
| 299 SpdyHeaderBlock resp_block; | 301 SpdyHeaderBlock resp_block; |
| 300 resp_block[spdy_util_.GetStatusKey()] = "407"; | 302 resp_block[spdy_util_.GetStatusKey()] = "407"; |
| 301 resp_block["proxy-authenticate"] = "Basic realm=\"MyRealm1\""; | 303 resp_block["proxy-authenticate"] = "Basic realm=\"MyRealm1\""; |
| 302 spdy_util_.MaybeAddVersionHeader(&resp_block); | 304 spdy_util_.MaybeAddVersionHeader(&resp_block); |
| 303 | 305 |
| 304 std::unique_ptr<SpdySerializedFrame> resp( | 306 std::unique_ptr<SpdySerializedFrame> resp( |
| 305 spdy_util_.ConstructSpdyReply(1, resp_block)); | 307 spdy_util_.ConstructSpdyReply(1, std::move(resp_block))); |
| 306 MockRead spdy_reads[] = { | 308 MockRead spdy_reads[] = { |
| 307 CreateMockRead(*resp, 1, ASYNC), | 309 CreateMockRead(*resp, 1, ASYNC), |
| 308 MockRead(ASYNC, 0, 3) | 310 MockRead(ASYNC, 0, 3) |
| 309 }; | 311 }; |
| 310 | 312 |
| 311 Initialize(reads, arraysize(reads), writes, arraysize(writes), | 313 Initialize(reads, arraysize(reads), writes, arraysize(writes), |
| 312 spdy_reads, arraysize(spdy_reads), spdy_writes, | 314 spdy_reads, arraysize(spdy_reads), spdy_writes, |
| 313 arraysize(spdy_writes)); | 315 arraysize(spdy_writes)); |
| 314 | 316 |
| 315 int rv = handle_.Init("a", CreateTunnelParams(NULL), LOW, | 317 int rv = handle_.Init("a", CreateTunnelParams(NULL), LOW, |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // Make sure Location header was included and correct. | 743 // Make sure Location header was included and correct. |
| 742 std::string location; | 744 std::string location; |
| 743 EXPECT_TRUE(headers->IsRedirect(&location)); | 745 EXPECT_TRUE(headers->IsRedirect(&location)); |
| 744 EXPECT_EQ(location, redirectTarget); | 746 EXPECT_EQ(location, redirectTarget); |
| 745 } | 747 } |
| 746 } | 748 } |
| 747 | 749 |
| 748 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. | 750 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. |
| 749 | 751 |
| 750 } // namespace net | 752 } // namespace net |
| OLD | NEW |