| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_ |
| 6 #define REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "remoting/protocol/connection_to_host.h" | 10 #include "remoting/protocol/connection_to_host.h" |
| 11 #include "remoting/protocol/protocol_mock_objects.h" | 11 #include "remoting/protocol/protocol_mock_objects.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 class FakeConnectionToHost : public protocol::ConnectionToHost { | 16 class FakeConnectionToHost : public protocol::ConnectionToHost { |
| 17 public: | 17 public: |
| 18 FakeConnectionToHost(); | 18 FakeConnectionToHost(); |
| 19 ~FakeConnectionToHost() override; | 19 ~FakeConnectionToHost() override; |
| 20 | 20 |
| 21 // ConnectionToHost interface. | 21 // ConnectionToHost interface. |
| 22 void set_candidate_config( | |
| 23 scoped_ptr<protocol::CandidateSessionConfig> config) override; | |
| 24 void set_client_stub(protocol::ClientStub* client_stub) override; | 22 void set_client_stub(protocol::ClientStub* client_stub) override; |
| 25 void set_clipboard_stub(protocol::ClipboardStub* clipboard_stub) override; | 23 void set_clipboard_stub(protocol::ClipboardStub* clipboard_stub) override; |
| 26 void set_video_stub(protocol::VideoStub* video_stub) override; | 24 void set_video_stub(protocol::VideoStub* video_stub) override; |
| 27 void set_audio_stub(protocol::AudioStub* audio_stub) override; | 25 void set_audio_stub(protocol::AudioStub* audio_stub) override; |
| 28 void Connect(SignalStrategy* signal_strategy, | 26 void Connect(scoped_ptr<protocol::Session> session, |
| 29 scoped_refptr<protocol::TransportContext> transport_context, | |
| 30 scoped_ptr<protocol::Authenticator> authenticator, | |
| 31 const std::string& host_jid, | |
| 32 HostEventCallback* event_callback) override; | 27 HostEventCallback* event_callback) override; |
| 33 const protocol::SessionConfig& config() override; | 28 const protocol::SessionConfig& config() override; |
| 34 protocol::ClipboardStub* clipboard_forwarder() override; | 29 protocol::ClipboardStub* clipboard_forwarder() override; |
| 35 protocol::HostStub* host_stub() override; | 30 protocol::HostStub* host_stub() override; |
| 36 protocol::InputStub* input_stub() override; | 31 protocol::InputStub* input_stub() override; |
| 37 State state() const override; | 32 State state() const override; |
| 38 | 33 |
| 39 // Calls OnConnectionState on the |event_callback_| with the supplied state | 34 // Calls OnConnectionState on the |event_callback_| with the supplied state |
| 40 // and error. | 35 // and error. |
| 41 void SignalStateChange(protocol::Session::State state, | 36 void SignalStateChange(protocol::Session::State state, |
| 42 protocol::ErrorCode error); | 37 protocol::ErrorCode error); |
| 43 | 38 |
| 44 // Calls OnConnectionReady on the |event_callback_| with the supplied bool. | 39 // Calls OnConnectionReady on the |event_callback_| with the supplied bool. |
| 45 void SignalConnectionReady(bool ready); | 40 void SignalConnectionReady(bool ready); |
| 46 | 41 |
| 47 private: | 42 private: |
| 48 void SetState(State state, protocol::ErrorCode error); | 43 void SetState(State state, protocol::ErrorCode error); |
| 49 | 44 |
| 50 State state_; | 45 State state_ = INITIALIZING; |
| 51 | 46 |
| 52 HostEventCallback* event_callback_; | 47 HostEventCallback* event_callback_; |
| 53 | 48 |
| 54 testing::NiceMock<protocol::MockClipboardStub> mock_clipboard_stub_; | 49 testing::NiceMock<protocol::MockClipboardStub> mock_clipboard_stub_; |
| 55 testing::NiceMock<protocol::MockHostStub> mock_host_stub_; | 50 testing::NiceMock<protocol::MockHostStub> mock_host_stub_; |
| 56 testing::NiceMock<protocol::MockInputStub> mock_input_stub_; | 51 testing::NiceMock<protocol::MockInputStub> mock_input_stub_; |
| 57 scoped_ptr<protocol::SessionConfig> session_config_; | 52 scoped_ptr<protocol::SessionConfig> session_config_; |
| 58 | 53 |
| 59 DISALLOW_COPY_AND_ASSIGN(FakeConnectionToHost); | 54 DISALLOW_COPY_AND_ASSIGN(FakeConnectionToHost); |
| 60 }; | 55 }; |
| 61 | 56 |
| 62 } // namespace test | 57 } // namespace test |
| 63 } // namespace remoting | 58 } // namespace remoting |
| 64 | 59 |
| 65 #endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_ | 60 #endif // REMOTING_PROTOCOL_FAKE_CONNECTION_TO_HOST_H_ |
| OLD | NEW |