kerneltest/e32test/usbho/t_otgdi/src/testcase0456.cpp
changeset 259 57b9594f5772
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
247:d8d70de2bd36 259:57b9594f5772
     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".
    24 #include <e32base_private.h>
    24 #include <e32base_private.h>
    25 #include <e32Test.h>	// RTest headder
    25 #include <e32Test.h>	// RTest headder
    26 #include "testcaseroot.h"
    26 #include "testcaseroot.h"
    27 #include "testcasefactory.h"
    27 #include "testcasefactory.h"
    28 #include "testcase0456.h"
    28 #include "testcase0456.h"
       
    29 #include "OstTraceDefinitions.h"
       
    30 #ifdef OST_TRACE_COMPILER_IN_USE
       
    31 #include "testcase0456Traces.h"
       
    32 #endif
    29 
    33 
    30 
    34 
    31 
    35 
    32 
    36 
    33 // the name below is used to add a pointer to our construction method to a pointer MAP in 
    37 // the name below is used to add a pointer to our construction method to a pointer MAP in 
    36 const TTestCaseFactoryReceipt<CTestCase0456> CTestCase0456::iFactoryReceipt(KTestCaseId);	
    40 const TTestCaseFactoryReceipt<CTestCase0456> CTestCase0456::iFactoryReceipt(KTestCaseId);	
    37 
    41 
    38 
    42 
    39 CTestCase0456* CTestCase0456::NewL(TBool aHost)
    43 CTestCase0456* CTestCase0456::NewL(TBool aHost)
    40 	{
    44 	{
    41 	LOG_FUNC
    45 	if(gVerboseOutput)
       
    46 	    {
       
    47 	    OstTraceFunctionEntry0(CTESTCASE0456_NEWL);
       
    48 	    }
    42 	CTestCase0456* self = new (ELeave) CTestCase0456(aHost);
    49 	CTestCase0456* self = new (ELeave) CTestCase0456(aHost);
    43 	CleanupStack::PushL(self);
    50 	CleanupStack::PushL(self);
    44 	self->ConstructL();
    51 	self->ConstructL();
    45 	CleanupStack::Pop(self);
    52 	CleanupStack::Pop(self);
    46 	return self;
    53 	return self;
    48 	
    55 	
    49 
    56 
    50 CTestCase0456::CTestCase0456(TBool aHost)
    57 CTestCase0456::CTestCase0456(TBool aHost)
    51 :	CTestCaseRoot(KTestCaseId, aHost)
    58 :	CTestCaseRoot(KTestCaseId, aHost)
    52 	{	
    59 	{	
    53 	LOG_FUNC
    60 	if(gVerboseOutput)
       
    61 	    {
       
    62 	    OstTraceFunctionEntry0(CTESTCASE0456_CTESTCASE0456);
       
    63 	    }
    54 	} 
    64 	} 
    55 
    65 
    56 
    66 
    57 /**
    67 /**
    58  ConstructL
    68  ConstructL
    59 */
    69 */
    60 void CTestCase0456::ConstructL()
    70 void CTestCase0456::ConstructL()
    61 	{
    71 	{
    62 	LOG_FUNC
    72 	if(gVerboseOutput)
       
    73 	    {
       
    74 	    OstTraceFunctionEntry0(CTESTCASE0456_CONSTRUCTL);
       
    75 	    }
    63 	iRepeats = OPEN_REPEATS;
    76 	iRepeats = OPEN_REPEATS;
    64 	
    77 	
    65 	BaseConstructL();
    78 	BaseConstructL();
    66 	}
    79 	}
    67 
    80 
    68 
    81 
    69 CTestCase0456::~CTestCase0456()
    82 CTestCase0456::~CTestCase0456()
    70 	{
    83 	{
    71 	LOG_FUNC
    84 	if(gVerboseOutput)
       
    85 	    {
       
    86 	    OstTraceFunctionEntry0(CTESTCASE0456_DCTESTCASE0456);
       
    87 	    }
    72 
    88 
    73 	Cancel();
    89 	Cancel();
    74 	}
    90 	}
    75 
    91 
    76 
    92 
    77 void CTestCase0456::ExecuteTestCaseL()
    93 void CTestCase0456::ExecuteTestCaseL()
    78 	{
    94 	{
    79 	LOG_FUNC
    95 	if(gVerboseOutput)
       
    96 	    {
       
    97 	    OstTraceFunctionEntry0(CTESTCASE0456_EXECUTETESTCASEL);
       
    98 	    }
    80 	iCaseStep = EPreconditions;
    99 	iCaseStep = EPreconditions;
    81 	
   100 	
    82 	CActiveScheduler::Add(this);
   101 	CActiveScheduler::Add(this);
    83 	SelfComplete();
   102 	SelfComplete();
    84 	}
   103 	}
    85 
   104 
    86 
   105 
    87 void CTestCase0456::DescribePreconditions()
   106 void CTestCase0456::DescribePreconditions()
    88 	{
   107 	{
    89 	test.Printf(_L("Insert A connector beforehand.\n"));
   108 	test.Printf(_L("Insert A connector beforehand.\n"));
       
   109 	OstTrace0(TRACE_NORMAL, CTESTCASE0456_DESCRIBEPRECONDITIONS, "Insert A connector beforehand.\n");
    90 	}
   110 	}
    91 
   111 
    92 	
   112 	
    93 void CTestCase0456::DoCancel()
   113 void CTestCase0456::DoCancel()
    94 	{
   114 	{
    95 	LOG_FUNC
   115 	if(gVerboseOutput)
       
   116 	    {
       
   117 	    OstTraceFunctionEntry0(CTESTCASE0456_DOCANCEL);
       
   118 	    }
    96 
   119 
    97 	// cancel our timer
   120 	// cancel our timer
    98 	iTimer.Cancel();
   121 	iTimer.Cancel();
    99 	}
   122 	}
   100 
   123 
   101 
   124 
   102 // handle event completion	
   125 // handle event completion	
   103 void CTestCase0456::RunStepL()
   126 void CTestCase0456::RunStepL()
   104 	{
   127 	{
   105 	LOG_FUNC
   128 	if(gVerboseOutput)
       
   129 	    {
       
   130 	    OstTraceFunctionEntry0(CTESTCASE0456_RUNSTEPL);
       
   131 	    }
   106 
   132 
   107 	// Obtain the completion code for this CActive obj.
   133 	// Obtain the completion code for this CActive obj.
   108 	TInt completionCode(iStatus.Int()); 
   134 	TInt completionCode(iStatus.Int()); 
   109 	
   135 	
   110 	switch(iCaseStep)
   136 	switch(iCaseStep)
   111 		{
   137 		{
   112 		case EPreconditions:
   138 		case EPreconditions:
   113 			{
   139 			{
   114 			test.Printf(KPressAnyKeyToStart);
   140 			test.Printf(KPressAnyKeyToStart);
       
   141 			OstTrace0(TRACE_NORMAL, CTESTCASE0456_RUNSTEPL_DUP01, KPressAnyKeyToStart);
   115 			iCaseStep = ELoadLdd;
   142 			iCaseStep = ELoadLdd;
   116 			RequestCharacter();			
   143 			RequestCharacter();			
   117 			break;			
   144 			break;			
   118 			}
   145 			}
   119 			
   146 			
   120 		
   147 		
   121 		case ELoadLdd:
   148 		case ELoadLdd:
   122 			test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
   149 			test.Printf(_L("Load the LDD iteration %d/%d\n"), OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
       
   150 			OstTraceExt2(TRACE_NORMAL, CTESTCASE0456_RUNSTEPL_DUP02, "Load the LDD iteration %d/%d\n", OPEN_REPEATS-iRepeats+1, OPEN_REPEATS);
   123 			if (!StepLoadLDD())
   151 			if (!StepLoadLDD())
   124 				{
   152 				{
   125 				break;
   153 				break;
   126 				}
   154 				}
   127 
   155 
   136 			SelfComplete();			
   164 			SelfComplete();			
   137 			break;
   165 			break;
   138 						
   166 						
   139 		case ELoopDecrement:
   167 		case ELoopDecrement:
   140 			test.Printf(_L("Repeat test\n"));
   168 			test.Printf(_L("Repeat test\n"));
       
   169 			OstTrace0(TRACE_NORMAL, CTESTCASE0456_RUNSTEPL_DUP03, "Repeat test\n");
   141 
   170 
   142 			if (--iRepeats)
   171 			if (--iRepeats)
   143 				iCaseStep = ELoadLdd;
   172 				iCaseStep = ELoadLdd;
   144 			else
   173 			else
   145 				iCaseStep = ELastStep;
   174 				iCaseStep = ELastStep;
   152 			return TestPassed();
   181 			return TestPassed();
   153 
   182 
   154 			
   183 			
   155 		default:
   184 		default:
   156 			test.Printf(_L("<Error> unknown test step"));
   185 			test.Printf(_L("<Error> unknown test step"));
       
   186 			OstTrace0(TRACE_NORMAL, CTESTCASE0456_RUNSTEPL_DUP04, "<Error> unknown test step");
   157 			Cancel();
   187 			Cancel();
   158 			TestPolicy().SignalTestComplete(KErrCorrupt);
   188 			TestPolicy().SignalTestComplete(KErrCorrupt);
   159 			break;
   189 			break;
   160 		}
   190 		}
   161 		
   191