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

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

Issue 7633009: Use MessageLoopProxy for network message loop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/message_reader.cc ('k') | remoting/protocol/protobuf_video_writer.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/message_loop.h"
8 #include "net/socket/socket.h" 7 #include "net/socket/socket.h"
9 #include "remoting/protocol/fake_session.h" 8 #include "remoting/protocol/fake_session.h"
10 #include "remoting/protocol/message_reader.h" 9 #include "remoting/protocol/message_reader.h"
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
13 #include "third_party/libjingle/source/talk/base/byteorder.h" 12 #include "third_party/libjingle/source/talk/base/byteorder.h"
14 13
15 using testing::_; 14 using testing::_;
16 using testing::DoAll; 15 using testing::DoAll;
17 using testing::Mock; 16 using testing::Mock;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 std::string result(buffer->total_bytes(), ' '); 56 std::string result(buffer->total_bytes(), ' ');
58 buffer->CopyTo(const_cast<char*>(result.data()), result.size()); 57 buffer->CopyTo(const_cast<char*>(result.data()), result.size());
59 return result == expected; 58 return result == expected;
60 } 59 }
61 60
62 void RunAndDeleteTask(Task* task) { 61 void RunAndDeleteTask(Task* task) {
63 task->Run(); 62 task->Run();
64 delete task; 63 delete task;
65 } 64 }
66 65
67 // MessageLoop must be first here, so that is is destroyed the last.
68 MessageLoop message_loop_;
69
70 scoped_refptr<MessageReader> reader_; 66 scoped_refptr<MessageReader> reader_;
71 FakeSocket socket_; 67 FakeSocket socket_;
72 MockMessageReceivedCallback callback_; 68 MockMessageReceivedCallback callback_;
73 }; 69 };
74 70
75 // Receive one message and process it with delay 71 // Receive one message and process it with delay
76 TEST_F(MessageReaderTest, OneMessage_Delay) { 72 TEST_F(MessageReaderTest, OneMessage_Delay) {
77 CompoundBuffer* buffer; 73 CompoundBuffer* buffer;
78 Task* done_task; 74 Task* done_task;
79 75
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // finished processing the previous message. 234 // finished processing the previous message.
239 EXPECT_FALSE(socket_.read_pending()); 235 EXPECT_FALSE(socket_.read_pending());
240 236
241 RunAndDeleteTask(done_task); 237 RunAndDeleteTask(done_task);
242 238
243 EXPECT_TRUE(socket_.read_pending()); 239 EXPECT_TRUE(socket_.read_pending());
244 } 240 }
245 241
246 } // namespace protocol 242 } // namespace protocol
247 } // namespace remoting 243 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/message_reader.cc ('k') | remoting/protocol/protobuf_video_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698