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

Side by Side Diff: remoting/host/chromoting_host_unittest.cc

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 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.cc ('k') | remoting/host/client_session.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "remoting/host/capturer_fake.h" 9 #include "remoting/host/capturer_fake.h"
10 #include "remoting/host/chromoting_host.h" 10 #include "remoting/host/chromoting_host.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 namespace { 44 namespace {
45 45
46 void PostQuitTask(MessageLoop* message_loop) { 46 void PostQuitTask(MessageLoop* message_loop) {
47 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 47 message_loop->PostTask(FROM_HERE, new MessageLoop::QuitTask());
48 } 48 }
49 49
50 // Run the task and delete it afterwards. This action is used to deal with 50 // Run the task and delete it afterwards. This action is used to deal with
51 // done callbacks. 51 // done callbacks.
52 ACTION(RunDoneTask) { 52 ACTION(RunDoneTask) {
53 arg1->Run(); 53 arg1.Run();
54 delete arg1;
55 } 54 }
56 55
57 ACTION_P(QuitMainMessageLoop, message_loop) { 56 ACTION_P(QuitMainMessageLoop, message_loop) {
58 PostQuitTask(message_loop); 57 PostQuitTask(message_loop);
59 } 58 }
60 59
61 void DummyDoneTask() { 60 void DummyDoneTask() {
62 } 61 }
63 62
64 } // namespace 63 } // namespace
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 connection2_ = new MockConnectionToClient( 110 connection2_ = new MockConnectionToClient(
112 &handler_, &host_stub2_, &event_executor2_); 111 &handler_, &host_stub2_, &event_executor2_);
113 session_.reset(new MockSession()); 112 session_.reset(new MockSession());
114 session2_.reset(new MockSession()); 113 session2_.reset(new MockSession());
115 session_config_ = SessionConfig::GetDefault(); 114 session_config_ = SessionConfig::GetDefault();
116 session_jid_ = "user@domain/rest-of-jid"; 115 session_jid_ = "user@domain/rest-of-jid";
117 session2_jid_ = "user2@domain/rest-of-jid"; 116 session2_jid_ = "user2@domain/rest-of-jid";
118 session_config2_ = SessionConfig::GetDefault(); 117 session_config2_ = SessionConfig::GetDefault();
119 118
120 ON_CALL(video_stub_, ProcessVideoPacket(_, _)) 119 ON_CALL(video_stub_, ProcessVideoPacket(_, _))
121 .WillByDefault( 120 .WillByDefault(DeleteArg<0>());
122 DoAll(DeleteArg<0>(), DeleteArg<1>()));
123 ON_CALL(video_stub2_, ProcessVideoPacket(_, _)) 121 ON_CALL(video_stub2_, ProcessVideoPacket(_, _))
124 .WillByDefault( 122 .WillByDefault(DeleteArg<0>());
125 DoAll(DeleteArg<0>(), DeleteArg<1>()));
126 ON_CALL(*connection_.get(), video_stub()) 123 ON_CALL(*connection_.get(), video_stub())
127 .WillByDefault(Return(&video_stub_)); 124 .WillByDefault(Return(&video_stub_));
128 ON_CALL(*connection_.get(), client_stub()) 125 ON_CALL(*connection_.get(), client_stub())
129 .WillByDefault(Return(&client_stub_)); 126 .WillByDefault(Return(&client_stub_));
130 ON_CALL(*connection_.get(), session()) 127 ON_CALL(*connection_.get(), session())
131 .WillByDefault(Return(session_.get())); 128 .WillByDefault(Return(session_.get()));
132 ON_CALL(*connection2_.get(), video_stub()) 129 ON_CALL(*connection2_.get(), video_stub())
133 .WillByDefault(Return(&video_stub2_)); 130 .WillByDefault(Return(&video_stub2_));
134 ON_CALL(*connection2_.get(), client_stub()) 131 ON_CALL(*connection2_.get(), client_stub())
135 .WillByDefault(Return(&client_stub2_)); 132 .WillByDefault(Return(&client_stub2_));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 181
185 context_.network_message_loop()->PostTask( 182 context_.network_message_loop()->PostTask(
186 FROM_HERE, 183 FROM_HERE,
187 NewRunnableFunction(&ChromotingHostTest::AddClientToHost, 184 NewRunnableFunction(&ChromotingHostTest::AddClientToHost,
188 host_, client)); 185 host_, client));
189 context_.network_message_loop()->PostTask( 186 context_.network_message_loop()->PostTask(
190 FROM_HERE, 187 FROM_HERE,
191 NewRunnableMethod(client.get(), 188 NewRunnableMethod(client.get(),
192 &ClientSession::BeginSessionRequest, 189 &ClientSession::BeginSessionRequest,
193 &credentials_, 190 &credentials_,
194 NewRunnableFunction(&DummyDoneTask))); 191 base::Bind(&DummyDoneTask)));
195 } 192 }
196 193
197 // Helper method to remove a client connection from ChromotingHost. 194 // Helper method to remove a client connection from ChromotingHost.
198 void RemoveClientConnection() { 195 void RemoveClientConnection() {
199 context_.network_message_loop()->PostTask( 196 context_.network_message_loop()->PostTask(
200 FROM_HERE, 197 FROM_HERE,
201 NewRunnableMethod(host_.get(), 198 NewRunnableMethod(host_.get(),
202 &ChromotingHost::OnClientDisconnected, 199 &ChromotingHost::OnClientDisconnected,
203 connection_)); 200 connection_));
204 } 201 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 .InSequence(s1, s2); 491 .InSequence(s1, s2);
495 EXPECT_CALL(*connection_.get(), Disconnect()) 492 EXPECT_CALL(*connection_.get(), Disconnect())
496 .InSequence(s1, s2) 493 .InSequence(s1, s2)
497 .RetiresOnSaturation(); 494 .RetiresOnSaturation();
498 } 495 }
499 SimulateClientConnection(0, true); 496 SimulateClientConnection(0, true);
500 message_loop_.Run(); 497 message_loop_.Run();
501 host_->set_it2me(false); 498 host_->set_it2me(false);
502 EXPECT_THAT(curtain_activated, false); 499 EXPECT_THAT(curtain_activated, false);
503 } 500 }
501
504 } // namespace remoting 502 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698