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

Side by Side Diff: remoting/protocol/fake_session.cc

Issue 227473008: make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux typo Created 6 years, 8 months 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) 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 "remoting/protocol/fake_session.h" 5 #include "remoting/protocol/fake_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "net/base/address_list.h" 9 #include "net/base/address_list.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 if (peer_socket_.get()) { 130 if (peer_socket_.get()) {
131 message_loop_->PostTask( 131 message_loop_->PostTask(
132 FROM_HERE, 132 FROM_HERE,
133 base::Bind(&FakeSocket::AppendInputData, 133 base::Bind(&FakeSocket::AppendInputData,
134 peer_socket_, 134 peer_socket_,
135 std::vector<char>(buf->data(), buf->data() + buf_len))); 135 std::vector<char>(buf->data(), buf->data() + buf_len)));
136 } 136 }
137 } 137 }
138 138
139 bool FakeSocket::SetReceiveBufferSize(int32 size) { 139 int FakeSocket::SetReceiveBufferSize(int32 size) {
140 NOTIMPLEMENTED(); 140 NOTIMPLEMENTED();
141 return false; 141 return net::ERR_NOT_IMPLEMENTED;
142 } 142 }
143 bool FakeSocket::SetSendBufferSize(int32 size) { 143
144 int FakeSocket::SetSendBufferSize(int32 size) {
144 NOTIMPLEMENTED(); 145 NOTIMPLEMENTED();
145 return false; 146 return net::ERR_NOT_IMPLEMENTED;
146 } 147 }
147 148
148 int FakeSocket::Connect(const net::CompletionCallback& callback) { 149 int FakeSocket::Connect(const net::CompletionCallback& callback) {
149 EXPECT_EQ(message_loop_, base::MessageLoop::current()); 150 EXPECT_EQ(message_loop_, base::MessageLoop::current());
150 return net::OK; 151 return net::OK;
151 } 152 }
152 153
153 void FakeSocket::Disconnect() { 154 void FakeSocket::Disconnect() {
154 peer_socket_.reset(); 155 peer_socket_.reset();
155 } 156 }
156 157
157 bool FakeSocket::IsConnected() const { 158 bool FakeSocket::IsConnected() const {
158 EXPECT_EQ(message_loop_, base::MessageLoop::current()); 159 EXPECT_EQ(message_loop_, base::MessageLoop::current());
159 return true; 160 return true;
160 } 161 }
161 162
162 bool FakeSocket::IsConnectedAndIdle() const { 163 bool FakeSocket::IsConnectedAndIdle() const {
163 NOTIMPLEMENTED(); 164 NOTIMPLEMENTED();
164 return false; 165 return false;
165 } 166 }
166 167
167 int FakeSocket::GetPeerAddress(net::IPEndPoint* address) const { 168 int FakeSocket::GetPeerAddress(net::IPEndPoint* address) const {
168 net::IPAddressNumber ip(net::kIPv4AddressSize); 169 net::IPAddressNumber ip(net::kIPv4AddressSize);
169 *address = net::IPEndPoint(ip, 0); 170 *address = net::IPEndPoint(ip, 0);
170 return net::OK; 171 return net::OK;
171 } 172 }
172 173
173 int FakeSocket::GetLocalAddress(net::IPEndPoint* address) const { 174 int FakeSocket::GetLocalAddress(net::IPEndPoint* address) const {
174 NOTIMPLEMENTED(); 175 NOTIMPLEMENTED();
175 return net::ERR_FAILED; 176 return net::ERR_NOT_IMPLEMENTED;
176 } 177 }
177 178
178 const net::BoundNetLog& FakeSocket::NetLog() const { 179 const net::BoundNetLog& FakeSocket::NetLog() const {
179 EXPECT_EQ(message_loop_, base::MessageLoop::current()); 180 EXPECT_EQ(message_loop_, base::MessageLoop::current());
180 return net_log_; 181 return net_log_;
181 } 182 }
182 183
183 void FakeSocket::SetSubresourceSpeculation() { 184 void FakeSocket::SetSubresourceSpeculation() {
184 NOTIMPLEMENTED(); 185 NOTIMPLEMENTED();
185 } 186 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 257 }
257 258
258 int FakeUdpSocket::Write(net::IOBuffer* buf, int buf_len, 259 int FakeUdpSocket::Write(net::IOBuffer* buf, int buf_len,
259 const net::CompletionCallback& callback) { 260 const net::CompletionCallback& callback) {
260 EXPECT_EQ(message_loop_, base::MessageLoop::current()); 261 EXPECT_EQ(message_loop_, base::MessageLoop::current());
261 written_packets_.push_back(std::string()); 262 written_packets_.push_back(std::string());
262 written_packets_.back().assign(buf->data(), buf->data() + buf_len); 263 written_packets_.back().assign(buf->data(), buf->data() + buf_len);
263 return buf_len; 264 return buf_len;
264 } 265 }
265 266
266 bool FakeUdpSocket::SetReceiveBufferSize(int32 size) { 267 int FakeUdpSocket::SetReceiveBufferSize(int32 size) {
267 NOTIMPLEMENTED(); 268 NOTIMPLEMENTED();
268 return false; 269 return net::ERR_NOT_IMPLEMENTED;
269 } 270 }
270 bool FakeUdpSocket::SetSendBufferSize(int32 size) { 271
272 int FakeUdpSocket::SetSendBufferSize(int32 size) {
271 NOTIMPLEMENTED(); 273 NOTIMPLEMENTED();
272 return false; 274 return net::ERR_NOT_IMPLEMENTED;
273 } 275 }
274 276
275 FakeSession::FakeSession() 277 FakeSession::FakeSession()
276 : event_handler_(NULL), 278 : event_handler_(NULL),
277 candidate_config_(CandidateSessionConfig::CreateDefault()), 279 candidate_config_(CandidateSessionConfig::CreateDefault()),
278 config_(SessionConfig::ForTest()), 280 config_(SessionConfig::ForTest()),
279 message_loop_(base::MessageLoop::current()), 281 message_loop_(base::MessageLoop::current()),
280 async_creation_(false), 282 async_creation_(false),
281 jid_(kTestJid), 283 jid_(kTestJid),
282 error_(OK), 284 error_(OK),
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 callback.Run(scoped_ptr<net::Socket>(datagram_channels_[name])); 384 callback.Run(scoped_ptr<net::Socket>(datagram_channels_[name]));
383 } 385 }
384 386
385 void FakeSession::CancelChannelCreation(const std::string& name) { 387 void FakeSession::CancelChannelCreation(const std::string& name) {
386 stream_channels_.erase(name); 388 stream_channels_.erase(name);
387 datagram_channels_.erase(name); 389 datagram_channels_.erase(name);
388 } 390 }
389 391
390 } // namespace protocol 392 } // namespace protocol
391 } // namespace remoting 393 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698