Update contrib.
1 // Copyright (c) 2007-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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 #include <e32std_private.h>
21 #include <u32std.h> // unicode builds
23 #include <e32base_private.h>
24 #include <e32Test.h> // RTest headder
25 #include "testcaseroot.h"
26 #include "testcase0463.h"
31 // the name below is used to add a pointer to our construction method to a pointer MAP in
33 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0463");
34 const TTestCaseFactoryReceipt<CTestCase0463> CTestCase0463::iFactoryReceipt(KTestCaseId);
37 CTestCase0463* CTestCase0463::NewL(TBool aHost)
40 CTestCase0463* self = new (ELeave) CTestCase0463(aHost);
41 CleanupStack::PushL(self);
43 CleanupStack::Pop(self);
48 CTestCase0463::CTestCase0463(TBool aHost)
49 : CTestCaseRoot(KTestCaseId, aHost)
58 void CTestCase0463::ConstructL()
61 iRepeats = OOMOPEN_REPEATS;
62 iAllocFailNumber = OOMOPEN_REPEATS + 1; // allocs 1..11 fail
68 CTestCase0463::~CTestCase0463()
76 void CTestCase0463::ExecuteTestCaseL()
79 iCaseStep = EMarkStack;
80 CActiveScheduler::Add(this);
86 void CTestCase0463::DescribePreconditions()
88 test.Printf(_L("Insert A connector beforehand.\n"));
92 void CTestCase0463::DoCancel()
101 // handle event completion
102 void CTestCase0463::RunStepL()
106 // Obtain the completion code for this CActive obj.
107 TInt completionCode(iStatus.Int());
113 iCaseStep = ELoadLdd;
117 __UHEAP_SETFAIL(RHeap::EDeterministic, iAllocFailNumber);
119 test.Printf(_L("Load the LDD iteration %d/%d\n"), OOMOPEN_REPEATS-iRepeats+1, OOMOPEN_REPEATS);
120 aIntegerP = new TInt;
121 CleanupStack::PushL(aIntegerP);
126 // panic if the cleanupstack was messed
127 CleanupStack::PopAndDestroy(aIntegerP);
129 // SAMPLE : some code to test that the __HEAP macros did their stuff
130 // uncomment this to verify the test flow would fail
132 // TInt *aInt = new TInt;
134 // test.Printf(_L("Alloc failed!!!!!!\n"));
137 iCaseStep = EUnloadLdd;
142 if (EFalse == StepUnloadLDD())
143 return TestFailed(KErrAbort,_L("Unload Ldd failure"));
145 test.Printf(_L("Heap intact: Asize %d\n"), iAllocFailNumber);
146 iCaseStep = ELoopDecrement;
151 test.Printf(_L("Repeat test\n"));
156 iCaseStep = ELoadLdd;
158 iCaseStep = ELastStep;
164 TestPolicy().SignalTestComplete(KErrNone);
168 test.Printf(_L("<Error> unknown test step"));
170 TestPolicy().SignalTestComplete(KErrCorrupt);