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

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

Issue 1250403003: Fix BufferedSocketWriter not to return any results from Write(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « remoting/protocol/channel_multiplexer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/channel_multiplexer.h" 5 #include "remoting/protocol/channel_multiplexer.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 "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 host_session_.fake_channel_factory().GetFakeChannel(kMuxChannelName)-> 248 host_session_.fake_channel_factory().GetFakeChannel(kMuxChannelName)->
249 set_next_write_error(net::ERR_FAILED); 249 set_next_write_error(net::ERR_FAILED);
250 host_session_.fake_channel_factory().GetFakeChannel(kMuxChannelName)-> 250 host_session_.fake_channel_factory().GetFakeChannel(kMuxChannelName)->
251 set_async_write(false); 251 set_async_write(false);
252 252
253 scoped_refptr<net::IOBufferWithSize> buf = CreateTestBuffer(100); 253 scoped_refptr<net::IOBufferWithSize> buf = CreateTestBuffer(100);
254 254
255 MockSocketCallback cb1; 255 MockSocketCallback cb1;
256 MockSocketCallback cb2; 256 MockSocketCallback cb2;
257 EXPECT_CALL(cb1, OnDone(net::ERR_FAILED));
258 EXPECT_CALL(cb2, OnDone(net::ERR_FAILED));
257 259
258 EXPECT_CALL(cb1, OnDone(_)) 260 EXPECT_EQ(net::ERR_IO_PENDING,
259 .Times(0);
260 EXPECT_CALL(cb2, OnDone(_))
261 .Times(0);
262
263 EXPECT_EQ(net::ERR_FAILED,
264 host_socket1_->Write(buf.get(), 261 host_socket1_->Write(buf.get(),
265 buf->size(), 262 buf->size(),
266 base::Bind(&MockSocketCallback::OnDone, 263 base::Bind(&MockSocketCallback::OnDone,
267 base::Unretained(&cb1)))); 264 base::Unretained(&cb1))));
268 EXPECT_EQ(net::ERR_FAILED, 265 EXPECT_EQ(net::ERR_IO_PENDING,
269 host_socket2_->Write(buf.get(), 266 host_socket2_->Write(buf.get(),
270 buf->size(), 267 buf->size(),
271 base::Bind(&MockSocketCallback::OnDone, 268 base::Bind(&MockSocketCallback::OnDone,
272 base::Unretained(&cb2)))); 269 base::Unretained(&cb2))));
273 270
274 base::RunLoop().RunUntilIdle(); 271 base::RunLoop().RunUntilIdle();
275 } 272 }
276 273
277 TEST_F(ChannelMultiplexerTest, WriteFailAsync) { 274 TEST_F(ChannelMultiplexerTest, WriteFailAsync) {
278 ASSERT_NO_FATAL_FAILURE( 275 ASSERT_NO_FATAL_FAILURE(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 .WillOnce(InvokeWithoutArgs( 365 .WillOnce(InvokeWithoutArgs(
369 this, &ChannelMultiplexerTest::DeleteAfterSessionFail)); 366 this, &ChannelMultiplexerTest::DeleteAfterSessionFail));
370 EXPECT_CALL(cb2, OnConnectedPtr(_)) 367 EXPECT_CALL(cb2, OnConnectedPtr(_))
371 .Times(0); 368 .Times(0);
372 369
373 base::RunLoop().RunUntilIdle(); 370 base::RunLoop().RunUntilIdle();
374 } 371 }
375 372
376 } // namespace protocol 373 } // namespace protocol
377 } // namespace remoting 374 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/channel_multiplexer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698