OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ | 5 #ifndef PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ |
6 #define PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ | 6 #define PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ |
7 | 7 |
8 #include "ipc/ipc_listener.h" | 8 #include "ipc/ipc_listener.h" |
9 #include "ipc/ipc_test_sink.h" | 9 #include "ipc/ipc_test_sink.h" |
10 #include "ppapi/c/pp_stdint.h" | 10 #include "ppapi/c/pp_stdint.h" |
11 | 11 |
12 namespace ppapi { | 12 namespace ppapi { |
13 namespace proxy { | 13 namespace proxy { |
14 | 14 |
15 class ResourceMessageCallParams; | 15 class ResourceMessageCallParams; |
16 class ResourceMessageReplyParams; | 16 class ResourceMessageReplyParams; |
17 class SerializedHandle; | 17 class SerializedHandle; |
18 | 18 |
19 // Extends IPC::TestSink to add extra capabilities for searching for and | 19 // Extends IPC::TestSink to add extra capabilities for searching for and |
20 // decoding resource messages. | 20 // decoding resource messages. |
21 class ResourceMessageTestSink : public IPC::TestSink { | 21 class ResourceMessageTestSink : public IPC::TestSink { |
22 public: | 22 public: |
23 ResourceMessageTestSink(); | 23 ResourceMessageTestSink(); |
24 virtual ~ResourceMessageTestSink(); | 24 virtual ~ResourceMessageTestSink(); |
25 | 25 |
26 // IPC::TestSink. | 26 // IPC::TestSink. |
27 // Overridden to handle sync messages. | 27 // Overridden to handle sync messages. |
28 virtual bool Send(IPC::Message* msg) OVERRIDE; | 28 virtual bool Send(IPC::Message* msg) override; |
29 | 29 |
30 // Sets the reply message that will be returned to the next sync message sent. | 30 // Sets the reply message that will be returned to the next sync message sent. |
31 // This test sink owns any reply messages passed into this method. | 31 // This test sink owns any reply messages passed into this method. |
32 void SetSyncReplyMessage(IPC::Message* reply_msg); | 32 void SetSyncReplyMessage(IPC::Message* reply_msg); |
33 | 33 |
34 // Searches the queue for the first resource call message with a nested | 34 // Searches the queue for the first resource call message with a nested |
35 // message matching the given ID. On success, returns true and populates the | 35 // message matching the given ID. On success, returns true and populates the |
36 // given params and nested message. | 36 // given params and nested message. |
37 bool GetFirstResourceCallMatching( | 37 bool GetFirstResourceCallMatching( |
38 uint32 id, | 38 uint32 id, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // sink().RemoveFilter(&handler); | 78 // sink().RemoveFilter(&handler); |
79 class ResourceSyncCallHandler : public IPC::Listener { | 79 class ResourceSyncCallHandler : public IPC::Listener { |
80 public: | 80 public: |
81 ResourceSyncCallHandler(ResourceMessageTestSink* test_sink, | 81 ResourceSyncCallHandler(ResourceMessageTestSink* test_sink, |
82 uint32 incoming_type, | 82 uint32 incoming_type, |
83 int32_t result, | 83 int32_t result, |
84 const IPC::Message& reply_msg); | 84 const IPC::Message& reply_msg); |
85 virtual ~ResourceSyncCallHandler(); | 85 virtual ~ResourceSyncCallHandler(); |
86 | 86 |
87 // IPC::Listener. | 87 // IPC::Listener. |
88 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 88 virtual bool OnMessageReceived(const IPC::Message& message) override; |
89 | 89 |
90 IPC::Message last_handled_msg() { return last_handled_msg_; } | 90 IPC::Message last_handled_msg() { return last_handled_msg_; } |
91 | 91 |
92 // Sets a handle to be appended to the ReplyParams. The pointer is owned by | 92 // Sets a handle to be appended to the ReplyParams. The pointer is owned by |
93 // the caller. | 93 // the caller. |
94 void set_serialized_handle(const SerializedHandle* serialized_handle) { | 94 void set_serialized_handle(const SerializedHandle* serialized_handle) { |
95 serialized_handle_ = serialized_handle; | 95 serialized_handle_ = serialized_handle; |
96 } | 96 } |
97 | 97 |
98 private: | 98 private: |
99 ResourceMessageTestSink* test_sink_; | 99 ResourceMessageTestSink* test_sink_; |
100 uint32 incoming_type_; | 100 uint32 incoming_type_; |
101 int32_t result_; | 101 int32_t result_; |
102 const SerializedHandle* serialized_handle_; // Non-owning pointer. | 102 const SerializedHandle* serialized_handle_; // Non-owning pointer. |
103 IPC::Message reply_msg_; | 103 IPC::Message reply_msg_; |
104 IPC::Message last_handled_msg_; | 104 IPC::Message last_handled_msg_; |
105 }; | 105 }; |
106 | 106 |
107 } // namespace proxy | 107 } // namespace proxy |
108 } // namespace ppapi | 108 } // namespace ppapi |
109 | 109 |
110 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ | 110 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ |
OLD | NEW |