OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
vandebo (ex-Chrome)
2010/12/14 00:30:23
I'd like to see a unit test (here or at the HttpNe
Ryan Hamilton
2010/12/15 20:14:17
Just to confirm. It's ok to reuse the TCP/SSL soc
vandebo (ex-Chrome)
2010/12/15 22:52:38
Yea, I had a think-o.
| |
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" |
11 #include "net/base/mock_host_resolver.h" | 11 #include "net/base/mock_host_resolver.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 AddAuthToCache(); | 491 AddAuthToCache(); |
492 | 492 |
493 int rv = handle_.Init("a", GetTunnelParams(), LOW, &callback_, &pool_, | 493 int rv = handle_.Init("a", GetTunnelParams(), LOW, &callback_, &pool_, |
494 BoundNetLog()); | 494 BoundNetLog()); |
495 EXPECT_EQ(ERR_IO_PENDING, rv); | 495 EXPECT_EQ(ERR_IO_PENDING, rv); |
496 EXPECT_FALSE(handle_.is_initialized()); | 496 EXPECT_FALSE(handle_.is_initialized()); |
497 EXPECT_FALSE(handle_.socket()); | 497 EXPECT_FALSE(handle_.socket()); |
498 | 498 |
499 data_->RunFor(2); | 499 data_->RunFor(2); |
500 | 500 |
501 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, callback_.WaitForResult()); | 501 rv = callback_.WaitForResult(); |
502 EXPECT_FALSE(handle_.is_initialized()); | 502 EXPECT_FALSE(handle_.is_initialized()); |
503 EXPECT_FALSE(handle_.socket()); | 503 EXPECT_FALSE(handle_.socket()); |
504 if (GetParam() == HTTP) { | |
505 // HTTP Proxy CONNECT responses are not trustworthy | |
506 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); | |
507 } else { | |
508 // HTTP Proxy CONNECT responses are trustworthy | |
509 EXPECT_EQ(ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE, rv); | |
510 } | |
504 } | 511 } |
505 | 512 |
506 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. | 513 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. |
507 | 514 |
508 } // namespace net | 515 } // namespace net |
OLD | NEW |