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