| 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/auto_thread_task_runner.h" | 6 #include "remoting/base/auto_thread_task_runner.h" |
| 7 #include "remoting/base/constants.h" | 7 #include "remoting/base/constants.h" |
| 8 #include "remoting/host/audio_capturer.h" | |
| 9 #include "remoting/host/client_session.h" | 8 #include "remoting/host/client_session.h" |
| 10 #include "remoting/host/desktop_environment.h" | 9 #include "remoting/host/desktop_environment.h" |
| 11 #include "remoting/host/host_mock_objects.h" | 10 #include "remoting/host/host_mock_objects.h" |
| 12 #include "remoting/protocol/protocol_mock_objects.h" | 11 #include "remoting/protocol/protocol_mock_objects.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 13 |
| 15 namespace remoting { | 14 namespace remoting { |
| 16 | 15 |
| 17 using protocol::MockClipboardStub; | 16 using protocol::MockClipboardStub; |
| 18 using protocol::MockConnectionToClient; | 17 using protocol::MockConnectionToClient; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(session_config_)); | 69 EXPECT_CALL(*session, config()).WillRepeatedly(ReturnRef(session_config_)); |
| 71 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); | 70 EXPECT_CALL(*session, jid()).WillRepeatedly(ReturnRef(client_jid_)); |
| 72 EXPECT_CALL(*session, SetEventHandler(_)); | 71 EXPECT_CALL(*session, SetEventHandler(_)); |
| 73 EXPECT_CALL(*session, Close()); | 72 EXPECT_CALL(*session, Close()); |
| 74 scoped_ptr<protocol::ConnectionToClient> connection( | 73 scoped_ptr<protocol::ConnectionToClient> connection( |
| 75 new protocol::ConnectionToClient(session)); | 74 new protocol::ConnectionToClient(session)); |
| 76 connection_ = connection.get(); | 75 connection_ = connection.get(); |
| 77 | 76 |
| 78 client_session_ = new ClientSession( | 77 client_session_ = new ClientSession( |
| 79 &session_event_handler_, | 78 &session_event_handler_, |
| 79 context_.audio_task_runner(), |
| 80 context_.capture_task_runner(), | 80 context_.capture_task_runner(), |
| 81 context_.encode_task_runner(), | 81 context_.encode_task_runner(), |
| 82 context_.network_task_runner(), | 82 context_.network_task_runner(), |
| 83 connection.Pass(), | 83 connection.Pass(), |
| 84 desktop_environment_factory_.get(), | 84 desktop_environment_factory_.get(), |
| 85 base::TimeDelta()); | 85 base::TimeDelta()); |
| 86 } | 86 } |
| 87 | 87 |
| 88 virtual void TearDown() OVERRIDE { | 88 virtual void TearDown() OVERRIDE { |
| 89 // MockClientSessionEventHandler won't trigger StopAndDelete, so fake it. | 89 // MockClientSessionEventHandler won't trigger StopAndDelete, so fake it. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 104 MockVideoFrameCapturer* capturer = new MockVideoFrameCapturer(); | 104 MockVideoFrameCapturer* capturer = new MockVideoFrameCapturer(); |
| 105 EXPECT_CALL(*capturer, Start(_)); | 105 EXPECT_CALL(*capturer, Start(_)); |
| 106 EXPECT_CALL(*capturer, Stop()); | 106 EXPECT_CALL(*capturer, Stop()); |
| 107 EXPECT_CALL(*capturer, InvalidateRegion(_)).Times(AnyNumber()); | 107 EXPECT_CALL(*capturer, InvalidateRegion(_)).Times(AnyNumber()); |
| 108 EXPECT_CALL(*capturer, CaptureInvalidRegion(_)).Times(AnyNumber()); | 108 EXPECT_CALL(*capturer, CaptureInvalidRegion(_)).Times(AnyNumber()); |
| 109 EXPECT_CALL(*capturer, size_most_recent()) | 109 EXPECT_CALL(*capturer, size_most_recent()) |
| 110 .WillRepeatedly(ReturnRef(screen_size_)); | 110 .WillRepeatedly(ReturnRef(screen_size_)); |
| 111 | 111 |
| 112 EXPECT_TRUE(!event_executor_); | 112 EXPECT_TRUE(!event_executor_); |
| 113 event_executor_ = new MockEventExecutor(); | 113 event_executor_ = new MockEventExecutor(); |
| 114 return new DesktopEnvironment(scoped_ptr<AudioCapturer>(NULL), | 114 return new DesktopEnvironment(scoped_ptr<EventExecutor>(event_executor_), |
| 115 scoped_ptr<EventExecutor>(event_executor_), | |
| 116 scoped_ptr<VideoFrameCapturer>(capturer)); | 115 scoped_ptr<VideoFrameCapturer>(capturer)); |
| 117 } | 116 } |
| 118 | 117 |
| 119 void DisconnectClientSession() { | 118 void DisconnectClientSession() { |
| 120 client_session_->Disconnect(); | 119 client_session_->Disconnect(); |
| 121 // MockSession won't trigger OnConnectionClosed, so fake it. | 120 // MockSession won't trigger OnConnectionClosed, so fake it. |
| 122 client_session_->OnConnectionClosed(client_session_->connection(), | 121 client_session_->OnConnectionClosed(client_session_->connection(), |
| 123 protocol::OK); | 122 protocol::OK); |
| 124 } | 123 } |
| 125 | 124 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 expected_y[j]))) | 359 expected_y[j]))) |
| 361 .After(connected); | 360 .After(connected); |
| 362 connection_->input_stub()->InjectMouseEvent(event); | 361 connection_->input_stub()->InjectMouseEvent(event); |
| 363 } | 362 } |
| 364 } | 363 } |
| 365 | 364 |
| 366 DisconnectClientSession(); | 365 DisconnectClientSession(); |
| 367 } | 366 } |
| 368 | 367 |
| 369 } // namespace remoting | 368 } // namespace remoting |
| OLD | NEW |