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