dom/plugins/test/testplugin/nptest.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial