os/graphics/windowing/windowserver/test/tauto/TBUFFERSECURITY.H
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // DEF075471 buffer security test
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @test
    21  @internalComponent - Internal Symbian test code
    22 */
    23 
    24 #ifndef __TBUFFERSECURITY_H__
    25 #define __TBUFFERSECURITY_H__
    26 
    27 #include "AUTO.H"
    28 #include "../tlib/testbase.h"
    29 #include <w32std.h>
    30 #include "../SERVER/w32cmd.h"
    31 
    32 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
    33 #include "../nonnga/CLIENT/w32comm.h"
    34 #endif
    35 
    36 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
    37 #include "../nga/CLIENT/w32comm.h"
    38 #endif
    39 
    40 #include <e32property.h>
    41 #include "TGraphicsHarness.h"
    42 
    43 //Set this #define to add extra logging to this test case (useful when debugging a test fail)
    44 //#define _TBUFS_LOGGING
    45 
    46 //Set this #define to initiate a long running soak test, this should be done periodically
    47 //#define _TBUFS_TEST_SOAK_TEST
    48 
    49 #ifdef _TBUFS_LOGGING
    50 #define TBufSStartLogText StartLogText
    51 #define TBufSLogText LogText
    52 #define TBufSLogFormat LogFormat
    53 #else
    54 #define TBufSStartLogText
    55 #define TBufSLogText
    56 #define TBufSLogFormat
    57 #endif
    58 
    59 LOCAL_D const TUint KPanicThreadHeapSize=0x4000;
    60 
    61 _LIT(KLitKernExec, "KERN-EXEC");
    62 _LIT(KTestName, "DEF086238 Buffer Security Test");
    63 static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
    64 static _LIT_SECURITY_POLICY_C1(KWriteDeviceDataMgmtPolicy,ECapabilityWriteDeviceData);
    65 const TInt KTestDataMax = 256;
    66 const TInt KTestDataMax32 = KTestDataMax/4;
    67 
    68 struct TTestThreadData
    69 	{
    70 	TInt iOpCode;
    71 	union
    72 		{
    73 		TUint8 iData[KTestDataMax];
    74 		TUint32 iData32[KTestDataMax32];
    75 		};
    76 	TInt iDataLength;
    77 	};
    78 
    79 enum KBufSecTestType
    80 	{
    81 	EBufSecUnInitialised,
    82 	EBufSecRandom,
    83 	EBufSecZero
    84 	};
    85 
    86 union TTestDataStore
    87 	{
    88 	TAny *any;
    89 	TWsClCmdSetPointerCursorArea* cursorArea;
    90 	TWsClCmdHeapSetFail *heapSetFail;
    91 	TXYInputType *xyInputType;
    92 	};
    93 
    94 class CTBufferSecurity : public CTWsGraphicsBase
    95 	{
    96 public:
    97 	CTBufferSecurity(CTestStep* aStep);
    98 	~CTBufferSecurity();
    99 	void TestWsBufferL(TInt aOpCode, TUint aDataFill, TBool aEightBit=ETrue);
   100 	void TestBadStringAnimDllL();
   101 	void TestBadStringL();
   102 	void TestBadIpcL();
   103 	void ConstructL();
   104 protected:
   105 //from 	CTGraphicsStep
   106 	virtual void RunTestCaseL(TInt aCurTestCase);
   107 private:
   108 	void TestBufferSecurityL();
   109 	};
   110 
   111 class RTestIpcSession : public RSessionBase
   112 	{
   113 public:
   114 	inline RTestIpcSession() {};
   115 	TInt Connect();
   116 	TInt SendBadBuffer();
   117 private:
   118 	TInt iWsHandle;
   119 	};
   120 
   121 class CTBufferSecurityStep : public CTGraphicsStep
   122 	{
   123 public:
   124 	CTBufferSecurityStep();
   125 protected:
   126 	//from CTGraphicsStep
   127 	virtual CTGraphicsBase* CreateTestL();
   128 	};
   129 
   130 _LIT(KTBufferSecurityStep,"TBufferSecurity");
   131 
   132 #endif