• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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.
4 
5 #ifndef REMOTING_HOST_FAKE_DESKTOP_ENVIRONMENT_H_
6 #define REMOTING_HOST_FAKE_DESKTOP_ENVIRONMENT_H_
7 
8 #include "remoting/host/desktop_environment.h"
9 #include "remoting/host/fake_desktop_capturer.h"
10 #include "remoting/host/fake_mouse_cursor_monitor.h"
11 #include "remoting/host/input_injector.h"
12 #include "remoting/host/screen_controls.h"
13 
14 namespace remoting {
15 
16 class FakeInputInjector : public InputInjector {
17  public:
18   FakeInputInjector();
19   virtual ~FakeInputInjector();
20 
21   virtual void Start(
22       scoped_ptr<protocol::ClipboardStub> client_clipboard) OVERRIDE;
23   virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE;
24   virtual void InjectTextEvent(const protocol::TextEvent& event) OVERRIDE;
25   virtual void InjectMouseEvent(const protocol::MouseEvent& event) OVERRIDE;
26   virtual void InjectClipboardEvent(
27       const protocol::ClipboardEvent& event) OVERRIDE;
28 };
29 
30 class FakeScreenControls : public ScreenControls {
31  public:
32   FakeScreenControls();
33   virtual ~FakeScreenControls();
34 
35   // ScreenControls implementation.
36   virtual void SetScreenResolution(const ScreenResolution& resolution) OVERRIDE;
37 };
38 
39 class FakeDesktopEnvironment : public DesktopEnvironment {
40  public:
41   FakeDesktopEnvironment();
42   virtual ~FakeDesktopEnvironment();
43 
44   // Sets frame generator to be used for FakeDesktopCapturer created by
45   // FakeDesktopEnvironment.
set_frame_generator(FakeDesktopCapturer::FrameGenerator frame_generator)46   void set_frame_generator(
47       FakeDesktopCapturer::FrameGenerator frame_generator) {
48     frame_generator_ = frame_generator;
49   }
50 
51   // DesktopEnvironment implementation.
52   virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE;
53   virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE;
54   virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE;
55   virtual scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer() OVERRIDE;
56   virtual scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor()
57       OVERRIDE;
58   virtual std::string GetCapabilities() const OVERRIDE;
59   virtual void SetCapabilities(const std::string& capabilities) OVERRIDE;
60   virtual scoped_ptr<GnubbyAuthHandler> CreateGnubbyAuthHandler(
61       protocol::ClientStub* client_stub) OVERRIDE;
62 
63  private:
64   FakeDesktopCapturer::FrameGenerator frame_generator_;
65 
66   DISALLOW_COPY_AND_ASSIGN(FakeDesktopEnvironment);
67 };
68 
69 class FakeDesktopEnvironmentFactory : public DesktopEnvironmentFactory {
70  public:
71   FakeDesktopEnvironmentFactory();
72   virtual ~FakeDesktopEnvironmentFactory();
73 
74   // Sets frame generator to be used for FakeDesktopCapturer created by
75   // FakeDesktopEnvironment.
set_frame_generator(FakeDesktopCapturer::FrameGenerator frame_generator)76   void set_frame_generator(
77       FakeDesktopCapturer::FrameGenerator frame_generator) {
78     frame_generator_ = frame_generator;
79   }
80 
81   // DesktopEnvironmentFactory implementation.
82   virtual scoped_ptr<DesktopEnvironment> Create(
83       base::WeakPtr<ClientSessionControl> client_session_control) OVERRIDE;
84   virtual void SetEnableCurtaining(bool enable) OVERRIDE;
85   virtual bool SupportsAudioCapture() const OVERRIDE;
86   virtual void SetEnableGnubbyAuth(bool enable) OVERRIDE;
87 
88  private:
89   FakeDesktopCapturer::FrameGenerator frame_generator_;
90 
91   DISALLOW_COPY_AND_ASSIGN(FakeDesktopEnvironmentFactory);
92 };
93 
94 }  // namespace remoting
95 
96 #endif  // REMOTING_HOST_FAKE_DESKTOP_ENVIRONMENT_H_
97