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