OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 base::Bind(&TransportClientSocketTest::AcceptCallback, | 113 base::Bind(&TransportClientSocketTest::AcceptCallback, |
114 base::Unretained(this))); | 114 base::Unretained(this))); |
115 | 115 |
116 AddressList addr; | 116 AddressList addr; |
117 // MockHostResolver resolves everything to 127.0.0.1. | 117 // MockHostResolver resolves everything to 127.0.0.1. |
118 std::unique_ptr<HostResolver> resolver(new MockHostResolver()); | 118 std::unique_ptr<HostResolver> resolver(new MockHostResolver()); |
119 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); | 119 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); |
120 TestCompletionCallback callback; | 120 TestCompletionCallback callback; |
121 std::unique_ptr<HostResolver::Request> request; | 121 std::unique_ptr<HostResolver::Request> request; |
122 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, &addr, callback.callback(), | 122 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, &addr, callback.callback(), |
123 &request, BoundNetLog()); | 123 &request, NetLogWithSource()); |
124 CHECK_EQ(ERR_IO_PENDING, rv); | 124 CHECK_EQ(ERR_IO_PENDING, rv); |
125 rv = callback.WaitForResult(); | 125 rv = callback.WaitForResult(); |
126 CHECK_EQ(rv, OK); | 126 CHECK_EQ(rv, OK); |
127 sock_ = socket_factory_->CreateTransportClientSocket(addr, NULL, &net_log_, | 127 sock_ = socket_factory_->CreateTransportClientSocket(addr, NULL, &net_log_, |
128 NetLog::Source()); | 128 NetLog::Source()); |
129 } | 129 } |
130 | 130 |
131 int TransportClientSocketTest::DrainClientSocket( | 131 int TransportClientSocketTest::DrainClientSocket( |
132 IOBuffer* buf, | 132 IOBuffer* buf, |
133 uint32_t buf_len, | 133 uint32_t buf_len, |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 // It's possible the read is blocked because it's already read all the data. | 471 // It's possible the read is blocked because it's already read all the data. |
472 // Close the server socket, so there will at least be a 0-byte read. | 472 // Close the server socket, so there will at least be a 0-byte read. |
473 CloseServerSocket(); | 473 CloseServerSocket(); |
474 | 474 |
475 rv = callback.WaitForResult(); | 475 rv = callback.WaitForResult(); |
476 EXPECT_GE(rv, 0); | 476 EXPECT_GE(rv, 0); |
477 } | 477 } |
478 | 478 |
479 } // namespace net | 479 } // namespace net |
OLD | NEW |