Pepper_47_C_interfaces
ppb_testing_samsung.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Samsung Electronics, Visual Display Division.
3  * All Rights Reserved.
4  *
5  * This source code is written basing on the Chromium source code.
6  *
7  * Copyright (c) 2013 The Chromium Authors. All rights reserved.
8  *
9  * Use of this source code is governed by a BSD-style license that can be
10  * found in the Chromium-LICENSE file.
11  */
12 
13 /* From samsung/ppb_testing_samsung.idl modified Mon Sep 19 15:21:41 2016. */
14 
15 #ifndef PPAPI_C_SAMSUNG_PPB_TESTING_SAMSUNG_H_
16 #define PPAPI_C_SAMSUNG_PPB_TESTING_SAMSUNG_H_
17 
19 #include "ppapi/c/pp_bool.h"
20 #include "ppapi/c/pp_instance.h"
21 #include "ppapi/c/pp_macros.h"
22 #include "ppapi/c/pp_point.h"
23 #include "ppapi/c/pp_resource.h"
24 #include "ppapi/c/pp_stdint.h"
25 #include "ppapi/c/pp_var.h"
26 
27 #define PPB_TESTING_SAMSUNG_INTERFACE_1_0 "PPB_Testing_Samsung;1.0"
28 #define PPB_TESTING_SAMSUNG_INTERFACE PPB_TESTING_SAMSUNG_INTERFACE_1_0
29 
30 /**
31  * @file
32  * This file contains interface functions used for unit testing.
33  */
34 
35 
36 /**
37  * @addtogroup Interfaces
38  * @{
39  */
41  /**
42  * Reads the bitmap data out of the backing store for the given
43  * DeviceContext2D and into the given image. If the data was successfully
44  * read, it will return PP_TRUE.
45  *
46  * This function should not generally be necessary for normal plugin
47  * operation. If you want to update portions of a device, the expectation is
48  * that you will either regenerate the data, or maintain a backing store
49  * pushing updates to the device from your backing store via PaintImageData.
50  * Using this function will introduce an extra copy which will make your
51  * plugin slower. In some cases, this may be a very expensive operation (it
52  * may require slow cross-process transitions or graphics card readbacks).
53  *
54  * Data will be read into the image starting at |top_left| in the device
55  * context, and proceeding down and to the right for as many pixels as the
56  * image is large. If any part of the image bound would fall outside of the
57  * backing store of the device if positioned at |top_left|, this function
58  * will fail and return PP_FALSE.
59  *
60  * The image format must be of the format
61  * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and
62  * return PP_FALSE.
63  *
64  * The returned image data will represent the current status of the backing
65  * store. This will not include any paint, scroll, or replace operations
66  * that have not yet been flushed; these operations are only reflected in
67  * the backing store (and hence ReadImageData) until after a Flush()
68  * operation has completed.
69  */
70  PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
71  PP_Resource image,
72  const struct PP_Point* top_left);
73  /**
74  * Runs a nested message loop. The plugin will be reentered from this call.
75  * This function is used for unit testing the API. The normal pattern is to
76  * issue some asynchronous call that has a callback. Then you call
77  * RunMessageLoop which will suspend the plugin and go back to processing
78  * messages, giving the asynchronous operation time to complete. In your
79  * callback, you save the data and call QuitMessageLoop, which will then
80  * pop back up and continue with the test. This avoids having to write a
81  * complicated state machine for simple tests for asynchronous APIs.
82  */
83  void (*RunMessageLoop)(PP_Instance instance);
84  /**
85  * Posts a quit message for the outermost nested message loop. Use this to
86  * exit and return back to the caller after you call RunMessageLoop.
87  */
88  void (*QuitMessageLoop)(PP_Instance instance);
89  /**
90  * Returns the number of live objects (resources + strings + objects)
91  * associated with this plugin instance. Used for detecting leaks. Returns
92  * (uint32_t)-1 on failure.
93  */
94  uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
95  /**
96  * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE
97  * otherwise.
98  */
100  /**
101  * Posts the plugin's current Power Saver status to JavaScript. The plugin
102  * itself does not recieve anything. This is not idiomatic for Pepper,
103  * but convenient for testing.
104  */
106  /**
107  * Subscribes to changes to the plugin's Power Saver status. The status
108  * changes are not forwarded to the plugin itself, but posted to JavaScript.
109  * This is not idiomatic for Pepper, but conveienent for testing.
110  */
112  /**
113  * Passes the input event to the browser, which sends it back to the
114  * plugin. The plugin should implement PPP_InputEvent and register for
115  * the input event type.
116  *
117  * This method sends an input event through the browser just as if it had
118  * come from the user. If the browser determines that it is an event for the
119  * plugin, it will be sent to be handled by the plugin's PPP_InputEvent
120  * interface. When generating mouse events, make sure the position is within
121  * the plugin's area on the page. When generating a keyboard event, make sure
122  * the plugin is focused.
123  *
124  * Note that the browser may generate extra input events in order to
125  * maintain certain invariants, such as always having a "mouse enter" event
126  * before any other mouse event. Furthermore, the event the plugin receives
127  * after sending a simulated event will be slightly different from the
128  * original event. The browser may change the timestamp, add modifiers, and
129  * slightly alter the mouse position, due to coordinate transforms it
130  * performs.
131  */
132  void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event);
133  /**
134  * Returns the URL for the document. This is a safe way to retrieve
135  * window.location.href.
136  * If the canonicalized URL is valid, the method will parse the URL
137  * and fill in the components structure. This pointer may be NULL
138  * to specify that no component information is necessary.
139  */
140  struct PP_Var (*GetDocumentURL)(PP_Instance instance,
141  struct PP_URLComponents_Dev* components);
142  /**
143  * Fetches up to |array_size| active PP_Vars in the tracker. Returns the
144  * number of vars in the tracker. The active vars are written to |live_vars|
145  * contiguously starting at index 0. The vars are not in any particular order.
146  * If the number of live vars is greater than |array_size|, then an arbitrary
147  * subset of |array_size| vars is written to |live_vars|. The reference count
148  * of the returned PP_Vars will *not* be affected by this call.
149  */
150  uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size);
151  /**
152  * Sets the threshold size at which point we switch from transmitting
153  * array buffers in IPC messages to using shared memory. This is only used
154  * for testing purposes where we need to transmit small buffers using shmem
155  * (in order to have fast tests). Passing a value of 0 resets the threshold
156  * to its default. The threshold is in bytes.
157  */
159  uint32_t threshold);
160  /**
161  * Run the V8 garbage collector for tests.
162  */
163  void (*RunV8GC)(PP_Instance instance);
164  /**
165  * Simulate losing graphics 3D context.
166  */
167  void (*LoseContext)(PP_Instance instance);
168 };
169 
171 /**
172  * @}
173  */
174 
175 #endif /* PPAPI_C_SAMSUNG_PPB_TESTING_SAMSUNG_H_ */
176 
void(* QuitMessageLoop)(PP_Instance instance)
int32_t PP_Resource
Definition: pp_resource.h:40
void(* SimulateInputEvent)(PP_Instance instance, PP_Resource input_event)
uint32_t(* GetLiveObjectsForInstance)(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(* PostPowerSaverStatus)(PP_Instance instance)
Definition: pp_var.h:166
void(* RunV8GC)(PP_Instance instance)
PP_Bool(* IsOutOfProcess)(void)
int32_t PP_Instance
Definition: pp_instance.h:34
uint32_t(* GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size)
void(* SetMinimumArrayBufferSizeForShmem)(PP_Instance instance, uint32_t threshold)
struct PP_Var(* GetDocumentURL)(PP_Instance instance, struct PP_URLComponents_Dev *components)
PP_Bool
Definition: pp_bool.h:30
void(* LoseContext)(PP_Instance instance)
void(* SubscribeToPowerSaverNotifications)(PP_Instance instance)