Pepper_47_C_interfaces
ppb_testing_dev.h
Go to the documentation of this file.
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
3  * found in the LICENSE file.
4  */
5 
6 /* From dev/ppb_testing_dev.idl modified Mon Jan 5 16:44:32 2015. */
7 
8 #ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_
9 #define PPAPI_C_DEV_PPB_TESTING_DEV_H_
10 
12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_point.h"
16 #include "ppapi/c/pp_resource.h"
17 #include "ppapi/c/pp_stdint.h"
18 #include "ppapi/c/pp_var.h"
19 
20 #define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7"
21 #define PPB_TESTING_DEV_INTERFACE_0_8 "PPB_Testing(Dev);0.8"
22 #define PPB_TESTING_DEV_INTERFACE_0_9 "PPB_Testing(Dev);0.9"
23 #define PPB_TESTING_DEV_INTERFACE_0_91 "PPB_Testing(Dev);0.91"
24 #define PPB_TESTING_DEV_INTERFACE_0_92 "PPB_Testing(Dev);0.92"
25 #define PPB_TESTING_DEV_INTERFACE_0_93 "PPB_Testing(Dev);0.93"
26 #define PPB_TESTING_DEV_INTERFACE_0_94 "PPB_Testing(Dev);0.94"
27 #define PPB_TESTING_DEV_INTERFACE_0_95 "PPB_Testing(Dev);0.95"
28 #define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_95
29 
30 /**
31  * @file
32  * This file contains interface functions used for unit testing. Do not use in
33  * production code. They are not guaranteed to be available in normal plugin
34  * environments so you should not depend on them.
35  */
36 
37 
38 /**
39  * @addtogroup Interfaces
40  * @{
41  */
43  /**
44  * Reads the bitmap data out of the backing store for the given
45  * DeviceContext2D and into the given image. If the data was successfully
46  * read, it will return PP_TRUE.
47  *
48  * This function should not generally be necessary for normal plugin
49  * operation. If you want to update portions of a device, the expectation is
50  * that you will either regenerate the data, or maintain a backing store
51  * pushing updates to the device from your backing store via PaintImageData.
52  * Using this function will introduce an extra copy which will make your
53  * plugin slower. In some cases, this may be a very expensive operation (it
54  * may require slow cross-process transitions or graphics card readbacks).
55  *
56  * Data will be read into the image starting at |top_left| in the device
57  * context, and proceeding down and to the right for as many pixels as the
58  * image is large. If any part of the image bound would fall outside of the
59  * backing store of the device if positioned at |top_left|, this function
60  * will fail and return PP_FALSE.
61  *
62  * The image format must be of the format
63  * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and
64  * return PP_FALSE.
65  *
66  * The returned image data will represent the current status of the backing
67  * store. This will not include any paint, scroll, or replace operations
68  * that have not yet been flushed; these operations are only reflected in
69  * the backing store (and hence ReadImageData) until after a Flush()
70  * operation has completed.
71  */
72  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
73  PP_Resource image,
74  const struct PP_Point* top_left);
75  /**
76  * Runs a nested message loop. The plugin will be reentered from this call.
77  * This function is used for unit testing the API. The normal pattern is to
78  * issue some asynchronous call that has a callback. Then you call
79  * RunMessageLoop which will suspend the plugin and go back to processing
80  * messages, giving the asynchronous operation time to complete. In your
81  * callback, you save the data and call QuitMessageLoop, which will then
82  * pop back up and continue with the test. This avoids having to write a
83  * complicated state machine for simple tests for asynchronous APIs.
84  */
85  void (*RunMessageLoop)(PP_Instance instance);
86  /**
87  * Posts a quit message for the outermost nested message loop. Use this to
88  * exit and return back to the caller after you call RunMessageLoop.
89  */
90  void (*QuitMessageLoop)(PP_Instance instance);
91  /**
92  * Returns the number of live objects (resources + strings + objects)
93  * associated with this plugin instance. Used for detecting leaks. Returns
94  * (uint32_t)-1 on failure.
95  */
96  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
97  /**
98  * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE
99  * otherwise.
100  */
102  /**
103  * Passes the input event to the browser, which sends it back to the
104  * plugin. The plugin should implement PPP_InputEvent and register for
105  * the input event type.
106  *
107  * This method sends an input event through the browser just as if it had
108  * come from the user. If the browser determines that it is an event for the
109  * plugin, it will be sent to be handled by the plugin's PPP_InputEvent
110  * interface. When generating mouse events, make sure the position is within
111  * the plugin's area on the page. When generating a keyboard event, make sure
112  * the plugin is focused.
113  *
114  * Note that the browser may generate extra input events in order to
115  * maintain certain invariants, such as always having a "mouse enter" event
116  * before any other mouse event. Furthermore, the event the plugin receives
117  * after sending a simulated event will be slightly different from the
118  * original event. The browser may change the timestamp, add modifiers, and
119  * slightly alter the mouse position, due to coordinate transforms it
120  * performs.
121  */
122  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
123  /**
124  * Returns the URL for the document. This is a safe way to retrieve
125  * window.location.href.
126  * If the canonicalized URL is valid, the method will parse the URL
127  * and fill in the components structure. This pointer may be NULL
128  * to specify that no component information is necessary.
129  */
130  struct PP_Var (*GetDocumentURL)(PP_Instance instance,
131  struct PP_URLComponents_Dev* components);
132  /**
133  * Fetches up to |array_size| active PP_Vars in the tracker. Returns the
134  * number of vars in the tracker. The active vars are written to |live_vars|
135  * contiguously starting at index 0. The vars are not in any particular order.
136  * If the number of live vars is greater than |array_size|, then an arbitrary
137  * subset of |array_size| vars is written to |live_vars|. The reference count
138  * of the returned PP_Vars will *not* be affected by this call.
139  */
140  uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
141  /**
142  * Sets the threshold size at which point we switch from transmitting
143  * array buffers in IPC messages to using shared memory. This is only used
144  * for testing purposes where we need to transmit small buffers using shmem
145  * (in order to have fast tests). Passing a value of 0 resets the threshold
146  * to its default. The threshold is in bytes.
147  */
149  uint32_t threshold);
150  struct PP_Var (*ListDirectory)(PP_Instance instance, struct PP_Var path);
151  struct PP_Var (*ReadFile)(PP_Instance instance, struct PP_Var path);
152  struct PP_Var (*ReadSymbolicLink)(PP_Instance instance, struct PP_Var path);
153  void (*LoseContext)(PP_Instance instance);
154  void (*EnableTestingServices)(PP_Resource service_list);
155 };
156 
158 
160  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
161  PP_Resource image,
162  const struct PP_Point* top_left);
163  void (*RunMessageLoop)(PP_Instance instance);
164  void (*QuitMessageLoop)(PP_Instance instance);
165  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
167 };
168 
170  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
171  PP_Resource image,
172  const struct PP_Point* top_left);
173  void (*RunMessageLoop)(PP_Instance instance);
174  void (*QuitMessageLoop)(PP_Instance instance);
175  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
177  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
178 };
179 
181  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
182  PP_Resource image,
183  const struct PP_Point* top_left);
184  void (*RunMessageLoop)(PP_Instance instance);
185  void (*QuitMessageLoop)(PP_Instance instance);
186  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
188  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
189  struct PP_Var (*GetDocumentURL)(PP_Instance instance,
190  struct PP_URLComponents_Dev* components);
191 };
192 
194  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
195  PP_Resource image,
196  const struct PP_Point* top_left);
197  void (*RunMessageLoop)(PP_Instance instance);
198  void (*QuitMessageLoop)(PP_Instance instance);
199  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
201  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
202  struct PP_Var (*GetDocumentURL)(PP_Instance instance,
203  struct PP_URLComponents_Dev* components);
204  uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
205 };
206 
208  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
209  PP_Resource image,
210  const struct PP_Point* top_left);
211  void (*RunMessageLoop)(PP_Instance instance);
212  void (*QuitMessageLoop)(PP_Instance instance);
213  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
215  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
216  struct PP_Var (*GetDocumentURL)(PP_Instance instance,
217  struct PP_URLComponents_Dev* components);
218  uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
220  uint32_t threshold);
221 };
222 
224  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
225  PP_Resource image,
226  const struct PP_Point* top_left);
227  void (*RunMessageLoop)(PP_Instance instance);
228  void (*QuitMessageLoop)(PP_Instance instance);
229  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
231  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
232  struct PP_Var (*GetDocumentURL)(PP_Instance instance,
233  struct PP_URLComponents_Dev* components);
234  uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
236  uint32_t threshold);
237  struct PP_Var (*ListDirectory)(PP_Instance instance, struct PP_Var path);
238  struct PP_Var (*ReadFile)(PP_Instance instance, struct PP_Var path);
239  struct PP_Var (*ReadSymbolicLink)(PP_Instance instance, struct PP_Var path);
240 };
241 
243  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
244  PP_Resource image,
245  const struct PP_Point* top_left);
246  void (*RunMessageLoop)(PP_Instance instance);
247  void (*QuitMessageLoop)(PP_Instance instance);
248  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
250  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
251  struct PP_Var (*GetDocumentURL)(PP_Instance instance,
252  struct PP_URLComponents_Dev* components);
253  uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
255  uint32_t threshold);
256  struct PP_Var (*ListDirectory)(PP_Instance instance, struct PP_Var path);
257  struct PP_Var (*ReadFile)(PP_Instance instance, struct PP_Var path);
258  struct PP_Var (*ReadSymbolicLink)(PP_Instance instance, struct PP_Var path);
259  void (*LoseContext)(PP_Instance instance);
260 };
261 /**
262  * @}
263  */
264 
265 #endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */
266 
struct PP_Var(* ReadFile)(PP_Instance instance, struct PP_Var path)
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)
struct PP_Var(* ReadFile)(PP_Instance instance, struct PP_Var path)
void(* SetMinimumArrayBufferSizeForShmem)(PP_Instance instance, uint32_t threshold)
struct PP_Var(* ListDirectory)(PP_Instance instance, struct PP_Var path)
struct PP_Var(* GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev *components)
void(* QuitMessageLoop)(PP_Instance instance)
void(* SetMinimumArrayBufferSizeForShmem)(PP_Instance instance, uint32_t threshold)
PP_Bool(* IsOutOfProcess)(void)
void(* SetMinimumArrayBufferSizeForShmem)(PP_Instance instance, uint32_t threshold)
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
void(* RunMessageLoop)(PP_Instance instance)
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
PP_Bool(* IsOutOfProcess)(void)
void(* LoseContext)(PP_Instance instance)
PP_Bool(* IsOutOfProcess)(void)
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
void(* QuitMessageLoop)(PP_Instance instance)
struct PP_Var(* GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev *components)
PP_Bool(* IsOutOfProcess)(void)
void(* RunMessageLoop)(PP_Instance instance)
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)
void(* QuitMessageLoop)(PP_Instance instance)
struct PP_Var(* GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev *components)
int32_t PP_Resource
Definition: pp_resource.h:40
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
void(* LoseContext)(PP_Instance instance)
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
void(* RunMessageLoop)(PP_Instance instance)
void(* RunMessageLoop)(PP_Instance instance)
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
PP_Bool(* IsOutOfProcess)(void)
struct PP_Var(* GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev *components)
struct PP_Var(* ReadSymbolicLink)(PP_Instance instance, struct PP_Var path)
struct PP_Var(* ListDirectory)(PP_Instance instance, struct PP_Var path)
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)
void(* RunMessageLoop)(PP_Instance instance)
void(* QuitMessageLoop)(PP_Instance instance)
struct PP_Var(* ReadSymbolicLink)(PP_Instance instance, struct PP_Var path)
struct PP_Var(* ListDirectory)(PP_Instance instance, struct PP_Var path)
void(* QuitMessageLoop)(PP_Instance instance)
struct PP_Var(* ReadSymbolicLink)(PP_Instance instance, struct PP_Var path)
uint32_t(* GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size)
void(* SetMinimumArrayBufferSizeForShmem)(PP_Instance instance, uint32_t threshold)
PP_Bool(* IsOutOfProcess)(void)
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
struct PP_Var(* ReadFile)(PP_Instance instance, struct PP_Var path)
void(* EnableTestingServices)(PP_Resource service_list)
Definition: pp_var.h:166
uint32_t(* GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size)
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
uint32_t(* GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size)
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
int32_t PP_Instance
Definition: pp_instance.h:34
void(* RunMessageLoop)(PP_Instance instance)
void(* QuitMessageLoop)(PP_Instance instance)
PP_Bool(* IsOutOfProcess)(void)
void(* QuitMessageLoop)(PP_Instance instance)
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)
PP_Bool(* IsOutOfProcess)(void)
uint32_t(* GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size)
void(* RunMessageLoop)(PP_Instance instance)
struct PP_Var(* GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev *components)
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)
void(* QuitMessageLoop)(PP_Instance instance)
PP_Bool
Definition: pp_bool.h:30
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)
struct PP_Var(* GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev *components)
uint32_t(* GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size)
PP_Bool(* ReadImageData)(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point *top_left)
void(* RunMessageLoop)(PP_Instance instance)
uint32_t(* GetLiveObjectsForInstance)(PP_Instance instance)