kerneltest/e32test/usbho/t_otgdi/src/testcase0671.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 "testcase0671.h"
    26 #include "testcase0671.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "testcase0671Traces.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-0671");
    36 _LIT(KTestCaseId,"PBASE-USB_OTGDI-0671");
    33 const TTestCaseFactoryReceipt<CTestCase0671> CTestCase0671::iFactoryReceipt(KTestCaseId);	
    37 const TTestCaseFactoryReceipt<CTestCase0671> CTestCase0671::iFactoryReceipt(KTestCaseId);	
    34 
    38 
    35 CTestCase0671* CTestCase0671::NewL(TBool aHost)
    39 CTestCase0671* CTestCase0671::NewL(TBool aHost)
    36 	{
    40 	{
    37 	LOG_FUNC
    41 	if(gVerboseOutput)
       
    42 	    {
       
    43 	    OstTraceFunctionEntry0(CTESTCASE0671_NEWL);
       
    44 	    }
    38 	CTestCase0671* self = new (ELeave) CTestCase0671(aHost);
    45 	CTestCase0671* self = new (ELeave) CTestCase0671(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 CTestCase0671::CTestCase0671(TBool aHost)
    53 CTestCase0671::CTestCase0671(TBool aHost)
    47 :	CTestCaseRoot(KTestCaseId, aHost)
    54 :	CTestCaseRoot(KTestCaseId, aHost)
    48 	{
    55 	{
    49 	LOG_FUNC
    56 	if(gVerboseOutput)
       
    57 	    {
       
    58 	    OstTraceFunctionEntry0(CTESTCASE0671_CTESTCASE0671);
       
    59 	    }
    50 		
    60 		
    51 	} 
    61 	} 
    52 
    62 
    53 
    63 
    54 /**
    64 /**
    80 	}
    90 	}
    81 
    91 
    82 	
    92 	
    83 void CTestCase0671::DoCancel()
    93 void CTestCase0671::DoCancel()
    84 	{
    94 	{
    85 	LOG_FUNC
    95 	if(gVerboseOutput)
       
    96 	    {
       
    97 	    OstTraceFunctionEntry0(CTESTCASE0671_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 CTestCase0671::DescribePreconditions()
   122 void CTestCase0671::DescribePreconditions()
   110 	{
   123 	{
   111 	// H4 width     ****************************
   124 	// H4 width     ****************************
   112 	test.Printf(_L("***************************\n"));
   125 	test.Printf(_L("***************************\n"));
       
   126 	OstTrace0(TRACE_NORMAL, CTESTCASE0671_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, CTESTCASE0671_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, CTESTCASE0671_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, CTESTCASE0671_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, CTESTCASE0671_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, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP05, "*  USB OPT test code      *\n");
   118 	test.Printf(_L("***************************\n"));
   137 	test.Printf(_L("***************************\n"));
       
   138 	OstTrace0(TRACE_NORMAL, CTESTCASE0671_DESCRIBEPRECONDITIONS_DUP06, "***************************\n");
   119 	}
   139 	}
   120 
   140 
   121 
   141 
   122 // handle event completion	
   142 // handle event completion	
   123 void CTestCase0671::RunStepL()
   143 void CTestCase0671::RunStepL()
   124 	{
   144 	{
   125 	LOG_FUNC
   145 	if(gVerboseOutput)
       
   146 	    {
       
   147 	    OstTraceFunctionEntry0(CTESTCASE0671_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, CTESTCASE0671_RUNSTEPL_DUP01, "\n");
   158 			test.Printf(_L("***********************\n"));
   182 			test.Printf(_L("***********************\n"));
       
   183 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP02, "***********************\n");
   159 			test.Printf(_L("Connect H4(B) to OPT(A)\n"));
   184 			test.Printf(_L("Connect H4(B) to OPT(A)\n"));
       
   185 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP03, "Connect H4(Bto OPT(A)\n");
   160 			test.Printf(KPressAnyKeyToContinue);
   186 			test.Printf(KPressAnyKeyToContinue);
       
   187 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP04, KPressAnyKeyToContinue);
   161 
   188 
   162 			iCaseStep = EStartOptTD5_5;
   189 			iCaseStep = EStartOptTD5_5;
   163 			RequestCharacter();	
   190 			RequestCharacter();	
   164 			break;
   191 			break;
   165 
   192 
   166 		case EStartOptTD5_5:
   193 		case EStartOptTD5_5:
   167 			// H4 width     ****************************
   194 			// H4 width     ****************************
   168 			test.Printf(_L("On the OPT, select:\n"));
   195 			test.Printf(_L("On the OPT, select:\n"));
       
   196 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP05, "On the OPT, select:\n");
   169 			test.Printf(_L("  Certified FS-B-UUT Test\n"));
   197 			test.Printf(_L("  Certified FS-B-UUT Test\n"));
       
   198 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP06, "  Certified FS-B-UUT Test\n");
   170 			test.Printf(_L("  Test TD.5.5\n"));
   199 			test.Printf(_L("  Test TD.5.5\n"));
       
   200 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP07, "  Test TD.5.5\n");
   171 			test.Printf(_L("  And then Click 'Run' "));
   201 			test.Printf(_L("  And then Click 'Run' "));
       
   202 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP08, "  And then Click 'Run' ");
   172 			test.Printf(_L("  When test starts, press any key"));
   203 			test.Printf(_L("  When test starts, press any key"));
       
   204 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP09, "  When test starts, press any key");
   173 			iCaseStep = EPromptYOpt5_5;
   205 			iCaseStep = EPromptYOpt5_5;
   174 			RequestCharacter();	
   206 			RequestCharacter();	
   175 			break;
   207 			break;
   176 
   208 
   177 		case EPromptYOpt5_5:
   209 		case EPromptYOpt5_5:
   178 			iCaseStep = EConfirmOpt5_5;
   210 			iCaseStep = EConfirmOpt5_5;
   179 			test.Printf(_L("Did it PASS (Y/N)?"));
   211 			test.Printf(_L("Did it PASS (Y/N)?"));
       
   212 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP10, "Did it PASS (Y/N?");
   180 			RequestCharacter(); // 30 seconds for user input
   213 			RequestCharacter(); // 30 seconds for user input
   181 			iWDTimer->IssueRequest(KDelayDurationForTest4_5, this, &CancelKB);
   214 			iWDTimer->IssueRequest(KDelayDurationForTest4_5, this, &CancelKB);
   182 			break;
   215 			break;
   183 
   216 
   184 		case EConfirmOpt5_5:
   217 		case EConfirmOpt5_5:
   221 			TestPassed();
   254 			TestPassed();
   222 			break;
   255 			break;
   223 			
   256 			
   224 		default:
   257 		default:
   225 			test.Printf(_L("<Error> unknown test step"));
   258 			test.Printf(_L("<Error> unknown test step"));
       
   259 			OstTrace0(TRACE_NORMAL, CTESTCASE0671_RUNSTEPL_DUP11, "<Error> unknown test step");
   226 			Cancel();
   260 			Cancel();
   227 			return (TestFailed(KErrCorrupt, _L("<Error> unknown test step")));
   261 			return (TestFailed(KErrCorrupt, _L("<Error> unknown test step")));
   228 		}
   262 		}
   229 	}
   263 	}
   230 
   264