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