| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 | 689 |
| 690 socket_1.Send("How do"); | 690 socket_1.Send("How do"); |
| 691 socket_1.Send("you do?"); | 691 socket_1.Send("you do?"); |
| 692 | 692 |
| 693 socket_0.WaitForMessage(2); | 693 socket_0.WaitForMessage(2); |
| 694 EXPECT_EQ("How do", socket_0.received_messages()[0]); | 694 EXPECT_EQ("How do", socket_0.received_messages()[0]); |
| 695 EXPECT_EQ("you do?", socket_0.received_messages()[1]); | 695 EXPECT_EQ("you do?", socket_0.received_messages()[1]); |
| 696 } | 696 } |
| 697 | 697 |
| 698 } // namespace mojo | 698 } // namespace mojo |
| OLD | NEW |