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