OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 480 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 if (GetParam() == HTTP) { |
503 EXPECT_FALSE(handle_.socket()); | 503 // HTTP Proxy CONNECT responses are not trustworthy |
| 504 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); |
| 505 EXPECT_FALSE(handle_.is_initialized()); |
| 506 EXPECT_FALSE(handle_.socket()); |
| 507 } else { |
| 508 // HTTPS or SPDY Proxy CONNECT responses are trustworthy |
| 509 EXPECT_EQ(ERR_HTTPS_PROXY_TUNNEL_RESPONSE, rv); |
| 510 EXPECT_TRUE(handle_.is_initialized()); |
| 511 EXPECT_TRUE(handle_.socket()); |
| 512 } |
504 } | 513 } |
505 | 514 |
506 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. | 515 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. |
507 | 516 |
508 } // namespace net | 517 } // namespace net |
OLD | NEW |