| 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 "remoting/host/client_session.h" | 5 #include "remoting/host/client_session.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_)); | 178 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(*session_config_)); |
| 179 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); | 179 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); |
| 180 | 180 |
| 181 // Mock protocol::ConnectionToClient APIs called directly by ClientSession. | 181 // Mock protocol::ConnectionToClient APIs called directly by ClientSession. |
| 182 // HostStub is not touched by ClientSession, so we can safely pass nullptr. | 182 // HostStub is not touched by ClientSession, so we can safely pass nullptr. |
| 183 std::unique_ptr<protocol::FakeConnectionToClient> connection( | 183 std::unique_ptr<protocol::FakeConnectionToClient> connection( |
| 184 new protocol::FakeConnectionToClient(std::move(session))); | 184 new protocol::FakeConnectionToClient(std::move(session))); |
| 185 connection->set_client_stub(&client_stub_); | 185 connection->set_client_stub(&client_stub_); |
| 186 connection_ = connection.get(); | 186 connection_ = connection.get(); |
| 187 | 187 |
| 188 client_session_.reset(new ClientSession( | 188 client_session_.reset( |
| 189 &session_event_handler_, | 189 new ClientSession(&session_event_handler_, std::move(connection), |
| 190 task_runner_, // Audio thread. | 190 desktop_environment_factory_.get(), base::TimeDelta(), |
| 191 std::move(connection), desktop_environment_factory_.get(), | 191 nullptr, extensions_)); |
| 192 base::TimeDelta(), nullptr, extensions_)); | |
| 193 } | 192 } |
| 194 | 193 |
| 195 void ClientSessionTest::ConnectClientSession() { | 194 void ClientSessionTest::ConnectClientSession() { |
| 196 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); | 195 EXPECT_CALL(session_event_handler_, OnSessionAuthenticated(_)); |
| 197 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); | 196 EXPECT_CALL(session_event_handler_, OnSessionChannelsConnected(_)); |
| 198 | 197 |
| 199 // Stubs should be set only after connection is authenticated. | 198 // Stubs should be set only after connection is authenticated. |
| 200 EXPECT_FALSE(connection_->clipboard_stub()); | 199 EXPECT_FALSE(connection_->clipboard_stub()); |
| 201 EXPECT_FALSE(connection_->input_stub()); | 200 EXPECT_FALSE(connection_->input_stub()); |
| 202 | 201 |
| 203 client_session_->OnConnectionAuthenticated(client_session_->connection()); | 202 client_session_->OnConnectionAuthenticated(client_session_->connection()); |
| 204 | 203 |
| 205 EXPECT_TRUE(connection_->clipboard_stub()); | 204 EXPECT_TRUE(connection_->clipboard_stub()); |
| 206 EXPECT_TRUE(connection_->input_stub()); | 205 EXPECT_TRUE(connection_->input_stub()); |
| 207 | 206 |
| 208 client_session_->CreateVideoStreams(client_session_->connection()); | 207 client_session_->CreateMediaStreams(client_session_->connection()); |
| 209 client_session_->OnConnectionChannelsConnected(client_session_->connection()); | 208 client_session_->OnConnectionChannelsConnected(client_session_->connection()); |
| 210 } | 209 } |
| 211 | 210 |
| 212 void ClientSessionTest::NotifyVideoSize() { | 211 void ClientSessionTest::NotifyVideoSize() { |
| 213 connection_->last_video_stream()->observer()->OnVideoSizeChanged( | 212 connection_->last_video_stream()->observer()->OnVideoSizeChanged( |
| 214 connection_->last_video_stream().get(), | 213 connection_->last_video_stream().get(), |
| 215 webrtc::DesktopSize(protocol::FakeDesktopCapturer::kWidth, | 214 webrtc::DesktopSize(protocol::FakeDesktopCapturer::kWidth, |
| 216 protocol::FakeDesktopCapturer::kHeight), | 215 protocol::FakeDesktopCapturer::kHeight), |
| 217 webrtc::DesktopVector(kDefaultDpi, kDefaultDpi)); | 216 webrtc::DesktopVector(kDefaultDpi, kDefaultDpi)); |
| 218 } | 217 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 423 |
| 425 // ext2 was instantiated but not sent a message, and wrapped video encoder. | 424 // ext2 was instantiated but not sent a message, and wrapped video encoder. |
| 426 EXPECT_TRUE(extension2.was_instantiated()); | 425 EXPECT_TRUE(extension2.was_instantiated()); |
| 427 EXPECT_FALSE(extension2.has_handled_message()); | 426 EXPECT_FALSE(extension2.has_handled_message()); |
| 428 | 427 |
| 429 // ext3 was sent a message but not instantiated. | 428 // ext3 was sent a message but not instantiated. |
| 430 EXPECT_FALSE(extension3.was_instantiated()); | 429 EXPECT_FALSE(extension3.was_instantiated()); |
| 431 } | 430 } |
| 432 | 431 |
| 433 } // namespace remoting | 432 } // namespace remoting |
| OLD | NEW |