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