kerneltest/e32test/usbho/t_otgdi/src/testcase0458.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257: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.h>
    22 #include <e32base.h>
    23 #include <e32base_private.h>
    23 #include <e32base_private.h>
    24 #include <e32Test.h>	// RTest headder
    24 #include <e32Test.h>	// RTest headder
    25 #include "testcaseroot.h"
    25 #include "testcaseroot.h"
    26 #include "testcase0458.h"
    26 #include "testcase0458.h"
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "testcase0458Traces.h"
       
    30 #endif
       
    31 
    27 
    32 
    28 
    33 
    29 
    34 
    30 
    35 // the name below is used to add a pointer to our construction method to a pointer MAP in 
    31 // the name below is used to add a pointer to our construction method to a pointer MAP in 
    57 /**
    53 /**
    58  ConstructL
    54  ConstructL
    59 */
    55 */
    60 void CTestCase0458::ConstructL()
    56 void CTestCase0458::ConstructL()
    61 	{
    57 	{
    62 	if(gVerboseOutput)
    58 	LOG_FUNC
    63 	    {
       
    64 	    OstTraceFunctionEntry0(CTESTCASE0458_CONSTRUCTL);
       
    65 	    }
       
    66 	iRepeats = OPEN_REPEATS;
    59 	iRepeats = OPEN_REPEATS;
    67 	
    60 	
    68 	BaseConstructL();
    61 	BaseConstructL();
    69 	}
    62 	}
    70 
    63 
    71 
    64 
    72 CTestCase0458::~CTestCase0458()
    65 CTestCase0458::~CTestCase0458()
    73 	{
    66 	{
    74 	if(gVerboseOutput)
    67 	LOG_FUNC
    75 	    {
       
    76 	    OstTraceFunctionEntry0(CTESTCASE0458_DCTESTCASE0458);
       
    77 	    }
       
    78 
    68 
    79 	Cancel();
    69 	Cancel();
    80 	}
    70 	}
    81 
    71 
    82 
    72 
    83 void CTestCase0458::ExecuteTestCaseL()
    73 void CTestCase0458::ExecuteTestCaseL()
    84 	{
    74 	{
    85 	if(gVerboseOutput)
    75 	LOG_FUNC
    86 	    {
       
    87 	    OstTraceFunctionEntry0(CTESTCASE0458_EXECUTETESTCASEL);
       
    88 	    }
       
    89 	iCaseStep = EPreconditions;
    76 	iCaseStep = EPreconditions;
    90 	
    77 	
    91 	CActiveScheduler::Add(this);
    78 	CActiveScheduler::Add(this);
    92 	SelfComplete();
    79 	SelfComplete();
    93 
    80 
    94 	}
    81 	}
    95 
    82 
    96 void CTestCase0458::DescribePreconditions()
    83 void CTestCase0458::DescribePreconditions()
    97 	{
    84 	{
    98 	test.Printf(_L("Insert 'B' connector from cable\n"));
    85 	test.Printf(_L("Insert 'B' connector from cable\n"));
    99 	OstTrace0(TRACE_NORMAL, CTESTCASE0458_DESCRIBEPRECONDITIONS, "Insert 'B' connector from cable\n");
       
   100 	test.Printf(_L("attached to powered host beforehand.\n"));
    86 	test.Printf(_L("attached to powered host beforehand.\n"));
   101 	OstTrace0(TRACE_NORMAL, CTESTCASE0458_DESCRIBEPRECONDITIONS_DUP01, "attached to powered host beforehand.\n");
       
   102 	}
    87 	}
   103 
    88 
   104 	
    89 	
   105 void CTestCase0458::DoCancel()
    90 void CTestCase0458::DoCancel()
   106 	{
    91 	{
   107 	if(gVerboseOutput)
    92 	LOG_FUNC
   108 	    {
       
   109 	    OstTraceFunctionEntry0(CTESTCASE0458_DOCANCEL);
       
   110 	    }
       
   111 
    93 
   112 	// cancel our timer
    94 	// cancel our timer
   113 	iTimer.Cancel();
    95 	iTimer.Cancel();
   114 	}
    96 	}
   115 
    97 
   116 
    98 
   117 // handle event completion	
    99 // handle event completion	
   118 void CTestCase0458::RunStepL()
   100 void CTestCase0458::RunStepL()
   119 	{
   101 	{
   120 	if(gVerboseOutput)
   102 	LOG_FUNC
   121 	    {
       
   122 	    OstTraceFunctionEntry0(CTESTCASE0458_RUNSTEPL);
       
   123 	    }
       
   124 
   103 
   125 	// Obtain the completion code for this CActive obj.
   104 	// Obtain the completion code for this CActive obj.
   126 	TInt completionCode(iStatus.Int()); 
   105 	TInt completionCode(iStatus.Int()); 
   127 	
   106 	
   128 	switch(iCaseStep)
   107 	switch(iCaseStep)
   129 		{
   108 		{
   130 		case EPreconditions:
   109 		case EPreconditions:
   131 			{
   110 			{
   132 			test.Printf(KPressAnyKeyToStart);
   111 			test.Printf(KPressAnyKeyToStart);
   133 			OstTrace0(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP01, KPressAnyKeyToStart);
       
   134 			iCaseStep = ELoadLdd;
   112 			iCaseStep = ELoadLdd;
   135 			RequestCharacter();			
   113 			RequestCharacter();			
   136 			break;			
   114 			break;			
   137 			}
   115 			}
   138 
   116 
   139 		case ELoadLdd:
   117 		case ELoadLdd:
   140 			test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
   118 			test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
   141 			OstTraceExt2(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP02, "Load the LDD iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
       
   142 			if (!StepLoadLDD())
   119 			if (!StepLoadLDD())
   143 				{
   120 				{
   144 				break;
   121 				break;
   145 				}
   122 				}
   146 
   123 
   155 			SelfComplete();			
   132 			SelfComplete();			
   156 			break;
   133 			break;
   157 						
   134 						
   158 		case ELoopDecrement:
   135 		case ELoopDecrement:
   159 			test.Printf(_L("Repeat test\n"));
   136 			test.Printf(_L("Repeat test\n"));
   160 			OstTrace0(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP03, "Repeat test\n");
       
   161 
   137 
   162 			if (--iRepeats)
   138 			if (--iRepeats)
   163 				{
   139 				{
   164 				iCaseStep = ELoadLdd;
   140 				iCaseStep = ELoadLdd;
   165 				}
   141 				}
   176 			return TestPassed();
   152 			return TestPassed();
   177 
   153 
   178 			
   154 			
   179 		default:
   155 		default:
   180 			test.Printf(_L("<Error> unknown test step"));
   156 			test.Printf(_L("<Error> unknown test step"));
   181 			OstTrace0(TRACE_NORMAL, CTESTCASE0458_RUNSTEPL_DUP04, "<Error> unknown test step");
       
   182 			Cancel();
   157 			Cancel();
   183 			TestPolicy().SignalTestComplete(KErrCorrupt);
   158 			TestPolicy().SignalTestComplete(KErrCorrupt);
   184 			break;
   159 			break;
   185 		}
   160 		}
   186 		
   161