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.
19 #include <e32std_private.h>
20 #include <u32std.h> // unicode builds
22 #include <e32base_private.h>
23 #include <e32Test.h> // RTest headder
24 #include "testcaseroot.h"
25 #include "testcase0464.h"
29 // the name below is used to add a pointer to our construction method to a pointer MAP in
31 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0464");
32 const TTestCaseFactoryReceipt<CTestCase0464> CTestCase0464::iFactoryReceipt(KTestCaseId);
34 CTestCase0464* CTestCase0464::NewL(TBool aHost)
37 CTestCase0464* self = new (ELeave) CTestCase0464(aHost);
38 CleanupStack::PushL(self);
40 CleanupStack::Pop(self);
45 CTestCase0464::CTestCase0464(TBool aHost)
46 : CTestCaseRoot(KTestCaseId, aHost)
56 void CTestCase0464::ConstructL()
64 CTestCase0464::~CTestCase0464()
72 void CTestCase0464::ExecuteTestCaseL()
75 iCaseStep = EPreconditions;
77 CActiveScheduler::Add(this);
82 void CTestCase0464::DescribePreconditions()
84 test.Printf(_L("Insert 'A' connector beforehand.\n"));
88 void CTestCase0464::DoCancel()
97 void CTestCase0464::CancelKB(CTestCaseRoot *pThis)
99 CTestCase0464 * p = REINTERPRET_CAST(CTestCase0464 *,pThis);
100 // cancel any pending call, and then complete our active obj with a timeout value
102 p->iConsole->ReadCancel();
107 // handle event completion
108 void CTestCase0464::RunStepL()
111 // Obtain the completion code for this CActive obj.
112 TInt completionCode(iStatus.Int());
113 TBuf<MAX_DSTRLEN> aDescription;
119 iCaseStep = ELoadLdd;
122 iCaseStep = ELoadLdd;
126 // prompt to insert 'A' connector
127 test.Printf(KInsertAConnectorPrompt);
128 test.Printf(KPressAnyKeyToContinue);
138 iCaseStep = EDriveBus;
143 LOG_VERBOSE1(_L("Turn ON VBus\n"))
144 err = otgBusRequest();
147 return TestFailed(KErrAbort, _L("Raise VBus - RUsbOtgDriver::BusRequest() FAILED!"));
149 iCaseStep = EUnloadLdd;
154 LOG_VERBOSE1(_L("Unload.\n"))
155 if (EFalse == StepUnloadLDD())
156 return TestFailed(KErrAbort,_L("unload Ldd failure"));
157 test.Printf(_L("Measure VBus =0 and then press Y or N to continue."));
159 iCaseStep = EVerifyVBusGone;
162 case EVerifyVBusGone:
163 LOG_VERBOSE1(_L("Test !VBus after unload.\n"))
164 // test key response (or via an API)
165 if (('y' == iKeyCodeInput) ||('Y' == iKeyCodeInput))
167 test.Printf(_L("VBUS drop 'seen' \n"));
172 return TestFailed(KErrAbort, _L("VBus drop not 'seen' - FAILED!"));
174 iCaseStep = ELastStep;
181 test.Printf(_L("<Error> unknown test step"));
183 return (TestFailed(KErrCorrupt, _L("<Error> unknown test step")));