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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 arraysize(spdy_writes)); | 467 arraysize(spdy_writes)); |
468 AddAuthToCache(); | 468 AddAuthToCache(); |
469 | 469 |
470 int rv = handle_.Init("a", GetTunnelParams(), LOW, callback_.callback(), | 470 int rv = handle_.Init("a", GetTunnelParams(), LOW, callback_.callback(), |
471 &pool_, BoundNetLog()); | 471 &pool_, BoundNetLog()); |
472 EXPECT_EQ(ERR_IO_PENDING, rv); | 472 EXPECT_EQ(ERR_IO_PENDING, rv); |
473 EXPECT_FALSE(handle_.is_initialized()); | 473 EXPECT_FALSE(handle_.is_initialized()); |
474 EXPECT_FALSE(handle_.socket()); | 474 EXPECT_FALSE(handle_.socket()); |
475 | 475 |
476 data_->RunFor(3); | 476 data_->RunFor(3); |
477 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback_.WaitForResult()); | 477 if (GetParam() == SPDY) { |
| 478 // SPDY cannot process a headers block unless it's complete and so it |
| 479 // returns ERR_CONNECTION_CLOSED in this case. |
| 480 EXPECT_EQ(ERR_CONNECTION_CLOSED, callback_.WaitForResult()); |
| 481 } else { |
| 482 EXPECT_EQ(ERR_HEADERS_TRUNCATED, callback_.WaitForResult()); |
| 483 } |
478 EXPECT_FALSE(handle_.is_initialized()); | 484 EXPECT_FALSE(handle_.is_initialized()); |
479 EXPECT_FALSE(handle_.socket()); | 485 EXPECT_FALSE(handle_.socket()); |
480 } | 486 } |
481 | 487 |
482 TEST_P(HttpProxyClientSocketPoolSpdy2Test, TunnelSetupError) { | 488 TEST_P(HttpProxyClientSocketPoolSpdy2Test, TunnelSetupError) { |
483 MockWrite writes[] = { | 489 MockWrite writes[] = { |
484 MockWrite(ASYNC, 0, | 490 MockWrite(ASYNC, 0, |
485 "CONNECT www.google.com:443 HTTP/1.1\r\n" | 491 "CONNECT www.google.com:443 HTTP/1.1\r\n" |
486 "Host: www.google.com\r\n" | 492 "Host: www.google.com\r\n" |
487 "Proxy-Connection: keep-alive\r\n" | 493 "Proxy-Connection: keep-alive\r\n" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 // Make sure Location header was included and correct. | 608 // Make sure Location header was included and correct. |
603 std::string location; | 609 std::string location; |
604 EXPECT_TRUE(headers->IsRedirect(&location)); | 610 EXPECT_TRUE(headers->IsRedirect(&location)); |
605 EXPECT_EQ(location, redirectTarget); | 611 EXPECT_EQ(location, redirectTarget); |
606 } | 612 } |
607 } | 613 } |
608 | 614 |
609 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. | 615 // It would be nice to also test the timeouts in HttpProxyClientSocketPool. |
610 | 616 |
611 } // namespace net | 617 } // namespace net |
OLD | NEW |