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: remoting/protocol/message_reader_unittest.cc

Issue 14314026: remoting: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 buffer->CopyTo(const_cast<char*>(result.data()), result.size()); 91 buffer->CopyTo(const_cast<char*>(result.data()), result.size());
92 return result == expected; 92 return result == expected;
93 } 93 }
94 94
95 void OnMessage(scoped_ptr<CompoundBuffer> buffer, 95 void OnMessage(scoped_ptr<CompoundBuffer> buffer,
96 const base::Closure& done_callback) { 96 const base::Closure& done_callback) {
97 messages_.push_back(buffer.release()); 97 messages_.push_back(buffer.release());
98 callback_.OnMessage(done_callback); 98 callback_.OnMessage(done_callback);
99 } 99 }
100 100
101 MessageLoop message_loop_; 101 base::MessageLoop message_loop_;
102 scoped_ptr<MessageReader> reader_; 102 scoped_ptr<MessageReader> reader_;
103 FakeSocket socket_; 103 FakeSocket socket_;
104 MockMessageReceivedCallback callback_; 104 MockMessageReceivedCallback callback_;
105 std::vector<CompoundBuffer*> messages_; 105 std::vector<CompoundBuffer*> messages_;
106 bool in_callback_; 106 bool in_callback_;
107 }; 107 };
108 108
109 // Receive one message and process it with delay 109 // Receive one message and process it with delay
110 TEST_F(MessageReaderTest, OneMessage_Delay) { 110 TEST_F(MessageReaderTest, OneMessage_Delay) {
111 base::Closure done_task; 111 base::Closure done_task;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 EXPECT_CALL(callback_, OnMessage(_)) 317 EXPECT_CALL(callback_, OnMessage(_))
318 .Times(1) 318 .Times(1)
319 .WillOnce(Invoke(this, &MessageReaderTest::DeleteReader)); 319 .WillOnce(Invoke(this, &MessageReaderTest::DeleteReader));
320 320
321 InitReader(); 321 InitReader();
322 message_loop_.RunUntilIdle(); 322 message_loop_.RunUntilIdle();
323 } 323 }
324 324
325 } // namespace protocol 325 } // namespace protocol
326 } // namespace remoting 326 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session_unittest.cc ('k') | remoting/protocol/ssl_hmac_channel_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698