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

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

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