OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_HOST_FAKE_HOST_EXTENSION_H_ | 5 #ifndef REMOTING_HOST_FAKE_HOST_EXTENSION_H_ |
6 #define REMOTING_HOST_FAKE_HOST_EXTENSION_H_ | 6 #define REMOTING_HOST_FAKE_HOST_EXTENSION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "remoting/host/host_extension.h" | 11 #include "remoting/host/host_extension.h" |
12 | 12 |
13 namespace remoting { | 13 namespace remoting { |
14 | 14 |
15 class ClientSessionControl; | 15 class ClientSessionControl; |
| 16 class ClientSessionDetails; |
16 class HostExtensionSession; | 17 class HostExtensionSession; |
17 | 18 |
18 namespace protocol { | 19 namespace protocol { |
19 class ClientStub; | 20 class ClientStub; |
20 } | 21 } |
21 | 22 |
22 // |HostExtension| implementation that can report a specified capability, and | 23 // |HostExtension| implementation that can report a specified capability, and |
23 // reports messages matching a specified type as having been handled. | 24 // reports messages matching a specified type as having been handled. |
24 class FakeExtension : public HostExtension { | 25 class FakeExtension : public HostExtension { |
25 public: | 26 public: |
26 FakeExtension(const std::string& message_type, | 27 FakeExtension(const std::string& message_type, |
27 const std::string& capability); | 28 const std::string& capability); |
28 ~FakeExtension() override; | 29 ~FakeExtension() override; |
29 | 30 |
30 // HostExtension interface. | 31 // HostExtension interface. |
31 std::string capability() const override; | 32 std::string capability() const override; |
32 std::unique_ptr<HostExtensionSession> CreateExtensionSession( | 33 std::unique_ptr<HostExtensionSession> CreateExtensionSession( |
33 ClientSessionControl* client_session_control, | 34 ClientSessionControl* client_session_control, |
| 35 ClientSessionDetails* client_session_details, |
34 protocol::ClientStub* client_stub) override; | 36 protocol::ClientStub* client_stub) override; |
35 | 37 |
36 // Accessors for testing. | 38 // Accessors for testing. |
37 bool has_handled_message() const { return has_handled_message_; } | 39 bool has_handled_message() const { return has_handled_message_; } |
38 bool was_instantiated() const { return was_instantiated_; } | 40 bool was_instantiated() const { return was_instantiated_; } |
39 | 41 |
40 private: | 42 private: |
41 class Session; | 43 class Session; |
42 friend class Session; | 44 friend class Session; |
43 | 45 |
44 // The type name of extension messages that this fake consumes. | 46 // The type name of extension messages that this fake consumes. |
45 std::string message_type_; | 47 std::string message_type_; |
46 | 48 |
47 // The capability this fake reports, and requires clients to support, if any. | 49 // The capability this fake reports, and requires clients to support, if any. |
48 std::string capability_; | 50 std::string capability_; |
49 | 51 |
50 // True if a message of |message_type_| has been processed by this extension. | 52 // True if a message of |message_type_| has been processed by this extension. |
51 bool has_handled_message_ = false; | 53 bool has_handled_message_ = false; |
52 | 54 |
53 // True if CreateExtensionSession() was called on this extension. | 55 // True if CreateExtensionSession() was called on this extension. |
54 bool was_instantiated_ = false; | 56 bool was_instantiated_ = false; |
55 | 57 |
56 DISALLOW_COPY_AND_ASSIGN(FakeExtension); | 58 DISALLOW_COPY_AND_ASSIGN(FakeExtension); |
57 }; | 59 }; |
58 | 60 |
59 } // namespace remoting | 61 } // namespace remoting |
60 | 62 |
61 #endif // REMOTING_HOST_FAKE_HOST_EXTENSION_H_ | 63 #endif // REMOTING_HOST_FAKE_HOST_EXTENSION_H_ |
OLD | NEW |