Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / remoting / host / fake_host_extension.h
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_HOST_EXTENSION_H_
6 #define REMOTING_HOST_FAKE_HOST_EXTENSION_H_
7
8 #include <string>
9
10 #include "remoting/host/host_extension.h"
11
12 namespace remoting {
13
14 class ClientSessionControl;
15 class HostExtensionSession;
16
17 namespace protocol {
18 class ClientStub;
19 }
20
21 // |HostExtension| implementation that can report a specified capability, and
22 // reports messages matching a specified type as having been handled.
23 class FakeExtension : public HostExtension {
24  public:
25   FakeExtension(const std::string& message_type,
26                 const std::string& capability);
27   virtual ~FakeExtension();
28
29   // HostExtension interface.
30   virtual std::string capability() const OVERRIDE;
31   virtual scoped_ptr<HostExtensionSession> CreateExtensionSession(
32       ClientSessionControl* client_session_control,
33       protocol::ClientStub* client_stub) OVERRIDE;
34
35   // Controls for testing.
36   void set_steal_video_capturer(bool steal_video_capturer);
37
38   // Accessors for testing.
39   bool has_handled_message();
40   bool has_wrapped_video_encoder();
41   bool has_wrapped_video_capturer();
42   bool was_instantiated() { return was_instantiated_; }
43
44  private:
45   class Session;
46   friend class Session;
47
48   std::string message_type_;
49   std::string capability_;
50
51   bool steal_video_capturer_;
52
53   bool has_handled_message_;
54   bool has_wrapped_video_encoder_;
55   bool has_wrapped_video_capturer_;
56   bool was_instantiated_;
57
58   DISALLOW_COPY_AND_ASSIGN(FakeExtension);
59 };
60
61 } // namespace remoting
62
63 #endif  // REMOTING_HOST_FAKE_HOST_EXTENSION_H_