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

Side by Side Diff: remoting/host/client_session_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
« no previous file with comments | « remoting/host/chromoting_host_unittest.cc ('k') | remoting/host/clipboard_x11.cc » ('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) 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "media/video/capture/screen/screen_capturer_fake.h" 6 #include "media/video/capture/screen/screen_capturer_fake.h"
7 #include "media/video/capture/screen/screen_capturer_mock_objects.h" 7 #include "media/video/capture/screen/screen_capturer_mock_objects.h"
8 #include "remoting/base/auto_thread_task_runner.h" 8 #include "remoting/base/auto_thread_task_runner.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/host/audio_capturer.h" 10 #include "remoting/host/audio_capturer.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Notifies the client session that the client connection has been 83 // Notifies the client session that the client connection has been
84 // authenticated and channels have been connected. This effectively enables 84 // authenticated and channels have been connected. This effectively enables
85 // the input pipe line and starts video capturing. 85 // the input pipe line and starts video capturing.
86 void ConnectClientSession(); 86 void ConnectClientSession();
87 87
88 // Invoked when the last reference to the AutoThreadTaskRunner has been 88 // Invoked when the last reference to the AutoThreadTaskRunner has been
89 // released and quits the message loop to finish the test. 89 // released and quits the message loop to finish the test.
90 void QuitMainMessageLoop(); 90 void QuitMainMessageLoop();
91 91
92 // Message loop passed to |client_session_| to perform all functions on. 92 // Message loop passed to |client_session_| to perform all functions on.
93 MessageLoop message_loop_; 93 base::MessageLoop message_loop_;
94 94
95 // ClientSession instance under test. 95 // ClientSession instance under test.
96 scoped_ptr<ClientSession> client_session_; 96 scoped_ptr<ClientSession> client_session_;
97 97
98 // ClientSession::EventHandler mock for use in tests. 98 // ClientSession::EventHandler mock for use in tests.
99 MockClientSessionEventHandler session_event_handler_; 99 MockClientSessionEventHandler session_event_handler_;
100 100
101 // Storage for values to be returned by the protocol::Session mock. 101 // Storage for values to be returned by the protocol::Session mock.
102 SessionConfig session_config_; 102 SessionConfig session_config_;
103 const std::string client_jid_; 103 const std::string client_jid_;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 media::ScreenCapturer* ClientSessionTest::CreateVideoCapturer() { 210 media::ScreenCapturer* ClientSessionTest::CreateVideoCapturer() {
211 return new media::ScreenCapturerFake(); 211 return new media::ScreenCapturerFake();
212 } 212 }
213 213
214 void ClientSessionTest::ConnectClientSession() { 214 void ClientSessionTest::ConnectClientSession() {
215 client_session_->OnConnectionAuthenticated(client_session_->connection()); 215 client_session_->OnConnectionAuthenticated(client_session_->connection());
216 client_session_->OnConnectionChannelsConnected(client_session_->connection()); 216 client_session_->OnConnectionChannelsConnected(client_session_->connection());
217 } 217 }
218 218
219 void ClientSessionTest::QuitMainMessageLoop() { 219 void ClientSessionTest::QuitMainMessageLoop() {
220 message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure()); 220 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
221 } 221 }
222 222
223 MATCHER_P2(EqualsClipboardEvent, m, d, "") { 223 MATCHER_P2(EqualsClipboardEvent, m, d, "") {
224 return (strcmp(arg.mime_type().c_str(), m) == 0 && 224 return (strcmp(arg.mime_type().c_str(), m) == 0 &&
225 memcmp(arg.data().data(), d, arg.data().size()) == 0); 225 memcmp(arg.data().data(), d, arg.data().size()) == 0);
226 } 226 }
227 227
228 TEST_F(ClientSessionTest, ClipboardStubFilter) { 228 TEST_F(ClientSessionTest, ClipboardStubFilter) {
229 protocol::ClipboardEvent clipboard_event1; 229 protocol::ClipboardEvent clipboard_event1;
230 clipboard_event1.set_mime_type(kMimeTypeTextUtf8); 230 clipboard_event1.set_mime_type(kMimeTypeTextUtf8);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 .After(connected) 520 .After(connected)
521 .WillOnce(DoAll( 521 .WillOnce(DoAll(
522 InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession), 522 InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession),
523 InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); 523 InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession)));
524 524
525 ConnectClientSession(); 525 ConnectClientSession();
526 message_loop_.Run(); 526 message_loop_.Run();
527 } 527 }
528 528
529 } // namespace remoting 529 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host_unittest.cc ('k') | remoting/host/clipboard_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698