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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 .WillRepeatedly(Return(false)); | 217 .WillRepeatedly(Return(false)); |
218 | 218 |
219 input_injector_.reset(new MockInputInjector()); | 219 input_injector_.reset(new MockInputInjector()); |
220 | 220 |
221 session_config_ = SessionConfig::ForTest(); | 221 session_config_ = SessionConfig::ForTest(); |
222 } | 222 } |
223 | 223 |
224 void ClientSessionTest::TearDown() { | 224 void ClientSessionTest::TearDown() { |
225 // Clear out |task_runner_| reference so the loop can quit, and run it until | 225 // Clear out |task_runner_| reference so the loop can quit, and run it until |
226 // it does. | 226 // it does. |
227 task_runner_ = NULL; | 227 task_runner_ = nullptr; |
228 run_loop_.Run(); | 228 run_loop_.Run(); |
229 } | 229 } |
230 | 230 |
231 void ClientSessionTest::CreateClientSession() { | 231 void ClientSessionTest::CreateClientSession() { |
232 // Mock protocol::Session APIs called directly by ClientSession. | 232 // Mock protocol::Session APIs called directly by ClientSession. |
233 protocol::MockSession* session = new MockSession(); | 233 protocol::MockSession* session = new MockSession(); |
234 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(session_config_)); | 234 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(session_config_)); |
235 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); | 235 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); |
236 EXPECT_CALL(*session, SetEventHandler(_)); | 236 EXPECT_CALL(*session, SetEventHandler(_)); |
237 | 237 |
238 // Mock protocol::ConnectionToClient APIs called directly by ClientSession. | 238 // Mock protocol::ConnectionToClient APIs called directly by ClientSession. |
239 // HostStub is not touched by ClientSession, so we can safely pass NULL. | 239 // HostStub is not touched by ClientSession, so we can safely pass nullptr. |
240 scoped_ptr<MockConnectionToClient> connection( | 240 scoped_ptr<MockConnectionToClient> connection( |
241 new MockConnectionToClient(session, NULL)); | 241 new MockConnectionToClient(session, nullptr)); |
242 EXPECT_CALL(*connection, session()).WillRepeatedly(Return(session)); | 242 EXPECT_CALL(*connection, session()).WillRepeatedly(Return(session)); |
243 EXPECT_CALL(*connection, client_stub()) | 243 EXPECT_CALL(*connection, client_stub()) |
244 .WillRepeatedly(Return(&client_stub_)); | 244 .WillRepeatedly(Return(&client_stub_)); |
245 EXPECT_CALL(*connection, video_stub()).WillRepeatedly(Return(&video_stub_)); | 245 EXPECT_CALL(*connection, video_stub()).WillRepeatedly(Return(&video_stub_)); |
246 EXPECT_CALL(*connection, Disconnect()); | 246 EXPECT_CALL(*connection, Disconnect()); |
247 connection_ = connection.get(); | 247 connection_ = connection.get(); |
248 | 248 |
249 client_session_.reset(new ClientSession( | 249 client_session_.reset(new ClientSession( |
250 &session_event_handler_, | 250 &session_event_handler_, |
251 task_runner_, // Audio thread. | 251 task_runner_, // Audio thread. |
252 task_runner_, // Input thread. | 252 task_runner_, // Input thread. |
253 task_runner_, // Capture thread. | 253 task_runner_, // Capture thread. |
254 task_runner_, // Encode thread. | 254 task_runner_, // Encode thread. |
255 task_runner_, // Network thread. | 255 task_runner_, // Network thread. |
256 task_runner_, // UI thread. | 256 task_runner_, // UI thread. |
257 connection.Pass(), | 257 connection.Pass(), |
258 desktop_environment_factory_.get(), | 258 desktop_environment_factory_.get(), |
259 base::TimeDelta(), | 259 base::TimeDelta(), |
260 NULL, | 260 nullptr, |
261 extensions_)); | 261 extensions_)); |
262 } | 262 } |
263 | 263 |
264 void ClientSessionTest::DisconnectClientSession() { | 264 void ClientSessionTest::DisconnectClientSession() { |
265 client_session_->DisconnectSession(); | 265 client_session_->DisconnectSession(); |
266 // MockSession won't trigger OnConnectionClosed, so fake it. | 266 // MockSession won't trigger OnConnectionClosed, so fake it. |
267 client_session_->OnConnectionClosed(client_session_->connection(), | 267 client_session_->OnConnectionClosed(client_session_->connection(), |
268 protocol::OK); | 268 protocol::OK); |
269 } | 269 } |
270 | 270 |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 808 |
809 DisconnectClientSession(); | 809 DisconnectClientSession(); |
810 StopClientSession(); | 810 StopClientSession(); |
811 | 811 |
812 // ext1 was instantiated and wrapped the video capturer. | 812 // ext1 was instantiated and wrapped the video capturer. |
813 EXPECT_TRUE(extension.was_instantiated()); | 813 EXPECT_TRUE(extension.was_instantiated()); |
814 EXPECT_TRUE(extension.has_wrapped_video_capturer()); | 814 EXPECT_TRUE(extension.has_wrapped_video_capturer()); |
815 } | 815 } |
816 | 816 |
817 } // namespace remoting | 817 } // namespace remoting |
OLD | NEW |