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