| 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_TEST_TEST_CHROMOTING_CLIENT_H_ | 5 #ifndef REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ |
| 6 #define REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ | 6 #define REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "remoting/client/chromoting_client.h" |
| 13 #include "remoting/client/client_user_interface.h" | 14 #include "remoting/client/client_user_interface.h" |
| 14 #include "remoting/protocol/clipboard_filter.h" | 15 #include "remoting/protocol/clipboard_filter.h" |
| 15 #include "remoting/protocol/cursor_shape_stub.h" | 16 #include "remoting/protocol/cursor_shape_stub.h" |
| 16 #include "remoting/test/remote_connection_observer.h" | 17 #include "remoting/test/remote_connection_observer.h" |
| 17 #include "remoting/test/remote_host_info.h" | 18 #include "remoting/test/remote_host_info.h" |
| 18 | 19 |
| 19 namespace remoting { | 20 namespace remoting { |
| 20 class ChromotingClient; | 21 |
| 21 class ClientContext; | 22 class ClientContext; |
| 22 class XmppSignalStrategy; | 23 class XmppSignalStrategy; |
| 23 class VideoRenderer; | 24 class VideoRenderer; |
| 25 |
| 26 namespace protocol { |
| 27 class ClipboardStub; |
| 28 class HostStub; |
| 29 class InputStub; |
| 24 } | 30 } |
| 25 | 31 |
| 26 namespace remoting { | |
| 27 namespace test { | 32 namespace test { |
| 28 | 33 |
| 29 // Manages a chromoting connection to a remote host. Destroying a | 34 // Manages a chromoting connection to a remote host. Destroying a |
| 30 // TestChromotingClient object with an active connection will close it. | 35 // TestChromotingClient object with an active connection will close it. |
| 31 // Must be used from a thread running an IO message loop. | 36 // Must be used from a thread running an IO message loop. |
| 32 // RemoteConnectionObserver objects must not destroy this class within a | 37 // RemoteConnectionObserver objects must not destroy this class within a |
| 33 // callback. | 38 // callback. |
| 34 class TestChromotingClient : public ClientUserInterface, | 39 class TestChromotingClient : public ClientUserInterface, |
| 35 public protocol::ClipboardStub, | 40 public protocol::ClipboardStub, |
| 36 public protocol::CursorShapeStub { | 41 public protocol::CursorShapeStub { |
| 37 public: | 42 public: |
| 38 TestChromotingClient(); | 43 TestChromotingClient(); |
| 39 ~TestChromotingClient() override; | 44 ~TestChromotingClient() override; |
| 40 | 45 |
| 41 // Starts a chromoting connection with the specified remote host. | 46 // Starts a chromoting connection with the specified remote host. |
| 42 void StartConnection(const std::string& user_name, | 47 void StartConnection(const std::string& user_name, |
| 43 const std::string& access_token, | 48 const std::string& access_token, |
| 44 const RemoteHostInfo& remote_host_info); | 49 const RemoteHostInfo& remote_host_info); |
| 45 | 50 |
| 46 // Ends the current remote connection and updates the connection state. | 51 // Ends the current remote connection and updates the connection state. |
| 47 void EndConnection(); | 52 void EndConnection(); |
| 48 | 53 |
| 54 // Stubs used to send messages to the remote host. |
| 55 protocol::ClipboardStub* clipboard_forwarder() { |
| 56 return chromoting_client_->clipboard_forwarder(); |
| 57 } |
| 58 protocol::HostStub* host_stub() { return chromoting_client_->host_stub(); } |
| 59 protocol::InputStub* input_stub() { return chromoting_client_->input_stub(); } |
| 60 |
| 49 // Registers an observer which will be notfied when remote connection events | 61 // Registers an observer which will be notfied when remote connection events |
| 50 // occur. Registered Observers must not tear-down this object on receipt of | 62 // occur. Registered Observers must not tear-down this object on receipt of |
| 51 // these callbacks. The callbacks should be used for informational purposes. | 63 // these callbacks. The callbacks should be used for informational purposes. |
| 52 void AddRemoteConnectionObserver(RemoteConnectionObserver* observer); | 64 void AddRemoteConnectionObserver(RemoteConnectionObserver* observer); |
| 53 | 65 |
| 54 // Unregisters an observerer from notifications for remote connection events. | 66 // Unregisters an observerer from notifications for remote connection events. |
| 55 void RemoveRemoteConnectionObserver(RemoteConnectionObserver* observer); | 67 void RemoveRemoteConnectionObserver(RemoteConnectionObserver* observer); |
| 56 | 68 |
| 57 // Used to set a fake/mock connection object for TestChromotingClient tests. | 69 // Used to set a fake/mock connection object for TestChromotingClient tests. |
| 58 void SetConnectionToHostForTests( | 70 void SetConnectionToHostForTests( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Used to establish an XMPP connection with the google talk service. | 116 // Used to establish an XMPP connection with the google talk service. |
| 105 scoped_ptr<XmppSignalStrategy> signal_strategy_; | 117 scoped_ptr<XmppSignalStrategy> signal_strategy_; |
| 106 | 118 |
| 107 DISALLOW_COPY_AND_ASSIGN(TestChromotingClient); | 119 DISALLOW_COPY_AND_ASSIGN(TestChromotingClient); |
| 108 }; | 120 }; |
| 109 | 121 |
| 110 } // namespace test | 122 } // namespace test |
| 111 } // namespace remoting | 123 } // namespace remoting |
| 112 | 124 |
| 113 #endif // REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ | 125 #endif // REMOTING_TEST_TEST_CHROMOTING_CLIENT_H_ |
| OLD | NEW |