sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // DEF075471 buffer security test sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #ifndef __TBUFFERSECURITY_H__ sl@0: #define __TBUFFERSECURITY_H__ sl@0: sl@0: #include "AUTO.H" sl@0: #include "../tlib/testbase.h" sl@0: #include sl@0: #include "../SERVER/w32cmd.h" sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: #include "../nonnga/CLIENT/w32comm.h" sl@0: #endif sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: #include "../nga/CLIENT/w32comm.h" sl@0: #endif sl@0: sl@0: #include sl@0: #include "TGraphicsHarness.h" sl@0: sl@0: //Set this #define to add extra logging to this test case (useful when debugging a test fail) sl@0: //#define _TBUFS_LOGGING sl@0: sl@0: //Set this #define to initiate a long running soak test, this should be done periodically sl@0: //#define _TBUFS_TEST_SOAK_TEST sl@0: sl@0: #ifdef _TBUFS_LOGGING sl@0: #define TBufSStartLogText StartLogText sl@0: #define TBufSLogText LogText sl@0: #define TBufSLogFormat LogFormat sl@0: #else sl@0: #define TBufSStartLogText sl@0: #define TBufSLogText sl@0: #define TBufSLogFormat sl@0: #endif sl@0: sl@0: LOCAL_D const TUint KPanicThreadHeapSize=0x4000; sl@0: sl@0: _LIT(KLitKernExec, "KERN-EXEC"); sl@0: _LIT(KTestName, "DEF086238 Buffer Security Test"); sl@0: static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); sl@0: static _LIT_SECURITY_POLICY_C1(KWriteDeviceDataMgmtPolicy,ECapabilityWriteDeviceData); sl@0: const TInt KTestDataMax = 256; sl@0: const TInt KTestDataMax32 = KTestDataMax/4; sl@0: sl@0: struct TTestThreadData sl@0: { sl@0: TInt iOpCode; sl@0: union sl@0: { sl@0: TUint8 iData[KTestDataMax]; sl@0: TUint32 iData32[KTestDataMax32]; sl@0: }; sl@0: TInt iDataLength; sl@0: }; sl@0: sl@0: enum KBufSecTestType sl@0: { sl@0: EBufSecUnInitialised, sl@0: EBufSecRandom, sl@0: EBufSecZero sl@0: }; sl@0: sl@0: union TTestDataStore sl@0: { sl@0: TAny *any; sl@0: TWsClCmdSetPointerCursorArea* cursorArea; sl@0: TWsClCmdHeapSetFail *heapSetFail; sl@0: TXYInputType *xyInputType; sl@0: }; sl@0: sl@0: class CTBufferSecurity : public CTWsGraphicsBase sl@0: { sl@0: public: sl@0: CTBufferSecurity(CTestStep* aStep); sl@0: ~CTBufferSecurity(); sl@0: void TestWsBufferL(TInt aOpCode, TUint aDataFill, TBool aEightBit=ETrue); sl@0: void TestBadStringAnimDllL(); sl@0: void TestBadStringL(); sl@0: void TestBadIpcL(); sl@0: void ConstructL(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: private: sl@0: void TestBufferSecurityL(); sl@0: }; sl@0: sl@0: class RTestIpcSession : public RSessionBase sl@0: { sl@0: public: sl@0: inline RTestIpcSession() {}; sl@0: TInt Connect(); sl@0: TInt SendBadBuffer(); sl@0: private: sl@0: TInt iWsHandle; sl@0: }; sl@0: sl@0: class CTBufferSecurityStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTBufferSecurityStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: _LIT(KTBufferSecurityStep,"TBufferSecurity"); sl@0: sl@0: #endif