Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: net/socket/transport_client_socket_pool_unittest.cc

Issue 8801005: base::Bind: Convert Socket::Read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/socket/transport_client_socket_pool.h" 5 #include "net/socket/transport_client_socket_pool.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 virtual void SetSubresourceSpeculation() {} 88 virtual void SetSubresourceSpeculation() {}
89 virtual void SetOmniboxSpeculation() {} 89 virtual void SetOmniboxSpeculation() {}
90 virtual bool WasEverUsed() const { return false; } 90 virtual bool WasEverUsed() const { return false; }
91 virtual bool UsingTCPFastOpen() const { return false; } 91 virtual bool UsingTCPFastOpen() const { return false; }
92 virtual int64 NumBytesRead() const { return -1; } 92 virtual int64 NumBytesRead() const { return -1; }
93 virtual base::TimeDelta GetConnectTimeMicros() const { 93 virtual base::TimeDelta GetConnectTimeMicros() const {
94 return base::TimeDelta::FromMicroseconds(-1); 94 return base::TimeDelta::FromMicroseconds(-1);
95 } 95 }
96 96
97 // Socket methods: 97 // Socket implementation.
98 virtual int Read(IOBuffer* buf, int buf_len, 98 virtual int Read(IOBuffer* buf, int buf_len,
99 OldCompletionCallback* callback) { 99 OldCompletionCallback* callback) {
100 return ERR_FAILED; 100 return ERR_FAILED;
101 } 101 }
102 virtual int Read(IOBuffer* buf, int buf_len,
103 const CompletionCallback& callback) {
104 return ERR_FAILED;
105 }
102 virtual int Write(IOBuffer* buf, int buf_len, 106 virtual int Write(IOBuffer* buf, int buf_len,
103 OldCompletionCallback* callback) { 107 OldCompletionCallback* callback) {
104 return ERR_FAILED; 108 return ERR_FAILED;
105 } 109 }
106 virtual bool SetReceiveBufferSize(int32 size) { return true; } 110 virtual bool SetReceiveBufferSize(int32 size) { return true; }
107 virtual bool SetSendBufferSize(int32 size) { return true; } 111 virtual bool SetSendBufferSize(int32 size) { return true; }
108 112
109 private: 113 private:
110 bool connected_; 114 bool connected_;
111 const AddressList addrlist_; 115 const AddressList addrlist_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 148
145 virtual void SetSubresourceSpeculation() {} 149 virtual void SetSubresourceSpeculation() {}
146 virtual void SetOmniboxSpeculation() {} 150 virtual void SetOmniboxSpeculation() {}
147 virtual bool WasEverUsed() const { return false; } 151 virtual bool WasEverUsed() const { return false; }
148 virtual bool UsingTCPFastOpen() const { return false; } 152 virtual bool UsingTCPFastOpen() const { return false; }
149 virtual int64 NumBytesRead() const { return -1; } 153 virtual int64 NumBytesRead() const { return -1; }
150 virtual base::TimeDelta GetConnectTimeMicros() const { 154 virtual base::TimeDelta GetConnectTimeMicros() const {
151 return base::TimeDelta::FromMicroseconds(-1); 155 return base::TimeDelta::FromMicroseconds(-1);
152 } 156 }
153 157
154 // Socket methods: 158 // Socket implementation.
155 virtual int Read(IOBuffer* buf, int buf_len, 159 virtual int Read(IOBuffer* buf, int buf_len,
156 OldCompletionCallback* callback) { 160 OldCompletionCallback* callback) {
157 return ERR_FAILED; 161 return ERR_FAILED;
158 } 162 }
163 virtual int Read(IOBuffer* buf, int buf_len,
164 const CompletionCallback& callback) {
165 return ERR_FAILED;
166 }
159 167
160 virtual int Write(IOBuffer* buf, int buf_len, 168 virtual int Write(IOBuffer* buf, int buf_len,
161 OldCompletionCallback* callback) { 169 OldCompletionCallback* callback) {
162 return ERR_FAILED; 170 return ERR_FAILED;
163 } 171 }
164 virtual bool SetReceiveBufferSize(int32 size) { return true; } 172 virtual bool SetReceiveBufferSize(int32 size) { return true; }
165 virtual bool SetSendBufferSize(int32 size) { return true; } 173 virtual bool SetSendBufferSize(int32 size) { return true; }
166 174
167 private: 175 private:
168 const AddressList addrlist_; 176 const AddressList addrlist_;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 239
232 virtual void SetSubresourceSpeculation() {} 240 virtual void SetSubresourceSpeculation() {}
233 virtual void SetOmniboxSpeculation() {} 241 virtual void SetOmniboxSpeculation() {}
234 virtual bool WasEverUsed() const { return false; } 242 virtual bool WasEverUsed() const { return false; }
235 virtual bool UsingTCPFastOpen() const { return false; } 243 virtual bool UsingTCPFastOpen() const { return false; }
236 virtual int64 NumBytesRead() const { return -1; } 244 virtual int64 NumBytesRead() const { return -1; }
237 virtual base::TimeDelta GetConnectTimeMicros() const { 245 virtual base::TimeDelta GetConnectTimeMicros() const {
238 return base::TimeDelta::FromMicroseconds(-1); 246 return base::TimeDelta::FromMicroseconds(-1);
239 } 247 }
240 248
241 // Socket methods: 249 // Socket implementation.
242 virtual int Read(IOBuffer* buf, int buf_len, 250 virtual int Read(IOBuffer* buf, int buf_len,
243 OldCompletionCallback* callback) { 251 OldCompletionCallback* callback) {
244 return ERR_FAILED; 252 return ERR_FAILED;
245 } 253 }
254 virtual int Read(IOBuffer* buf, int buf_len,
255 const CompletionCallback& callback) {
256 return ERR_FAILED;
257 }
246 258
247 virtual int Write(IOBuffer* buf, int buf_len, 259 virtual int Write(IOBuffer* buf, int buf_len,
248 OldCompletionCallback* callback) { 260 OldCompletionCallback* callback) {
249 return ERR_FAILED; 261 return ERR_FAILED;
250 } 262 }
251 virtual bool SetReceiveBufferSize(int32 size) { return true; } 263 virtual bool SetReceiveBufferSize(int32 size) { return true; }
252 virtual bool SetSendBufferSize(int32 size) { return true; } 264 virtual bool SetSendBufferSize(int32 size) { return true; }
253 265
254 private: 266 private:
255 void DoOldCallback(OldCompletionCallback* callback) { 267 void DoOldCallback(OldCompletionCallback* callback) {
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 EXPECT_TRUE(handle.socket()); 1267 EXPECT_TRUE(handle.socket());
1256 IPEndPoint endpoint; 1268 IPEndPoint endpoint;
1257 handle.socket()->GetLocalAddress(&endpoint); 1269 handle.socket()->GetLocalAddress(&endpoint);
1258 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size()); 1270 EXPECT_EQ(kIPv4AddressSize, endpoint.address().size());
1259 EXPECT_EQ(1, client_socket_factory_.allocation_count()); 1271 EXPECT_EQ(1, client_socket_factory_.allocation_count());
1260 } 1272 }
1261 1273
1262 } // namespace 1274 } // namespace
1263 1275
1264 } // namespace net 1276 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698