equal
deleted
inserted
replaced
|
1 // Copyright (c) 2002-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 // |
|
15 |
|
16 /** |
|
17 @file TestOom.h |
|
18 */ |
|
19 |
|
20 #ifndef __TESTOOM_H__ |
|
21 #define __TESTOOM_H__ |
|
22 |
|
23 // System includes |
|
24 #include <e32std.h> |
|
25 |
|
26 |
|
27 // Testing macro, used as a wrapper to calls made to the WAP Stack. |
|
28 // The macro simulates allocation failures in the WAP Stack, and returns |
|
29 // KErrNoMemory in OOM situations when used in a heap-failure testing environment. |
|
30 // Also define the test-leave macro, which should be place before calls to leaving functions |
|
31 // in order to simulate the control paths followed should their leaves occur. |
|
32 #if defined (_DEBUG) && defined(__UNIT_TESTING__) |
|
33 |
|
34 #define __TESTOOM(_r, _x) _r = KErrNone;{HBufC* _a=HBufC::New(4);delete _a;if (_a==NULL)_r=KErrNoMemory;else _r=_x;} |
|
35 #define __TESTOOMD(_r, _x) TInt _r = KErrNone;{HBufC* _a=HBufC::New(4);delete _a;if (_a==NULL)_r=KErrNoMemory;else _r=_x;} |
|
36 #define __DEBUGTESTLEAVE {HBufC* _a=HBufC::NewL(4);delete _a;} |
|
37 |
|
38 #else |
|
39 |
|
40 #define __TESTOOM(_r, _x) _r = _x |
|
41 #define __TESTOOMD(_r, _x) TInt _r = _x |
|
42 #define __DEBUGTESTLEAVE |
|
43 |
|
44 #endif |
|
45 |
|
46 |
|
47 #endif // __TESTOOM_H__ |