Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* ***** BEGIN LICENSE BLOCK *****
2 *
3 * Copyright (c) 2008, Mozilla Corporation
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * * Redistributions of source code must retain the above copyright notice, this
10 * list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 * * Neither the name of the Mozilla Corporation nor the names of its
15 * contributors may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Contributor(s):
30 * Josh Aas <josh@mozilla.com>
31 *
32 * ***** END LICENSE BLOCK ***** */
34 #ifndef nptest_h_
35 #define nptest_h_
37 #include "mozilla-config.h"
39 #include "npapi.h"
40 #include "npfunctions.h"
41 #include "npruntime.h"
42 #include <stdint.h>
43 #include <string>
44 #include <sstream>
46 typedef enum {
47 DM_DEFAULT,
48 DM_SOLID_COLOR
49 } DrawMode;
51 typedef enum {
52 FUNCTION_NONE,
53 FUNCTION_NPP_GETURL,
54 FUNCTION_NPP_GETURLNOTIFY,
55 FUNCTION_NPP_POSTURL,
56 FUNCTION_NPP_POSTURLNOTIFY,
57 FUNCTION_NPP_NEWSTREAM,
58 FUNCTION_NPP_WRITEREADY,
59 FUNCTION_NPP_WRITE,
60 FUNCTION_NPP_DESTROYSTREAM,
61 FUNCTION_NPP_WRITE_RPC
62 } TestFunction;
64 typedef enum {
65 AD_NONE,
66 AD_BITMAP,
67 AD_DXGI
68 } AsyncDrawing;
70 typedef enum {
71 ACTIVATION_STATE_UNKNOWN,
72 ACTIVATION_STATE_ACTIVATED,
73 ACTIVATION_STATE_DEACTIVATED
74 } ActivationState;
76 typedef struct FunctionTable {
77 TestFunction funcId;
78 const char* funcName;
79 } FunctionTable;
81 typedef enum {
82 POSTMODE_FRAME,
83 POSTMODE_STREAM
84 } PostMode;
86 typedef struct TestNPObject : NPObject {
87 NPP npp;
88 DrawMode drawMode;
89 uint32_t drawColor; // 0xAARRGGBB
90 } TestNPObject;
92 typedef struct _PlatformData PlatformData;
94 typedef struct TestRange : NPByteRange {
95 bool waiting;
96 } TestRange;
98 typedef struct InstanceData {
99 NPP npp;
100 NPWindow window;
101 TestNPObject* scriptableObject;
102 PlatformData* platformData;
103 int32_t instanceCountWatchGeneration;
104 bool lastReportedPrivateModeState;
105 bool hasWidget;
106 bool npnNewStream;
107 bool throwOnNextInvoke;
108 bool runScriptOnPaint;
109 bool dontTouchElement;
110 uint32_t timerID[2];
111 bool timerTestResult;
112 bool asyncCallbackResult;
113 bool invalidateDuringPaint;
114 bool slowPaint;
115 int32_t winX;
116 int32_t winY;
117 int32_t lastMouseX;
118 int32_t lastMouseY;
119 int32_t widthAtLastPaint;
120 int32_t paintCount;
121 int32_t writeCount;
122 int32_t writeReadyCount;
123 int32_t asyncTestPhase;
124 TestFunction testFunction;
125 TestFunction functionToFail;
126 NPError failureCode;
127 NPObject* callOnDestroy;
128 PostMode postMode;
129 std::string testUrl;
130 std::string frame;
131 std::string timerTestScriptCallback;
132 std::string asyncTestScriptCallback;
133 std::ostringstream err;
134 uint16_t streamMode;
135 int32_t streamChunkSize;
136 int32_t streamBufSize;
137 int32_t fileBufSize;
138 TestRange* testrange;
139 void* streamBuf;
140 void* fileBuf;
141 bool crashOnDestroy;
142 bool cleanupWidget;
143 ActivationState topLevelWindowActivationState;
144 int32_t topLevelWindowActivationEventCount;
145 ActivationState focusState;
146 int32_t focusEventCount;
147 int32_t eventModel;
148 bool closeStream;
149 std::string lastKeyText;
150 bool wantsAllStreams;
151 AsyncDrawing asyncDrawing;
152 NPAsyncSurface *frontBuffer;
153 NPAsyncSurface *backBuffer;
154 int32_t mouseUpEventCount;
155 int32_t bugMode;
156 std::string javaCodebase;
157 } InstanceData;
159 void notifyDidPaint(InstanceData* instanceData);
161 #endif // nptest_h_