First public contribution.
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.
15 // Open/Close 'powered peripheral' test
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 "testcase0458.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-0458");
34 const TTestCaseFactoryReceipt<CTestCase0458> CTestCase0458::iFactoryReceipt(KTestCaseId);
37 CTestCase0458* CTestCase0458::NewL(TBool aHost)
39 CTestCase0458* self = new (ELeave) CTestCase0458(aHost);
40 CleanupStack::PushL(self);
42 CleanupStack::Pop(self);
47 CTestCase0458::CTestCase0458(TBool aHost)
48 : CTestCaseRoot(KTestCaseId, aHost)
56 void CTestCase0458::ConstructL()
59 iRepeats = OPEN_REPEATS;
65 CTestCase0458::~CTestCase0458()
73 void CTestCase0458::ExecuteTestCaseL()
76 iCaseStep = EPreconditions;
78 CActiveScheduler::Add(this);
83 void CTestCase0458::DescribePreconditions()
85 test.Printf(_L("Insert 'B' connector from cable\n"));
86 test.Printf(_L("attached to powered host beforehand.\n"));
90 void CTestCase0458::DoCancel()
99 // handle event completion
100 void CTestCase0458::RunStepL()
104 // Obtain the completion code for this CActive obj.
105 TInt completionCode(iStatus.Int());
111 test.Printf(KPressAnyKeyToStart);
112 iCaseStep = ELoadLdd;
118 test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
124 iCaseStep = EUnloadLdd;
128 if (EFalse == StepUnloadLDD())
129 return TestFailed(KErrAbort,_L("Unload Ldd failure"));
131 iCaseStep = ELoopDecrement;
136 test.Printf(_L("Repeat test\n"));
140 iCaseStep = ELoadLdd;
144 iCaseStep = ELastStep;
156 test.Printf(_L("<Error> unknown test step"));
158 TestPolicy().SignalTestComplete(KErrCorrupt);