| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return !timed_out; | 71 return !timed_out; |
| 72 } | 72 } |
| 73 | 73 |
| 74 class TestHttpClient { | 74 class TestHttpClient { |
| 75 public: | 75 public: |
| 76 TestHttpClient() : connect_result_(OK) {} | 76 TestHttpClient() : connect_result_(OK) {} |
| 77 | 77 |
| 78 int ConnectAndWait(const IPEndPoint& address) { | 78 int ConnectAndWait(const IPEndPoint& address) { |
| 79 AddressList addresses(address); | 79 AddressList addresses(address); |
| 80 NetLog::Source source; | 80 NetLog::Source source; |
| 81 socket_.reset(new TCPClientSocket(addresses, NULL, source)); | 81 socket_.reset(new TCPClientSocket(addresses, NULL, NULL, source)); |
| 82 | 82 |
| 83 base::RunLoop run_loop; | 83 base::RunLoop run_loop; |
| 84 connect_result_ = socket_->Connect(base::Bind(&TestHttpClient::OnConnect, | 84 connect_result_ = socket_->Connect(base::Bind(&TestHttpClient::OnConnect, |
| 85 base::Unretained(this), | 85 base::Unretained(this), |
| 86 run_loop.QuitClosure())); | 86 run_loop.QuitClosure())); |
| 87 if (connect_result_ != OK && connect_result_ != ERR_IO_PENDING) | 87 if (connect_result_ != OK && connect_result_ != ERR_IO_PENDING) |
| 88 return connect_result_; | 88 return connect_result_; |
| 89 | 89 |
| 90 if (!RunLoopWithTimeout(&run_loop)) | 90 if (!RunLoopWithTimeout(&run_loop)) |
| 91 return ERR_TIMED_OUT; | 91 return ERR_TIMED_OUT; |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); | 648 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); |
| 649 client.Send("GET / HTTP/1.1\r\n\r\n"); | 649 client.Send("GET / HTTP/1.1\r\n\r\n"); |
| 650 ASSERT_FALSE(RunUntilRequestsReceived(1)); | 650 ASSERT_FALSE(RunUntilRequestsReceived(1)); |
| 651 ASSERT_EQ(1ul, connection_ids_.size()); | 651 ASSERT_EQ(1ul, connection_ids_.size()); |
| 652 ASSERT_EQ(0ul, requests_.size()); | 652 ASSERT_EQ(0ul, requests_.size()); |
| 653 } | 653 } |
| 654 | 654 |
| 655 } // namespace | 655 } // namespace |
| 656 | 656 |
| 657 } // namespace net | 657 } // namespace net |
| OLD | NEW |