michael@0: /* ***** BEGIN LICENSE BLOCK ***** michael@0: * michael@0: * Copyright (c) 2008, Mozilla Corporation michael@0: * All rights reserved. michael@0: * michael@0: * Redistribution and use in source and binary forms, with or without michael@0: * modification, are permitted provided that the following conditions are met: michael@0: * michael@0: * * Redistributions of source code must retain the above copyright notice, this michael@0: * list of conditions and the following disclaimer. michael@0: * * Redistributions in binary form must reproduce the above copyright notice, michael@0: * this list of conditions and the following disclaimer in the documentation michael@0: * and/or other materials provided with the distribution. michael@0: * * Neither the name of the Mozilla Corporation nor the names of its michael@0: * contributors may be used to endorse or promote products derived from this michael@0: * software without specific prior written permission. michael@0: * michael@0: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND michael@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED michael@0: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE michael@0: * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR michael@0: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES michael@0: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; michael@0: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON michael@0: * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT michael@0: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS michael@0: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. michael@0: * michael@0: * Contributor(s): michael@0: * Josh Aas michael@0: * michael@0: * ***** END LICENSE BLOCK ***** */ michael@0: michael@0: #ifndef nptest_h_ michael@0: #define nptest_h_ michael@0: michael@0: #include "mozilla-config.h" michael@0: michael@0: #include "npapi.h" michael@0: #include "npfunctions.h" michael@0: #include "npruntime.h" michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: typedef enum { michael@0: DM_DEFAULT, michael@0: DM_SOLID_COLOR michael@0: } DrawMode; michael@0: michael@0: typedef enum { michael@0: FUNCTION_NONE, michael@0: FUNCTION_NPP_GETURL, michael@0: FUNCTION_NPP_GETURLNOTIFY, michael@0: FUNCTION_NPP_POSTURL, michael@0: FUNCTION_NPP_POSTURLNOTIFY, michael@0: FUNCTION_NPP_NEWSTREAM, michael@0: FUNCTION_NPP_WRITEREADY, michael@0: FUNCTION_NPP_WRITE, michael@0: FUNCTION_NPP_DESTROYSTREAM, michael@0: FUNCTION_NPP_WRITE_RPC michael@0: } TestFunction; michael@0: michael@0: typedef enum { michael@0: AD_NONE, michael@0: AD_BITMAP, michael@0: AD_DXGI michael@0: } AsyncDrawing; michael@0: michael@0: typedef enum { michael@0: ACTIVATION_STATE_UNKNOWN, michael@0: ACTIVATION_STATE_ACTIVATED, michael@0: ACTIVATION_STATE_DEACTIVATED michael@0: } ActivationState; michael@0: michael@0: typedef struct FunctionTable { michael@0: TestFunction funcId; michael@0: const char* funcName; michael@0: } FunctionTable; michael@0: michael@0: typedef enum { michael@0: POSTMODE_FRAME, michael@0: POSTMODE_STREAM michael@0: } PostMode; michael@0: michael@0: typedef struct TestNPObject : NPObject { michael@0: NPP npp; michael@0: DrawMode drawMode; michael@0: uint32_t drawColor; // 0xAARRGGBB michael@0: } TestNPObject; michael@0: michael@0: typedef struct _PlatformData PlatformData; michael@0: michael@0: typedef struct TestRange : NPByteRange { michael@0: bool waiting; michael@0: } TestRange; michael@0: michael@0: typedef struct InstanceData { michael@0: NPP npp; michael@0: NPWindow window; michael@0: TestNPObject* scriptableObject; michael@0: PlatformData* platformData; michael@0: int32_t instanceCountWatchGeneration; michael@0: bool lastReportedPrivateModeState; michael@0: bool hasWidget; michael@0: bool npnNewStream; michael@0: bool throwOnNextInvoke; michael@0: bool runScriptOnPaint; michael@0: bool dontTouchElement; michael@0: uint32_t timerID[2]; michael@0: bool timerTestResult; michael@0: bool asyncCallbackResult; michael@0: bool invalidateDuringPaint; michael@0: bool slowPaint; michael@0: int32_t winX; michael@0: int32_t winY; michael@0: int32_t lastMouseX; michael@0: int32_t lastMouseY; michael@0: int32_t widthAtLastPaint; michael@0: int32_t paintCount; michael@0: int32_t writeCount; michael@0: int32_t writeReadyCount; michael@0: int32_t asyncTestPhase; michael@0: TestFunction testFunction; michael@0: TestFunction functionToFail; michael@0: NPError failureCode; michael@0: NPObject* callOnDestroy; michael@0: PostMode postMode; michael@0: std::string testUrl; michael@0: std::string frame; michael@0: std::string timerTestScriptCallback; michael@0: std::string asyncTestScriptCallback; michael@0: std::ostringstream err; michael@0: uint16_t streamMode; michael@0: int32_t streamChunkSize; michael@0: int32_t streamBufSize; michael@0: int32_t fileBufSize; michael@0: TestRange* testrange; michael@0: void* streamBuf; michael@0: void* fileBuf; michael@0: bool crashOnDestroy; michael@0: bool cleanupWidget; michael@0: ActivationState topLevelWindowActivationState; michael@0: int32_t topLevelWindowActivationEventCount; michael@0: ActivationState focusState; michael@0: int32_t focusEventCount; michael@0: int32_t eventModel; michael@0: bool closeStream; michael@0: std::string lastKeyText; michael@0: bool wantsAllStreams; michael@0: AsyncDrawing asyncDrawing; michael@0: NPAsyncSurface *frontBuffer; michael@0: NPAsyncSurface *backBuffer; michael@0: int32_t mouseUpEventCount; michael@0: int32_t bugMode; michael@0: std::string javaCodebase; michael@0: } InstanceData; michael@0: michael@0: void notifyDidPaint(InstanceData* instanceData); michael@0: michael@0: #endif // nptest_h_