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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 AddressList addr; | 111 AddressList addr; |
112 // MockHostResolver resolves everything to 127.0.0.1. | 112 // MockHostResolver resolves everything to 127.0.0.1. |
113 scoped_ptr<HostResolver> resolver(new MockHostResolver()); | 113 scoped_ptr<HostResolver> resolver(new MockHostResolver()); |
114 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); | 114 HostResolver::RequestInfo info(HostPortPair("localhost", listen_port_)); |
115 TestCompletionCallback callback; | 115 TestCompletionCallback callback; |
116 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, &addr, callback.callback(), | 116 int rv = resolver->Resolve(info, DEFAULT_PRIORITY, &addr, callback.callback(), |
117 NULL, BoundNetLog()); | 117 NULL, BoundNetLog()); |
118 CHECK_EQ(ERR_IO_PENDING, rv); | 118 CHECK_EQ(ERR_IO_PENDING, rv); |
119 rv = callback.WaitForResult(); | 119 rv = callback.WaitForResult(); |
120 CHECK_EQ(rv, OK); | 120 CHECK_EQ(rv, OK); |
121 sock_ = socket_factory_->CreateTransportClientSocket(addr, &net_log_, | 121 sock_ = socket_factory_->CreateTransportClientSocket(addr, NULL, &net_log_, |
122 NetLog::Source()); | 122 NetLog::Source()); |
123 } | 123 } |
124 | 124 |
125 int TransportClientSocketTest::DrainClientSocket( | 125 int TransportClientSocketTest::DrainClientSocket( |
126 IOBuffer* buf, | 126 IOBuffer* buf, |
127 uint32_t buf_len, | 127 uint32_t buf_len, |
128 uint32_t bytes_to_read, | 128 uint32_t bytes_to_read, |
129 TestCompletionCallback* callback) { | 129 TestCompletionCallback* callback) { |
130 int rv = OK; | 130 int rv = OK; |
131 uint32_t bytes_read = 0; | 131 uint32_t bytes_read = 0; |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 // It's possible the read is blocked because it's already read all the data. | 464 // It's possible the read is blocked because it's already read all the data. |
465 // Close the server socket, so there will at least be a 0-byte read. | 465 // Close the server socket, so there will at least be a 0-byte read. |
466 CloseServerSocket(); | 466 CloseServerSocket(); |
467 | 467 |
468 rv = callback.WaitForResult(); | 468 rv = callback.WaitForResult(); |
469 EXPECT_GE(rv, 0); | 469 EXPECT_GE(rv, 0); |
470 } | 470 } |
471 | 471 |
472 } // namespace net | 472 } // namespace net |
OLD | NEW |