kerneltest/e32test/usbho/t_otgdi/src/testcase0670.cpp
branchRCL_3
changeset 44 3e88ff8f41d5
parent 43 c1f20ce4abcf
equal deleted inserted replaced
43:c1f20ce4abcf 44:3e88ff8f41d5
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 #include <e32base_private.h>
    22 #include <e32base_private.h>
    23 #include <e32Test.h>	// RTest headder
    23 #include <e32Test.h>	// RTest headder
    24 #include "testcaseroot.h"
    24 #include "testcaseroot.h"
    25 #include "testcasewd.h"
    25 #include "testcasewd.h"
    26 #include "testcase0670.h"
    26 #include "testcase0670.h"
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "testcase0670Traces.h"
       
    30 #endif
       
    31 
    27 
    32 
    28 
    33 
    29 
    34 // the name below is used to add a pointer to our construction method to a pointer MAP in 
    30 // the name below is used to add a pointer to our construction method to a pointer MAP in 
    35 // the class factory
    31 // the class factory
    36 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0670");
    32 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0670");
    37 const TTestCaseFactoryReceipt<CTestCase0670> CTestCase0670::iFactoryReceipt(KTestCaseId);	
    33 const TTestCaseFactoryReceipt<CTestCase0670> CTestCase0670::iFactoryReceipt(KTestCaseId);	
    38 
    34 
    39 CTestCase0670* CTestCase0670::NewL(TBool aHost)
    35 CTestCase0670* CTestCase0670::NewL(TBool aHost)
    40 	{
    36 	{
    41 	if(gVerboseOutput)
    37 	LOG_FUNC
    42 	    {
       
    43 	    OstTraceFunctionEntry0(CTESTCASE0670_NEWL);
       
    44 	    }
       
    45 	CTestCase0670* self = new (ELeave) CTestCase0670(aHost);
    38 	CTestCase0670* self = new (ELeave) CTestCase0670(aHost);
    46 	CleanupStack::PushL(self);
    39 	CleanupStack::PushL(self);
    47 	self->ConstructL();
    40 	self->ConstructL();
    48 	CleanupStack::Pop(self);
    41 	CleanupStack::Pop(self);
    49 	return self;
    42 	return self;
    51 	
    44 	
    52 
    45 
    53 CTestCase0670::CTestCase0670(TBool aHost)
    46 CTestCase0670::CTestCase0670(TBool aHost)
    54 :	CTestCaseRoot(KTestCaseId, aHost)
    47 :	CTestCaseRoot(KTestCaseId, aHost)
    55 	{
    48 	{
    56 	if(gVerboseOutput)
    49 	LOG_FUNC
    57 	    {
       
    58 	    OstTraceFunctionEntry0(CTESTCASE0670_CTESTCASE0670);
       
    59 	    }
       
    60 		
    50 		
    61 	} 
    51 	} 
    62 
    52 
    63 
    53 
    64 /**
    54 /**
    90 	}
    80 	}
    91 
    81 
    92 	
    82 	
    93 void CTestCase0670::DoCancel()
    83 void CTestCase0670::DoCancel()
    94 	{
    84 	{
    95 	if(gVerboseOutput)
    85 	LOG_FUNC
    96 	    {
       
    97 	    OstTraceFunctionEntry0(CTESTCASE0670_DOCANCEL);
       
    98 	    }
       
    99 
    86 
   100 	// cancel our timer
    87 	// cancel our timer
   101 	iTimer.Cancel();
    88 	iTimer.Cancel();
   102 	}
    89 	}
   103 
    90 
   121 
   108 
   122 void CTestCase0670::DescribePreconditions()
   109 void CTestCase0670::DescribePreconditions()
   123 	{
   110 	{
   124 	// H4 width     ****************************
   111 	// H4 width     ****************************
   125 	test.Printf(_L("***************************\n"));
   112 	test.Printf(_L("***************************\n"));
   126 	OstTrace0(TRACE_NORMAL, CTESTCASE0670_DESCRIBEPRECONDITIONS, "***************************\n");
       
   127 	test.Printf(_L("* This test uses a Mini-A *\n"));
   113 	test.Printf(_L("* This test uses a Mini-A *\n"));
   128 	OstTrace0(TRACE_NORMAL, CTESTCASE0670_DESCRIBEPRECONDITIONS_DUP01, "* This test uses a Mini-A *\n");
       
   129 	test.Printf(_L("* to Mini-B cable to link *\n"));
   114 	test.Printf(_L("* to Mini-B cable to link *\n"));
   130 	OstTrace0(TRACE_NORMAL, CTESTCASE0670_DESCRIBEPRECONDITIONS_DUP02, "* to Mini-B cable to link *\n");
       
   131 	test.Printf(_L("* the H4 board to the OPT *\n"));
   115 	test.Printf(_L("* the H4 board to the OPT *\n"));
   132 	OstTrace0(TRACE_NORMAL, CTESTCASE0670_DESCRIBEPRECONDITIONS_DUP03, "* the H4 board to the OPT *\n");
       
   133 	test.Printf(_L("* and makes use of the    *\n"));
   116 	test.Printf(_L("* and makes use of the    *\n"));
   134 	OstTrace0(TRACE_NORMAL, CTESTCASE0670_DESCRIBEPRECONDITIONS_DUP04, "* and makes use of the    *\n");
       
   135 	test.Printf(_L("*  USB OPT test code      *\n"));
   117 	test.Printf(_L("*  USB OPT test code      *\n"));
   136 	OstTrace0(TRACE_NORMAL, CTESTCASE0670_DESCRIBEPRECONDITIONS_DUP05, "*  USB OPT test code      *\n");
       
   137 	test.Printf(_L("***************************\n"));
   118 	test.Printf(_L("***************************\n"));
   138 	OstTrace0(TRACE_NORMAL, CTESTCASE0670_DESCRIBEPRECONDITIONS_DUP06, "***************************\n");
       
   139 	}
   119 	}
   140 
   120 
   141 
   121 
   142 // handle event completion	
   122 // handle event completion	
   143 void CTestCase0670::RunStepL()
   123 void CTestCase0670::RunStepL()
   144 	{
   124 	{
   145 	if(gVerboseOutput)
   125 	LOG_FUNC
   146 	    {
       
   147 	    OstTraceFunctionEntry0(CTESTCASE0670_RUNSTEPL);
       
   148 	    }
       
   149 	// Obtain the completion code for this CActive obj.
   126 	// Obtain the completion code for this CActive obj.
   150 	TInt completionCode(iStatus.Int()); 
   127 	TInt completionCode(iStatus.Int()); 
   151 	TBuf<MAX_DSTRLEN> aDescription;
   128 	TBuf<MAX_DSTRLEN> aDescription;
   152 		
   129 		
   153 	switch(iCaseStep)
   130 	switch(iCaseStep)
   176 			break;
   153 			break;
   177 			
   154 			
   178 		case EConnectAtoB:
   155 		case EConnectAtoB:
   179 			// H4 width     ****************************
   156 			// H4 width     ****************************
   180 			test.Printf(_L("\n"));
   157 			test.Printf(_L("\n"));
   181 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP01, "\n");
       
   182 			test.Printf(_L("***********************\n"));
   158 			test.Printf(_L("***********************\n"));
   183 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP02, "***********************\n");
       
   184 //			WAIT_ON_KEYOP( "Connect H4(A) to OPT(B)\n");
   159 //			WAIT_ON_KEYOP( "Connect H4(A) to OPT(B)\n");
   185 			test.Printf(_L("Connect H4(A) to OPT(B)\n"));
   160 			test.Printf(_L("Connect H4(A) to OPT(B)\n"));
   186 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP03, "Connect H4(Ato OPT(B)\n");
       
   187 			test.Printf(KPressAnyKeyToContinue);
   161 			test.Printf(KPressAnyKeyToContinue);
   188 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP04, KPressAnyKeyToContinue);
       
   189 
   162 
   190 			iCaseStep = EStartOptTD4_5;
   163 			iCaseStep = EStartOptTD4_5;
   191 			RequestCharacter();	
   164 			RequestCharacter();	
   192 			break;
   165 			break;
   193 
   166 
   194 		case EStartOptTD4_5:
   167 		case EStartOptTD4_5:
   195 			// H4 width     ****************************
   168 			// H4 width     ****************************
   196 			test.Printf(_L("On the OPT, select:\n"));
   169 			test.Printf(_L("On the OPT, select:\n"));
   197 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP05, "On the OPT, select:\n");
       
   198 			test.Printf(_L("  Certified FS-A-UUT Test\n"));
   170 			test.Printf(_L("  Certified FS-A-UUT Test\n"));
   199 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP06, "  Certified FS-A-UUT Test\n");
       
   200 			test.Printf(_L("  Test TD.4.5-2.9ms-100ms\n"));
   171 			test.Printf(_L("  Test TD.4.5-2.9ms-100ms\n"));
   201 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP07, "  Test TD.4.5-2.9ms-100ms\n");
       
   202 			test.Printf(_L("  And then Click 'Run' "));
   172 			test.Printf(_L("  And then Click 'Run' "));
   203 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP08, "  And then Click 'Run' ");
       
   204 			test.Printf(_L("  When test starts, press any key"));
   173 			test.Printf(_L("  When test starts, press any key"));
   205 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP09, "  When test starts, press any key");
       
   206 			iCaseStep = EPromptYOpt4_5;
   174 			iCaseStep = EPromptYOpt4_5;
   207 			RequestCharacter();	
   175 			RequestCharacter();	
   208 			break;
   176 			break;
   209 
   177 
   210 		case EPromptYOpt4_5:
   178 		case EPromptYOpt4_5:
   211 			iCaseStep = EConfirmOpt4_5;
   179 			iCaseStep = EConfirmOpt4_5;
   212 			test.Printf(_L("Did it PASS (Y/N)?"));
   180 			test.Printf(_L("Did it PASS (Y/N)?"));
   213 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP10, "Did it PASS (Y/N?");
       
   214 			RequestCharacter(); // 30 seconds for user input
   181 			RequestCharacter(); // 30 seconds for user input
   215 			iWDTimer->IssueRequest(KDelayDurationForTest4_5, this, &CancelKB);
   182 			iWDTimer->IssueRequest(KDelayDurationForTest4_5, this, &CancelKB);
   216 			break;
   183 			break;
   217 
   184 
   218 		case EConfirmOpt4_5:
   185 		case EConfirmOpt4_5:
   255 			TestPassed();
   222 			TestPassed();
   256 			break;
   223 			break;
   257 			
   224 			
   258 		default:
   225 		default:
   259 			test.Printf(_L("<Error> unknown test step"));
   226 			test.Printf(_L("<Error> unknown test step"));
   260 			OstTrace0(TRACE_NORMAL, CTESTCASE0670_RUNSTEPL_DUP11, "<Error> unknown test step");
       
   261 			Cancel();
   227 			Cancel();
   262 			return (TestFailed(KErrCorrupt, _L("<Error> unknown test step")));
   228 			return (TestFailed(KErrCorrupt, _L("<Error> unknown test step")));
   263 		}
   229 		}
   264 	}
   230 	}
   265 
   231