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