| 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 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 5 #ifndef REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
| 6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 6 #define REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "remoting/protocol/pairing_registry.h" | 23 #include "remoting/protocol/pairing_registry.h" |
| 24 #include "remoting/protocol/session.h" | 24 #include "remoting/protocol/session.h" |
| 25 #include "remoting/protocol/session_manager.h" | 25 #include "remoting/protocol/session_manager.h" |
| 26 #include "remoting/protocol/transport.h" | 26 #include "remoting/protocol/transport.h" |
| 27 #include "remoting/protocol/video_stub.h" | 27 #include "remoting/protocol/video_stub.h" |
| 28 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
| 29 | 29 |
| 30 namespace remoting { | 30 namespace remoting { |
| 31 namespace protocol { | 31 namespace protocol { |
| 32 | 32 |
| 33 class MockConnectionToClient : public ConnectionToClient { | |
| 34 public: | |
| 35 MockConnectionToClient(scoped_ptr<Session> session, HostStub* host_stub); | |
| 36 ~MockConnectionToClient() override; | |
| 37 | |
| 38 void SetEventHandler(EventHandler* event_handler) override { | |
| 39 event_handler_ = event_handler; | |
| 40 } | |
| 41 | |
| 42 MOCK_METHOD1(Init, void(Session* session)); | |
| 43 MOCK_METHOD0(video_stub, VideoStub*()); | |
| 44 MOCK_METHOD0(audio_stub, AudioStub*()); | |
| 45 MOCK_METHOD0(client_stub, ClientStub*()); | |
| 46 MOCK_METHOD1(Disconnect, void(ErrorCode error)); | |
| 47 | |
| 48 Session* session() override { return session_.get(); } | |
| 49 void OnInputEventReceived(int64_t timestamp) override {} | |
| 50 | |
| 51 void set_clipboard_stub(ClipboardStub* clipboard_stub) override { | |
| 52 clipboard_stub_ = clipboard_stub; | |
| 53 } | |
| 54 void set_host_stub(HostStub* host_stub) override { host_stub_ = host_stub; } | |
| 55 void set_input_stub(InputStub* input_stub) override { | |
| 56 input_stub_ = input_stub; | |
| 57 } | |
| 58 | |
| 59 void set_video_feedback_stub( | |
| 60 VideoFeedbackStub* video_feedback_stub) override { | |
| 61 video_feedback_stub_ = video_feedback_stub; | |
| 62 } | |
| 63 | |
| 64 EventHandler* event_handler() { return event_handler_; } | |
| 65 ClipboardStub* clipboard_stub() { return clipboard_stub_; } | |
| 66 HostStub* host_stub() { return host_stub_; } | |
| 67 InputStub* input_stub() { return input_stub_; } | |
| 68 VideoFeedbackStub* video_feedback_stub() { return video_feedback_stub_; } | |
| 69 | |
| 70 private: | |
| 71 scoped_ptr<Session> session_; | |
| 72 EventHandler* event_handler_ = nullptr; | |
| 73 | |
| 74 ClipboardStub* clipboard_stub_ = nullptr; | |
| 75 HostStub* host_stub_ = nullptr; | |
| 76 InputStub* input_stub_ = nullptr; | |
| 77 VideoFeedbackStub* video_feedback_stub_ = nullptr; | |
| 78 | |
| 79 DISALLOW_COPY_AND_ASSIGN(MockConnectionToClient); | |
| 80 }; | |
| 81 | |
| 82 class MockConnectionToClientEventHandler | 33 class MockConnectionToClientEventHandler |
| 83 : public ConnectionToClient::EventHandler { | 34 : public ConnectionToClient::EventHandler { |
| 84 public: | 35 public: |
| 85 MockConnectionToClientEventHandler(); | 36 MockConnectionToClientEventHandler(); |
| 86 ~MockConnectionToClientEventHandler() override; | 37 ~MockConnectionToClientEventHandler() override; |
| 87 | 38 |
| 88 MOCK_METHOD1(OnConnectionAuthenticating, | 39 MOCK_METHOD1(OnConnectionAuthenticating, |
| 89 void(ConnectionToClient* connection)); | 40 void(ConnectionToClient* connection)); |
| 90 MOCK_METHOD1(OnConnectionAuthenticated, void(ConnectionToClient* connection)); | 41 MOCK_METHOD1(OnConnectionAuthenticated, void(ConnectionToClient* connection)); |
| 91 MOCK_METHOD1(OnConnectionChannelsConnected, | 42 MOCK_METHOD1(OnConnectionChannelsConnected, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // Runs tasks synchronously instead of posting them to |task_runner|. | 238 // Runs tasks synchronously instead of posting them to |task_runner|. |
| 288 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 239 void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 289 const tracked_objects::Location& from_here, | 240 const tracked_objects::Location& from_here, |
| 290 const base::Closure& task) override; | 241 const base::Closure& task) override; |
| 291 }; | 242 }; |
| 292 | 243 |
| 293 } // namespace protocol | 244 } // namespace protocol |
| 294 } // namespace remoting | 245 } // namespace remoting |
| 295 | 246 |
| 296 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ | 247 #endif // REMOTING_PROTOCOL_PROTOCOL_MOCK_OBJECTS_H_ |
| OLD | NEW |