OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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_C_DEV_PPB_TESTING_DEV_H_ | 5 #ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_TESTING_DEV_H_ | 6 #define PPAPI_C_DEV_PPB_TESTING_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/c/pp_stdint.h" | 11 #include "ppapi/c/pp_stdint.h" |
12 | 12 |
13 struct PP_Point; | 13 struct PP_Point; |
14 | 14 |
15 // TODO(dmichael): Delete support for 0.6. | |
16 #define PPB_TESTING_DEV_INTERFACE_0_6 "PPB_Testing(Dev);0.6" | |
17 #define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7" | 15 #define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7" |
18 #define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7 | 16 #define PPB_TESTING_DEV_INTERFACE_0_8 "PPB_Testing(Dev);0.8" |
| 17 #define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_8 |
19 | 18 |
20 // This interface contains functions used for unit testing. Do not use in | 19 // This interface contains functions used for unit testing. Do not use in |
21 // production code. They are not guaranteed to be available in normal plugin | 20 // production code. They are not guaranteed to be available in normal plugin |
22 // environments so you should not depend on them. | 21 // environments so you should not depend on them. |
23 struct PPB_Testing_Dev { | 22 struct PPB_Testing_Dev { |
24 // Reads the bitmap data out of the backing store for the given | 23 // Reads the bitmap data out of the backing store for the given |
25 // DeviceContext2D and into the given image. If the data was successfully | 24 // DeviceContext2D and into the given image. If the data was successfully |
26 // read, it will return PP_TRUE. | 25 // read, it will return PP_TRUE. |
27 // | 26 // |
28 // This function should not generally be necessary for normal plugin | 27 // This function should not generally be necessary for normal plugin |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void (*QuitMessageLoop)(PP_Instance instance); | 66 void (*QuitMessageLoop)(PP_Instance instance); |
68 | 67 |
69 // Returns the number of live objects (resources + strings + objects) | 68 // Returns the number of live objects (resources + strings + objects) |
70 // associated with this plugin instance. Used for detecting leaks. Returns | 69 // associated with this plugin instance. Used for detecting leaks. Returns |
71 // (uint32_t)-1 on failure. | 70 // (uint32_t)-1 on failure. |
72 uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); | 71 uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); |
73 | 72 |
74 // Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE | 73 // Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE |
75 // otherwise. | 74 // otherwise. |
76 PP_Bool (*IsOutOfProcess)(); | 75 PP_Bool (*IsOutOfProcess)(); |
| 76 |
| 77 // Passes the input event to the renderer, which sends it back to the |
| 78 // plugin. The plugin should implement PPP_InputEvent and register for |
| 79 // the input event type. |
| 80 // |
| 81 // This method sends an input event through the renderer just as if it had |
| 82 // come from the user. If the renderer determines that it is an event for the |
| 83 // plugin, it will be sent to be handled by the plugin's PPP_InputEvent |
| 84 // interface. When generating mouse events, make sure the position is within |
| 85 // the plugin's area on the page. When generating wheel events, make sure to |
| 86 // precede it with a mouse event inside the plugin's area. When generating a |
| 87 // keyboard event, make sure the plugin has focus. |
| 88 // |
| 89 // Note that the renderer may generate extra input events in order to |
| 90 // maintain certain invariants, such as always having a "mouse enter" event |
| 91 // before any other mouse event. Furthermore, the event the plugin receives |
| 92 // after sending a simulated event will be slightly different from the |
| 93 // original event. The renderer will change the timestamp, add modifiers, |
| 94 // and slightly change mouse position, due to the complex coordinate |
| 95 // transforms it performs. |
| 96 void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event); |
| 97 }; |
| 98 |
| 99 struct PPB_Testing_Dev_0_7 { |
| 100 PP_Bool (*ReadImageData)(PP_Resource device_context_2d, |
| 101 PP_Resource image, |
| 102 const struct PP_Point* top_left); |
| 103 void (*RunMessageLoop)(PP_Instance instance); |
| 104 void (*QuitMessageLoop)(PP_Instance instance); |
| 105 uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); |
| 106 PP_Bool (*IsOutOfProcess)(); |
77 }; | 107 }; |
78 | 108 |
79 #endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */ | 109 #endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */ |
80 | 110 |
OLD | NEW |