1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/testplugin/nptest.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,161 @@ 1.4 +/* ***** BEGIN LICENSE BLOCK ***** 1.5 + * 1.6 + * Copyright (c) 2008, Mozilla Corporation 1.7 + * All rights reserved. 1.8 + * 1.9 + * Redistribution and use in source and binary forms, with or without 1.10 + * modification, are permitted provided that the following conditions are met: 1.11 + * 1.12 + * * Redistributions of source code must retain the above copyright notice, this 1.13 + * list of conditions and the following disclaimer. 1.14 + * * Redistributions in binary form must reproduce the above copyright notice, 1.15 + * this list of conditions and the following disclaimer in the documentation 1.16 + * and/or other materials provided with the distribution. 1.17 + * * Neither the name of the Mozilla Corporation nor the names of its 1.18 + * contributors may be used to endorse or promote products derived from this 1.19 + * software without specific prior written permission. 1.20 + * 1.21 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 1.22 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 1.23 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 1.24 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 1.25 + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 1.26 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 1.27 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 1.28 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.29 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 1.30 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.31 + * 1.32 + * Contributor(s): 1.33 + * Josh Aas <josh@mozilla.com> 1.34 + * 1.35 + * ***** END LICENSE BLOCK ***** */ 1.36 + 1.37 +#ifndef nptest_h_ 1.38 +#define nptest_h_ 1.39 + 1.40 +#include "mozilla-config.h" 1.41 + 1.42 +#include "npapi.h" 1.43 +#include "npfunctions.h" 1.44 +#include "npruntime.h" 1.45 +#include <stdint.h> 1.46 +#include <string> 1.47 +#include <sstream> 1.48 + 1.49 +typedef enum { 1.50 + DM_DEFAULT, 1.51 + DM_SOLID_COLOR 1.52 +} DrawMode; 1.53 + 1.54 +typedef enum { 1.55 + FUNCTION_NONE, 1.56 + FUNCTION_NPP_GETURL, 1.57 + FUNCTION_NPP_GETURLNOTIFY, 1.58 + FUNCTION_NPP_POSTURL, 1.59 + FUNCTION_NPP_POSTURLNOTIFY, 1.60 + FUNCTION_NPP_NEWSTREAM, 1.61 + FUNCTION_NPP_WRITEREADY, 1.62 + FUNCTION_NPP_WRITE, 1.63 + FUNCTION_NPP_DESTROYSTREAM, 1.64 + FUNCTION_NPP_WRITE_RPC 1.65 +} TestFunction; 1.66 + 1.67 +typedef enum { 1.68 + AD_NONE, 1.69 + AD_BITMAP, 1.70 + AD_DXGI 1.71 +} AsyncDrawing; 1.72 + 1.73 +typedef enum { 1.74 + ACTIVATION_STATE_UNKNOWN, 1.75 + ACTIVATION_STATE_ACTIVATED, 1.76 + ACTIVATION_STATE_DEACTIVATED 1.77 +} ActivationState; 1.78 + 1.79 +typedef struct FunctionTable { 1.80 + TestFunction funcId; 1.81 + const char* funcName; 1.82 +} FunctionTable; 1.83 + 1.84 +typedef enum { 1.85 + POSTMODE_FRAME, 1.86 + POSTMODE_STREAM 1.87 +} PostMode; 1.88 + 1.89 +typedef struct TestNPObject : NPObject { 1.90 + NPP npp; 1.91 + DrawMode drawMode; 1.92 + uint32_t drawColor; // 0xAARRGGBB 1.93 +} TestNPObject; 1.94 + 1.95 +typedef struct _PlatformData PlatformData; 1.96 + 1.97 +typedef struct TestRange : NPByteRange { 1.98 + bool waiting; 1.99 +} TestRange; 1.100 + 1.101 +typedef struct InstanceData { 1.102 + NPP npp; 1.103 + NPWindow window; 1.104 + TestNPObject* scriptableObject; 1.105 + PlatformData* platformData; 1.106 + int32_t instanceCountWatchGeneration; 1.107 + bool lastReportedPrivateModeState; 1.108 + bool hasWidget; 1.109 + bool npnNewStream; 1.110 + bool throwOnNextInvoke; 1.111 + bool runScriptOnPaint; 1.112 + bool dontTouchElement; 1.113 + uint32_t timerID[2]; 1.114 + bool timerTestResult; 1.115 + bool asyncCallbackResult; 1.116 + bool invalidateDuringPaint; 1.117 + bool slowPaint; 1.118 + int32_t winX; 1.119 + int32_t winY; 1.120 + int32_t lastMouseX; 1.121 + int32_t lastMouseY; 1.122 + int32_t widthAtLastPaint; 1.123 + int32_t paintCount; 1.124 + int32_t writeCount; 1.125 + int32_t writeReadyCount; 1.126 + int32_t asyncTestPhase; 1.127 + TestFunction testFunction; 1.128 + TestFunction functionToFail; 1.129 + NPError failureCode; 1.130 + NPObject* callOnDestroy; 1.131 + PostMode postMode; 1.132 + std::string testUrl; 1.133 + std::string frame; 1.134 + std::string timerTestScriptCallback; 1.135 + std::string asyncTestScriptCallback; 1.136 + std::ostringstream err; 1.137 + uint16_t streamMode; 1.138 + int32_t streamChunkSize; 1.139 + int32_t streamBufSize; 1.140 + int32_t fileBufSize; 1.141 + TestRange* testrange; 1.142 + void* streamBuf; 1.143 + void* fileBuf; 1.144 + bool crashOnDestroy; 1.145 + bool cleanupWidget; 1.146 + ActivationState topLevelWindowActivationState; 1.147 + int32_t topLevelWindowActivationEventCount; 1.148 + ActivationState focusState; 1.149 + int32_t focusEventCount; 1.150 + int32_t eventModel; 1.151 + bool closeStream; 1.152 + std::string lastKeyText; 1.153 + bool wantsAllStreams; 1.154 + AsyncDrawing asyncDrawing; 1.155 + NPAsyncSurface *frontBuffer; 1.156 + NPAsyncSurface *backBuffer; 1.157 + int32_t mouseUpEventCount; 1.158 + int32_t bugMode; 1.159 + std::string javaCodebase; 1.160 +} InstanceData; 1.161 + 1.162 +void notifyDidPaint(InstanceData* instanceData); 1.163 + 1.164 +#endif // nptest_h_