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

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

Issue 10916263: [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to ClientSession. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 3 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/client_session.cc ('k') | remoting/host/desktop_environment.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) 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 "remoting/base/auto_thread_task_runner.h"
6 #include "remoting/base/constants.h" 7 #include "remoting/base/constants.h"
8 #include "remoting/host/audio_capturer.h"
7 #include "remoting/host/client_session.h" 9 #include "remoting/host/client_session.h"
10 #include "remoting/host/desktop_environment.h"
8 #include "remoting/host/host_mock_objects.h" 11 #include "remoting/host/host_mock_objects.h"
9 #include "remoting/protocol/protocol_mock_objects.h" 12 #include "remoting/protocol/protocol_mock_objects.h"
10 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
11 14
12 namespace remoting { 15 namespace remoting {
13 16
14 using protocol::MockClipboardStub; 17 using protocol::MockClipboardStub;
15 using protocol::MockConnectionToClient; 18 using protocol::MockConnectionToClient;
16 using protocol::MockConnectionToClientEventHandler; 19 using protocol::MockConnectionToClientEventHandler;
17 using protocol::MockHostStub; 20 using protocol::MockHostStub;
18 using protocol::MockInputStub; 21 using protocol::MockInputStub;
19 using protocol::MockSession; 22 using protocol::MockSession;
23 using protocol::SessionConfig;
20 24
21 using testing::_; 25 using testing::_;
26 using testing::AnyNumber;
22 using testing::DeleteArg; 27 using testing::DeleteArg;
28 using testing::Expectation;
23 using testing::InSequence; 29 using testing::InSequence;
24 using testing::Return; 30 using testing::Return;
25 using testing::ReturnRef; 31 using testing::ReturnRef;
26 32
27 class ClientSessionTest : public testing::Test { 33 class ClientSessionTest : public testing::Test {
28 public: 34 public:
29 ClientSessionTest() {} 35 ClientSessionTest() {}
30 36
31 virtual void SetUp() OVERRIDE { 37 virtual void SetUp() OVERRIDE {
38 ui_task_runner_ = new AutoThreadTaskRunner(
39 message_loop_.message_loop_proxy(),
40 base::Bind(&ClientSessionTest::QuitMainMessageLoop,
41 base::Unretained(this)));
42
43 EXPECT_CALL(context_, ui_task_runner())
44 .Times(AnyNumber())
45 .WillRepeatedly(Return(ui_task_runner_.get()));
46 EXPECT_CALL(context_, capture_task_runner())
47 .Times(AnyNumber())
48 .WillRepeatedly(Return(ui_task_runner_.get()));
49 EXPECT_CALL(context_, encode_task_runner())
50 .Times(AnyNumber())
51 .WillRepeatedly(Return(ui_task_runner_.get()));
52 EXPECT_CALL(context_, network_task_runner())
53 .Times(AnyNumber())
54 .WillRepeatedly(Return(ui_task_runner_.get()));
55
32 client_jid_ = "user@domain/rest-of-jid"; 56 client_jid_ = "user@domain/rest-of-jid";
33 57
58 event_executor_ = new MockEventExecutor();
59 capturer_ = new MockVideoFrameCapturer();
60 EXPECT_CALL(*capturer_, Start(_));
61 EXPECT_CALL(*capturer_, Stop());
62 EXPECT_CALL(*capturer_, InvalidateRegion(_)).Times(AnyNumber());
63 EXPECT_CALL(*capturer_, CaptureInvalidRegion(_)).Times(AnyNumber());
64
65 scoped_ptr<DesktopEnvironment> desktop_environment(new DesktopEnvironment(
66 scoped_ptr<AudioCapturer>(NULL),
67 scoped_ptr<EventExecutor>(event_executor_),
68 scoped_ptr<VideoFrameCapturer>(capturer_)));
69
34 // Set up a large default screen size that won't affect most tests. 70 // Set up a large default screen size that won't affect most tests.
35 default_screen_size_.set(1000, 1000); 71 default_screen_size_.set(1000, 1000);
36 EXPECT_CALL(capturer_, size_most_recent()) 72 EXPECT_CALL(*capturer_, size_most_recent())
37 .WillRepeatedly(ReturnRef(default_screen_size_)); 73 .WillRepeatedly(ReturnRef(default_screen_size_));
38 74
75 session_config_ = SessionConfig::GetDefault();
76
39 protocol::MockSession* session = new MockSession(); 77 protocol::MockSession* session = new MockSession();
78 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(session_config_));
40 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); 79 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_));
41 EXPECT_CALL(*session, SetEventHandler(_)); 80 EXPECT_CALL(*session, SetEventHandler(_));
42 EXPECT_CALL(*session, Close()); 81 EXPECT_CALL(*session, Close());
43 scoped_ptr<protocol::ConnectionToClient> connection( 82 scoped_ptr<protocol::ConnectionToClient> connection(
44 new protocol::ConnectionToClient(session)); 83 new protocol::ConnectionToClient(session));
45 connection_ = connection.get(); 84 connection_ = connection.get();
46 client_session_.reset(new ClientSession( 85
47 &session_event_handler_, connection.Pass(), 86 client_session_ = new ClientSession(
48 &host_clipboard_stub_, &host_input_stub_, &capturer_, 87 &session_event_handler_,
49 base::TimeDelta())); 88 context_.capture_task_runner(),
89 context_.encode_task_runner(),
90 context_.network_task_runner(),
91 connection.Pass(),
92 desktop_environment.Pass(),
93 base::TimeDelta());
50 } 94 }
51 95
52 virtual void TearDown() OVERRIDE { 96 virtual void TearDown() OVERRIDE {
53 client_session_.reset(); 97 // MockClientSessionEventHandler won't trigger StopAndDelete, so fake it.
54 // Run message loop before destroying because protocol::Session is 98 client_session_->Stop(base::Bind(
55 // destroyed asynchronously. 99 &ClientSessionTest::OnClientStopped, base::Unretained(this)));
56 message_loop_.RunAllPending(); 100
101 // Run message loop before destroying because the session is destroyed
102 // asynchronously.
103 ui_task_runner_ = NULL;
104 message_loop_.Run();
105
106 // Verify that the client session has been stopped.
107 EXPECT_TRUE(client_session_.get() == NULL);
57 } 108 }
58 109
59 protected: 110 protected:
60 void DisconnectClientSession() { 111 void DisconnectClientSession() {
61 client_session_->Disconnect(); 112 client_session_->Disconnect();
62 // MockSession won't trigger OnConnectionClosed, so fake it. 113 // MockSession won't trigger OnConnectionClosed, so fake it.
63 client_session_->OnConnectionClosed(client_session_->connection(), 114 client_session_->OnConnectionClosed(client_session_->connection(),
64 protocol::OK); 115 protocol::OK);
65 } 116 }
66 117
118 void QuitMainMessageLoop() {
119 message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure());
120 }
121
122 void OnClientStopped() {
123 client_session_ = NULL;
124 }
125
126 MessageLoop message_loop_;
127 scoped_refptr<AutoThreadTaskRunner> ui_task_runner_;
128 MockChromotingHostContext context_;
67 SkISize default_screen_size_; 129 SkISize default_screen_size_;
68 MessageLoop message_loop_;
69 std::string client_jid_; 130 std::string client_jid_;
70 MockHostStub host_stub_; 131 MockHostStub host_stub_;
71 MockClipboardStub host_clipboard_stub_; 132 MockEventExecutor* event_executor_;
72 MockInputStub host_input_stub_; 133 MockVideoFrameCapturer* capturer_;
73 MockVideoFrameCapturer capturer_;
74 MockClientSessionEventHandler session_event_handler_; 134 MockClientSessionEventHandler session_event_handler_;
75 scoped_ptr<ClientSession> client_session_; 135 scoped_refptr<ClientSession> client_session_;
136 SessionConfig session_config_;
76 137
77 // ClientSession owns |connection_| but tests need it to inject fake events. 138 // ClientSession owns |connection_| but tests need it to inject fake events.
78 protocol::ConnectionToClient* connection_; 139 protocol::ConnectionToClient* connection_;
79 }; 140 };
80 141
81 MATCHER_P2(EqualsClipboardEvent, m, d, "") { 142 MATCHER_P2(EqualsClipboardEvent, m, d, "") {
82 return (strcmp(arg.mime_type().c_str(), m) == 0 && 143 return (strcmp(arg.mime_type().c_str(), m) == 0 &&
83 memcmp(arg.data().data(), d, arg.data().size()) == 0); 144 memcmp(arg.data().data(), d, arg.data().size()) == 0);
84 } 145 }
85 146
86 TEST_F(ClientSessionTest, ClipboardStubFilter) { 147 TEST_F(ClientSessionTest, ClipboardStubFilter) {
87 protocol::ClipboardEvent clipboard_event1; 148 protocol::ClipboardEvent clipboard_event1;
88 clipboard_event1.set_mime_type(kMimeTypeTextUtf8); 149 clipboard_event1.set_mime_type(kMimeTypeTextUtf8);
89 clipboard_event1.set_data("a"); 150 clipboard_event1.set_data("a");
90 151
91 protocol::ClipboardEvent clipboard_event2; 152 protocol::ClipboardEvent clipboard_event2;
92 clipboard_event2.set_mime_type(kMimeTypeTextUtf8); 153 clipboard_event2.set_mime_type(kMimeTypeTextUtf8);
93 clipboard_event2.set_data("b"); 154 clipboard_event2.set_data("b");
94 155
95 protocol::ClipboardEvent clipboard_event3; 156 protocol::ClipboardEvent clipboard_event3;
96 clipboard_event3.set_mime_type(kMimeTypeTextUtf8); 157 clipboard_event3.set_mime_type(kMimeTypeTextUtf8);
97 clipboard_event3.set_data("c"); 158 clipboard_event3.set_data("c");
98 159
99 InSequence s; 160 InSequence s;
100 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); 161 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
162 EXPECT_CALL(*event_executor_, StartPtr(_));
101 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); 163 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
102 EXPECT_CALL(host_clipboard_stub_, InjectClipboardEvent(EqualsClipboardEvent( 164 EXPECT_CALL(*event_executor_, InjectClipboardEvent(EqualsClipboardEvent(
103 kMimeTypeTextUtf8, "b"))); 165 kMimeTypeTextUtf8, "b")));
104 EXPECT_CALL(session_event_handler_, OnSessionClosed(_)); 166 EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
167 EXPECT_CALL(*event_executor_, StopAndDeleteMock());
105 168
106 // This event should not get through to the clipboard stub, 169 // This event should not get through to the clipboard stub,
107 // because the client isn't authenticated yet. 170 // because the client isn't authenticated yet.
108 connection_->clipboard_stub()->InjectClipboardEvent(clipboard_event1); 171 connection_->clipboard_stub()->InjectClipboardEvent(clipboard_event1);
109 client_session_->OnConnectionAuthenticated(client_session_->connection()); 172 client_session_->OnConnectionAuthenticated(client_session_->connection());
110 client_session_->OnConnectionChannelsConnected(client_session_->connection()); 173 client_session_->OnConnectionChannelsConnected(client_session_->connection());
111 // This event should get through to the clipboard stub. 174 // This event should get through to the clipboard stub.
112 connection_->clipboard_stub()->InjectClipboardEvent(clipboard_event2); 175 connection_->clipboard_stub()->InjectClipboardEvent(clipboard_event2);
113 DisconnectClientSession(); 176 DisconnectClientSession();
114 // This event should not get through to the clipboard stub, 177 // This event should not get through to the clipboard stub,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 protocol::MouseEvent mouse_event2; 216 protocol::MouseEvent mouse_event2;
154 mouse_event2.set_x(200); 217 mouse_event2.set_x(200);
155 mouse_event2.set_y(201); 218 mouse_event2.set_y(201);
156 219
157 protocol::MouseEvent mouse_event3; 220 protocol::MouseEvent mouse_event3;
158 mouse_event3.set_x(300); 221 mouse_event3.set_x(300);
159 mouse_event3.set_y(301); 222 mouse_event3.set_y(301);
160 223
161 InSequence s; 224 InSequence s;
162 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); 225 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
226 EXPECT_CALL(*event_executor_, StartPtr(_));
163 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); 227 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
164 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsUsbEvent(2, true))); 228 EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, true)));
165 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsUsbEvent(2, false))); 229 EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, false)));
166 EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201))); 230 EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseEvent(200, 201)));
167 EXPECT_CALL(session_event_handler_, OnSessionClosed(_)); 231 EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
232 EXPECT_CALL(*event_executor_, StopAndDeleteMock());
168 233
169 // These events should not get through to the input stub, 234 // These events should not get through to the input stub,
170 // because the client isn't authenticated yet. 235 // because the client isn't authenticated yet.
171 connection_->input_stub()->InjectKeyEvent(key_event1); 236 connection_->input_stub()->InjectKeyEvent(key_event1);
172 connection_->input_stub()->InjectMouseEvent(mouse_event1); 237 connection_->input_stub()->InjectMouseEvent(mouse_event1);
173 client_session_->OnConnectionAuthenticated(client_session_->connection()); 238 client_session_->OnConnectionAuthenticated(client_session_->connection());
174 client_session_->OnConnectionChannelsConnected(client_session_->connection()); 239 client_session_->OnConnectionChannelsConnected(client_session_->connection());
175 // These events should get through to the input stub. 240 // These events should get through to the input stub.
176 connection_->input_stub()->InjectKeyEvent(key_event2_down); 241 connection_->input_stub()->InjectKeyEvent(key_event2_down);
177 connection_->input_stub()->InjectKeyEvent(key_event2_up); 242 connection_->input_stub()->InjectKeyEvent(key_event2_up);
(...skipping 11 matching lines...) Expand all
189 mouse_event1.set_y(101); 254 mouse_event1.set_y(101);
190 protocol::MouseEvent mouse_event2; 255 protocol::MouseEvent mouse_event2;
191 mouse_event2.set_x(200); 256 mouse_event2.set_x(200);
192 mouse_event2.set_y(201); 257 mouse_event2.set_y(201);
193 protocol::MouseEvent mouse_event3; 258 protocol::MouseEvent mouse_event3;
194 mouse_event3.set_x(300); 259 mouse_event3.set_x(300);
195 mouse_event3.set_y(301); 260 mouse_event3.set_y(301);
196 261
197 InSequence s; 262 InSequence s;
198 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); 263 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
264 EXPECT_CALL(*event_executor_, StartPtr(_));
199 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); 265 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
200 EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent(100, 101))); 266 EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseEvent(100, 101)));
201 EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201))); 267 EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseEvent(200, 201)));
202 EXPECT_CALL(session_event_handler_, OnSessionClosed(_)); 268 EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
269 EXPECT_CALL(*event_executor_, StopAndDeleteMock());
203 270
204 client_session_->OnConnectionAuthenticated(client_session_->connection()); 271 client_session_->OnConnectionAuthenticated(client_session_->connection());
205 client_session_->OnConnectionChannelsConnected(client_session_->connection()); 272 client_session_->OnConnectionChannelsConnected(client_session_->connection());
206 // This event should get through to the input stub. 273 // This event should get through to the input stub.
207 connection_->input_stub()->InjectMouseEvent(mouse_event1); 274 connection_->input_stub()->InjectMouseEvent(mouse_event1);
208 // This one should too because the local event echoes the remote one. 275 // This one should too because the local event echoes the remote one.
209 client_session_->LocalMouseMoved(SkIPoint::Make(mouse_event1.x(), 276 client_session_->LocalMouseMoved(SkIPoint::Make(mouse_event1.x(),
210 mouse_event1.y())); 277 mouse_event1.y()));
211 connection_->input_stub()->InjectMouseEvent(mouse_event2); 278 connection_->input_stub()->InjectMouseEvent(mouse_event2);
212 // This one should not. 279 // This one should not.
(...skipping 13 matching lines...) Expand all
226 protocol::KeyEvent key2; 293 protocol::KeyEvent key2;
227 key2.set_pressed(true); 294 key2.set_pressed(true);
228 key2.set_usb_keycode(2); 295 key2.set_usb_keycode(2);
229 296
230 protocol::MouseEvent mousedown; 297 protocol::MouseEvent mousedown;
231 mousedown.set_button(protocol::MouseEvent::BUTTON_LEFT); 298 mousedown.set_button(protocol::MouseEvent::BUTTON_LEFT);
232 mousedown.set_button_down(true); 299 mousedown.set_button_down(true);
233 300
234 InSequence s; 301 InSequence s;
235 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); 302 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
303 EXPECT_CALL(*event_executor_, StartPtr(_));
236 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); 304 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
237 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsUsbEvent(1, true))); 305 EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(1, true)));
238 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsUsbEvent(2, true))); 306 EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, true)));
239 EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseButtonEvent( 307 EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseButtonEvent(
240 protocol::MouseEvent::BUTTON_LEFT, true))); 308 protocol::MouseEvent::BUTTON_LEFT, true)));
241 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsUsbEvent(1, false))); 309 EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(1, false)));
242 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsUsbEvent(2, false))); 310 EXPECT_CALL(*event_executor_, InjectKeyEvent(EqualsUsbEvent(2, false)));
243 EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseButtonEvent( 311 EXPECT_CALL(*event_executor_, InjectMouseEvent(EqualsMouseButtonEvent(
244 protocol::MouseEvent::BUTTON_LEFT, false))); 312 protocol::MouseEvent::BUTTON_LEFT, false)));
245 EXPECT_CALL(session_event_handler_, OnSessionClosed(_)); 313 EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
314 EXPECT_CALL(*event_executor_, StopAndDeleteMock());
246 315
247 client_session_->OnConnectionAuthenticated(client_session_->connection()); 316 client_session_->OnConnectionAuthenticated(client_session_->connection());
248 client_session_->OnConnectionChannelsConnected(client_session_->connection()); 317 client_session_->OnConnectionChannelsConnected(client_session_->connection());
249 318
250 connection_->input_stub()->InjectKeyEvent(key1); 319 connection_->input_stub()->InjectKeyEvent(key1);
251 connection_->input_stub()->InjectKeyEvent(key2); 320 connection_->input_stub()->InjectKeyEvent(key2);
252 connection_->input_stub()->InjectMouseEvent(mousedown); 321 connection_->input_stub()->InjectMouseEvent(mousedown);
253 322
254 DisconnectClientSession(); 323 DisconnectClientSession();
255 } 324 }
256 325
257 TEST_F(ClientSessionTest, ClampMouseEvents) { 326 TEST_F(ClientSessionTest, ClampMouseEvents) {
258 SkISize screen(SkISize::Make(200, 100)); 327 SkISize screen(SkISize::Make(200, 100));
259 EXPECT_CALL(capturer_, size_most_recent()) 328 EXPECT_CALL(*capturer_, size_most_recent())
260 .WillRepeatedly(ReturnRef(screen)); 329 .WillRepeatedly(ReturnRef(screen));
261 330
262 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); 331 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_));
263 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); 332 EXPECT_CALL(*event_executor_, StartPtr(_));
333 Expectation connected =
334 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_));
264 EXPECT_CALL(session_event_handler_, OnSessionClosed(_)); 335 EXPECT_CALL(session_event_handler_, OnSessionClosed(_));
336 EXPECT_CALL(*event_executor_, StopAndDeleteMock());
265 337
266 client_session_->OnConnectionAuthenticated(client_session_->connection()); 338 client_session_->OnConnectionAuthenticated(client_session_->connection());
267 client_session_->OnConnectionChannelsConnected(client_session_->connection()); 339 client_session_->OnConnectionChannelsConnected(client_session_->connection());
268 340
269 int input_x[3] = { -999, 100, 999 }; 341 int input_x[3] = { -999, 100, 999 };
270 int expected_x[3] = { 0, 100, 199 }; 342 int expected_x[3] = { 0, 100, 199 };
271 int input_y[3] = { -999, 50, 999 }; 343 int input_y[3] = { -999, 50, 999 };
272 int expected_y[3] = { 0, 50, 99 }; 344 int expected_y[3] = { 0, 50, 99 };
273 345
274 protocol::MouseEvent event; 346 protocol::MouseEvent event;
275 for (int j = 0; j < 3; j++) { 347 for (int j = 0; j < 3; j++) {
276 for (int i = 0; i < 3; i++) { 348 for (int i = 0; i < 3; i++) {
277 event.set_x(input_x[i]); 349 event.set_x(input_x[i]);
278 event.set_y(input_y[j]); 350 event.set_y(input_y[j]);
279 EXPECT_CALL(host_input_stub_, InjectMouseEvent(EqualsMouseEvent( 351 connected =
280 expected_x[i], expected_y[j]))); 352 EXPECT_CALL(*event_executor_,
353 InjectMouseEvent(EqualsMouseEvent(expected_x[i],
354 expected_y[j])))
355 .After(connected);
281 connection_->input_stub()->InjectMouseEvent(event); 356 connection_->input_stub()->InjectMouseEvent(event);
282 } 357 }
283 } 358 }
284 359
285 DisconnectClientSession(); 360 DisconnectClientSession();
286 } 361 }
287 362
288 } // namespace remoting 363 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session.cc ('k') | remoting/host/desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698