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