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

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

Issue 9646013: Add the plumbing that will carry a clipboard item from a chromoting client to a host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor InputStub, ClipboardStub, and HostEventStub. Created 8 years, 9 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/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 "remoting/jingle_glue/mock_objects.h" 8 #include "remoting/jingle_glue/mock_objects.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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 EXPECT_CALL(context_, network_message_loop()) 86 EXPECT_CALL(context_, network_message_loop())
87 .Times(AnyNumber()); 87 .Times(AnyNumber());
88 EXPECT_CALL(context_, ui_message_loop()) 88 EXPECT_CALL(context_, ui_message_loop())
89 .Times(AnyNumber()); 89 .Times(AnyNumber());
90 90
91 scoped_ptr<Capturer> capturer(new CapturerFake()); 91 scoped_ptr<Capturer> capturer(new CapturerFake());
92 event_executor_ = new MockEventExecutor(); 92 event_executor_ = new MockEventExecutor();
93 desktop_environment_ = DesktopEnvironment::CreateFake( 93 desktop_environment_ = DesktopEnvironment::CreateFake(
94 &context_, 94 &context_,
95 capturer.Pass(), 95 capturer.Pass(),
96 scoped_ptr<protocol::InputStub>(event_executor_)); 96 scoped_ptr<protocol::HostEventStub>(event_executor_));
97 97
98 host_ = new ChromotingHost( 98 host_ = new ChromotingHost(
99 &context_, &signal_strategy_, desktop_environment_.get(), 99 &context_, &signal_strategy_, desktop_environment_.get(),
100 protocol::NetworkSettings()); 100 protocol::NetworkSettings());
101 101
102 disconnect_window_ = new MockDisconnectWindow(); 102 disconnect_window_ = new MockDisconnectWindow();
103 continue_window_ = new MockContinueWindow(); 103 continue_window_ = new MockContinueWindow();
104 local_input_monitor_ = new MockLocalInputMonitor(); 104 local_input_monitor_ = new MockLocalInputMonitor();
105 it2me_host_user_interface_.reset(new It2MeHostUserInterface(host_, 105 it2me_host_user_interface_.reset(new It2MeHostUserInterface(host_,
106 &context_)); 106 &context_));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Run message loop before destroying because protocol::Session is 174 // Run message loop before destroying because protocol::Session is
175 // destroyed asynchronously. 175 // destroyed asynchronously.
176 message_loop_.RunAllPending(); 176 message_loop_.RunAllPending();
177 } 177 }
178 178
179 // Helper method to pretend a client is connected to ChromotingHost. 179 // Helper method to pretend a client is connected to ChromotingHost.
180 void SimulateClientConnection(int connection_index, bool authenticate) { 180 void SimulateClientConnection(int connection_index, bool authenticate) {
181 protocol::ConnectionToClient* connection = (connection_index == 0) ? 181 protocol::ConnectionToClient* connection = (connection_index == 0) ?
182 owned_connection_.release() : owned_connection2_.release(); 182 owned_connection_.release() : owned_connection2_.release();
183 ClientSession* client = new ClientSession( 183 ClientSession* client = new ClientSession(
184 host_.get(), connection, event_executor_, 184 host_.get(), connection, event_executor_, event_executor_,
185 desktop_environment_->capturer()); 185 desktop_environment_->capturer());
186 connection->set_host_stub(client); 186 connection->set_host_stub(client);
187 187
188 context_.network_message_loop()->PostTask( 188 context_.network_message_loop()->PostTask(
189 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost, 189 FROM_HERE, base::Bind(&ChromotingHostTest::AddClientToHost,
190 host_, client)); 190 host_, client));
191 if (authenticate) { 191 if (authenticate) {
192 context_.network_message_loop()->PostTask( 192 context_.network_message_loop()->PostTask(
193 FROM_HERE, base::Bind(&ClientSession::OnConnectionOpened, 193 FROM_HERE, base::Bind(&ClientSession::OnConnectionOpened,
194 base::Unretained(client), connection)); 194 base::Unretained(client), connection));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 EXPECT_CALL(*connection_, Disconnect()) 369 EXPECT_CALL(*connection_, Disconnect())
370 .RetiresOnSaturation(); 370 .RetiresOnSaturation();
371 EXPECT_CALL(*connection2_, Disconnect()) 371 EXPECT_CALL(*connection2_, Disconnect())
372 .RetiresOnSaturation(); 372 .RetiresOnSaturation();
373 373
374 SimulateClientConnection(0, true); 374 SimulateClientConnection(0, true);
375 message_loop_.Run(); 375 message_loop_.Run();
376 } 376 }
377 377
378 } // namespace remoting 378 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698