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" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 typedef std::pair<ResourceMessageCallParams, IPC::Message> ResourceCall; | 48 typedef std::pair<ResourceMessageCallParams, IPC::Message> ResourceCall; |
49 typedef std::vector<ResourceCall> ResourceCallVector; | 49 typedef std::vector<ResourceCall> ResourceCallVector; |
50 ResourceCallVector GetAllResourceCallsMatching(uint32_t id); | 50 ResourceCallVector GetAllResourceCallsMatching(uint32_t id); |
51 | 51 |
52 // Like GetAllResourceCallsMatching except for replies. | 52 // Like GetAllResourceCallsMatching except for replies. |
53 typedef std::pair<ResourceMessageReplyParams, IPC::Message> ResourceReply; | 53 typedef std::pair<ResourceMessageReplyParams, IPC::Message> ResourceReply; |
54 typedef std::vector<ResourceReply> ResourceReplyVector; | 54 typedef std::vector<ResourceReply> ResourceReplyVector; |
55 ResourceReplyVector GetAllResourceRepliesMatching(uint32_t id); | 55 ResourceReplyVector GetAllResourceRepliesMatching(uint32_t id); |
56 | 56 |
57 private: | 57 private: |
58 scoped_ptr<IPC::Message> sync_reply_msg_; | 58 std::unique_ptr<IPC::Message> sync_reply_msg_; |
59 }; | 59 }; |
60 | 60 |
61 // This is a message handler which generates reply messages for synchronous | 61 // This is a message handler which generates reply messages for synchronous |
62 // resource calls. This allows unit testing of the plugin side of resources | 62 // resource calls. This allows unit testing of the plugin side of resources |
63 // which send sync messages. If you want to reply to a sync message type named | 63 // which send sync messages. If you want to reply to a sync message type named |
64 // |PpapiHostMsg_X_Y| with |PpapiPluginMsg_X_YReply| then usage would be as | 64 // |PpapiHostMsg_X_Y| with |PpapiPluginMsg_X_YReply| then usage would be as |
65 // follows (from within |PluginProxyTest|s): | 65 // follows (from within |PluginProxyTest|s): |
66 // | 66 // |
67 // PpapiHostMsg_X_YReply my_reply; | 67 // PpapiHostMsg_X_YReply my_reply; |
68 // ResourceSyncCallHandler handler(&sink(), | 68 // ResourceSyncCallHandler handler(&sink(), |
(...skipping 30 matching lines...) Expand all Loading... |
99 int32_t result_; | 99 int32_t result_; |
100 const SerializedHandle* serialized_handle_; // Non-owning pointer. | 100 const SerializedHandle* serialized_handle_; // Non-owning pointer. |
101 IPC::Message reply_msg_; | 101 IPC::Message reply_msg_; |
102 IPC::Message last_handled_msg_; | 102 IPC::Message last_handled_msg_; |
103 }; | 103 }; |
104 | 104 |
105 } // namespace proxy | 105 } // namespace proxy |
106 } // namespace ppapi | 106 } // namespace ppapi |
107 | 107 |
108 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ | 108 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_TEST_SINK_H_ |
OLD | NEW |