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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // |HostExtension| implementation that can report a specified capability, and | 22 // |HostExtension| implementation that can report a specified capability, and |
23 // reports messages matching a specified type as having been handled. | 23 // reports messages matching a specified type as having been handled. |
24 class FakeExtension : public HostExtension { | 24 class FakeExtension : public HostExtension { |
25 public: | 25 public: |
26 FakeExtension(const std::string& message_type, | 26 FakeExtension(const std::string& message_type, |
27 const std::string& capability); | 27 const std::string& capability); |
28 ~FakeExtension() override; | 28 ~FakeExtension() override; |
29 | 29 |
30 // HostExtension interface. | 30 // HostExtension interface. |
31 std::string capability() const override; | 31 std::string capability() const override; |
32 scoped_ptr<HostExtensionSession> CreateExtensionSession( | 32 std::unique_ptr<HostExtensionSession> CreateExtensionSession( |
33 ClientSessionControl* client_session_control, | 33 ClientSessionControl* client_session_control, |
34 protocol::ClientStub* client_stub) override; | 34 protocol::ClientStub* client_stub) override; |
35 | 35 |
36 // Accessors for testing. | 36 // Accessors for testing. |
37 bool has_handled_message() const { return has_handled_message_; } | 37 bool has_handled_message() const { return has_handled_message_; } |
38 bool was_instantiated() const { return was_instantiated_; } | 38 bool was_instantiated() const { return was_instantiated_; } |
39 | 39 |
40 private: | 40 private: |
41 class Session; | 41 class Session; |
42 friend class Session; | 42 friend class Session; |
43 | 43 |
44 // The type name of extension messages that this fake consumes. | 44 // The type name of extension messages that this fake consumes. |
45 std::string message_type_; | 45 std::string message_type_; |
46 | 46 |
47 // The capability this fake reports, and requires clients to support, if any. | 47 // The capability this fake reports, and requires clients to support, if any. |
48 std::string capability_; | 48 std::string capability_; |
49 | 49 |
50 // True if a message of |message_type_| has been processed by this extension. | 50 // True if a message of |message_type_| has been processed by this extension. |
51 bool has_handled_message_ = false; | 51 bool has_handled_message_ = false; |
52 | 52 |
53 // True if CreateExtensionSession() was called on this extension. | 53 // True if CreateExtensionSession() was called on this extension. |
54 bool was_instantiated_ = false; | 54 bool was_instantiated_ = false; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(FakeExtension); | 56 DISALLOW_COPY_AND_ASSIGN(FakeExtension); |
57 }; | 57 }; |
58 | 58 |
59 } // namespace remoting | 59 } // namespace remoting |
60 | 60 |
61 #endif // REMOTING_HOST_FAKE_HOST_EXTENSION_H_ | 61 #endif // REMOTING_HOST_FAKE_HOST_EXTENSION_H_ |
OLD | NEW |