OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <math.h> // ceil | 5 #include <math.h> // ceil |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
9 #include "net/base/mock_host_resolver.h" | 9 #include "net/base/mock_host_resolver.h" |
10 #include "net/base/request_priority.h" | 10 #include "net/base/request_priority.h" |
(...skipping 3538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3549 EXPECT_EQ(ERR_IO_PENDING, trans->Start(&request, &callback, NULL)); | 3549 EXPECT_EQ(ERR_IO_PENDING, trans->Start(&request, &callback, NULL)); |
3550 EXPECT_EQ(tests[i].expected_group_name, | 3550 EXPECT_EQ(tests[i].expected_group_name, |
3551 conn_pool->last_group_name_received()); | 3551 conn_pool->last_group_name_received()); |
3552 } | 3552 } |
3553 } | 3553 } |
3554 | 3554 |
3555 TEST_F(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { | 3555 TEST_F(HttpNetworkTransactionTest, ReconsiderProxyAfterFailedConnection) { |
3556 SessionDependencies session_deps( | 3556 SessionDependencies session_deps( |
3557 CreateFixedProxyService("myproxy:70;foobar:80")); | 3557 CreateFixedProxyService("myproxy:70;foobar:80")); |
3558 | 3558 |
| 3559 // This simulates failure resolving all hostnames; that means we will fail |
| 3560 // connecting to both proxies (myproxy:70 and foobar:80). |
3559 session_deps.host_resolver->rules()->AddSimulatedFailure("*"); | 3561 session_deps.host_resolver->rules()->AddSimulatedFailure("*"); |
3560 | 3562 |
3561 scoped_ptr<HttpTransaction> trans( | 3563 scoped_ptr<HttpTransaction> trans( |
3562 new HttpNetworkTransaction(CreateSession(&session_deps))); | 3564 new HttpNetworkTransaction(CreateSession(&session_deps))); |
3563 | 3565 |
3564 HttpRequestInfo request; | 3566 HttpRequestInfo request; |
3565 request.method = "GET"; | 3567 request.method = "GET"; |
3566 request.url = GURL("http://www.google.com/"); | 3568 request.url = GURL("http://www.google.com/"); |
3567 | 3569 |
3568 TestCompletionCallback callback; | 3570 TestCompletionCallback callback; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3897 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), | 3899 MockRead("HTTP/1.0 200 OK\r\nContent-Length:6719476739\r\n\r\n"), |
3898 MockRead(false, OK), | 3900 MockRead(false, OK), |
3899 }; | 3901 }; |
3900 SimpleGetHelperResult out = SimpleGetHelper(data_reads); | 3902 SimpleGetHelperResult out = SimpleGetHelper(data_reads); |
3901 EXPECT_EQ(OK, out.rv); | 3903 EXPECT_EQ(OK, out.rv); |
3902 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); | 3904 EXPECT_EQ("HTTP/1.0 200 OK", out.status_line); |
3903 EXPECT_EQ("", out.response_data); | 3905 EXPECT_EQ("", out.response_data); |
3904 } | 3906 } |
3905 | 3907 |
3906 } // namespace net | 3908 } // namespace net |
OLD | NEW |