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

Side by Side Diff: jingle/glue/channel_socket_adapter_unittest.cc

Issue 14307021: jingle: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "jingle/glue/channel_socket_adapter.h" 8 #include "jingle/glue/channel_socket_adapter.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 void Callback(int result) { 57 void Callback(int result) {
58 callback_result_ = result; 58 callback_result_ = result;
59 } 59 }
60 60
61 MockTransportChannel channel_; 61 MockTransportChannel channel_;
62 scoped_ptr<TransportChannelSocketAdapter> target_; 62 scoped_ptr<TransportChannelSocketAdapter> target_;
63 net::CompletionCallback callback_; 63 net::CompletionCallback callback_;
64 int callback_result_; 64 int callback_result_;
65 MessageLoopForIO message_loop_; 65 base::MessageLoopForIO message_loop_;
66 }; 66 };
67 67
68 // Verify that Read() returns net::ERR_IO_PENDING. 68 // Verify that Read() returns net::ERR_IO_PENDING.
69 TEST_F(TransportChannelSocketAdapterTest, Read) { 69 TEST_F(TransportChannelSocketAdapterTest, Read) {
70 scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize)); 70 scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize));
71 71
72 int result = target_->Read(buffer, kBufferSize, callback_); 72 int result = target_->Read(buffer, kBufferSize, callback_);
73 ASSERT_EQ(net::ERR_IO_PENDING, result); 73 ASSERT_EQ(net::ERR_IO_PENDING, result);
74 74
75 channel_.SignalReadPacket(&channel_, kTestData, kTestDataSize, 0); 75 channel_.SignalReadPacket(&channel_, kTestData, kTestDataSize, 0);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 .WillOnce(Return(SOCKET_ERROR)); 111 .WillOnce(Return(SOCKET_ERROR));
112 112
113 EXPECT_CALL(channel_, GetError()) 113 EXPECT_CALL(channel_, GetError())
114 .WillOnce(Return(EWOULDBLOCK)); 114 .WillOnce(Return(EWOULDBLOCK));
115 115
116 int result = target_->Write(buffer, kTestDataSize, callback_); 116 int result = target_->Write(buffer, kTestDataSize, callback_);
117 ASSERT_EQ(net::OK, result); 117 ASSERT_EQ(net::OK, result);
118 } 118 }
119 119
120 } // namespace jingle_glue 120 } // namespace jingle_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698