| 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 "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 EXPECT_EQ(OK, rv); | 337 EXPECT_EQ(OK, rv); |
| 338 EXPECT_TRUE(handle_.is_initialized()); | 338 EXPECT_TRUE(handle_.is_initialized()); |
| 339 ASSERT_TRUE(handle_.socket()); | 339 ASSERT_TRUE(handle_.socket()); |
| 340 HttpProxyClientSocket* tunnel_socket = | 340 HttpProxyClientSocket* tunnel_socket = |
| 341 static_cast<HttpProxyClientSocket*>(handle_.socket()); | 341 static_cast<HttpProxyClientSocket*>(handle_.socket()); |
| 342 EXPECT_TRUE(tunnel_socket->IsConnected()); | 342 EXPECT_TRUE(tunnel_socket->IsConnected()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 TEST_P(HttpProxyClientSocketPoolSpdy3Test, AsyncHaveAuth) { | 345 TEST_P(HttpProxyClientSocketPoolSpdy3Test, AsyncHaveAuth) { |
| 346 MockWrite writes[] = { | 346 MockWrite writes[] = { |
| 347 MockWrite("CONNECT www.google.com:443 HTTP/1.1\r\n" | 347 MockWrite(ASYNC, 0, |
| 348 "CONNECT www.google.com:443 HTTP/1.1\r\n" |
| 348 "Host: www.google.com\r\n" | 349 "Host: www.google.com\r\n" |
| 349 "Proxy-Connection: keep-alive\r\n" | 350 "Proxy-Connection: keep-alive\r\n" |
| 350 "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), | 351 "Proxy-Authorization: Basic Zm9vOmJhcg==\r\n\r\n"), |
| 351 }; | 352 }; |
| 352 MockRead reads[] = { | 353 MockRead reads[] = { |
| 353 MockRead(SYNCHRONOUS, "HTTP/1.1 200 Connection Established\r\n\r\n"), | 354 MockRead(ASYNC, 1, "HTTP/1.1 200 Connection Established\r\n\r\n"), |
| 354 }; | 355 }; |
| 355 | 356 |
| 356 scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(kAuthHeaders, | 357 scoped_ptr<SpdyFrame> req(ConstructSpdyConnect(kAuthHeaders, |
| 357 kAuthHeadersSize, 1)); | 358 kAuthHeadersSize, 1)); |
| 358 MockWrite spdy_writes[] = { | 359 MockWrite spdy_writes[] = { |
| 359 CreateMockWrite(*req, 0, ASYNC) | 360 CreateMockWrite(*req, 0, ASYNC) |
| 360 }; | 361 }; |
| 361 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); | 362 scoped_ptr<SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1)); |
| 362 MockRead spdy_reads[] = { | 363 MockRead spdy_reads[] = { |
| 363 CreateMockRead(*resp, 1, ASYNC), | 364 CreateMockRead(*resp, 1, ASYNC), |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 // HTTPS or SPDY Proxy CONNECT responses are trustworthy | 539 // HTTPS or SPDY Proxy CONNECT responses are trustworthy |
| 539 EXPECT_EQ(ERR_HTTPS_PROXY_TUNNEL_RESPONSE, rv); | 540 EXPECT_EQ(ERR_HTTPS_PROXY_TUNNEL_RESPONSE, rv); |
| 540 EXPECT_TRUE(handle_.is_initialized()); | 541 EXPECT_TRUE(handle_.is_initialized()); |
| 541 EXPECT_TRUE(handle_.socket()); | 542 EXPECT_TRUE(handle_.socket()); |
| 542 } | 543 } |
| 543 } | 544 } |
| 544 | 545 |
| 545 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. | 546 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. |
| 546 | 547 |
| 547 } // namespace net | 548 } // namespace net |
| OLD | NEW |