ozone: DCHECK page_flip_request instead of page_flip_request_
[chromium-blink-merge.git] / remoting / host / host_mock_objects.h
blobd4462c815e2b67260f366c12d2825ec36e698053
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_HOST_MOCK_OBJECTS_H_
6 #define REMOTING_HOST_HOST_MOCK_OBJECTS_H_
8 #include <string>
10 #include "net/base/ip_endpoint.h"
11 #include "remoting/codec/video_encoder.h"
12 #include "remoting/host/chromoting_host_context.h"
13 #include "remoting/host/client_session.h"
14 #include "remoting/host/client_session_control.h"
15 #include "remoting/host/desktop_environment.h"
16 #include "remoting/host/gnubby_auth_handler.h"
17 #include "remoting/host/host_status_observer.h"
18 #include "remoting/host/input_injector.h"
19 #include "remoting/host/screen_controls.h"
20 #include "remoting/host/screen_resolution.h"
21 #include "remoting/proto/control.pb.h"
22 #include "testing/gmock/include/gmock/gmock.h"
23 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
24 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
26 namespace base {
27 class SingleThreadTaskRunner;
28 } // namespace base
30 namespace remoting {
32 class MockDesktopEnvironment : public DesktopEnvironment {
33 public:
34 MockDesktopEnvironment();
35 ~MockDesktopEnvironment() override;
37 MOCK_METHOD0(CreateAudioCapturerPtr, AudioCapturer*());
38 MOCK_METHOD0(CreateInputInjectorPtr, InputInjector*());
39 MOCK_METHOD0(CreateScreenControlsPtr, ScreenControls*());
40 MOCK_METHOD0(CreateVideoCapturerPtr, webrtc::DesktopCapturer*());
41 MOCK_METHOD0(CreateMouseCursorMonitorPtr, webrtc::MouseCursorMonitor*());
42 MOCK_CONST_METHOD0(GetCapabilities, std::string());
43 MOCK_METHOD1(SetCapabilities, void(const std::string&));
44 MOCK_METHOD1(CreateGnubbyAuthHandlerPtr, GnubbyAuthHandler*(
45 protocol::ClientStub* client_stub));
47 // DesktopEnvironment implementation.
48 scoped_ptr<AudioCapturer> CreateAudioCapturer() override;
49 scoped_ptr<InputInjector> CreateInputInjector() override;
50 scoped_ptr<ScreenControls> CreateScreenControls() override;
51 scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() override;
52 scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler(
53 protocol::ClientStub* client_stub) override;
54 scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor()
55 override;
58 class MockClientSessionControl : public ClientSessionControl {
59 public:
60 MockClientSessionControl();
61 ~MockClientSessionControl() override;
63 MOCK_CONST_METHOD0(client_jid, const std::string&());
64 MOCK_METHOD0(DisconnectSession, void());
65 MOCK_METHOD1(OnLocalMouseMoved, void(const webrtc::DesktopVector&));
66 MOCK_METHOD1(SetDisableInputs, void(bool));
67 MOCK_METHOD0(ResetVideoPipeline, void());
69 private:
70 DISALLOW_COPY_AND_ASSIGN(MockClientSessionControl);
73 class MockClientSessionEventHandler : public ClientSession::EventHandler {
74 public:
75 MockClientSessionEventHandler();
76 ~MockClientSessionEventHandler() override;
78 MOCK_METHOD1(OnSessionAuthenticating, void(ClientSession* client));
79 MOCK_METHOD1(OnSessionAuthenticated, bool(ClientSession* client));
80 MOCK_METHOD1(OnSessionChannelsConnected, void(ClientSession* client));
81 MOCK_METHOD1(OnSessionAuthenticationFailed, void(ClientSession* client));
82 MOCK_METHOD1(OnSessionClosed, void(ClientSession* client));
83 MOCK_METHOD3(OnSessionRouteChange, void(
84 ClientSession* client,
85 const std::string& channel_name,
86 const protocol::TransportRoute& route));
88 private:
89 DISALLOW_COPY_AND_ASSIGN(MockClientSessionEventHandler);
92 class MockDesktopEnvironmentFactory : public DesktopEnvironmentFactory {
93 public:
94 MockDesktopEnvironmentFactory();
95 ~MockDesktopEnvironmentFactory() override;
97 MOCK_METHOD0(CreatePtr, DesktopEnvironment*());
98 MOCK_CONST_METHOD0(SupportsAudioCapture, bool());
100 scoped_ptr<DesktopEnvironment> Create(
101 base::WeakPtr<ClientSessionControl> client_session_control) override;
103 private:
104 DISALLOW_COPY_AND_ASSIGN(MockDesktopEnvironmentFactory);
107 class MockInputInjector : public InputInjector {
108 public:
109 MockInputInjector();
110 ~MockInputInjector() override;
112 MOCK_METHOD1(InjectClipboardEvent,
113 void(const protocol::ClipboardEvent& event));
114 MOCK_METHOD1(InjectKeyEvent, void(const protocol::KeyEvent& event));
115 MOCK_METHOD1(InjectTextEvent, void(const protocol::TextEvent& event));
116 MOCK_METHOD1(InjectMouseEvent, void(const protocol::MouseEvent& event));
117 MOCK_METHOD1(InjectTouchEvent, void(const protocol::TouchEvent& event));
118 MOCK_METHOD1(StartPtr,
119 void(protocol::ClipboardStub* client_clipboard));
121 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard);
123 private:
124 DISALLOW_COPY_AND_ASSIGN(MockInputInjector);
127 class MockHostStatusObserver : public HostStatusObserver {
128 public:
129 MockHostStatusObserver();
130 ~MockHostStatusObserver() override;
132 MOCK_METHOD1(OnAccessDenied, void(const std::string& jid));
133 MOCK_METHOD1(OnClientAuthenticated, void(const std::string& jid));
134 MOCK_METHOD1(OnClientConnected, void(const std::string& jid));
135 MOCK_METHOD1(OnClientDisconnected, void(const std::string& jid));
136 MOCK_METHOD3(OnClientRouteChange,
137 void(const std::string& jid,
138 const std::string& channel_name,
139 const protocol::TransportRoute& route));
140 MOCK_METHOD1(OnStart, void(const std::string& xmpp_login));
141 MOCK_METHOD0(OnShutdown, void());
144 class MockGnubbyAuthHandler : public GnubbyAuthHandler {
145 public:
146 MockGnubbyAuthHandler();
147 ~MockGnubbyAuthHandler() override;
149 MOCK_METHOD1(DeliverClientMessage, void(const std::string& message));
150 MOCK_CONST_METHOD2(DeliverHostDataMessage,
151 void(int connection_id, const std::string& data));
153 private:
154 DISALLOW_COPY_AND_ASSIGN(MockGnubbyAuthHandler);
157 class MockMouseCursorMonitor : public webrtc::MouseCursorMonitor {
158 public:
159 MockMouseCursorMonitor();
160 ~MockMouseCursorMonitor() override;
162 MOCK_METHOD2(Init, void(Callback* callback, Mode mode));
163 MOCK_METHOD0(Capture, void());
165 private:
166 DISALLOW_COPY_AND_ASSIGN(MockMouseCursorMonitor);
169 class MockVideoEncoder : public VideoEncoder {
170 public:
171 MockVideoEncoder();
172 ~MockVideoEncoder() override;
174 MOCK_METHOD1(SetLosslessEncode, void(bool));
175 MOCK_METHOD1(SetLosslessColor, void(bool));
176 MOCK_METHOD1(EncodePtr, VideoPacket*(const webrtc::DesktopFrame&));
178 scoped_ptr<VideoPacket> Encode(const webrtc::DesktopFrame& frame) override;
181 } // namespace remoting
183 #endif // REMOTING_HOST_HOST_MOCK_OBJECTS_H_