OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 class TestHttpClient { | 166 class TestHttpClient { |
167 public: | 167 public: |
168 TestHttpClient() : connect_result_(net::OK) {} | 168 TestHttpClient() : connect_result_(net::OK) {} |
169 | 169 |
170 void Connect(const net::IPEndPoint& address) { | 170 void Connect(const net::IPEndPoint& address) { |
171 net::AddressList addresses(address); | 171 net::AddressList addresses(address); |
172 net::NetLog::Source source; | 172 net::NetLog::Source source; |
173 socket_.reset(new net::TCPClientSocket(addresses, NULL, source)); | 173 socket_.reset(new net::TCPClientSocket(addresses, NULL, NULL, source)); |
174 | 174 |
175 base::RunLoop run_loop; | 175 base::RunLoop run_loop; |
176 connect_result_ = socket_->Connect(base::Bind(&TestHttpClient::OnConnect, | 176 connect_result_ = socket_->Connect(base::Bind(&TestHttpClient::OnConnect, |
177 base::Unretained(this), | 177 base::Unretained(this), |
178 run_loop.QuitClosure())); | 178 run_loop.QuitClosure())); |
179 if (connect_result_ == net::ERR_IO_PENDING) | 179 if (connect_result_ == net::ERR_IO_PENDING) |
180 run_loop.Run(); | 180 run_loop.Run(); |
181 | 181 |
182 ASSERT_EQ(net::OK, connect_result_); | 182 ASSERT_EQ(net::OK, connect_result_); |
183 } | 183 } |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 | 692 |
693 socket_1.Send("How do"); | 693 socket_1.Send("How do"); |
694 socket_1.Send("you do?"); | 694 socket_1.Send("you do?"); |
695 | 695 |
696 socket_0.WaitForMessage(2); | 696 socket_0.WaitForMessage(2); |
697 EXPECT_EQ("How do", socket_0.received_messages()[0]); | 697 EXPECT_EQ("How do", socket_0.received_messages()[0]); |
698 EXPECT_EQ("you do?", socket_0.received_messages()[1]); | 698 EXPECT_EQ("you do?", socket_0.received_messages()[1]); |
699 } | 699 } |
700 | 700 |
701 } // namespace mojo | 701 } // namespace mojo |
OLD | NEW |