Fix iOS build for XCode 4.6.
[chromium-blink-merge.git] / ppapi / api / dev / ppb_testing_dev.idl
blob6c0b22b88285886f06323706b930958160975eea
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 */
6 /**
7 * This file contains interface functions used for unit testing. Do not use in
8 * production code. They are not guaranteed to be available in normal plugin
9 * environments so you should not depend on them.
12 label Chrome {
13 M14 = 0.7,
14 M15 = 0.8,
15 M17 = 0.9,
16 M18 = 0.91
19 interface PPB_Testing_Dev {
20 /**
21 * Reads the bitmap data out of the backing store for the given
22 * DeviceContext2D and into the given image. If the data was successfully
23 * read, it will return PP_TRUE.
25 * This function should not generally be necessary for normal plugin
26 * operation. If you want to update portions of a device, the expectation is
27 * that you will either regenerate the data, or maintain a backing store
28 * pushing updates to the device from your backing store via PaintImageData.
29 * Using this function will introduce an extra copy which will make your
30 * plugin slower. In some cases, this may be a very expensive operation (it
31 * may require slow cross-process transitions or graphics card readbacks).
33 * Data will be read into the image starting at |top_left| in the device
34 * context, and proceeding down and to the right for as many pixels as the
35 * image is large. If any part of the image bound would fall outside of the
36 * backing store of the device if positioned at |top_left|, this function
37 * will fail and return PP_FALSE.
39 * The image format must be of the format
40 * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and
41 * return PP_FALSE.
43 * The returned image data will represent the current status of the backing
44 * store. This will not include any paint, scroll, or replace operations
45 * that have not yet been flushed; these operations are only reflected in
46 * the backing store (and hence ReadImageData) until after a Flush()
47 * operation has completed.
49 PP_Bool ReadImageData([in] PP_Resource device_context_2d,
50 [in] PP_Resource image,
51 [in] PP_Point top_left);
53 /**
54 * Runs a nested message loop. The plugin will be reentered from this call.
55 * This function is used for unit testing the API. The normal pattern is to
56 * issue some asynchronous call that has a callback. Then you call
57 * RunMessageLoop which will suspend the plugin and go back to processing
58 * messages, giving the asynchronous operation time to complete. In your
59 * callback, you save the data and call QuitMessageLoop, which will then
60 * pop back up and continue with the test. This avoids having to write a
61 * complicated state machine for simple tests for asynchronous APIs.
63 void RunMessageLoop([in] PP_Instance instance);
65 /**
66 * Posts a quit message for the outermost nested message loop. Use this to
67 * exit and return back to the caller after you call RunMessageLoop.
69 void QuitMessageLoop([in] PP_Instance instance);
71 /**
72 * Returns the number of live objects (resources + strings + objects)
73 * associated with this plugin instance. Used for detecting leaks. Returns
74 * (uint32_t)-1 on failure.
76 uint32_t GetLiveObjectsForInstance([in] PP_Instance instance);
78 /**
79 * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE
80 * otherwise.
82 PP_Bool IsOutOfProcess();
84 /**
85 * Passes the input event to the browser, which sends it back to the
86 * plugin. The plugin should implement PPP_InputEvent and register for
87 * the input event type.
89 * This method sends an input event through the browser just as if it had
90 * come from the user. If the browser determines that it is an event for the
91 * plugin, it will be sent to be handled by the plugin's PPP_InputEvent
92 * interface. When generating mouse events, make sure the position is within
93 * the plugin's area on the page. When generating a keyboard event, make sure
94 * the plugin is focused.
96 * Note that the browser may generate extra input events in order to
97 * maintain certain invariants, such as always having a "mouse enter" event
98 * before any other mouse event. Furthermore, the event the plugin receives
99 * after sending a simulated event will be slightly different from the
100 * original event. The browser may change the timestamp, add modifiers, and
101 * slightly alter the mouse position, due to coordinate transforms it
102 * performs.
104 [version=0.8]
105 void SimulateInputEvent([in] PP_Instance instance,
106 [in] PP_Resource input_event);
109 * Returns the URL for the document. This is a safe way to retrieve
110 * window.location.href.
111 * If the canonicalized URL is valid, the method will parse the URL
112 * and fill in the components structure. This pointer may be NULL
113 * to specify that no component information is necessary.
115 [version=0.9]
116 PP_Var GetDocumentURL([in] PP_Instance instance,
117 [out] PP_URLComponents_Dev components);
120 * Fetches up to |array_size| active PP_Vars in the tracker. Returns the
121 * number of vars in the tracker. The active vars are written to |live_vars|
122 * contiguously starting at index 0. The vars are not in any particular order.
123 * If the number of live vars is greater than |array_size|, then an arbitrary
124 * subset of |array_size| vars is written to |live_vars|. The reference count
125 * of the returned PP_Vars will *not* be affected by this call.
127 [version=0.91]
128 uint32_t GetLiveVars([size_as=array_size] PP_Var[] live_vars,
129 [in] uint32_t array_size);