1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TBUFFERSECURITY.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,132 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// DEF075471 buffer security test
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @test
1.24 + @internalComponent - Internal Symbian test code
1.25 +*/
1.26 +
1.27 +#ifndef __TBUFFERSECURITY_H__
1.28 +#define __TBUFFERSECURITY_H__
1.29 +
1.30 +#include "AUTO.H"
1.31 +#include "../tlib/testbase.h"
1.32 +#include <w32std.h>
1.33 +#include "../SERVER/w32cmd.h"
1.34 +
1.35 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.36 +#include "../nonnga/CLIENT/w32comm.h"
1.37 +#endif
1.38 +
1.39 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.40 +#include "../nga/CLIENT/w32comm.h"
1.41 +#endif
1.42 +
1.43 +#include <e32property.h>
1.44 +#include "TGraphicsHarness.h"
1.45 +
1.46 +//Set this #define to add extra logging to this test case (useful when debugging a test fail)
1.47 +//#define _TBUFS_LOGGING
1.48 +
1.49 +//Set this #define to initiate a long running soak test, this should be done periodically
1.50 +//#define _TBUFS_TEST_SOAK_TEST
1.51 +
1.52 +#ifdef _TBUFS_LOGGING
1.53 +#define TBufSStartLogText StartLogText
1.54 +#define TBufSLogText LogText
1.55 +#define TBufSLogFormat LogFormat
1.56 +#else
1.57 +#define TBufSStartLogText
1.58 +#define TBufSLogText
1.59 +#define TBufSLogFormat
1.60 +#endif
1.61 +
1.62 +LOCAL_D const TUint KPanicThreadHeapSize=0x4000;
1.63 +
1.64 +_LIT(KLitKernExec, "KERN-EXEC");
1.65 +_LIT(KTestName, "DEF086238 Buffer Security Test");
1.66 +static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
1.67 +static _LIT_SECURITY_POLICY_C1(KWriteDeviceDataMgmtPolicy,ECapabilityWriteDeviceData);
1.68 +const TInt KTestDataMax = 256;
1.69 +const TInt KTestDataMax32 = KTestDataMax/4;
1.70 +
1.71 +struct TTestThreadData
1.72 + {
1.73 + TInt iOpCode;
1.74 + union
1.75 + {
1.76 + TUint8 iData[KTestDataMax];
1.77 + TUint32 iData32[KTestDataMax32];
1.78 + };
1.79 + TInt iDataLength;
1.80 + };
1.81 +
1.82 +enum KBufSecTestType
1.83 + {
1.84 + EBufSecUnInitialised,
1.85 + EBufSecRandom,
1.86 + EBufSecZero
1.87 + };
1.88 +
1.89 +union TTestDataStore
1.90 + {
1.91 + TAny *any;
1.92 + TWsClCmdSetPointerCursorArea* cursorArea;
1.93 + TWsClCmdHeapSetFail *heapSetFail;
1.94 + TXYInputType *xyInputType;
1.95 + };
1.96 +
1.97 +class CTBufferSecurity : public CTWsGraphicsBase
1.98 + {
1.99 +public:
1.100 + CTBufferSecurity(CTestStep* aStep);
1.101 + ~CTBufferSecurity();
1.102 + void TestWsBufferL(TInt aOpCode, TUint aDataFill, TBool aEightBit=ETrue);
1.103 + void TestBadStringAnimDllL();
1.104 + void TestBadStringL();
1.105 + void TestBadIpcL();
1.106 + void ConstructL();
1.107 +protected:
1.108 +//from CTGraphicsStep
1.109 + virtual void RunTestCaseL(TInt aCurTestCase);
1.110 +private:
1.111 + void TestBufferSecurityL();
1.112 + };
1.113 +
1.114 +class RTestIpcSession : public RSessionBase
1.115 + {
1.116 +public:
1.117 + inline RTestIpcSession() {};
1.118 + TInt Connect();
1.119 + TInt SendBadBuffer();
1.120 +private:
1.121 + TInt iWsHandle;
1.122 + };
1.123 +
1.124 +class CTBufferSecurityStep : public CTGraphicsStep
1.125 + {
1.126 +public:
1.127 + CTBufferSecurityStep();
1.128 +protected:
1.129 + //from CTGraphicsStep
1.130 + virtual CTGraphicsBase* CreateTestL();
1.131 + };
1.132 +
1.133 +_LIT(KTBufferSecurityStep,"TBufferSecurity");
1.134 +
1.135 +#endif