Remove dependency on content from remoting_host.
[chromium-blink-merge.git] / remoting / host / fake_host_extension.h
bloba50daa92fb7820eae60d9276516986f7b3f4ce51
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.
5 #ifndef REMOTING_HOST_FAKE_HOST_EXTENSION_H_
6 #define REMOTING_HOST_FAKE_HOST_EXTENSION_H_
8 #include <string>
10 #include "remoting/host/host_extension.h"
12 namespace remoting {
14 class ClientSessionControl;
15 class HostExtensionSession;
17 namespace protocol {
18 class ClientStub;
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 ~FakeExtension() override;
29 // HostExtension interface.
30 std::string capability() const override;
31 scoped_ptr<HostExtensionSession> CreateExtensionSession(
32 ClientSessionControl* client_session_control,
33 protocol::ClientStub* client_stub) override;
35 // Controls for testing.
36 void set_steal_video_capturer(bool steal_video_capturer) {
37 steal_video_capturer_ = steal_video_capturer;
40 // Accessors for testing.
41 bool has_handled_message() const { return has_handled_message_; }
42 bool has_wrapped_video_encoder() const { return has_wrapped_video_encoder_; }
43 bool has_wrapped_video_capturer() const {
44 return has_wrapped_video_capturer_;
46 bool was_instantiated() const { return was_instantiated_; }
48 private:
49 class Session;
50 friend class Session;
52 // The type name of extension messages that this fake consumes.
53 std::string message_type_;
55 // The capability this fake reports, and requires clients to support, if any.
56 std::string capability_;
58 // True if this extension should intercept creation of the session's video
59 // capturer and consume it, preventing the video pipeline being created.
60 bool steal_video_capturer_;
62 // True if a message of |message_type_| has been processed by this extension.
63 bool has_handled_message_;
65 // True if this extension had the opportunity to modify the video pipeline.
66 bool has_wrapped_video_encoder_;
67 bool has_wrapped_video_capturer_;
69 // True if CreateExtensionSession() was called on this extension.
70 bool was_instantiated_;
72 DISALLOW_COPY_AND_ASSIGN(FakeExtension);
75 } // namespace remoting
77 #endif // REMOTING_HOST_FAKE_HOST_EXTENSION_H_