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