omxilcomp/omxilaudioemulator/pcmrenderer/unittest/src/tsu_omxil_pcmrenderer_step.cpp
changeset 0 58be5850fb6c
child 1 e0d606d6e3b1
equal deleted inserted replaced
-1:000000000000 0:58be5850fb6c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <e32cmn.h>
       
    23 #include <mmf/server/mmfbuffer.h>
       
    24 #include <mmf/server/mmfdatabuffer.h>
       
    25 
       
    26 #include <openmax/il/khronos/v1_x/OMX_Component.h>
       
    27 #include <openmax/il/khronos/v1_x/OMX_Types.h>
       
    28 
       
    29 #include <openmax/il/loader/omxilcomponentif.h>
       
    30 #include <openmax/il/extensions/omxilsymbianaudiopcmextensions.h>
       
    31 
       
    32 #include "log.h"
       
    33 #include "omxilpcmrenderer.hrh"
       
    34 #include <openmax/il/common/omxilspecversion.h>
       
    35 
       
    36 #include "tsu_omxil_pcmrenderer_step.h"
       
    37 
       
    38 _LIT8(KSymbianOmxILPcmRendererRole, "audio_renderer.pcm");
       
    39 _LIT8(KTestOmxILWrongRendererRole, "audio_renderer.wrong");
       
    40 _LIT(KPcmRendererTestFile, "c:\\omxil\\testfiles\\pcm16stereo8khz.raw");
       
    41 _LIT(KPcmRendererTestFile2, "c:\\omxil\\testfiles\\pcm16stereo44khz.raw");
       
    42 
       
    43 OMX_ERRORTYPE ComponentInit(OMX_HANDLETYPE /*aComponent*/)
       
    44 	{
       
    45 	return OMX_ErrorNone;
       
    46 	}
       
    47 
       
    48 
       
    49 //
       
    50 // RAsyncTestStepOmxILPcmRenderer0020
       
    51 //
       
    52 RAsyncTestStepOmxILPcmRenderer0020::RAsyncTestStepOmxILPcmRenderer0020(const TDesC& aTestName, TInt aComponentUid)
       
    53 	:
       
    54 	RAsyncTestStepOmxILComponentBase(aTestName, aComponentUid),
       
    55 	ipKickoff01(NULL),
       
    56 	ipKickoff02(NULL),
       
    57 	ipKickoff03(NULL),
       
    58 	ipKickoff04(NULL),
       
    59 	ipKickoff05(NULL),
       
    60 	ipKickoff06(NULL)
       
    61 
       
    62 	{
       
    63     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0020::RAsyncTestStepOmxILPcmRenderer0020"));
       
    64 	}
       
    65 
       
    66 
       
    67 void
       
    68 RAsyncTestStepOmxILPcmRenderer0020::KickoffTestL()
       
    69 	{
       
    70     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0020::KickoffTestL"));
       
    71 
       
    72 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test20  "));
       
    73 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Init Component "));
       
    74 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Obtain the component's state (GetState) "));
       
    75 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Obtain the component's version (GetComponentVersion) "));
       
    76 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Provide callbacks to component (SetCallbacks) "));
       
    77 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Obtain the port def params for Port #0 (GetParameter) "));
       
    78 
       
    79 	// This will install one callback
       
    80 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
    81 
       
    82 	// This is the only step in this test...
       
    83 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0020Step01, this);
       
    84 	delete ipKickoff01;
       
    85 	ipKickoff01 = NULL;
       
    86 	ipKickoff01 =
       
    87 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
    88 	ipKickoff01->Call();
       
    89 
       
    90 	// The successful termination...
       
    91 	TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
    92 	delete ipKickoffStop;
       
    93 	ipKickoffStop = NULL;
       
    94 	ipKickoffStop =
       
    95 		new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
    96 	ipKickoffStop->Call();
       
    97 
       
    98 	}
       
    99 
       
   100 void
       
   101 RAsyncTestStepOmxILPcmRenderer0020::CloseTest()
       
   102 	{
       
   103     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0020::CloseTest"));
       
   104 
       
   105 	delete ipKickoff01; // no need to Cancel
       
   106 	ipKickoff01 = NULL;
       
   107 	delete ipKickoff02; // no need to Cancel
       
   108 	ipKickoff02 = NULL;
       
   109 	delete ipKickoff03; // no need to Cancel
       
   110 	ipKickoff03 = NULL;
       
   111 	delete ipKickoff04; // no need to Cancel
       
   112 	ipKickoff04 = NULL;
       
   113 	delete ipKickoff05; // no need to Cancel
       
   114 	ipKickoff05 = NULL;
       
   115 	delete ipKickoff06; // no need to Cancel
       
   116 	ipKickoff06 = NULL;
       
   117 
       
   118 	delete ipKickoffStop; // no need to Cancel
       
   119 	ipKickoffStop = 0;
       
   120 
       
   121 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
   122 
       
   123 	}
       
   124 
       
   125 
       
   126 void
       
   127 RAsyncTestStepOmxILPcmRenderer0020::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
   128 											  OMX_EVENTTYPE /*aEvent*/,
       
   129 											  TUint /*aData1*/,
       
   130 											  TUint /*aData2*/,
       
   131 											  TAny* /*aExtra*/)
       
   132 	{
       
   133     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0020::DoEventHandlerL"));
       
   134 
       
   135 	// We don't expect here any callback
       
   136 	return StopTest(KErrGeneral, EFail);
       
   137 
       
   138 	}
       
   139 
       
   140 
       
   141 TInt
       
   142 RAsyncTestStepOmxILPcmRenderer0020::RAsyncTestStepOmxILPcmRenderer0020Step01(TAny* aPtr)
       
   143 	{
       
   144     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0020::RAsyncTestStepOmxILPcmRenderer0020Step01"));
       
   145     RAsyncTestStepOmxILPcmRenderer0020* self =
       
   146 		static_cast<RAsyncTestStepOmxILPcmRenderer0020*> (aPtr);
       
   147 	self->DoRAsyncTestStepOmxILPcmRenderer0020Step01();
       
   148 	return KErrNone;
       
   149 	}
       
   150 
       
   151 void
       
   152 RAsyncTestStepOmxILPcmRenderer0020::DoRAsyncTestStepOmxILPcmRenderer0020Step01()
       
   153 	{
       
   154     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0020::DoRAsyncTestStepOmxILPcmRenderer0020Step01"));
       
   155 
       
   156 
       
   157 	//
       
   158 	// Obtain the component's state
       
   159 	//
       
   160 	OMX_STATETYPE compState;
       
   161 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
   162 												&compState))
       
   163 		{
       
   164 		return StopTest(KErrGeneral, EFail);
       
   165 		}
       
   166 
       
   167 	PrintOmxState(compState);
       
   168 
       
   169 	if (OMX_StateLoaded != compState)
       
   170 		{
       
   171 		return StopTest(KErrGeneral, EFail);
       
   172 		}
       
   173 
       
   174 	char componentNameArray[OMX_MAX_STRINGNAME_SIZE];
       
   175 	OMX_VERSIONTYPE componentVersion;
       
   176 	OMX_VERSIONTYPE specVersion;
       
   177 	OMX_UUIDTYPE componentUUID;
       
   178 
       
   179 	//
       
   180 	// Obtain the component's version
       
   181 	//
       
   182 
       
   183 	if (OMX_ErrorNone != ipCompHandle->GetComponentVersion(
       
   184 			ipCompHandle,
       
   185 			componentNameArray,
       
   186 			&componentVersion,
       
   187 			&specVersion,
       
   188 			&componentUUID))
       
   189 		{
       
   190 		return StopTest(KErrGeneral, EFail);
       
   191 		}
       
   192 
       
   193 	TBuf8<128> componentNameBuf8;
       
   194 	componentNameBuf8 = const_cast<const TUint8*>(reinterpret_cast<TUint8*>(componentNameArray));
       
   195 	TBuf<128> componentNameBuf16;
       
   196 	INFO_PRINTF2(_L("Component Name length: %d"), componentNameBuf8.Length());
       
   197 	componentNameBuf16.Copy(componentNameBuf8);
       
   198 	componentNameBuf16.PtrZ();
       
   199 
       
   200 	// INFO_PRINTF2(_L("Component Name: %s"), dst.Ptr());
       
   201 	INFO_PRINTF2(_L("Component Name: %S"), &componentNameBuf16);
       
   202 	INFO_PRINTF2(_L("Component Version Major: %d"), componentVersion.s.nVersionMajor);
       
   203 	INFO_PRINTF2(_L("Component Version Minor: %d"), componentVersion.s.nVersionMinor);
       
   204 	INFO_PRINTF2(_L("Component Version Revision: %d"), componentVersion.s.nRevision);
       
   205 	INFO_PRINTF2(_L("Component Version Step: %d"), componentVersion.s.nStep);
       
   206 	INFO_PRINTF2(_L("OMX Version Major: %d"), specVersion.s.nVersionMajor);
       
   207 	INFO_PRINTF2(_L("OMX Version Minor: %d"), specVersion.s.nVersionMinor);
       
   208 	INFO_PRINTF2(_L("OMX Version Revision: %d"), specVersion.s.nRevision);
       
   209 	INFO_PRINTF2(_L("OMX Version Step: %d"), specVersion.s.nStep);
       
   210 	INFO_PRINTF2(_L("Component UUID: %X"), componentUUID);
       
   211 
       
   212 
       
   213 	//
       
   214 	// Provide callbacks to component
       
   215 	//
       
   216 	OMX_CALLBACKTYPE* omxCallbacks = *ipCallbackHandler;
       
   217 
       
   218 	if (OMX_ErrorNone != ipCompHandle->SetCallbacks(
       
   219 			ipCompHandle,
       
   220 			omxCallbacks,
       
   221 			ipCallbackHandler))
       
   222 		{
       
   223 		return StopTest(KErrGeneral, EFail);
       
   224 		}
       
   225 
       
   226 	INFO_PRINTF2(_L("Component Callbacks set successfully: %X"), ipCallbackHandler);
       
   227 
       
   228 	//
       
   229 	// Obtain the port def params for Port #0
       
   230 	//
       
   231 	OMX_PARAM_PORTDEFINITIONTYPE portParamsInputPort;
       
   232 	portParamsInputPort.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
       
   233 	portParamsInputPort.nVersion = TOmxILSpecVersion();
       
   234 	portParamsInputPort.nPortIndex = 0;
       
   235 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
   236 			ipCompHandle,
       
   237 			OMX_IndexParamPortDefinition,
       
   238 			&portParamsInputPort))
       
   239 		{
       
   240 		return StopTest(KErrGeneral, EFail);
       
   241 		}
       
   242 
       
   243 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE nPortIndex: %d"), portParamsInputPort.nPortIndex);
       
   244 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE eDir: %d"), portParamsInputPort.eDir);
       
   245 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE nBufferCountActual: %d"), portParamsInputPort.nBufferCountActual);
       
   246 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE nBufferCountMin: %d"), portParamsInputPort.nBufferCountMin);
       
   247 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE nBufferSize: %d"), portParamsInputPort.nBufferSize);
       
   248 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE bEnabled: %d"), portParamsInputPort.bEnabled == OMX_FALSE ? 0 : 1);
       
   249 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE bPopulated: %d"), portParamsInputPort.bPopulated == OMX_FALSE ? 0 : 1);
       
   250 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE eDomain: %d"), portParamsInputPort.eDomain);
       
   251 
       
   252 	TBuf8<128> cMIMEType8Input;
       
   253 	cMIMEType8Input = const_cast<const TUint8*>(reinterpret_cast<TUint8*>(portParamsInputPort.format.audio.cMIMEType));
       
   254 
       
   255 	TBuf<128> cMIMEType16Input;
       
   256 	cMIMEType16Input.Copy(cMIMEType8Input);
       
   257 	cMIMEType16Input.PtrZ();
       
   258 
       
   259 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE format.cMIMEType: %S"), &cMIMEType16Input);
       
   260 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE format.pNativeRender: %X"), portParamsInputPort.format.audio.pNativeRender);
       
   261 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE format.bFlagErrorConcealment: %d"),
       
   262 				 portParamsInputPort.format.audio.bFlagErrorConcealment == OMX_FALSE ? 0 : 1);
       
   263 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE format.eEncoding: %d"), portParamsInputPort.format.audio.eEncoding);
       
   264 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE bBuffersContiguous: %d"),
       
   265 				 portParamsInputPort.bBuffersContiguous == OMX_FALSE ? 0 : 1);
       
   266 	INFO_PRINTF2(_L("PORTDEFINITIONTYPE nBufferAlignment: %d"), portParamsInputPort.nBufferAlignment);
       
   267 	}
       
   268 
       
   269 //
       
   270 // RAsyncTestStepOmxILPcmRenderer0021
       
   271 //
       
   272 RAsyncTestStepOmxILPcmRenderer0021::RAsyncTestStepOmxILPcmRenderer0021(const TDesC& aTestName, TInt aComponentUid)
       
   273 	:
       
   274 	RAsyncTestStepOmxILComponentBase(aTestName, aComponentUid),
       
   275 	ipKickoff01(NULL),
       
   276 	ipKickoff02(NULL),
       
   277 	ipKickoff03(NULL),
       
   278 	ipKickoff04(NULL),
       
   279 	ipKickoff05(NULL),
       
   280 	ipKickoff06(NULL)
       
   281 
       
   282 	{
       
   283     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0021::RAsyncTestStepOmxILPcmRenderer0021"));
       
   284 	}
       
   285 
       
   286 
       
   287 void
       
   288 RAsyncTestStepOmxILPcmRenderer0021::KickoffTestL()
       
   289 	{
       
   290     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0021::KickoffTestL"));
       
   291 
       
   292 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test21  "));
       
   293 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Init Component "));
       
   294 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Provide callbacks to component (SetCallbacks) "));
       
   295 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Obtain the component's state (GetState) "));
       
   296 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Obtain component's role #1 with null string (ComponentRoleEnum fails with OMX_ErrorBadParameter) "));
       
   297 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Obtain component's role #1 (ComponentRoleEnum returns audio_renderer.pcm) "));
       
   298 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 6.- Obtain component's role #2 (ComponentRoleEnum fails with OMX_ErrorNoMore) "));
       
   299 
       
   300 	// This will install one callback
       
   301 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
   302 
       
   303 	// This is the only step in this test...
       
   304 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0021Step01, this);
       
   305 	delete ipKickoff01;
       
   306 	ipKickoff01 = NULL;
       
   307 	ipKickoff01 =
       
   308 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
   309 	ipKickoff01->Call();
       
   310 
       
   311 	// The successful termination...
       
   312 	TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
   313 	delete ipKickoffStop;
       
   314 	ipKickoffStop = NULL;
       
   315 	ipKickoffStop =
       
   316 		new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
   317 	ipKickoffStop->Call();
       
   318 
       
   319 	}
       
   320 
       
   321 void
       
   322 RAsyncTestStepOmxILPcmRenderer0021::CloseTest()
       
   323 	{
       
   324     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0021::CloseTest"));
       
   325 
       
   326 	delete ipKickoff01; // no need to Cancel
       
   327 	ipKickoff01 = NULL;
       
   328 	delete ipKickoff02; // no need to Cancel
       
   329 	ipKickoff02 = NULL;
       
   330 	delete ipKickoff03; // no need to Cancel
       
   331 	ipKickoff03 = NULL;
       
   332 	delete ipKickoff04; // no need to Cancel
       
   333 	ipKickoff04 = NULL;
       
   334 	delete ipKickoff05; // no need to Cancel
       
   335 	ipKickoff05 = NULL;
       
   336 	delete ipKickoff06; // no need to Cancel
       
   337 	ipKickoff06 = NULL;
       
   338 
       
   339 	delete ipKickoffStop; // no need to Cancel
       
   340 	ipKickoffStop = 0;
       
   341 
       
   342 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
   343 
       
   344 	}
       
   345 
       
   346 
       
   347 void
       
   348 RAsyncTestStepOmxILPcmRenderer0021::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
   349 											  OMX_EVENTTYPE /*aEvent*/,
       
   350 											  TUint /*aData1*/,
       
   351 											  TUint /*aData2*/,
       
   352 											  TAny* /*aExtra*/)
       
   353 	{
       
   354     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0021::DoEventHandlerL"));
       
   355 
       
   356 	// We don't expect here any callback
       
   357 	return StopTest(KErrGeneral, EFail);
       
   358 
       
   359 	}
       
   360 
       
   361 
       
   362 TInt
       
   363 RAsyncTestStepOmxILPcmRenderer0021::RAsyncTestStepOmxILPcmRenderer0021Step01(TAny* aPtr)
       
   364 	{
       
   365     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0021::RAsyncTestStepOmxILPcmRenderer0021Step01"));
       
   366     RAsyncTestStepOmxILPcmRenderer0021* self =
       
   367 		static_cast<RAsyncTestStepOmxILPcmRenderer0021*> (aPtr);
       
   368 	self->DoRAsyncTestStepOmxILPcmRenderer0021Step01();
       
   369 	return KErrNone;
       
   370 	}
       
   371 
       
   372 void
       
   373 RAsyncTestStepOmxILPcmRenderer0021::DoRAsyncTestStepOmxILPcmRenderer0021Step01()
       
   374 	{
       
   375     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0021::DoRAsyncTestStepOmxILPcmRenderer0021Step01"));
       
   376 
       
   377 	//
       
   378 	// Provide callbacks to component
       
   379 	//
       
   380 	OMX_CALLBACKTYPE* omxCallbacks = *ipCallbackHandler;
       
   381 
       
   382 	if (OMX_ErrorNone != ipCompHandle->SetCallbacks(
       
   383 			ipCompHandle,
       
   384 			omxCallbacks,
       
   385 			ipCallbackHandler))
       
   386 		{
       
   387 		return StopTest(KErrGeneral, EFail);
       
   388 		}
       
   389 
       
   390 	//
       
   391 	// Obtain the component's state
       
   392 	//
       
   393 	OMX_STATETYPE compState;
       
   394 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
   395 												&compState))
       
   396 		{
       
   397 		return StopTest(KErrGeneral, EFail);
       
   398 		}
       
   399 
       
   400 	PrintOmxState(compState);
       
   401 
       
   402 	if (OMX_StateLoaded != compState)
       
   403 		{
       
   404 		return StopTest(KErrGeneral, EFail);
       
   405 		}
       
   406 
       
   407 	INFO_PRINTF2(_L("Component Callbacks set successfully: %X"), ipCallbackHandler);
       
   408 
       
   409 
       
   410 	//
       
   411 	// Try to obtain the component's first role with null string  (must fail with error OMX_ErrorBadParameter)
       
   412 	//
       
   413 	OMX_U8* pNullUint = 0;
       
   414 	if (OMX_ErrorBadParameter != ipCompHandle->ComponentRoleEnum(
       
   415 			ipCompHandle,
       
   416 			pNullUint,
       
   417 			0 // This is index # 0, the first of the component's roles
       
   418 			))
       
   419 		{
       
   420 		return StopTest(KErrGeneral, EFail);
       
   421 		}
       
   422 
       
   423 	//
       
   424 	// Obtain the component's first role (success)
       
   425 	//
       
   426 	char componentRoleArray[OMX_MAX_STRINGNAME_SIZE];
       
   427 	if (OMX_ErrorNone != ipCompHandle->ComponentRoleEnum(
       
   428 			ipCompHandle,
       
   429 			reinterpret_cast<OMX_U8*>(componentRoleArray),
       
   430 			0 // This is index # 0, the first of the component's roles
       
   431 			))
       
   432 		{
       
   433 		return StopTest(KErrGeneral, EFail);
       
   434 		}
       
   435 
       
   436 	TBuf8<128> componentRoleBuf8;
       
   437 	componentRoleBuf8 = const_cast<const TUint8*>(reinterpret_cast<TUint8*>(componentRoleArray));
       
   438 	TBuf<128> componentRoleBuf16;
       
   439 	INFO_PRINTF2(_L("Component's Role length: %d"), componentRoleBuf8.Length());
       
   440 	componentRoleBuf16.Copy(componentRoleBuf8);
       
   441 	componentRoleBuf16.PtrZ();
       
   442 
       
   443 	INFO_PRINTF2(_L("Component's 1st Role [%S] "), &componentRoleBuf16);
       
   444 
       
   445 	if (componentRoleBuf8.Compare(KSymbianOmxILPcmRendererRole()) != 0)
       
   446 		{
       
   447 		return StopTest(KErrGeneral, EFail);
       
   448 		}
       
   449 
       
   450 	//
       
   451 	// Obtain the component's second role (must fail with error OMX_ErrorNoMore)
       
   452 	//
       
   453 	if (OMX_ErrorNoMore != ipCompHandle->ComponentRoleEnum(
       
   454 			ipCompHandle,
       
   455 			reinterpret_cast<OMX_U8*>(componentRoleArray),
       
   456 			1 // This is index # 1, the second of the component's roles
       
   457 			))
       
   458 		{
       
   459 		return StopTest(KErrGeneral, EFail);
       
   460 		}
       
   461 
       
   462 	}
       
   463 
       
   464 //
       
   465 // RAsyncTestStepOmxILPcmRenderer0022
       
   466 //
       
   467 RAsyncTestStepOmxILPcmRenderer0022::RAsyncTestStepOmxILPcmRenderer0022(const TDesC& aTestName, TInt aComponentUid)
       
   468 	:
       
   469 	RAsyncTestStepOmxILComponentBase(aTestName, aComponentUid),
       
   470 	ipKickoff01(NULL),
       
   471 	ipKickoff02(NULL),
       
   472 	ipKickoff03(NULL),
       
   473 	ipKickoff04(NULL),
       
   474 	ipKickoff05(NULL),
       
   475 	ipKickoff06(NULL)
       
   476 
       
   477 	{
       
   478     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0022::RAsyncTestStepOmxILPcmRenderer0022"));
       
   479 	}
       
   480 
       
   481 
       
   482 void
       
   483 RAsyncTestStepOmxILPcmRenderer0022::KickoffTestL()
       
   484 	{
       
   485     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0022::KickoffTestL"));
       
   486 
       
   487 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test22  "));
       
   488 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Init Component "));
       
   489 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Provide callbacks to component (SetCallbacks) "));
       
   490 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Obtain the component's state (GetState) "));
       
   491 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Get component's current role (GetParameter(OMX_IndexParamStandardComponentRole) )"));
       
   492 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Set unsupported audio_renderer.wrong role (SetParameter(OMX_IndexParamStandardComponentRole) )"));
       
   493 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5a.- SetParameter returns OMX_ErrorBadParameter (audio_renderer.wrong role not supported)"));
       
   494 
       
   495 	// This will install one callback
       
   496 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
   497 
       
   498 	// This is the only step in this test...
       
   499 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0022Step01, this);
       
   500 	delete ipKickoff01;
       
   501 	ipKickoff01 = NULL;
       
   502 	ipKickoff01 =
       
   503 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
   504 	ipKickoff01->Call();
       
   505 
       
   506 	// The successful termination...
       
   507 	TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
   508 	delete ipKickoffStop;
       
   509 	ipKickoffStop = NULL;
       
   510 	ipKickoffStop =
       
   511 		new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
   512 	ipKickoffStop->Call();
       
   513 
       
   514 	}
       
   515 
       
   516 void
       
   517 RAsyncTestStepOmxILPcmRenderer0022::CloseTest()
       
   518 	{
       
   519     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0022::CloseTest"));
       
   520 
       
   521 	delete ipKickoff01; // no need to Cancel
       
   522 	ipKickoff01 = NULL;
       
   523 	delete ipKickoff02; // no need to Cancel
       
   524 	ipKickoff02 = NULL;
       
   525 	delete ipKickoff03; // no need to Cancel
       
   526 	ipKickoff03 = NULL;
       
   527 	delete ipKickoff04; // no need to Cancel
       
   528 	ipKickoff04 = NULL;
       
   529 	delete ipKickoff05; // no need to Cancel
       
   530 	ipKickoff05 = NULL;
       
   531 	delete ipKickoff06; // no need to Cancel
       
   532 	ipKickoff06 = NULL;
       
   533 
       
   534 	delete ipKickoffStop; // no need to Cancel
       
   535 	ipKickoffStop = 0;
       
   536 
       
   537 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
   538 
       
   539 	}
       
   540 
       
   541 
       
   542 void
       
   543 RAsyncTestStepOmxILPcmRenderer0022::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
   544 											  OMX_EVENTTYPE /*aEvent*/,
       
   545 											  TUint /*aData1*/,
       
   546 											  TUint /*aData2*/,
       
   547 											  TAny* /*aExtra*/)
       
   548 	{
       
   549     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0022::DoEventHandlerL"));
       
   550 
       
   551 	// We don't expect here any callback
       
   552 	return StopTest(KErrGeneral, EFail);
       
   553 
       
   554 	}
       
   555 
       
   556 
       
   557 TInt
       
   558 RAsyncTestStepOmxILPcmRenderer0022::RAsyncTestStepOmxILPcmRenderer0022Step01(TAny* aPtr)
       
   559 	{
       
   560     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0022::RAsyncTestStepOmxILPcmRenderer0022Step01"));
       
   561     RAsyncTestStepOmxILPcmRenderer0022* self =
       
   562 		static_cast<RAsyncTestStepOmxILPcmRenderer0022*> (aPtr);
       
   563 	self->DoRAsyncTestStepOmxILPcmRenderer0022Step01();
       
   564 	return KErrNone;
       
   565 	}
       
   566 
       
   567 void
       
   568 RAsyncTestStepOmxILPcmRenderer0022::DoRAsyncTestStepOmxILPcmRenderer0022Step01()
       
   569 	{
       
   570     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0022::DoRAsyncTestStepOmxILPcmRenderer0022Step01"));
       
   571 
       
   572 	//
       
   573 	// Provide callbacks to component
       
   574 	//
       
   575 	OMX_CALLBACKTYPE* omxCallbacks = *ipCallbackHandler;
       
   576 
       
   577 	if (OMX_ErrorNone != ipCompHandle->SetCallbacks(
       
   578 			ipCompHandle,
       
   579 			omxCallbacks,
       
   580 			ipCallbackHandler))
       
   581 		{
       
   582 		return StopTest(KErrGeneral, EFail);
       
   583 		}
       
   584 
       
   585 	INFO_PRINTF2(_L("Component Callbacks set successfully: %X"), ipCallbackHandler);
       
   586 
       
   587 	//
       
   588 	// Obtain the component's state
       
   589 	//
       
   590 	OMX_STATETYPE compState;
       
   591 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
   592 												&compState))
       
   593 		{
       
   594 		return StopTest(KErrGeneral, EFail);
       
   595 		}
       
   596 
       
   597 	PrintOmxState(compState);
       
   598 
       
   599 	if (OMX_StateLoaded != compState)
       
   600 		{
       
   601 		return StopTest(KErrGeneral, EFail);
       
   602 		}
       
   603 
       
   604 	//
       
   605 	// Get component's current standard role
       
   606 	//
       
   607 	OMX_PARAM_COMPONENTROLETYPE componentRoleType;
       
   608 	componentRoleType.nSize = sizeof(OMX_PARAM_COMPONENTROLETYPE);
       
   609 	componentRoleType.nVersion = TOmxILSpecVersion();
       
   610 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
   611 			ipCompHandle,
       
   612 			OMX_IndexParamStandardComponentRole,
       
   613 			&componentRoleType))
       
   614 		{
       
   615 		return StopTest(KErrGeneral, EFail);
       
   616 		}
       
   617 
       
   618 	TBuf8<128> componentRoleBuf8;
       
   619 	componentRoleBuf8 = const_cast<const TUint8*>(reinterpret_cast<TUint8*>(componentRoleType.cRole));
       
   620 	TBuf<128> componentRoleBuf16;
       
   621 	INFO_PRINTF2(_L("Component Role length: %d"), componentRoleBuf8.Length());
       
   622 	componentRoleBuf16.Copy(componentRoleBuf8);
       
   623 	componentRoleBuf16.PtrZ();
       
   624 
       
   625 	INFO_PRINTF2(_L("Component's current Role: %S"), &componentRoleBuf16);
       
   626 
       
   627 
       
   628 	//
       
   629 	// Set unsupported standard role
       
   630 	//
       
   631 	TPtr8 role(reinterpret_cast<TUint8*>(componentRoleType.cRole),
       
   632 			   OMX_MAX_STRINGNAME_SIZE);
       
   633 	role.Copy(KTestOmxILWrongRendererRole());
       
   634 	role.PtrZ();
       
   635 
       
   636 	if (OMX_ErrorBadParameter != ipCompHandle->SetParameter(
       
   637 			ipCompHandle,
       
   638 			OMX_IndexParamStandardComponentRole,
       
   639 			&componentRoleType))
       
   640 		{
       
   641 		return StopTest(KErrGeneral, EFail);
       
   642 		}
       
   643 
       
   644 	TBuf8<128> cRole8;
       
   645 	cRole8 = const_cast<const TUint8*>(reinterpret_cast<TUint8*>(componentRoleType.cRole));
       
   646 
       
   647 	TBuf<128> cRole16;
       
   648 	cRole16.Copy(cRole8);
       
   649 	cRole16.PtrZ();
       
   650 
       
   651 	INFO_PRINTF2(_L("SetParameter of an unsupported standard role failed (success): %S"), &cRole16);
       
   652 
       
   653 	}
       
   654 
       
   655 
       
   656 
       
   657 //
       
   658 // RAsyncTestStepOmxILPcmRenderer0001
       
   659 //
       
   660 RAsyncTestStepOmxILPcmRenderer0001::RAsyncTestStepOmxILPcmRenderer0001(const TDesC& aTestName, TInt aComponentUid)
       
   661 	:
       
   662 	RAsyncTestStepOmxILComponentBase(aTestName, aComponentUid),
       
   663 	ipBufferHeaderInput(0),
       
   664 	ipBufferHeaderOutput(0),
       
   665 	iTerminateNow(EFalse),
       
   666 	iSamplingRate(8000),
       
   667 	iTestState(EStateDefault),
       
   668 	ipKickoff01(NULL),
       
   669 	ipKickoff02(NULL),
       
   670 	ipKickoff03(NULL),
       
   671 	ipKickoff04(NULL),
       
   672 	ipKickoff05(NULL),
       
   673 	ipKickoff06(NULL)
       
   674 	{
       
   675     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::RAsyncTestStepOmxILPcmRenderer0001"));
       
   676 	}
       
   677 
       
   678 
       
   679 void
       
   680 RAsyncTestStepOmxILPcmRenderer0001::KickoffTestL()
       
   681 	{
       
   682     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::KickoffTestL"));
       
   683 	iTestState = EStateLoadKickoffTestLComplete;
       
   684 
       
   685 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test01  "));
       
   686 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
   687 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Loaded(depopulation) "));
       
   688 
       
   689 	// This will install one callback
       
   690 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
   691 
       
   692 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0001Step01, this);
       
   693 	delete ipKickoff01;
       
   694 	ipKickoff01 = NULL;
       
   695 	ipKickoff01 =
       
   696 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
   697 	ipKickoff01->Call();
       
   698 
       
   699 	}
       
   700 
       
   701 void
       
   702 RAsyncTestStepOmxILPcmRenderer0001::CloseTest()
       
   703 	{
       
   704     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::CloseTest"));
       
   705 
       
   706 	delete ipKickoff01; // no need to Cancel
       
   707 	ipKickoff01 = NULL;
       
   708 	delete ipKickoff02; // no need to Cancel
       
   709 	ipKickoff02 = NULL;
       
   710 	delete ipKickoff03; // no need to Cancel
       
   711 	ipKickoff03 = NULL;
       
   712 	delete ipKickoff04; // no need to Cancel
       
   713 	ipKickoff04 = NULL;
       
   714 	delete ipKickoff05; // no need to Cancel
       
   715 	ipKickoff05 = NULL;
       
   716 	delete ipKickoff06; // no need to Cancel
       
   717 	ipKickoff06 = NULL;
       
   718 
       
   719 	delete ipKickoffStop; // no need to Cancel
       
   720 	ipKickoffStop = 0;
       
   721 
       
   722 	TInt count = ipClientClockPortBufferArray.Count();
       
   723 	
       
   724 	for (TInt n = 0; n < count; n++)
       
   725 		{
       
   726 		delete ipClientClockPortBufferArray[n];
       
   727 		}
       
   728 	
       
   729 	ipClientClockPortBufferArray.Close();
       
   730 	
       
   731 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
   732 
       
   733 	}
       
   734 
       
   735 
       
   736 void
       
   737 RAsyncTestStepOmxILPcmRenderer0001::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
   738 											  OMX_EVENTTYPE /*aEvent*/,
       
   739 											  TUint /*aData1*/,
       
   740 											  TUint /*aData2*/,
       
   741 											  TAny* /*aExtra*/)
       
   742 	{
       
   743     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::DoEventHandlerL"));
       
   744 
       
   745 	if (!iTerminateNow)
       
   746 		{
       
   747 		TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0001Step02, this);
       
   748 		delete ipKickoff02;
       
   749 		ipKickoff02 = NULL;
       
   750 		ipKickoff02 =
       
   751 			new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
   752 		ipKickoff02->Call();
       
   753 		}
       
   754 	else
       
   755 		{
       
   756 		OMX_STATETYPE compState;
       
   757 		if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
   758 													&compState))
       
   759 			{
       
   760 			return StopTest(KErrGeneral, EFail);
       
   761 			}
       
   762 
       
   763 		PrintOmxState(compState);
       
   764 
       
   765 		if (OMX_StateLoaded != compState)
       
   766 			{
       
   767 			return StopTest(KErrGeneral, EFail);
       
   768 			}
       
   769 
       
   770 		// The successful termination...
       
   771 		TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
   772 		delete ipKickoffStop;
       
   773 		ipKickoffStop = NULL;
       
   774 		ipKickoffStop =
       
   775 			new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
   776 		ipKickoffStop->Call();
       
   777 		}
       
   778 
       
   779 	}
       
   780 
       
   781 
       
   782 TInt
       
   783 RAsyncTestStepOmxILPcmRenderer0001::RAsyncTestStepOmxILPcmRenderer0001Step01(TAny* aPtr)
       
   784 	{
       
   785     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::RAsyncTestStepOmxILPcmRenderer0001Step01"));
       
   786     RAsyncTestStepOmxILPcmRenderer0001* self =
       
   787 		static_cast<RAsyncTestStepOmxILPcmRenderer0001*> (aPtr);
       
   788 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step01();
       
   789 	return KErrNone;
       
   790 	}
       
   791 
       
   792 void
       
   793 RAsyncTestStepOmxILPcmRenderer0001::DoRAsyncTestStepOmxILPcmRenderer0001Step01()
       
   794 	{
       
   795     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::DoRAsyncTestStepOmxILPcmRenderer0001Step01"));
       
   796 
       
   797 	//
       
   798 	// Provide callbacks to component
       
   799 	//
       
   800 	OMX_CALLBACKTYPE* omxCallbacks = *ipCallbackHandler;
       
   801 
       
   802 	if (OMX_ErrorNone != ipCompHandle->SetCallbacks(
       
   803 			ipCompHandle,
       
   804 			omxCallbacks,
       
   805 			ipCallbackHandler))
       
   806 		{
       
   807 		return StopTest(KErrGeneral, EFail);
       
   808 		}
       
   809 
       
   810 	INFO_PRINTF2(_L("Component Callbacks set successfully: %X"), ipCallbackHandler);
       
   811 
       
   812 	//
       
   813 	// Obtain the port def params for Port #0
       
   814 	//
       
   815 	OMX_PARAM_PORTDEFINITIONTYPE portParamsInputPort;
       
   816 	portParamsInputPort.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
       
   817 	portParamsInputPort.nVersion = TOmxILSpecVersion();
       
   818 	portParamsInputPort.nPortIndex = 0;
       
   819 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
   820 			ipCompHandle,
       
   821 			OMX_IndexParamPortDefinition,
       
   822 			&portParamsInputPort))
       
   823 		{
       
   824 		return StopTest(KErrGeneral, EFail);
       
   825 		}
       
   826 	
       
   827 	//
       
   828 	// Obtain the port def params for Client Clock Port #1
       
   829 	//
       
   830 	OMX_PARAM_PORTDEFINITIONTYPE portParamsInputPort1;
       
   831 	portParamsInputPort1.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
       
   832 	portParamsInputPort1.nVersion = TOmxILSpecVersion();
       
   833 	portParamsInputPort1.nPortIndex = 1;
       
   834 
       
   835 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
   836 			ipCompHandle,
       
   837 			OMX_IndexParamPortDefinition,
       
   838 			&portParamsInputPort1))
       
   839 		{
       
   840 		return StopTest(KErrGeneral, EFail);
       
   841 		}
       
   842 
       
   843 	//
       
   844 	// Change the sampling rate on PCM Renderer's port #0
       
   845 	//
       
   846 	OMX_AUDIO_PARAM_PCMMODETYPE pcmMode;
       
   847 	pcmMode.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
       
   848 	pcmMode.nVersion = TOmxILSpecVersion();
       
   849 	pcmMode.nPortIndex = 0;
       
   850 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
   851 			ipCompHandle,
       
   852 			OMX_IndexParamAudioPcm,
       
   853 			&pcmMode))
       
   854 		{
       
   855 		return StopTest(KErrGeneral, EFail);
       
   856 		}
       
   857 	pcmMode.nSamplingRate = iSamplingRate;
       
   858 	if (OMX_ErrorNone != ipCompHandle->SetParameter(
       
   859 			ipCompHandle,
       
   860 			OMX_IndexParamAudioPcm,
       
   861 			&pcmMode))
       
   862 		{
       
   863 		return StopTest(KErrGeneral, EFail);
       
   864 		}
       
   865 
       
   866 	//
       
   867 	// Move component to OMX_StateIdle
       
   868 	//
       
   869 
       
   870 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
   871 			ipCompHandle,
       
   872 			OMX_CommandStateSet,
       
   873 			OMX_StateIdle,
       
   874 			0))
       
   875 		{
       
   876 		return StopTest(KErrGeneral, EFail);
       
   877 		}
       
   878 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Moving component to OMX_StateIdle"));
       
   879 
       
   880 	OMX_STATETYPE compState;
       
   881 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
   882 												&compState))
       
   883 		{
       
   884 		return StopTest(KErrGeneral, EFail);
       
   885 		}
       
   886 
       
   887 	PrintOmxState(compState);
       
   888 
       
   889 	if (OMX_StateLoaded != compState)
       
   890 		{
       
   891 		return StopTest(KErrGeneral, EFail);
       
   892 		}
       
   893 
       
   894 	//
       
   895 	// Allocate buffer on input port
       
   896 	//
       
   897 	if (OMX_ErrorNone != ipCompHandle->AllocateBuffer(
       
   898 			ipCompHandle,
       
   899 			&ipBufferHeaderInput,
       
   900 			0, // input port
       
   901 			0,
       
   902 			portParamsInputPort.nBufferSize))
       
   903 		{
       
   904 		return StopTest(KErrGeneral, EFail);
       
   905 		}
       
   906 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Populated buffer (AllocateBuffer) in INPUT port"));
       
   907 	
       
   908 	//
       
   909 	// Allocate buffer on Client Clock Port
       
   910 	//
       
   911 	TInt bufferCount = portParamsInputPort1.nBufferCountActual;
       
   912 	
       
   913 	for (TInt n = 0; n < bufferCount; n++)
       
   914 		{
       
   915 		OMX_BUFFERHEADERTYPE* clockBufPtr;
       
   916 		
       
   917 		if (OMX_ErrorNone != ipCompHandle->AllocateBuffer(
       
   918 				ipCompHandle,
       
   919 				&clockBufPtr,
       
   920 				1, // Clock input port
       
   921 				0,
       
   922 				portParamsInputPort1.nBufferSize))
       
   923 			{
       
   924 			return StopTest(KErrGeneral, EFail);
       
   925 			}
       
   926 		
       
   927 		if (ipClientClockPortBufferArray.Append(clockBufPtr) != KErrNone)
       
   928 			{
       
   929 			return StopTest(KErrNoMemory, EFail);
       
   930 			}
       
   931 		}
       
   932 	
       
   933 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Populated buffer (AllocateBuffer) in Clock INPUT port"));
       
   934 	}
       
   935 
       
   936 TInt
       
   937 RAsyncTestStepOmxILPcmRenderer0001::RAsyncTestStepOmxILPcmRenderer0001Step02(TAny* aPtr)
       
   938 	{
       
   939     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::RAsyncTestStepOmxILPcmRenderer0001Step02"));
       
   940     RAsyncTestStepOmxILPcmRenderer0001* self =
       
   941 		static_cast<RAsyncTestStepOmxILPcmRenderer0001*> (aPtr);
       
   942 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step02();
       
   943 	return KErrNone;
       
   944 	}
       
   945 
       
   946 void
       
   947 RAsyncTestStepOmxILPcmRenderer0001::DoRAsyncTestStepOmxILPcmRenderer0001Step02()
       
   948 	{
       
   949     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0001::DoRAsyncTestStepOmxILPcmRenderer0001Step02"));
       
   950 
       
   951 	//
       
   952 	// Move component to OMX_StateLoaded
       
   953 	//
       
   954 
       
   955 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
   956 			ipCompHandle,
       
   957 			OMX_CommandStateSet,
       
   958 			OMX_StateLoaded,
       
   959 			0))
       
   960 		{
       
   961 		return StopTest(KErrGeneral, EFail);
       
   962 		}
       
   963 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Moving component to OMX_StateLoaded"));
       
   964 
       
   965 	OMX_STATETYPE compState;
       
   966 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
   967 												&compState))
       
   968 		{
       
   969 		return StopTest(KErrGeneral, EFail);
       
   970 		}
       
   971 
       
   972 	PrintOmxState(compState);
       
   973 
       
   974 	if (OMX_StateIdle != compState)
       
   975 		{
       
   976 		return StopTest(KErrGeneral, EFail);
       
   977 		}
       
   978 
       
   979 	//
       
   980 	// Free buffer on input port
       
   981 	//
       
   982 	if (OMX_ErrorNone != ipCompHandle->FreeBuffer(
       
   983 			ipCompHandle,
       
   984 			0, // input port
       
   985 			ipBufferHeaderInput))
       
   986 		{
       
   987 		return StopTest(KErrGeneral, EFail);
       
   988 		}
       
   989 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Depopulated buffer (FreeBuffer) in INPUT port"));
       
   990 
       
   991 	//
       
   992 	// Free Client Clock Port buffer on input port
       
   993 	//
       
   994 	TInt count =  ipClientClockPortBufferArray.Count();
       
   995 	
       
   996 	for (TInt n = 0; n < count; n++)
       
   997 		{
       
   998 		if (OMX_ErrorNone != ipCompHandle->FreeBuffer(
       
   999 				ipCompHandle,
       
  1000 				1, // Client Clock Port
       
  1001 				ipClientClockPortBufferArray[0]))
       
  1002 			{
       
  1003 			return StopTest(KErrGeneral, EFail);
       
  1004 			}
       
  1005 
       
  1006 		ipClientClockPortBufferArray.Remove(0);
       
  1007 		}
       
  1008 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Depopulated Client Clock Port buffer (FreeBuffer) in INPUT port"));
       
  1009 
       
  1010 	iTerminateNow = ETrue;
       
  1011 
       
  1012 	}
       
  1013 
       
  1014 
       
  1015 //
       
  1016 // RAsyncTestStepOmxILPcmRenderer0002
       
  1017 //
       
  1018 RAsyncTestStepOmxILPcmRenderer0002::RAsyncTestStepOmxILPcmRenderer0002(const TDesC& aTestName, TInt aComponentUid)
       
  1019 	:
       
  1020 	RAsyncTestStepOmxILPcmRenderer0001(aTestName, aComponentUid),
       
  1021 	ipInputBuffer(0),
       
  1022 	ipOutputBuffer(0)
       
  1023 
       
  1024 	{
       
  1025     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0002::RAsyncTestStepOmxILPcmRenderer0002"));
       
  1026 	}
       
  1027 
       
  1028 
       
  1029 void
       
  1030 RAsyncTestStepOmxILPcmRenderer0002::KickoffTestL()
       
  1031 	{
       
  1032     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0002::KickoffTestL"));
       
  1033 
       
  1034 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test02 "));
       
  1035 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(UseBuffer-population) "));
       
  1036 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Loaded(depopulation) "));
       
  1037 
       
  1038 	// This will install one callback
       
  1039 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  1040 
       
  1041 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0002Step01, this);
       
  1042 	delete ipKickoff01;
       
  1043 	ipKickoff01 = NULL;
       
  1044 	ipKickoff01 =
       
  1045 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  1046 	ipKickoff01->Call();
       
  1047 
       
  1048 	}
       
  1049 
       
  1050 void
       
  1051 RAsyncTestStepOmxILPcmRenderer0002::CloseTest()
       
  1052 	{
       
  1053     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0002::CloseTest"));
       
  1054 
       
  1055 	delete ipInputBuffer;
       
  1056 	ipInputBuffer = NULL;
       
  1057 	delete ipOutputBuffer;
       
  1058 	ipOutputBuffer = NULL;
       
  1059 
       
  1060 	delete ipKickoff01; // no need to Cancel
       
  1061 	ipKickoff01 = NULL;
       
  1062 	delete ipKickoff02; // no need to Cancel
       
  1063 	ipKickoff02 = NULL;
       
  1064 	delete ipKickoff03; // no need to Cancel
       
  1065 	ipKickoff03 = NULL;
       
  1066 	delete ipKickoff04; // no need to Cancel
       
  1067 	ipKickoff04 = NULL;
       
  1068 	delete ipKickoff05; // no need to Cancel
       
  1069 	ipKickoff05 = NULL;
       
  1070 	delete ipKickoff06; // no need to Cancel
       
  1071 	ipKickoff06 = NULL;
       
  1072 
       
  1073 	delete ipKickoffStop; // no need to Cancel
       
  1074 	ipKickoffStop = 0;
       
  1075 
       
  1076 	ipClientClockPortBufferArray.Close();
       
  1077 	
       
  1078 	TInt count = iClockPortBufferPtrArray.Count();
       
  1079 	
       
  1080 	for (TInt n = 0; n < count; n++)
       
  1081 		{
       
  1082 		delete iClockPortBufferPtrArray[n];
       
  1083 		}
       
  1084 	
       
  1085 	iClockPortBufferPtrArray.Close();
       
  1086 	
       
  1087 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
  1088 
       
  1089 	}
       
  1090 
       
  1091 void
       
  1092 RAsyncTestStepOmxILPcmRenderer0002::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  1093 											  OMX_EVENTTYPE /*aEvent*/,
       
  1094 											  TUint /*aData1*/,
       
  1095 											  TUint /*aData2*/,
       
  1096 											  TAny* /*aExtra*/)
       
  1097 	{
       
  1098     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0002::DoEventHandlerL"));
       
  1099 
       
  1100 	if (!iTerminateNow)
       
  1101 		{
       
  1102 		TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0002Step02, this);
       
  1103 		delete ipKickoff02;
       
  1104 		ipKickoff02 = NULL;
       
  1105 		ipKickoff02 =
       
  1106 			new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  1107 		ipKickoff02->Call();
       
  1108 		}
       
  1109 
       
  1110 	if (iTerminateNow)
       
  1111 		{
       
  1112 		OMX_STATETYPE compState;
       
  1113 		if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1114 													&compState))
       
  1115 			{
       
  1116 			return StopTest(KErrGeneral, EFail);
       
  1117 			}
       
  1118 
       
  1119 		PrintOmxState(compState);
       
  1120 
       
  1121 		if (OMX_StateLoaded != compState)
       
  1122 			{
       
  1123 			return StopTest(KErrGeneral, EFail);
       
  1124 			}
       
  1125 
       
  1126 		// The successful termination...
       
  1127 		TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  1128 		delete ipKickoffStop;
       
  1129 		ipKickoffStop = NULL;
       
  1130 		ipKickoffStop =
       
  1131 			new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  1132 		ipKickoffStop->Call();
       
  1133 		}
       
  1134 
       
  1135 	}
       
  1136 
       
  1137 
       
  1138 TInt
       
  1139 RAsyncTestStepOmxILPcmRenderer0002::RAsyncTestStepOmxILPcmRenderer0002Step01(TAny* aPtr)
       
  1140 	{
       
  1141     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0002::RAsyncTestStepOmxILPcmRenderer0002Step01"));
       
  1142 	RAsyncTestStepOmxILPcmRenderer0002* self =
       
  1143 		static_cast<RAsyncTestStepOmxILPcmRenderer0002*> (aPtr);
       
  1144 	self->DoRAsyncTestStepOmxILPcmRenderer0002Step01();
       
  1145 	return KErrNone;
       
  1146 	}
       
  1147 
       
  1148 void
       
  1149 RAsyncTestStepOmxILPcmRenderer0002::DoRAsyncTestStepOmxILPcmRenderer0002Step01()
       
  1150 	{
       
  1151     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0002::DoRAsyncTestStepOmxILPcmRenderer0002Step01"));
       
  1152 
       
  1153 	//
       
  1154 	// Provide callbacks to component
       
  1155 	//
       
  1156 	OMX_CALLBACKTYPE* omxCallbacks = *ipCallbackHandler;
       
  1157 
       
  1158 	if (OMX_ErrorNone != ipCompHandle->SetCallbacks(
       
  1159 			ipCompHandle,
       
  1160 			omxCallbacks,
       
  1161 			ipCallbackHandler))
       
  1162 		{
       
  1163 		return StopTest(KErrGeneral, EFail);
       
  1164 		}
       
  1165 
       
  1166 	INFO_PRINTF2(_L("Component Callbacks set successfully: %X"), ipCallbackHandler);
       
  1167 
       
  1168 	//
       
  1169 	// Obtain the port def params for Port #0
       
  1170 	//
       
  1171 	OMX_PARAM_PORTDEFINITIONTYPE portParamsInputPort;
       
  1172 	portParamsInputPort.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
       
  1173 	portParamsInputPort.nVersion = TOmxILSpecVersion();
       
  1174 	portParamsInputPort.nPortIndex = 0;
       
  1175 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
  1176 			ipCompHandle,
       
  1177 			OMX_IndexParamPortDefinition,
       
  1178 			&portParamsInputPort))
       
  1179 		{
       
  1180 		return StopTest(KErrGeneral, EFail);
       
  1181 		}
       
  1182 
       
  1183 	//
       
  1184 	// Obtain the port def params for Client Clock Port #1
       
  1185 	//
       
  1186 	OMX_PARAM_PORTDEFINITIONTYPE portParamsInputPort1;
       
  1187 	portParamsInputPort1.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
       
  1188 	portParamsInputPort1.nVersion = TOmxILSpecVersion();
       
  1189 	portParamsInputPort1.nPortIndex = 1;
       
  1190 
       
  1191 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
  1192 			ipCompHandle,
       
  1193 			OMX_IndexParamPortDefinition,
       
  1194 			&portParamsInputPort1))
       
  1195 		{
       
  1196 		return StopTest(KErrGeneral, EFail);
       
  1197 		}
       
  1198 
       
  1199 	//
       
  1200 	// Move component to OMX_StateIdle
       
  1201 	//
       
  1202 
       
  1203 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  1204 			ipCompHandle,
       
  1205 			OMX_CommandStateSet,
       
  1206 			OMX_StateIdle,
       
  1207 			0))
       
  1208 		{
       
  1209 		return StopTest(KErrGeneral, EFail);
       
  1210 		}
       
  1211 
       
  1212 	OMX_STATETYPE compState;
       
  1213 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1214 												&compState))
       
  1215 		{
       
  1216 		return StopTest(KErrGeneral, EFail);
       
  1217 		}
       
  1218 
       
  1219 	PrintOmxState(compState);
       
  1220 
       
  1221 	if (OMX_StateLoaded != compState)
       
  1222 		{
       
  1223 		return StopTest(KErrGeneral, EFail);
       
  1224 		}
       
  1225 
       
  1226 
       
  1227 	//
       
  1228 	// Allocate buffer on input port
       
  1229 	//
       
  1230 	TRAPD(err, ipInputBuffer = CMMFDescriptorBuffer::NewL(portParamsInputPort.nBufferSize));
       
  1231 	if(err != KErrNone)
       
  1232 		{
       
  1233 		return StopTest(KErrGeneral, EFail);
       
  1234 		}
       
  1235 
       
  1236 	TDes8& inputBufferDes = ipInputBuffer->Data();
       
  1237 
       
  1238 	if (OMX_ErrorNone != ipCompHandle->UseBuffer(
       
  1239 			ipCompHandle,
       
  1240 			&ipBufferHeaderInput,
       
  1241 			0,					// input port
       
  1242 			ipInputBuffer,		// pAppPrivate
       
  1243 			portParamsInputPort.nBufferSize,
       
  1244 			const_cast<TUint8*>(inputBufferDes.Ptr())))
       
  1245 		{
       
  1246 		return StopTest(KErrGeneral, EFail);
       
  1247 		}
       
  1248 	INFO_PRINTF1(_L("Populated buffer (UseBuffer) in INPUT port"));
       
  1249 
       
  1250 	//
       
  1251 	// Allocate Client Clock Port buffer
       
  1252 	//
       
  1253 	TInt bufferCount = portParamsInputPort1.nBufferCountActual;
       
  1254 	
       
  1255 	for (TInt n = 0; n < bufferCount; n++)
       
  1256 		{
       
  1257 		CMMFDescriptorBuffer* bufPtr;
       
  1258 		
       
  1259 		TRAPD(err, bufPtr = CMMFDescriptorBuffer::NewL(portParamsInputPort1.nBufferSize));
       
  1260 		
       
  1261 		if(err != KErrNone)
       
  1262 			{
       
  1263 			return StopTest(KErrGeneral, EFail);
       
  1264 			}
       
  1265 		
       
  1266 		if (iClockPortBufferPtrArray.Append(bufPtr) != KErrNone)
       
  1267 			{
       
  1268 			delete bufPtr;
       
  1269 			return StopTest(KErrGeneral, EFail);
       
  1270 			}
       
  1271 		
       
  1272 		TDes8& inputBufferDes = bufPtr->Data();
       
  1273 		OMX_BUFFERHEADERTYPE* clockBufPtr;
       
  1274 		
       
  1275 		if (OMX_ErrorNone != ipCompHandle->UseBuffer(
       
  1276 				ipCompHandle,
       
  1277 				&clockBufPtr,
       
  1278 				1,					// Clock input port
       
  1279 				ipInputBuffer,		// pAppPrivate
       
  1280 				portParamsInputPort.nBufferSize,
       
  1281 				const_cast<TUint8*>(inputBufferDes.Ptr())))
       
  1282 			{
       
  1283 			return StopTest(KErrGeneral, EFail);
       
  1284 			}
       
  1285 		
       
  1286 		TRAPD(error, ipClientClockPortBufferArray.AppendL(clockBufPtr));
       
  1287 		if(error != KErrNone)
       
  1288 		  {
       
  1289 		    return StopTest(KErrGeneral, EFail);
       
  1290 		  }
       
  1291 		}
       
  1292 	INFO_PRINTF1(_L("Populated buffer (UseBuffer) in Client Clock Port"));
       
  1293 
       
  1294 	}
       
  1295 
       
  1296 TInt
       
  1297 RAsyncTestStepOmxILPcmRenderer0002::RAsyncTestStepOmxILPcmRenderer0002Step02(TAny* aPtr)
       
  1298 	{
       
  1299     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0002::RAsyncTestStepOmxILPcmRenderer0002Step02"));
       
  1300 	// NOTE, Here we reuse inherited code, to depopulate the component and make it go to OMX_StateLoaded
       
  1301 	RAsyncTestStepOmxILPcmRenderer0002* self =
       
  1302 		static_cast<RAsyncTestStepOmxILPcmRenderer0002*> (aPtr);
       
  1303 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step02();
       
  1304 	return KErrNone;
       
  1305 	}
       
  1306 
       
  1307 
       
  1308 //
       
  1309 // RAsyncTestStepOmxILPcmRenderer0003
       
  1310 //
       
  1311 RAsyncTestStepOmxILPcmRenderer0003::RAsyncTestStepOmxILPcmRenderer0003(const TDesC& aTestName, TInt aComponentUid)
       
  1312 	:
       
  1313 	RAsyncTestStepOmxILComponentBase(aTestName, aComponentUid),
       
  1314 	iTerminateNow(EFalse),
       
  1315 	ipKickoff01(NULL),
       
  1316 	ipKickoff02(NULL),
       
  1317 	ipKickoff03(NULL),
       
  1318 	ipKickoff04(NULL),
       
  1319 	ipKickoff05(NULL),
       
  1320 	ipKickoff06(NULL)
       
  1321 
       
  1322 	{
       
  1323     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::RAsyncTestStepOmxILPcmRenderer0003"));
       
  1324 	}
       
  1325 
       
  1326 
       
  1327 void
       
  1328 RAsyncTestStepOmxILPcmRenderer0003::KickoffTestL()
       
  1329 	{
       
  1330     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::KickoffTestL"));
       
  1331 
       
  1332 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test03 "));
       
  1333 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->WaitForResources "));
       
  1334 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- WaitForResources->Loaded "));
       
  1335 
       
  1336 	// This will install one callback
       
  1337 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  1338 
       
  1339 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0003Step01, this);
       
  1340 	delete ipKickoff01;
       
  1341 	ipKickoff01 = NULL;
       
  1342 	ipKickoff01 =
       
  1343 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  1344 	ipKickoff01->Call();
       
  1345 
       
  1346 	// This will be used later in DoRAsyncTestStepOmxILPcmRenderer0003Step02
       
  1347 	TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  1348 	delete ipKickoffStop;
       
  1349 	ipKickoffStop = NULL;
       
  1350 	ipKickoffStop =
       
  1351 		new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  1352 
       
  1353 	}
       
  1354 
       
  1355 void
       
  1356 RAsyncTestStepOmxILPcmRenderer0003::CloseTest()
       
  1357 	{
       
  1358     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::CloseTest"));
       
  1359 
       
  1360 	delete ipKickoff01; // no need to Cancel
       
  1361 	ipKickoff01 = NULL;
       
  1362 	delete ipKickoff02; // no need to Cancel
       
  1363 	ipKickoff02 = NULL;
       
  1364 	delete ipKickoff03; // no need to Cancel
       
  1365 	ipKickoff03 = NULL;
       
  1366 	delete ipKickoff04; // no need to Cancel
       
  1367 	ipKickoff04 = NULL;
       
  1368 	delete ipKickoff05; // no need to Cancel
       
  1369 	ipKickoff05 = NULL;
       
  1370 	delete ipKickoff06; // no need to Cancel
       
  1371 	ipKickoff06 = NULL;
       
  1372 
       
  1373 	delete ipKickoffStop; // no need to Cancel
       
  1374 	ipKickoffStop = 0;
       
  1375 
       
  1376 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
  1377 
       
  1378 	}
       
  1379 
       
  1380 void
       
  1381 RAsyncTestStepOmxILPcmRenderer0003::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  1382 											  OMX_EVENTTYPE /*aEvent*/,
       
  1383 											  TUint /*aData1*/,
       
  1384 											  TUint /*aData2*/,
       
  1385 											  TAny* /*aExtra*/)
       
  1386 	{
       
  1387     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::DoEventHandlerL"));
       
  1388 
       
  1389 	TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0003Step02, this);
       
  1390 	delete ipKickoff02;
       
  1391 	ipKickoff02 = NULL;
       
  1392 	ipKickoff02 =
       
  1393 		new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  1394 	ipKickoff02->Call();
       
  1395 
       
  1396 	}
       
  1397 
       
  1398 
       
  1399 TInt
       
  1400 RAsyncTestStepOmxILPcmRenderer0003::RAsyncTestStepOmxILPcmRenderer0003Step01(TAny* aPtr)
       
  1401 	{
       
  1402     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::RAsyncTestStepOmxILPcmRenderer0003Step01"));
       
  1403 	RAsyncTestStepOmxILPcmRenderer0003* self =
       
  1404 		static_cast<RAsyncTestStepOmxILPcmRenderer0003*> (aPtr);
       
  1405 	self->DoRAsyncTestStepOmxILPcmRenderer0003Step01();
       
  1406 	return KErrNone;
       
  1407 	}
       
  1408 
       
  1409 void
       
  1410 RAsyncTestStepOmxILPcmRenderer0003::DoRAsyncTestStepOmxILPcmRenderer0003Step01()
       
  1411 	{
       
  1412     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::DoRAsyncTestStepOmxILPcmRenderer0003Step01"));
       
  1413 
       
  1414 	//
       
  1415 	// Obtain the component's state
       
  1416 	//
       
  1417 	OMX_STATETYPE compState;
       
  1418 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1419 												&compState))
       
  1420 		{
       
  1421 		return StopTest(KErrGeneral, EFail);
       
  1422 		}
       
  1423 
       
  1424 	PrintOmxState(compState);
       
  1425 
       
  1426 	if (OMX_StateLoaded != compState)
       
  1427 		{
       
  1428 		return StopTest(KErrGeneral, EFail);
       
  1429 		}
       
  1430 
       
  1431 	//
       
  1432 	// Provide callbacks to component
       
  1433 	//
       
  1434 	OMX_CALLBACKTYPE* omxCallbacks = *ipCallbackHandler;
       
  1435 
       
  1436 	if (OMX_ErrorNone != ipCompHandle->SetCallbacks(
       
  1437 			ipCompHandle,
       
  1438 			omxCallbacks,
       
  1439 			ipCallbackHandler))
       
  1440 		{
       
  1441 		return StopTest(KErrGeneral, EFail);
       
  1442 		}
       
  1443 
       
  1444 	INFO_PRINTF2(_L("Component Callbacks set successfully: %X"), ipCallbackHandler);
       
  1445 
       
  1446 	//
       
  1447 	// Move component to OMX_StateWaitForResources
       
  1448 	//
       
  1449 
       
  1450 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  1451 			ipCompHandle,
       
  1452 			OMX_CommandStateSet,
       
  1453 			OMX_StateWaitForResources,
       
  1454 			0))
       
  1455 		{
       
  1456 		return StopTest(KErrGeneral, EFail);
       
  1457 		}
       
  1458 
       
  1459 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1460 												&compState))
       
  1461 		{
       
  1462 		return StopTest(KErrGeneral, EFail);
       
  1463 		}
       
  1464 
       
  1465 	PrintOmxState(compState);
       
  1466 
       
  1467 	if (OMX_StateWaitForResources != compState)
       
  1468 		{
       
  1469 		return StopTest(KErrGeneral, EFail);
       
  1470 		}
       
  1471 
       
  1472     //
       
  1473     // The following code is to improve code coerage only
       
  1474     //
       
  1475     OMX_AUDIO_PARAM_PCMMODETYPE pcmMode;
       
  1476     pcmMode.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
       
  1477     pcmMode.nVersion = TOmxILSpecVersion();
       
  1478     pcmMode.nPortIndex = 0;
       
  1479     if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
  1480             ipCompHandle,
       
  1481             OMX_IndexParamAudioPcm,
       
  1482             &pcmMode))
       
  1483         {
       
  1484         return StopTest(KErrGeneral, EFail);
       
  1485         }
       
  1486     pcmMode.nSamplingRate = 44100;
       
  1487     if (OMX_ErrorNone != ipCompHandle->SetParameter(
       
  1488             ipCompHandle,
       
  1489             OMX_IndexParamAudioPcm,
       
  1490             &pcmMode))
       
  1491         {
       
  1492         return StopTest(KErrGeneral, EFail);
       
  1493         }
       
  1494     OMX_BUFFERHEADERTYPE temp;
       
  1495     OMX_BUFFERHEADERTYPE* bufferHeaderInput=&temp;
       
  1496     if (OMX_ErrorIncorrectStateOperation != ipCompHandle->AllocateBuffer(
       
  1497             ipCompHandle,
       
  1498             &bufferHeaderInput,
       
  1499             0, // input port
       
  1500             0,
       
  1501             1024))
       
  1502         {
       
  1503         return StopTest(KErrGeneral, EFail);
       
  1504         }
       
  1505 
       
  1506     if (OMX_ErrorBadPortIndex != ipCompHandle->EmptyThisBuffer(
       
  1507             ipCompHandle,
       
  1508             bufferHeaderInput))
       
  1509         {
       
  1510         return StopTest(KErrGeneral, EFail);
       
  1511         }
       
  1512 
       
  1513     if (OMX_ErrorBadPortIndex != ipCompHandle->FillThisBuffer(
       
  1514             ipCompHandle,
       
  1515             bufferHeaderInput))
       
  1516         {
       
  1517         return StopTest(KErrGeneral, EFail);
       
  1518         }
       
  1519     
       
  1520     if (OMX_ErrorBadPortIndex != ipCompHandle->FreeBuffer(
       
  1521             ipCompHandle,
       
  1522             2,
       
  1523             bufferHeaderInput))
       
  1524         {
       
  1525         return StopTest(KErrGeneral, EFail);
       
  1526         }
       
  1527     
       
  1528     if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  1529             ipCompHandle,
       
  1530             OMX_CommandPortEnable,
       
  1531             0,
       
  1532             0))
       
  1533         {
       
  1534         return StopTest(KErrGeneral, EFail);
       
  1535         }
       
  1536     
       
  1537     OMX_TUNNELSETUPTYPE tunnelSetup;
       
  1538     OMX_U32 outputPort = 1;
       
  1539     OMX_U32 inputPort = 0;
       
  1540         
       
  1541     if (OMX_ErrorIncorrectStateOperation !=
       
  1542         ipCompHandle->ComponentTunnelRequest(
       
  1543             ipCompHandle,
       
  1544             outputPort,
       
  1545             ipCompHandle,
       
  1546             inputPort,
       
  1547             &tunnelSetup))
       
  1548         {
       
  1549         return StopTest(KErrGeneral, EFail);
       
  1550         }
       
  1551 	}
       
  1552 
       
  1553 TInt
       
  1554 RAsyncTestStepOmxILPcmRenderer0003::RAsyncTestStepOmxILPcmRenderer0003Step02(TAny* aPtr)
       
  1555 	{
       
  1556     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::RAsyncTestStepOmxILPcmRenderer0003Step02"));
       
  1557 	RAsyncTestStepOmxILPcmRenderer0003* self =
       
  1558 		static_cast<RAsyncTestStepOmxILPcmRenderer0003*> (aPtr);
       
  1559 	self->DoRAsyncTestStepOmxILPcmRenderer0003Step02();
       
  1560 	return KErrNone;
       
  1561 	}
       
  1562 
       
  1563 void
       
  1564 RAsyncTestStepOmxILPcmRenderer0003::DoRAsyncTestStepOmxILPcmRenderer0003Step02()
       
  1565 	{
       
  1566     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0003::DoRAsyncTestStepOmxILPcmRenderer0003Step02"));
       
  1567 
       
  1568 	OMX_STATETYPE compState;
       
  1569 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1570 												&compState))
       
  1571 		{
       
  1572 		return StopTest(KErrGeneral, EFail);
       
  1573 		}
       
  1574 
       
  1575 	PrintOmxState(compState);
       
  1576 
       
  1577 	if (OMX_StateWaitForResources != compState)
       
  1578 		{
       
  1579 		return StopTest(KErrGeneral, EFail);
       
  1580 		}
       
  1581 
       
  1582 	//
       
  1583 	// Move component to OMX_StateLoaded
       
  1584 	//
       
  1585 
       
  1586 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  1587 			ipCompHandle,
       
  1588 			OMX_CommandStateSet,
       
  1589 			OMX_StateLoaded,
       
  1590 			0))
       
  1591 		{
       
  1592 		return StopTest(KErrGeneral, EFail);
       
  1593 		}
       
  1594 
       
  1595 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1596 												&compState))
       
  1597 		{
       
  1598 		return StopTest(KErrGeneral, EFail);
       
  1599 		}
       
  1600 
       
  1601 	PrintOmxState(compState);
       
  1602 
       
  1603 	if (OMX_StateLoaded != compState)
       
  1604 		{		return StopTest(KErrGeneral, EFail);
       
  1605 		}
       
  1606 
       
  1607 	// The successful termination...
       
  1608 	ipKickoffStop->Call();
       
  1609 
       
  1610 	}
       
  1611 
       
  1612 
       
  1613 //
       
  1614 // RAsyncTestStepOmxILPcmRenderer0004
       
  1615 //
       
  1616 RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004(const TDesC& aTestName, TInt aComponentUid)
       
  1617 	:
       
  1618 	RAsyncTestStepOmxILPcmRenderer0001(aTestName, aComponentUid)
       
  1619 
       
  1620 	{
       
  1621     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004"));
       
  1622 	}
       
  1623 
       
  1624 
       
  1625 void
       
  1626 RAsyncTestStepOmxILPcmRenderer0004::KickoffTestL()
       
  1627 	{
       
  1628     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::KickoffTestL"));
       
  1629 	iTestState = EStateLoadKickoffTestLComplete;
       
  1630 
       
  1631 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test04 "));
       
  1632 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  1633 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Pause "));
       
  1634 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Pause->Idle "));
       
  1635 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Idle->Loaded(depopulation) "));
       
  1636 
       
  1637 	// This will install one callback
       
  1638 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  1639 
       
  1640 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0004Step01, this);
       
  1641 	delete ipKickoff01;
       
  1642 	ipKickoff01 = NULL;
       
  1643 	ipKickoff01 =
       
  1644 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  1645 	ipKickoff01->Call();
       
  1646 
       
  1647 	}
       
  1648 
       
  1649 void
       
  1650 RAsyncTestStepOmxILPcmRenderer0004::CloseTest()
       
  1651 	{
       
  1652     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::CloseTest"));
       
  1653 
       
  1654 	delete ipKickoff01; // no need to Cancel
       
  1655 	ipKickoff01 = NULL;
       
  1656 	delete ipKickoff02; // no need to Cancel
       
  1657 	ipKickoff02 = NULL;
       
  1658 	delete ipKickoff03; // no need to Cancel
       
  1659 	ipKickoff03 = NULL;
       
  1660 	delete ipKickoff04; // no need to Cancel
       
  1661 	ipKickoff04 = NULL;
       
  1662 	delete ipKickoff05; // no need to Cancel
       
  1663 	ipKickoff05 = NULL;
       
  1664 	delete ipKickoff06; // no need to Cancel
       
  1665 	ipKickoff06 = NULL;
       
  1666 
       
  1667 	delete ipKickoffStop; // no need to Cancel
       
  1668 	ipKickoffStop = 0;
       
  1669 
       
  1670 	TInt count = ipClientClockPortBufferArray.Count();
       
  1671 	
       
  1672 	for (TInt n = 0; n < count; n++)
       
  1673 		{
       
  1674 		delete ipClientClockPortBufferArray[n];
       
  1675 		}
       
  1676 	
       
  1677 	ipClientClockPortBufferArray.Close();
       
  1678 	
       
  1679 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
  1680 
       
  1681 	}
       
  1682 
       
  1683 void
       
  1684 RAsyncTestStepOmxILPcmRenderer0004::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  1685 											  OMX_EVENTTYPE aEvent,
       
  1686 											  TUint aData1,
       
  1687 											  TUint aData2,
       
  1688 											  TAny* /*aExtra*/)
       
  1689 	{
       
  1690     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::DoEventHandlerL"));
       
  1691 
       
  1692 	switch (aEvent)
       
  1693 		{
       
  1694 	case OMX_EventError:
       
  1695 		{
       
  1696 		INFO_PRINTF2(_L("DoEventHandlerL: OMX_EventError [%d]"), aData1);
       
  1697 		return StopTest(KErrGeneral, EFail);
       
  1698 		}
       
  1699 	case OMX_EventCmdComplete:
       
  1700 		{
       
  1701 		switch(aData1)
       
  1702 			{
       
  1703 		case OMX_CommandStateSet:
       
  1704 			{
       
  1705 			switch(aData2)
       
  1706 				{
       
  1707 			case OMX_StateLoaded:
       
  1708 				{
       
  1709 				if (EStateTransitionToIdleComplete == iTestState)
       
  1710 					{
       
  1711 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateLoaded [EStateTransitionToIdleComplete]"));
       
  1712 					iTestState = EStateTransitionToLoadedComplete;
       
  1713 					OMX_STATETYPE compState;
       
  1714 					if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1715 																&compState))
       
  1716 						{
       
  1717 						return StopTest(KErrGeneral, EFail);
       
  1718 						}
       
  1719 
       
  1720 					PrintOmxState(compState);
       
  1721 
       
  1722 					if (OMX_StateLoaded != compState)
       
  1723 						{
       
  1724 						return StopTest(KErrGeneral, EFail);
       
  1725 						}
       
  1726 
       
  1727 					// The successful termination...
       
  1728 					TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  1729 					delete ipKickoffStop;
       
  1730 					ipKickoffStop = NULL;
       
  1731 					ipKickoffStop =
       
  1732 						new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  1733 					ipKickoffStop->Call();
       
  1734 					}
       
  1735 				}
       
  1736 				break;
       
  1737 			case OMX_StateIdle:
       
  1738 				{
       
  1739 				if (EStateLoadKickoffTestLComplete == iTestState)
       
  1740 					{
       
  1741 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateLoadKickoffTestLComplete]"));
       
  1742 					iTestState = EStateTransitionToIdleComplete;
       
  1743 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0004Step02, this);
       
  1744 					delete ipKickoff02;
       
  1745 					ipKickoff02 = NULL;
       
  1746 					ipKickoff02 =
       
  1747 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  1748 					ipKickoff02->Call();
       
  1749 
       
  1750 					}
       
  1751 				else if (EStateTransitionToPauseComplete == iTestState)
       
  1752 					{
       
  1753 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateTransitionToPauseComplete]"));
       
  1754 					iTestState = EStateTransitionToIdleComplete;
       
  1755 					TCallBack callback04 (RAsyncTestStepOmxILPcmRenderer0004Step04, this);
       
  1756 					delete ipKickoff04;
       
  1757 					ipKickoff04 = NULL;
       
  1758 					ipKickoff04 =
       
  1759 						new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
       
  1760 					ipKickoff04->Call();
       
  1761 
       
  1762 					}
       
  1763 				else
       
  1764 					{
       
  1765 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [Other]"));
       
  1766 					return StopTest(KErrGeneral, EFail);
       
  1767 					}
       
  1768 				}
       
  1769 				break;
       
  1770 			case OMX_StatePause:
       
  1771 				{
       
  1772 				if (EStateTransitionToIdleComplete == iTestState)
       
  1773 					{
       
  1774 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StatePause [EStateTransitionToIdleComplete]"));
       
  1775 					iTestState = EStateTransitionToPauseComplete;
       
  1776 					TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0004Step03, this);
       
  1777 					delete ipKickoff03;
       
  1778 					ipKickoff03 = NULL;
       
  1779 					ipKickoff03 =
       
  1780 						new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  1781 					ipKickoff03->Call();
       
  1782 					}
       
  1783 				else
       
  1784 					{
       
  1785 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StatePause [Other]"));
       
  1786 					return StopTest(KErrGeneral, EFail);
       
  1787 					}
       
  1788 				}
       
  1789 				break;
       
  1790 			default:
       
  1791 				{
       
  1792 				INFO_PRINTF2(_L("DoEventHandlerL: OMX_State [%d]"), aData2);
       
  1793 				return StopTest(KErrGeneral, EFail);
       
  1794 				}
       
  1795 				};
       
  1796 			}
       
  1797 			break;
       
  1798 		default:
       
  1799 			{
       
  1800 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_Command [%d]"), aData1);
       
  1801 			return StopTest(KErrGeneral, EFail);
       
  1802 			}
       
  1803 			};
       
  1804 		}
       
  1805 		break;
       
  1806 	default:
       
  1807 		{
       
  1808 		INFO_PRINTF2(_L("DoEventHandlerL: OMX Event [%d]"), aEvent);
       
  1809 		return StopTest(KErrGeneral, EFail);
       
  1810 		}
       
  1811 		};
       
  1812 
       
  1813 	}
       
  1814 
       
  1815 
       
  1816 TInt
       
  1817 RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step01(TAny* aPtr)
       
  1818 	{
       
  1819     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step01"));
       
  1820 	// NOTE, Here we reuse inherited code, to populate the component and make it go to OMX_StateIdle
       
  1821 	RAsyncTestStepOmxILPcmRenderer0004* self =
       
  1822 		static_cast<RAsyncTestStepOmxILPcmRenderer0004*> (aPtr);
       
  1823 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step01();
       
  1824 	return KErrNone;
       
  1825 	}
       
  1826 
       
  1827 TInt
       
  1828 RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step02(TAny* aPtr)
       
  1829 	{
       
  1830     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step02"));
       
  1831 	RAsyncTestStepOmxILPcmRenderer0004* self =
       
  1832 		static_cast<RAsyncTestStepOmxILPcmRenderer0004*> (aPtr);
       
  1833 	self->DoRAsyncTestStepOmxILPcmRenderer0004Step02();
       
  1834 	return KErrNone;
       
  1835 	}
       
  1836 
       
  1837 void
       
  1838 RAsyncTestStepOmxILPcmRenderer0004::DoRAsyncTestStepOmxILPcmRenderer0004Step02()
       
  1839 	{
       
  1840     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::DoRAsyncTestStepOmxILPcmRenderer0004Step02"));
       
  1841 
       
  1842 	OMX_STATETYPE compState;
       
  1843 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1844 												&compState))
       
  1845 		{
       
  1846 		return StopTest(KErrGeneral, EFail);
       
  1847 		}
       
  1848 
       
  1849 	PrintOmxState(compState);
       
  1850 
       
  1851 	if (OMX_StateIdle != compState)
       
  1852 		{
       
  1853 		return StopTest(KErrGeneral, EFail);
       
  1854 		}
       
  1855 
       
  1856 	//
       
  1857 	// Move component to OMX_StatePause
       
  1858 	//
       
  1859 
       
  1860 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  1861 			ipCompHandle,
       
  1862 			OMX_CommandStateSet,
       
  1863 			OMX_StatePause,
       
  1864 			0))
       
  1865 		{
       
  1866 		return StopTest(KErrGeneral, EFail);
       
  1867 		}
       
  1868 
       
  1869 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1870 												&compState))
       
  1871 		{
       
  1872 		return StopTest(KErrGeneral, EFail);
       
  1873 		}
       
  1874 
       
  1875 	PrintOmxState(compState);
       
  1876 
       
  1877 	if (OMX_StatePause != compState)
       
  1878 		{
       
  1879 		return StopTest(KErrGeneral, EFail);
       
  1880 		}
       
  1881 
       
  1882 	}
       
  1883 
       
  1884 TInt
       
  1885 RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step03(TAny* aPtr)
       
  1886 	{
       
  1887     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step03"));
       
  1888 	RAsyncTestStepOmxILPcmRenderer0004* self =
       
  1889 		static_cast<RAsyncTestStepOmxILPcmRenderer0004*> (aPtr);
       
  1890 	self->DoRAsyncTestStepOmxILPcmRenderer0004Step03();
       
  1891 	return KErrNone;
       
  1892 	}
       
  1893 
       
  1894 
       
  1895 void
       
  1896 RAsyncTestStepOmxILPcmRenderer0004::DoRAsyncTestStepOmxILPcmRenderer0004Step03()
       
  1897 	{
       
  1898     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::DoRAsyncTestStepOmxILPcmRenderer0004Step03"));
       
  1899 
       
  1900 	//
       
  1901 	// Move component to OMX_StateIdle
       
  1902 	//
       
  1903 
       
  1904 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  1905 			ipCompHandle,
       
  1906 			OMX_CommandStateSet,
       
  1907 			OMX_StateIdle,
       
  1908 			0))
       
  1909 		{
       
  1910 		return StopTest(KErrGeneral, EFail);
       
  1911 		}
       
  1912 
       
  1913 	OMX_STATETYPE compState;
       
  1914 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  1915 												&compState))
       
  1916 		{
       
  1917 		return StopTest(KErrGeneral, EFail);
       
  1918 		}
       
  1919 
       
  1920 	PrintOmxState(compState);
       
  1921 
       
  1922 	if (OMX_StateIdle != compState)
       
  1923 		{
       
  1924 		return StopTest(KErrGeneral, EFail);
       
  1925 		}
       
  1926 
       
  1927 	}
       
  1928 
       
  1929 
       
  1930 TInt
       
  1931 RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step04(TAny* aPtr)
       
  1932 	{
       
  1933     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0004::RAsyncTestStepOmxILPcmRenderer0004Step04"));
       
  1934 	// NOTE, Here we reuse inherited code, to depopulate the component and to
       
  1935 	// make it go to OMX_StateLoaded
       
  1936 	RAsyncTestStepOmxILPcmRenderer0004* self =
       
  1937 		static_cast<RAsyncTestStepOmxILPcmRenderer0004*> (aPtr);
       
  1938 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step02();
       
  1939 	return KErrNone;
       
  1940 	}
       
  1941 
       
  1942 
       
  1943 //
       
  1944 // RAsyncTestStepOmxILPcmRenderer0005
       
  1945 //
       
  1946 RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005(const TDesC& aTestName, TInt aComponentUid)
       
  1947 	:
       
  1948 	RAsyncTestStepOmxILPcmRenderer0004(aTestName, aComponentUid)
       
  1949 	{
       
  1950     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005"));
       
  1951 	}
       
  1952 
       
  1953 
       
  1954 void
       
  1955 RAsyncTestStepOmxILPcmRenderer0005::KickoffTestL()
       
  1956 	{
       
  1957     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::KickoffTestL"));
       
  1958 	iTestState = EStateLoadKickoffTestLComplete;
       
  1959 
       
  1960 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test05 "));
       
  1961 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  1962 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  1963 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2a. - Call EmptyThisBuffer on PCM Renderer "));
       
  1964 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2b. - EmptyBufferDone callback received "));
       
  1965 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Executing->Idle(BufferFlushing) "));
       
  1966 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Idle->Loaded(Depopulation) "));
       
  1967 
       
  1968 	// This will change the test file
       
  1969 	iTestFileName.Set(KPcmRendererTestFile);
       
  1970 	
       
  1971 	// This will install one callback
       
  1972 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  1973 
       
  1974 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0005Step01, this);
       
  1975 	delete ipKickoff01;
       
  1976 	ipKickoff01 = NULL;
       
  1977 	ipKickoff01 =
       
  1978 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  1979 	ipKickoff01->Call();
       
  1980 
       
  1981 	}
       
  1982 
       
  1983 void
       
  1984 RAsyncTestStepOmxILPcmRenderer0005::CloseTest()
       
  1985 	{
       
  1986     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::CloseTest"));
       
  1987 
       
  1988 	delete ipKickoff01; // no need to Cancel
       
  1989 	ipKickoff01 = NULL;
       
  1990 	delete ipKickoff02; // no need to Cancel
       
  1991 	ipKickoff02 = NULL;
       
  1992 	delete ipKickoff03; // no need to Cancel
       
  1993 	ipKickoff03 = NULL;
       
  1994 	delete ipKickoff04; // no need to Cancel
       
  1995 	ipKickoff04 = NULL;
       
  1996 	delete ipKickoff05; // no need to Cancel
       
  1997 	ipKickoff05 = NULL;
       
  1998 	delete ipKickoff06; // no need to Cancel
       
  1999 	ipKickoff06 = NULL;
       
  2000 
       
  2001 	delete ipKickoffStop; // no need to Cancel
       
  2002 	ipKickoffStop = 0;
       
  2003 
       
  2004 	TInt count = ipClientClockPortBufferArray.Count();
       
  2005 	
       
  2006 	for (TInt n = 0; n < count; n++)
       
  2007 		{
       
  2008 		delete ipClientClockPortBufferArray[n];
       
  2009 		}
       
  2010 	
       
  2011 	ipClientClockPortBufferArray.Close();
       
  2012 	
       
  2013 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
  2014 
       
  2015 	}
       
  2016 
       
  2017 void
       
  2018 RAsyncTestStepOmxILPcmRenderer0005::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  2019 											  OMX_EVENTTYPE aEvent,
       
  2020 											  TUint aData1,
       
  2021 											  TUint aData2,
       
  2022 											  TAny* /*aExtra*/)
       
  2023 	{
       
  2024     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::DoEventHandlerL"));
       
  2025 
       
  2026 	switch (aEvent)
       
  2027 		{
       
  2028 	case OMX_EventError:
       
  2029 		{
       
  2030 		INFO_PRINTF2(_L("DoEventHandlerL: OMX_EventError [%d]"), aData1);
       
  2031 		return StopTest(KErrGeneral, EFail);
       
  2032 		}
       
  2033 	case OMX_EventCmdComplete:
       
  2034 		{
       
  2035 		switch(aData1)
       
  2036 			{
       
  2037 		case OMX_CommandStateSet:
       
  2038 			{
       
  2039 			switch(aData2)
       
  2040 				{
       
  2041 			case OMX_StateLoaded:
       
  2042 				{
       
  2043 				if (EStateTransitionToIdleComplete == iTestState)
       
  2044 					{
       
  2045 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateLoaded [EStateTransitionToIdleComplete]"));
       
  2046 					iTestState = EStateTransitionToLoadedComplete;
       
  2047 					OMX_STATETYPE compState;
       
  2048 					if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  2049 																&compState))
       
  2050 						{
       
  2051 						return StopTest(KErrGeneral, EFail);
       
  2052 						}
       
  2053 
       
  2054 					PrintOmxState(compState);
       
  2055 
       
  2056 					if (OMX_StateLoaded != compState)
       
  2057 						{
       
  2058 						return StopTest(KErrGeneral, EFail);
       
  2059 						}
       
  2060 
       
  2061 					// The successful termination...
       
  2062 					TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  2063 					delete ipKickoffStop;
       
  2064 					ipKickoffStop = NULL;
       
  2065 					ipKickoffStop =
       
  2066 						new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  2067 					ipKickoffStop->Call();
       
  2068 					}
       
  2069 				}
       
  2070 				break;
       
  2071 			case OMX_StateIdle:
       
  2072 				{
       
  2073 				if (EStateLoadKickoffTestLComplete == iTestState)
       
  2074 					{
       
  2075 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateLoadKickoffTestLComplete]"));
       
  2076 					iTestState = EStateTransitionToIdleComplete;
       
  2077 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0005Step02, this);
       
  2078 					delete ipKickoff02;
       
  2079 					ipKickoff02 = NULL;
       
  2080 					ipKickoff02 =
       
  2081 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  2082 					ipKickoff02->Call();
       
  2083 
       
  2084 					}
       
  2085 				else if (EStateTransitionToExecutingComplete == iTestState)
       
  2086 					{
       
  2087 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateTransitionToPauseComplete]"));
       
  2088 					iTestState = EStateTransitionToIdleComplete;
       
  2089 					TCallBack callback04 (RAsyncTestStepOmxILPcmRenderer0005Step04, this);
       
  2090 					delete ipKickoff04;
       
  2091 					ipKickoff04 = NULL;
       
  2092 					ipKickoff04 =
       
  2093 						new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
       
  2094 					ipKickoff04->Call();
       
  2095 
       
  2096 					}
       
  2097 				else
       
  2098 					{
       
  2099 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [Other]"));
       
  2100 					return StopTest(KErrGeneral, EFail);
       
  2101 					}
       
  2102 				}
       
  2103 				break;
       
  2104 			case OMX_StateExecuting:
       
  2105 				{
       
  2106 				if (EStateTransitionToIdleComplete == iTestState)
       
  2107 					{
       
  2108 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  2109 					iTestState = EStateTransitionToExecutingComplete;
       
  2110 					CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  2111 					ipTestFile->ReadNextBuffer(dataBuffer);
       
  2112 					ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  2113 
       
  2114 					// Send a buffer to the input port
       
  2115 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [Send a buffer to the input port]"));
       
  2116 					INFO_PRINTF2(_L("ipBufferHeaderInput->pBuffer [%X]"), ipBufferHeaderInput->pBuffer);
       
  2117 					INFO_PRINTF2(_L("ipBufferHeaderInput->nAllocLen [%d]"), ipBufferHeaderInput->nAllocLen);
       
  2118 					INFO_PRINTF2(_L("ipBufferHeaderInput->nFilledLen [%d]"), ipBufferHeaderInput->nFilledLen);
       
  2119 					INFO_PRINTF2(_L("ipBufferHeaderInput->nOffset [%d]"), ipBufferHeaderInput->nOffset);
       
  2120 					INFO_PRINTF2(_L("ipBufferHeaderInput->pAppPrivate [%X]"), ipBufferHeaderInput->pAppPrivate);
       
  2121 					INFO_PRINTF2(_L("ipBufferHeaderInput->pPlatformPrivate [%X]"), ipBufferHeaderInput->pPlatformPrivate);
       
  2122 					INFO_PRINTF2(_L("ipBufferHeaderInput->pInputPortPrivate [%X]"), ipBufferHeaderInput->pInputPortPrivate);
       
  2123 					INFO_PRINTF2(_L("ipBufferHeaderInput->pOutputPortPrivate [%X]"), ipBufferHeaderInput->pOutputPortPrivate);
       
  2124 					INFO_PRINTF2(_L("ipBufferHeaderInput->hMarkTargetComponent [%X]"), ipBufferHeaderInput->hMarkTargetComponent);
       
  2125 					INFO_PRINTF2(_L("ipBufferHeaderInput->pMarkData [%X]"), ipBufferHeaderInput->pMarkData);
       
  2126 					INFO_PRINTF2(_L("ipBufferHeaderInput->nTickCount [%d]"), ipBufferHeaderInput->nTickCount);
       
  2127 					INFO_PRINTF2(_L("ipBufferHeaderInput->nFlags [%X]"), ipBufferHeaderInput->nFlags);
       
  2128 					INFO_PRINTF2(_L("ipBufferHeaderInput->nOutputPortIndex [%X]"), ipBufferHeaderInput->nOutputPortIndex);
       
  2129 					INFO_PRINTF2(_L("ipBufferHeaderInput->nInputPortIndex [%X]"), ipBufferHeaderInput->nInputPortIndex);
       
  2130 
       
  2131 					if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  2132 							ipCompHandle, ipBufferHeaderInput))
       
  2133 						{
       
  2134 						return StopTest(KErrGeneral, EFail);
       
  2135 						}
       
  2136 					}
       
  2137 				else
       
  2138 					{
       
  2139 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [Other]"));
       
  2140 					return StopTest(KErrGeneral, EFail);
       
  2141 					}
       
  2142 				}
       
  2143 				break;
       
  2144 			default:
       
  2145 				{
       
  2146 				INFO_PRINTF2(_L("DoEventHandlerL: OMX_State [%d]"), aData2);
       
  2147 				return StopTest(KErrGeneral, EFail);
       
  2148 				}
       
  2149 				};
       
  2150 			}
       
  2151 			break;
       
  2152 		default:
       
  2153 			{
       
  2154 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_Command [%d]"), aData1);
       
  2155 			return StopTest(KErrGeneral, EFail);
       
  2156 			}
       
  2157 			};
       
  2158 		}
       
  2159 		break;
       
  2160 	default:
       
  2161 		{
       
  2162 		INFO_PRINTF2(_L("DoEventHandlerL: OMX Event [%d]"), aEvent);
       
  2163 		return StopTest(KErrGeneral, EFail);
       
  2164 		}
       
  2165 		};
       
  2166 
       
  2167 	}
       
  2168 
       
  2169 void
       
  2170 RAsyncTestStepOmxILPcmRenderer0005::DoEmptyBufferDoneL(OMX_HANDLETYPE /*aComponent*/,
       
  2171 													 OMX_BUFFERHEADERTYPE* /*aBuffer*/)
       
  2172 	{
       
  2173     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::DoEmptyBufferDoneL"));
       
  2174 
       
  2175 	INFO_PRINTF1(_L("DoEmptyBufferDoneL : Callback received "));
       
  2176 
       
  2177 	TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0005Step03, this);
       
  2178 	delete ipKickoff03;
       
  2179 	ipKickoff03 = NULL;
       
  2180 	ipKickoff03 =
       
  2181 		new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  2182 	ipKickoff03->Call();
       
  2183 	}
       
  2184 
       
  2185 
       
  2186 TInt
       
  2187 RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step01(TAny* aPtr)
       
  2188 	{
       
  2189     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step01"));
       
  2190 	// NOTE, Here we reuse inherited code, to populate the component and make it go to OMX_StateIdle
       
  2191 	RAsyncTestStepOmxILPcmRenderer0005* self =
       
  2192 		static_cast<RAsyncTestStepOmxILPcmRenderer0005*> (aPtr);
       
  2193 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step01();
       
  2194 	return KErrNone;
       
  2195 	}
       
  2196 
       
  2197 TInt
       
  2198 RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step02(TAny* aPtr)
       
  2199 	{
       
  2200     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step02"));
       
  2201 	RAsyncTestStepOmxILPcmRenderer0005* self =
       
  2202 		static_cast<RAsyncTestStepOmxILPcmRenderer0005*> (aPtr);
       
  2203 	self->DoRAsyncTestStepOmxILPcmRenderer0005Step02();
       
  2204 	return KErrNone;
       
  2205 	}
       
  2206 
       
  2207 void
       
  2208 RAsyncTestStepOmxILPcmRenderer0005::DoRAsyncTestStepOmxILPcmRenderer0005Step02()
       
  2209 	{
       
  2210     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::DoRAsyncTestStepOmxILPcmRenderer0005Step02"));
       
  2211 
       
  2212 	//
       
  2213 	// Move component to OMX_StateExecuting
       
  2214 	//
       
  2215 
       
  2216 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  2217 			ipCompHandle,
       
  2218 			OMX_CommandStateSet,
       
  2219 			OMX_StateExecuting,
       
  2220 			0))
       
  2221 		{
       
  2222 		return StopTest(KErrGeneral, EFail);
       
  2223 		}
       
  2224 
       
  2225 	OMX_STATETYPE compState;
       
  2226 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  2227 												&compState))
       
  2228 		{
       
  2229 		return StopTest(KErrGeneral, EFail);
       
  2230 		}
       
  2231 
       
  2232 	PrintOmxState(compState);
       
  2233 
       
  2234 	if (OMX_StateExecuting != compState)
       
  2235 		{
       
  2236 		return StopTest(KErrGeneral, EFail);
       
  2237 		}
       
  2238 
       
  2239 	}
       
  2240 
       
  2241 TInt
       
  2242 RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step03(TAny* aPtr)
       
  2243 	{
       
  2244     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step03"));
       
  2245 	RAsyncTestStepOmxILPcmRenderer0005* self =
       
  2246 		static_cast<RAsyncTestStepOmxILPcmRenderer0005*> (aPtr);
       
  2247 	self->DoRAsyncTestStepOmxILPcmRenderer0004Step03();
       
  2248 	return KErrNone;
       
  2249 	}
       
  2250 
       
  2251 
       
  2252 TInt
       
  2253 RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step04(TAny* aPtr)
       
  2254 	{
       
  2255     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0005::RAsyncTestStepOmxILPcmRenderer0005Step04"));
       
  2256 	// NOTE, Here we reuse inherited code, to depopulate the component and to
       
  2257 	// make it go to OMX_StateLoaded
       
  2258 	RAsyncTestStepOmxILPcmRenderer0005* self =
       
  2259 		static_cast<RAsyncTestStepOmxILPcmRenderer0005*> (aPtr);
       
  2260 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step02();
       
  2261 	return KErrNone;
       
  2262 	}
       
  2263 
       
  2264 
       
  2265 
       
  2266 //
       
  2267 // RAsyncTestStepOmxILPcmRenderer0006
       
  2268 //
       
  2269 RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006(const TDesC& aTestName, TInt aComponentUid)
       
  2270 	:
       
  2271 	RAsyncTestStepOmxILPcmRenderer0005(aTestName, aComponentUid)
       
  2272 
       
  2273 	{
       
  2274     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006"));
       
  2275 	}
       
  2276 
       
  2277 
       
  2278 void
       
  2279 RAsyncTestStepOmxILPcmRenderer0006::KickoffTestL()
       
  2280 	{
       
  2281     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::KickoffTestL"));
       
  2282 	iTestState = EStateLoadKickoffTestLComplete;
       
  2283 
       
  2284 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test06 "));
       
  2285 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  2286 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  2287 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Executing->Pause "));
       
  2288 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Pause->Executing "));
       
  2289 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Executing->Idle(BufferFlushing) "));
       
  2290 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 6.- Idle->Loaded(depopulation) "));
       
  2291 
       
  2292 	// This will install one callback
       
  2293 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  2294 
       
  2295 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0006Step01, this);
       
  2296 	delete ipKickoff01;
       
  2297 	ipKickoff01 = NULL;
       
  2298 	ipKickoff01 =
       
  2299 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  2300 	ipKickoff01->Call();
       
  2301 
       
  2302 	}
       
  2303 
       
  2304 void
       
  2305 RAsyncTestStepOmxILPcmRenderer0006::CloseTest()
       
  2306 	{
       
  2307     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::CloseTest"));
       
  2308 
       
  2309 	delete ipKickoff01; // no need to Cancel
       
  2310 	ipKickoff01 = NULL;
       
  2311 	delete ipKickoff02; // no need to Cancel
       
  2312 	ipKickoff02 = NULL;
       
  2313 	delete ipKickoff03; // no need to Cancel
       
  2314 	ipKickoff03 = NULL;
       
  2315 	delete ipKickoff04; // no need to Cancel
       
  2316 	ipKickoff04 = NULL;
       
  2317 	delete ipKickoff05; // no need to Cancel
       
  2318 	ipKickoff05 = NULL;
       
  2319 	delete ipKickoff06; // no need to Cancel
       
  2320 	ipKickoff06 = NULL;
       
  2321 
       
  2322 	delete ipKickoffStop; // no need to Cancel
       
  2323 	ipKickoffStop = 0;
       
  2324 
       
  2325 	TInt count = ipClientClockPortBufferArray.Count();
       
  2326 	
       
  2327 	for (TInt n = 0; n < count; n++)
       
  2328 		{
       
  2329 		delete ipClientClockPortBufferArray[n];
       
  2330 		}
       
  2331 	
       
  2332 	ipClientClockPortBufferArray.Close();
       
  2333 	
       
  2334 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
  2335 
       
  2336 	}
       
  2337 
       
  2338 
       
  2339 void
       
  2340 RAsyncTestStepOmxILPcmRenderer0006::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  2341 											  OMX_EVENTTYPE aEvent,
       
  2342 											  TUint aData1,
       
  2343 											  TUint aData2,
       
  2344 											  TAny* /*aExtra*/)
       
  2345 	{
       
  2346     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::DoEventHandlerL"));
       
  2347 
       
  2348 	switch (aEvent)
       
  2349 		{
       
  2350 	case OMX_EventError:
       
  2351 		{
       
  2352 		INFO_PRINTF2(_L("DoEventHandlerL: OMX_EventError [%d]"), aData1);
       
  2353 		return StopTest(KErrGeneral, EFail);
       
  2354 		}
       
  2355 	case OMX_EventCmdComplete:
       
  2356 		{
       
  2357 		switch(aData1)
       
  2358 			{
       
  2359 		case OMX_CommandStateSet:
       
  2360 			{
       
  2361 			switch(aData2)
       
  2362 				{
       
  2363 			case OMX_StateLoaded:
       
  2364 				{
       
  2365 				if (EStateTransitionToIdleComplete == iTestState)
       
  2366 					{
       
  2367 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateLoaded [EStateTransitionToIdleComplete]"));
       
  2368 					iTestState = EStateTransitionToLoadedComplete;
       
  2369 					OMX_STATETYPE compState;
       
  2370 					if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  2371 																&compState))
       
  2372 						{
       
  2373 						return StopTest(KErrGeneral, EFail);
       
  2374 						}
       
  2375 
       
  2376 					PrintOmxState(compState);
       
  2377 
       
  2378 					if (OMX_StateLoaded != compState)
       
  2379 						{
       
  2380 						return StopTest(KErrGeneral, EFail);
       
  2381 						}
       
  2382 
       
  2383 					// The successful termination...
       
  2384 					TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  2385 					delete ipKickoffStop;
       
  2386 					ipKickoffStop = NULL;
       
  2387 					ipKickoffStop =
       
  2388 						new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  2389 					ipKickoffStop->Call();
       
  2390 					}
       
  2391 				}
       
  2392 				break;
       
  2393 			case OMX_StateIdle:
       
  2394 				{
       
  2395 				if (EStateLoadKickoffTestLComplete == iTestState)
       
  2396 					{
       
  2397 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateLoadKickoffTestLComplete]"));
       
  2398 					iTestState = EStateTransitionToIdleComplete;
       
  2399 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0006Step02, this);
       
  2400 					delete ipKickoff02;
       
  2401 					ipKickoff02 = NULL;
       
  2402 					ipKickoff02 =
       
  2403 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  2404 					ipKickoff02->Call();
       
  2405 
       
  2406 					}
       
  2407 				else if (EStateTransitionToExecutingComplete == iTestState)
       
  2408 					{
       
  2409 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateTransitionToExecutingComplete]"));
       
  2410 					iTestState = EStateTransitionToIdleComplete;
       
  2411 					TCallBack callback06 (RAsyncTestStepOmxILPcmRenderer0006Step06, this);
       
  2412 					delete ipKickoff06;
       
  2413 					ipKickoff06 = NULL;
       
  2414 					ipKickoff06 =
       
  2415 						new (ELeave) CAsyncCallBack (callback06, CActive::EPriorityLow);
       
  2416 					ipKickoff06->Call();
       
  2417 
       
  2418 					}
       
  2419 				else
       
  2420 					{
       
  2421 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [Other]"));
       
  2422 					return StopTest(KErrGeneral, EFail);
       
  2423 					}
       
  2424 				}
       
  2425 				break;
       
  2426 			case OMX_StateExecuting:
       
  2427 				{
       
  2428 				if (EStateTransitionToIdleComplete == iTestState)
       
  2429 					{
       
  2430 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  2431 					iTestState = EStateTransitionToExecutingComplete;
       
  2432 					TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0006Step03, this);
       
  2433 					delete ipKickoff03;
       
  2434 					ipKickoff03 = NULL;
       
  2435 					ipKickoff03 =
       
  2436 						new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  2437 					ipKickoff03->Call();
       
  2438 
       
  2439 					}
       
  2440 				else if (EStateTransitionToPauseComplete == iTestState)
       
  2441 					{
       
  2442 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToPauseComplete]"));
       
  2443 					iTestState = EStateTransitionToExecutingComplete;
       
  2444 					TCallBack callback05 (RAsyncTestStepOmxILPcmRenderer0006Step05, this);
       
  2445 					delete ipKickoff05;
       
  2446 					ipKickoff05 = NULL;
       
  2447 					ipKickoff05 =
       
  2448 						new (ELeave) CAsyncCallBack (callback05, CActive::EPriorityLow);
       
  2449 					ipKickoff05->Call();
       
  2450 
       
  2451 					}
       
  2452 				else
       
  2453 					{
       
  2454 					INFO_PRINTF2(_L("DoEventHandlerL: OMX_StateExecuting iTestState[%d]"), iTestState);
       
  2455 					return StopTest(KErrGeneral, EFail);
       
  2456 					}
       
  2457 				}
       
  2458 				break;
       
  2459 				case OMX_StatePause:
       
  2460 					{
       
  2461 					if (EStateTransitionToExecutingComplete == iTestState)
       
  2462 						{
       
  2463 						INFO_PRINTF1(_L("DoEventHandlerL: OMX_StatePause [EStateTransitionToExecutingComplete]"));
       
  2464 						iTestState = EStateTransitionToPauseComplete;
       
  2465 						TCallBack callback04 (RAsyncTestStepOmxILPcmRenderer0006Step04, this);
       
  2466 						delete ipKickoff04;
       
  2467 						ipKickoff04 = NULL;
       
  2468 						ipKickoff04 =
       
  2469 							new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
       
  2470 						ipKickoff04->Call();
       
  2471 						}
       
  2472 					else
       
  2473 						{
       
  2474 						INFO_PRINTF2(_L("DoEventHandlerL: OMX_StatePause iTestState[%d]"), iTestState);
       
  2475 						return StopTest(KErrGeneral, EFail);
       
  2476 						}
       
  2477 
       
  2478 					}
       
  2479 				break;
       
  2480 			default:
       
  2481 				{
       
  2482 				INFO_PRINTF2(_L("DoEventHandlerL: OMX_State [%d]"), aData2);
       
  2483 				return StopTest(KErrGeneral, EFail);
       
  2484 				}
       
  2485 				};
       
  2486 			}
       
  2487 			break;
       
  2488 		default:
       
  2489 			{
       
  2490 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_Command [%d]"), aData1);
       
  2491 			return StopTest(KErrGeneral, EFail);
       
  2492 			}
       
  2493 			};
       
  2494 		}
       
  2495 		break;
       
  2496 	default:
       
  2497 		{
       
  2498 		INFO_PRINTF2(_L("DoEventHandlerL: OMX Event [%d]"), aEvent);
       
  2499 		return StopTest(KErrGeneral, EFail);
       
  2500 		}
       
  2501 		};
       
  2502 
       
  2503 	}
       
  2504 
       
  2505 
       
  2506 TInt
       
  2507 RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step01(TAny* aPtr)
       
  2508 	{
       
  2509     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step01"));
       
  2510 	// NOTE, Here we reuse inherited code, to populate the component and make it go to OMX_StateIdle
       
  2511 	RAsyncTestStepOmxILPcmRenderer0006* self =
       
  2512 		static_cast<RAsyncTestStepOmxILPcmRenderer0006*> (aPtr);
       
  2513 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step01();
       
  2514 	return KErrNone;
       
  2515 	}
       
  2516 
       
  2517 TInt
       
  2518 RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step02(TAny* aPtr)
       
  2519 	{
       
  2520     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step02"));
       
  2521 	RAsyncTestStepOmxILPcmRenderer0006* self =
       
  2522 		static_cast<RAsyncTestStepOmxILPcmRenderer0006*> (aPtr);
       
  2523 	self->DoRAsyncTestStepOmxILPcmRenderer0005Step02();
       
  2524 	return KErrNone;
       
  2525 	}
       
  2526 
       
  2527 TInt
       
  2528 RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step03(TAny* aPtr)
       
  2529 	{
       
  2530     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step03"));
       
  2531 	RAsyncTestStepOmxILPcmRenderer0006* self =
       
  2532 		static_cast<RAsyncTestStepOmxILPcmRenderer0006*> (aPtr);
       
  2533 	self->DoRAsyncTestStepOmxILPcmRenderer0006Step03();
       
  2534 	return KErrNone;
       
  2535 	}
       
  2536 
       
  2537 void
       
  2538 RAsyncTestStepOmxILPcmRenderer0006::DoRAsyncTestStepOmxILPcmRenderer0006Step03()
       
  2539 	{
       
  2540     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::DoRAsyncTestStepOmxILPcmRenderer0006Step03"));
       
  2541 
       
  2542 	//
       
  2543 	// Move component to OMX_StatePause
       
  2544 	//
       
  2545 	OMX_STATETYPE compState;
       
  2546 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  2547 			ipCompHandle,
       
  2548 			OMX_CommandStateSet,
       
  2549 			OMX_StatePause,
       
  2550 			0))
       
  2551 		{
       
  2552 		return StopTest(KErrGeneral, EFail);
       
  2553 		}
       
  2554 
       
  2555 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  2556 												&compState))
       
  2557 		{
       
  2558 		return StopTest(KErrGeneral, EFail);
       
  2559 		}
       
  2560 
       
  2561 	PrintOmxState(compState);
       
  2562 
       
  2563 	if (OMX_StatePause != compState)
       
  2564 		{
       
  2565 		return StopTest(KErrGeneral, EFail);
       
  2566 		}
       
  2567 
       
  2568 	}
       
  2569 
       
  2570 
       
  2571 TInt
       
  2572 RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step04(TAny* aPtr)
       
  2573 	{
       
  2574     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step04"));
       
  2575 	// NOTE, Here we reuse inherited code, to make it go to OMX_StateIdle
       
  2576 	RAsyncTestStepOmxILPcmRenderer0006* self =
       
  2577 		static_cast<RAsyncTestStepOmxILPcmRenderer0006*> (aPtr);
       
  2578 	self->DoRAsyncTestStepOmxILPcmRenderer0005Step02();
       
  2579 	return KErrNone;
       
  2580 	}
       
  2581 
       
  2582 TInt
       
  2583 RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step05(TAny* aPtr)
       
  2584 	{
       
  2585     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step05"));
       
  2586 	// NOTE, Here we reuse inherited code, to make it go to OMX_StateIdle
       
  2587 	RAsyncTestStepOmxILPcmRenderer0006* self =
       
  2588 		static_cast<RAsyncTestStepOmxILPcmRenderer0006*> (aPtr);
       
  2589 	self->DoRAsyncTestStepOmxILPcmRenderer0004Step03();
       
  2590 	return KErrNone;
       
  2591 	}
       
  2592 
       
  2593 TInt
       
  2594 RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step06(TAny* aPtr)
       
  2595 	{
       
  2596     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0006::RAsyncTestStepOmxILPcmRenderer0006Step06"));
       
  2597 	// NOTE, Here we reuse inherited code, to make it go to OMX_StateLoaded
       
  2598 	RAsyncTestStepOmxILPcmRenderer0006* self =
       
  2599 		static_cast<RAsyncTestStepOmxILPcmRenderer0006*> (aPtr);
       
  2600 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step02();
       
  2601 	return KErrNone;
       
  2602 	}
       
  2603 
       
  2604 
       
  2605 //
       
  2606 // RAsyncTestStepOmxILPcmRenderer0007
       
  2607 //
       
  2608 RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007(const TDesC& aTestName, TInt aComponentUid)
       
  2609 	:
       
  2610 	RAsyncTestStepOmxILPcmRenderer0006(aTestName, aComponentUid)
       
  2611 
       
  2612 	{
       
  2613     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007"));
       
  2614 	}
       
  2615 
       
  2616 
       
  2617 void
       
  2618 RAsyncTestStepOmxILPcmRenderer0007::KickoffTestL()
       
  2619 	{
       
  2620     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::KickoffTestL"));
       
  2621 	iTestState = EStateLoadKickoffTestLComplete;
       
  2622 
       
  2623 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test07 "));
       
  2624 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  2625 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  2626 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Executing->Pause "));
       
  2627 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Pause->Idle(BufferFlushing)"));
       
  2628 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Idle->Loaded(depopulation) "));
       
  2629 
       
  2630 	// This will install one callback
       
  2631 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  2632 
       
  2633 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0007Step01, this);
       
  2634 	delete ipKickoff01;
       
  2635 	ipKickoff01 = NULL;
       
  2636 	ipKickoff01 =
       
  2637 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  2638 	ipKickoff01->Call();
       
  2639 
       
  2640 	}
       
  2641 
       
  2642 void
       
  2643 RAsyncTestStepOmxILPcmRenderer0007::CloseTest()
       
  2644 	{
       
  2645     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::CloseTest"));
       
  2646 
       
  2647 	delete ipKickoff01; // no need to Cancel
       
  2648 	ipKickoff01 = NULL;
       
  2649 	delete ipKickoff02; // no need to Cancel
       
  2650 	ipKickoff02 = NULL;
       
  2651 	delete ipKickoff03; // no need to Cancel
       
  2652 	ipKickoff03 = NULL;
       
  2653 	delete ipKickoff04; // no need to Cancel
       
  2654 	ipKickoff04 = NULL;
       
  2655 	delete ipKickoff05; // no need to Cancel
       
  2656 	ipKickoff05 = NULL;
       
  2657 	delete ipKickoff06; // no need to Cancel
       
  2658 	ipKickoff06 = NULL;
       
  2659 
       
  2660 	delete ipKickoffStop; // no need to Cancel
       
  2661 	ipKickoffStop = 0;
       
  2662 
       
  2663 	TInt count = ipClientClockPortBufferArray.Count();
       
  2664 	
       
  2665 	for (TInt n = 0; n < count; n++)
       
  2666 		{
       
  2667 		delete ipClientClockPortBufferArray[n];
       
  2668 		}
       
  2669 	
       
  2670 	ipClientClockPortBufferArray.Close();
       
  2671 	
       
  2672 	RAsyncTestStepOmxILComponentBase::CloseTest();
       
  2673 
       
  2674 	}
       
  2675 
       
  2676 
       
  2677 void
       
  2678 RAsyncTestStepOmxILPcmRenderer0007::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  2679 											  OMX_EVENTTYPE aEvent,
       
  2680 											  TUint aData1,
       
  2681 											  TUint aData2,
       
  2682 											  TAny* /*aExtra*/)
       
  2683 	{
       
  2684     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::DoEventHandlerL"));
       
  2685 
       
  2686 	switch (aEvent)
       
  2687 		{
       
  2688 	case OMX_EventError:
       
  2689 		{
       
  2690 		//  Ignore underflow errors...
       
  2691 		if (OMX_ErrorUnderflow == (OMX_S32)aData1)
       
  2692 			{
       
  2693 			INFO_PRINTF1(_L("DoEventHandlerL: [OMX_ErrorUnderflow]"));
       
  2694 			}
       
  2695 		else
       
  2696 			{
       
  2697 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_EventError [%x]"), aData1);
       
  2698 			return StopTest(KErrGeneral, EFail);
       
  2699 			}
       
  2700 		}
       
  2701 		break;
       
  2702 
       
  2703 	case OMX_EventCmdComplete:
       
  2704 		{
       
  2705 		switch(aData1)
       
  2706 			{
       
  2707 		case OMX_CommandStateSet:
       
  2708 			{
       
  2709 			switch(aData2)
       
  2710 				{
       
  2711 			case OMX_StateLoaded:
       
  2712 				{
       
  2713 				if (EStateTransitionToIdleComplete == iTestState)
       
  2714 					{
       
  2715 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateLoaded [EStateTransitionToIdleComplete]"));
       
  2716 					iTestState = EStateTransitionToLoadedComplete;
       
  2717 					OMX_STATETYPE compState;
       
  2718 					if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  2719 																&compState))
       
  2720 						{
       
  2721 						return StopTest(KErrGeneral, EFail);
       
  2722 						}
       
  2723 
       
  2724 					PrintOmxState(compState);
       
  2725 
       
  2726 					if (OMX_StateLoaded != compState)
       
  2727 						{
       
  2728 						return StopTest(KErrGeneral, EFail);
       
  2729 						}
       
  2730 
       
  2731 					// The successful termination...
       
  2732 					TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  2733 					delete ipKickoffStop;
       
  2734 					ipKickoffStop = NULL;
       
  2735 					ipKickoffStop =
       
  2736 						new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  2737 					ipKickoffStop->Call();
       
  2738 					}
       
  2739 				}
       
  2740 				break;
       
  2741 			case OMX_StateIdle:
       
  2742 				{
       
  2743 				if (EStateLoadKickoffTestLComplete == iTestState)
       
  2744 					{
       
  2745 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateLoadKickoffTestLComplete]"));
       
  2746 					iTestState = EStateTransitionToIdleComplete;
       
  2747 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0007Step02, this);
       
  2748 					delete ipKickoff02;
       
  2749 					ipKickoff02 = NULL;
       
  2750 					ipKickoff02 =
       
  2751 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  2752 					ipKickoff02->Call();
       
  2753 
       
  2754 					}
       
  2755 				else if (EStateTransitionToPauseComplete == iTestState)
       
  2756 					{
       
  2757 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateTransitionToPauseComplete]"));
       
  2758 					iTestState = EStateTransitionToIdleComplete;
       
  2759 					TCallBack callback05 (RAsyncTestStepOmxILPcmRenderer0007Step05, this);
       
  2760 					delete ipKickoff05;
       
  2761 					ipKickoff05 = NULL;
       
  2762 					ipKickoff05 =
       
  2763 						new (ELeave) CAsyncCallBack (callback05, CActive::EPriorityLow);
       
  2764 					ipKickoff05->Call();
       
  2765 
       
  2766 					}
       
  2767 				else
       
  2768 					{
       
  2769 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [Other]"));
       
  2770 					return StopTest(KErrGeneral, EFail);
       
  2771 					}
       
  2772 				}
       
  2773 				break;
       
  2774 			case OMX_StateExecuting:
       
  2775 				{
       
  2776 				if (EStateTransitionToIdleComplete == iTestState)
       
  2777 					{
       
  2778 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  2779 					iTestState = EStateTransitionToExecutingComplete;
       
  2780 					TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0007Step03, this);
       
  2781 					delete ipKickoff03;
       
  2782 					ipKickoff03 = NULL;
       
  2783 					ipKickoff03 =
       
  2784 						new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  2785 					ipKickoff03->Call();
       
  2786 
       
  2787 					}
       
  2788 				else
       
  2789 					{
       
  2790 					INFO_PRINTF2(_L("DoEventHandlerL: OMX_StateExecuting iTestState[%d]"), iTestState);
       
  2791 					return StopTest(KErrGeneral, EFail);
       
  2792 					}
       
  2793 				}
       
  2794 				break;
       
  2795 			case OMX_StatePause:
       
  2796 				{
       
  2797 				if (EStateTransitionToExecutingComplete == iTestState)
       
  2798 					{
       
  2799 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StatePause [EStateTransitionToExecutingComplete]"));
       
  2800 					iTestState = EStateTransitionToPauseComplete;
       
  2801 					TCallBack callback04 (RAsyncTestStepOmxILPcmRenderer0007Step04, this);
       
  2802 					delete ipKickoff04;
       
  2803 					ipKickoff04 = NULL;
       
  2804 					ipKickoff04 =
       
  2805 						new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
       
  2806 					ipKickoff04->Call();
       
  2807 					}
       
  2808 				else
       
  2809 					{
       
  2810 					INFO_PRINTF2(_L("DoEventHandlerL: OMX_StatePause iTestState[%d]"), iTestState);
       
  2811 					return StopTest(KErrGeneral, EFail);
       
  2812 					}
       
  2813 
       
  2814 				}
       
  2815 				break;
       
  2816 			default:
       
  2817 				{
       
  2818 				INFO_PRINTF2(_L("DoEventHandlerL: OMX_State [%d]"), aData2);
       
  2819 				return StopTest(KErrGeneral, EFail);
       
  2820 				}
       
  2821 				};
       
  2822 			}
       
  2823 			break;
       
  2824 		default:
       
  2825 			{
       
  2826 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_Command [%d]"), aData1);
       
  2827 			return StopTest(KErrGeneral, EFail);
       
  2828 			}
       
  2829 			};
       
  2830 		}
       
  2831 		break;
       
  2832 	default:
       
  2833 		{
       
  2834 		INFO_PRINTF2(_L("DoEventHandlerL: OMX Event [%d]"), aEvent);
       
  2835 		return StopTest(KErrGeneral, EFail);
       
  2836 		}
       
  2837 		};
       
  2838 
       
  2839 	}
       
  2840 
       
  2841 
       
  2842 TInt
       
  2843 RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step01(TAny* aPtr)
       
  2844 	{
       
  2845     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step01"));
       
  2846 	// NOTE, Here we reuse inherited code, to populate the component and make it go to OMX_StateIdle
       
  2847 	RAsyncTestStepOmxILPcmRenderer0007* self =
       
  2848 		static_cast<RAsyncTestStepOmxILPcmRenderer0007*> (aPtr);
       
  2849 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step01();
       
  2850 	return KErrNone;
       
  2851 	}
       
  2852 
       
  2853 TInt
       
  2854 RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step02(TAny* aPtr)
       
  2855 	{
       
  2856     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step02"));
       
  2857 	RAsyncTestStepOmxILPcmRenderer0007* self =
       
  2858 		static_cast<RAsyncTestStepOmxILPcmRenderer0007*> (aPtr);
       
  2859 	self->DoRAsyncTestStepOmxILPcmRenderer0005Step02();
       
  2860 	return KErrNone;
       
  2861 	}
       
  2862 
       
  2863 TInt
       
  2864 RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step03(TAny* aPtr)
       
  2865 	{
       
  2866     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step03"));
       
  2867 	RAsyncTestStepOmxILPcmRenderer0007* self =
       
  2868 		static_cast<RAsyncTestStepOmxILPcmRenderer0007*> (aPtr);
       
  2869 	self->DoRAsyncTestStepOmxILPcmRenderer0006Step03();
       
  2870 	return KErrNone;
       
  2871 	}
       
  2872 
       
  2873 TInt
       
  2874 RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step04(TAny* aPtr)
       
  2875 	{
       
  2876     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step04"));
       
  2877 	// NOTE, Here we reuse inherited code, to make it go to OMX_StateIdle
       
  2878 	RAsyncTestStepOmxILPcmRenderer0007* self =
       
  2879 		static_cast<RAsyncTestStepOmxILPcmRenderer0007*> (aPtr);
       
  2880 	self->DoRAsyncTestStepOmxILPcmRenderer0004Step03();
       
  2881 	return KErrNone;
       
  2882 	}
       
  2883 
       
  2884 TInt
       
  2885 RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step05(TAny* aPtr)
       
  2886 	{
       
  2887     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0007::RAsyncTestStepOmxILPcmRenderer0007Step05"));
       
  2888 	// NOTE, Here we reuse inherited code, to make it go to OMX_StateIdle
       
  2889 	RAsyncTestStepOmxILPcmRenderer0007* self =
       
  2890 		static_cast<RAsyncTestStepOmxILPcmRenderer0007*> (aPtr);
       
  2891 	self->DoRAsyncTestStepOmxILPcmRenderer0001Step02();
       
  2892 	return KErrNone;
       
  2893 	}
       
  2894 
       
  2895 //
       
  2896 // RAsyncTestStepOmxILPcmRenderer0008
       
  2897 //
       
  2898 RAsyncTestStepOmxILPcmRenderer0008::RAsyncTestStepOmxILPcmRenderer0008(const TDesC& aTestName, TInt aComponentUid)
       
  2899 	:
       
  2900 	RAsyncTestStepOmxILPcmRenderer0005(aTestName, aComponentUid)
       
  2901 	{
       
  2902     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0008::RAsyncTestStepOmxILPcmRenderer0008"));
       
  2903 	}
       
  2904 
       
  2905 
       
  2906 void
       
  2907 RAsyncTestStepOmxILPcmRenderer0008::KickoffTestL()
       
  2908 	{
       
  2909     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0008::KickoffTestL"));
       
  2910 	iTestState = EStateLoadKickoffTestLComplete;
       
  2911 
       
  2912 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test08 "));
       
  2913 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  2914 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  2915 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Repeat these two steps until the whole file has beeen empited "));
       
  2916 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2a. - Call EmptyThisBuffer on PCM Renderer "));
       
  2917 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2b. - EmptyBufferDone callback received "));
       
  2918 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Executing->Idle(BufferFlushing) "));
       
  2919 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Idle->Loaded(Depopulation) "));
       
  2920 
       
  2921 	// This will change the test file
       
  2922 	iTestFileName.Set(KPcmRendererTestFile);
       
  2923 	
       
  2924 	// This will install one callback
       
  2925 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  2926 
       
  2927 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0005Step01, this);
       
  2928 	delete ipKickoff01;
       
  2929 	ipKickoff01 = NULL;
       
  2930 	ipKickoff01 =
       
  2931 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  2932 	ipKickoff01->Call();
       
  2933 	}
       
  2934 
       
  2935 void
       
  2936 RAsyncTestStepOmxILPcmRenderer0008::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  2937 											  OMX_EVENTTYPE aEvent,
       
  2938 											  TUint aData1,
       
  2939 											  TUint aData2,
       
  2940 											  TAny* /*aExtra*/)
       
  2941 	{
       
  2942     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0008::DoEventHandlerL"));
       
  2943 
       
  2944 	switch (aEvent)
       
  2945 		{
       
  2946 	case OMX_EventError:
       
  2947 		{
       
  2948 		//  Ignore underflow errors...
       
  2949 		if (OMX_ErrorUnderflow == (OMX_S32)aData1)
       
  2950 			{
       
  2951 			INFO_PRINTF1(_L("DoEventHandlerL: [OMX_ErrorUnderflow]"));
       
  2952 			}
       
  2953 		else
       
  2954 			{
       
  2955 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_EventError [%x]"), aData1);
       
  2956 			return StopTest(KErrGeneral, EFail);
       
  2957 			}
       
  2958 		}
       
  2959 		break;
       
  2960 
       
  2961 	case OMX_EventCmdComplete:
       
  2962 		{
       
  2963 		switch(aData1)
       
  2964 			{
       
  2965 		case OMX_CommandStateSet:
       
  2966 			{
       
  2967 			switch(aData2)
       
  2968 				{
       
  2969 			case OMX_StateLoaded:
       
  2970 				{
       
  2971 				if (EStateTransitionToIdleComplete == iTestState)
       
  2972 					{
       
  2973 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateLoaded [EStateTransitionToIdleComplete]"));
       
  2974 					iTestState = EStateTransitionToLoadedComplete;
       
  2975 					OMX_STATETYPE compState;
       
  2976 					if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  2977 																&compState))
       
  2978 						{
       
  2979 						return StopTest(KErrGeneral, EFail);
       
  2980 						}
       
  2981 
       
  2982 					PrintOmxState(compState);
       
  2983 
       
  2984 					if (OMX_StateLoaded != compState)
       
  2985 						{
       
  2986 						return StopTest(KErrGeneral, EFail);
       
  2987 						}
       
  2988 
       
  2989 					// The successful termination...
       
  2990 					TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  2991 					delete ipKickoffStop;
       
  2992 					ipKickoffStop = NULL;
       
  2993 					ipKickoffStop =
       
  2994 						new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  2995 					ipKickoffStop->Call();
       
  2996 					}
       
  2997 				}
       
  2998 				break;
       
  2999 			case OMX_StateIdle:
       
  3000 				{
       
  3001 				if (EStateLoadKickoffTestLComplete == iTestState)
       
  3002 					{
       
  3003 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateLoadKickoffTestLComplete]"));
       
  3004 					iTestState = EStateTransitionToIdleComplete;
       
  3005 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0005Step02, this);
       
  3006 					delete ipKickoff02;
       
  3007 					ipKickoff02 = NULL;
       
  3008 					ipKickoff02 =
       
  3009 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  3010 					ipKickoff02->Call();
       
  3011 
       
  3012 					}
       
  3013 				else if (EStateTransitionToExecutingComplete == iTestState)
       
  3014 					{
       
  3015 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateTransitionToPauseComplete]"));
       
  3016 					iTestState = EStateTransitionToIdleComplete;
       
  3017 					TCallBack callback04 (RAsyncTestStepOmxILPcmRenderer0005Step04, this);
       
  3018 					delete ipKickoff04;
       
  3019 					ipKickoff04 = NULL;
       
  3020 					ipKickoff04 =
       
  3021 						new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
       
  3022 					ipKickoff04->Call();
       
  3023 
       
  3024 					}
       
  3025 				else
       
  3026 					{
       
  3027 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [Other]"));
       
  3028 					return StopTest(KErrGeneral, EFail);
       
  3029 					}
       
  3030 				}
       
  3031 				break;
       
  3032 			case OMX_StateExecuting:
       
  3033 				{
       
  3034 				if (EStateTransitionToIdleComplete == iTestState)
       
  3035 					{
       
  3036 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  3037 					iTestState = EStateTransitionToExecutingComplete;
       
  3038 					
       
  3039 					CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3040 					ipTestFile->ReadNextBuffer(dataBuffer);
       
  3041 					
       
  3042 					// Send a buffer to the input port
       
  3043 					ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3044 					
       
  3045 					if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3046 							ipCompHandle, ipBufferHeaderInput))
       
  3047 						{
       
  3048 						StopTest(KErrGeneral, EFail);
       
  3049 						}
       
  3050 					}
       
  3051 				else
       
  3052 					{
       
  3053 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [Other]"));
       
  3054 					return StopTest(KErrGeneral, EFail);
       
  3055 					}
       
  3056 				}
       
  3057 				break;
       
  3058 			default:
       
  3059 				{
       
  3060 				INFO_PRINTF2(_L("DoEventHandlerL: OMX_State [%d]"), aData2);
       
  3061 				return StopTest(KErrGeneral, EFail);
       
  3062 				}
       
  3063 				};
       
  3064 			}
       
  3065 			break;
       
  3066 		default:
       
  3067 			{
       
  3068 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_Command [%d]"), aData1);
       
  3069 			return StopTest(KErrGeneral, EFail);
       
  3070 			}
       
  3071 			};
       
  3072 		}
       
  3073 		break;
       
  3074 	default:
       
  3075 		{
       
  3076 		INFO_PRINTF2(_L("DoEventHandlerL: OMX Event [%d]"), aEvent);
       
  3077 		return StopTest(KErrGeneral, EFail);
       
  3078 		}
       
  3079 		};
       
  3080 
       
  3081 	}
       
  3082 
       
  3083 void
       
  3084 RAsyncTestStepOmxILPcmRenderer0008::DoEmptyBufferDoneL(OMX_HANDLETYPE /*aComponent*/,
       
  3085 													 OMX_BUFFERHEADERTYPE* /*aBuffer*/)
       
  3086 	{
       
  3087     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0008::DoEmptyBufferDoneL"));
       
  3088 	INFO_PRINTF1(_L("DoEmptyBufferDoneL : Callback received "));
       
  3089 	
       
  3090 	CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3091 	ipTestFile->ReadNextBuffer(dataBuffer);
       
  3092 	
       
  3093 	if (dataBuffer.BufferSize() > 0)
       
  3094 		{
       
  3095 		// Send a buffer to the input port
       
  3096 		ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3097 		
       
  3098 		if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3099 				ipCompHandle, ipBufferHeaderInput))
       
  3100 			{
       
  3101 			StopTest(KErrGeneral, EFail);
       
  3102 			}
       
  3103 		}
       
  3104 	else
       
  3105 		{
       
  3106 		TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0005Step03, this);
       
  3107 		delete ipKickoff03;
       
  3108 		ipKickoff03 = NULL;
       
  3109 		ipKickoff03 =
       
  3110 			new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  3111 		ipKickoff03->Call();
       
  3112 		}
       
  3113 	}
       
  3114 
       
  3115 //
       
  3116 // RAsyncTestStepOmxILPcmRenderer0009
       
  3117 //
       
  3118 RAsyncTestStepOmxILPcmRenderer0009::RAsyncTestStepOmxILPcmRenderer0009(const TDesC& aTestName, TInt aComponentUid)
       
  3119 	:
       
  3120 	RAsyncTestStepOmxILPcmRenderer0008(aTestName, aComponentUid)
       
  3121 	{
       
  3122     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0009::RAsyncTestStepOmxILPcmRenderer0009"));
       
  3123     iSamplingRate = 44100;
       
  3124 	}
       
  3125 
       
  3126 
       
  3127 void
       
  3128 RAsyncTestStepOmxILPcmRenderer0009::KickoffTestL()
       
  3129 	{
       
  3130     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0009::KickoffTestL"));
       
  3131 	iTestState = EStateLoadKickoffTestLComplete;
       
  3132 
       
  3133 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test09 "));
       
  3134 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  3135 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  3136 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Repeat these two steps until the whole file has beeen empited "));
       
  3137 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2a. - Call EmptyThisBuffer on PCM Renderer "));
       
  3138 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2b. - EmptyBufferDone callback received "));
       
  3139 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Executing->Pause and Pause->Executing (after 5 and again after 10 buffers played) "));
       
  3140 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Executing->Idle(BufferFlushing) "));
       
  3141 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Idle->Loaded(Depopulation) "));
       
  3142 
       
  3143 	// This will change the test file
       
  3144 	iTestFileName.Set(KPcmRendererTestFile2);
       
  3145 	
       
  3146 	// This will install one callback
       
  3147 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  3148 
       
  3149 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0005Step01, this);
       
  3150 	delete ipKickoff01;
       
  3151 	ipKickoff01 = NULL;
       
  3152 	ipKickoff01 =
       
  3153 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  3154 	ipKickoff01->Call();
       
  3155 	}
       
  3156 
       
  3157 void
       
  3158 RAsyncTestStepOmxILPcmRenderer0009::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  3159 											  OMX_EVENTTYPE aEvent,
       
  3160 											  TUint aData1,
       
  3161 											  TUint aData2,
       
  3162 											  TAny* /*aExtra*/)
       
  3163 	{
       
  3164     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0009::DoEventHandlerL"));
       
  3165 	
       
  3166 	switch (aEvent)
       
  3167 		{
       
  3168 	case OMX_EventError:
       
  3169 		{
       
  3170 		//  Ignore underflow errors...
       
  3171 		if (OMX_ErrorUnderflow == (OMX_S32)aData1)
       
  3172 			{
       
  3173 			INFO_PRINTF1(_L("DoEventHandlerL: [OMX_ErrorUnderflow]"));
       
  3174 			}
       
  3175 		else
       
  3176 			{
       
  3177 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_EventError [%x]"), aData1);
       
  3178 			return StopTest(KErrGeneral, EFail);
       
  3179 			}
       
  3180 		}
       
  3181 		break;
       
  3182 
       
  3183 	case OMX_EventCmdComplete:
       
  3184 		{
       
  3185 		switch(aData1)
       
  3186 			{
       
  3187 		case OMX_CommandStateSet:
       
  3188 			{
       
  3189 			switch(aData2)
       
  3190 				{
       
  3191 			case OMX_StateLoaded:
       
  3192 				{
       
  3193 				if (EStateTransitionToIdleComplete == iTestState)
       
  3194 					{
       
  3195 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateLoaded [EStateTransitionToIdleComplete]"));
       
  3196 					iTestState = EStateTransitionToLoadedComplete;
       
  3197 					OMX_STATETYPE compState;
       
  3198 					if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  3199 																&compState))
       
  3200 						{
       
  3201 						return StopTest(KErrGeneral, EFail);
       
  3202 						}
       
  3203 
       
  3204 					PrintOmxState(compState);
       
  3205 
       
  3206 					if (OMX_StateLoaded != compState)
       
  3207 						{
       
  3208 						return StopTest(KErrGeneral, EFail);
       
  3209 						}
       
  3210 
       
  3211 					// The successful termination...
       
  3212 					TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  3213 					delete ipKickoffStop;
       
  3214 					ipKickoffStop = NULL;
       
  3215 					ipKickoffStop =
       
  3216 						new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  3217 					ipKickoffStop->Call();
       
  3218 					}
       
  3219 				}
       
  3220 				break;
       
  3221 			case OMX_StateIdle:
       
  3222 				{
       
  3223 				if (EStateLoadKickoffTestLComplete == iTestState)
       
  3224 					{
       
  3225 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateLoadKickoffTestLComplete]"));
       
  3226 					iTestState = EStateTransitionToIdleComplete;
       
  3227 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0005Step02, this);
       
  3228 					delete ipKickoff02;
       
  3229 					ipKickoff02 = NULL;
       
  3230 					ipKickoff02 =
       
  3231 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  3232 					ipKickoff02->Call();
       
  3233 
       
  3234 					}
       
  3235 				else if (EStateTransitionToExecutingComplete == iTestState)
       
  3236 					{
       
  3237 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateTransitionToPauseComplete]"));
       
  3238 					iTestState = EStateTransitionToIdleComplete;
       
  3239 					TCallBack callback04 (RAsyncTestStepOmxILPcmRenderer0005Step04, this);
       
  3240 					delete ipKickoff04;
       
  3241 					ipKickoff04 = NULL;
       
  3242 					ipKickoff04 =
       
  3243 						new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
       
  3244 					ipKickoff04->Call();
       
  3245 
       
  3246 					}
       
  3247 				else
       
  3248 					{
       
  3249 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [Other]"));
       
  3250 					return StopTest(KErrGeneral, EFail);
       
  3251 					}
       
  3252 				}
       
  3253 				break;
       
  3254 			case OMX_StateExecuting:
       
  3255 				{
       
  3256 				if (EStateTransitionToIdleComplete == iTestState)
       
  3257 					{
       
  3258 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  3259 					iTestState = EStateTransitionToExecutingComplete;
       
  3260 					
       
  3261 					CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3262 					ipTestFile->ReadNextBuffer(dataBuffer);
       
  3263 					
       
  3264 					// Send a buffer to the input port
       
  3265 					ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3266 					
       
  3267 					if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3268 							ipCompHandle, ipBufferHeaderInput))
       
  3269 						{
       
  3270 						StopTest(KErrGeneral, EFail);
       
  3271 						}
       
  3272 					}
       
  3273 				else if (EStateTransitionToPauseComplete == iTestState)
       
  3274 					{
       
  3275 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  3276 					iTestState = EStateTransitionToExecutingComplete;
       
  3277 					}
       
  3278 				else
       
  3279 					{
       
  3280 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [Other]"));
       
  3281 					return StopTest(KErrGeneral, EFail);
       
  3282 					}
       
  3283 				}
       
  3284 				break;
       
  3285 			case OMX_StatePause:
       
  3286 				{
       
  3287 				if (EStateTransitionToExecutingComplete == iTestState)
       
  3288 					{
       
  3289 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StatePause [EStateTransitionToExecutingComplete]"));
       
  3290 					iTestState = EStateTransitionToPauseComplete;
       
  3291 					
       
  3292 					// Wait for a second...
       
  3293 					User::After(1000000);
       
  3294 					
       
  3295 					// Resume playing...
       
  3296 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0005Step02, this);
       
  3297 					delete ipKickoff02;
       
  3298 					ipKickoff02 = NULL;
       
  3299 					ipKickoff02 =
       
  3300 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  3301 					ipKickoff02->Call();
       
  3302 					}
       
  3303 				else
       
  3304 					{
       
  3305 					INFO_PRINTF2(_L("DoEventHandlerL: OMX_StatePause iTestState[%d]"), iTestState);
       
  3306 					return StopTest(KErrGeneral, EFail);
       
  3307 					}
       
  3308 
       
  3309 				}
       
  3310 				break;
       
  3311 			default:
       
  3312 				{
       
  3313 				INFO_PRINTF2(_L("DoEventHandlerL: OMX_State [%d]"), aData2);
       
  3314 				return StopTest(KErrGeneral, EFail);
       
  3315 				}
       
  3316 				};
       
  3317 			}
       
  3318 			break;
       
  3319 		default:
       
  3320 			{
       
  3321 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_Command [%d]"), aData1);
       
  3322 			return StopTest(KErrGeneral, EFail);
       
  3323 			}
       
  3324 			};
       
  3325 		}
       
  3326 		break;
       
  3327 	default:
       
  3328 		{
       
  3329 		INFO_PRINTF2(_L("DoEventHandlerL: OMX Event [%d]"), aEvent);
       
  3330 		return StopTest(KErrGeneral, EFail);
       
  3331 		}
       
  3332 		};
       
  3333 
       
  3334 	}
       
  3335 
       
  3336 void
       
  3337 RAsyncTestStepOmxILPcmRenderer0009::DoEmptyBufferDoneL(OMX_HANDLETYPE /*aComponent*/,
       
  3338 													 OMX_BUFFERHEADERTYPE* /*aBuffer*/)
       
  3339 	{
       
  3340     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0009::DoEmptyBufferDoneL"));
       
  3341 	INFO_PRINTF1(_L("DoEmptyBufferDoneL : Callback received "));
       
  3342 	
       
  3343 	iNumOfEmptiedBuffers++;
       
  3344 	if (iNumOfEmptiedBuffers == 5 || iNumOfEmptiedBuffers == 10)
       
  3345 		{
       
  3346 		//
       
  3347 		// Move component to OMX_StatePause
       
  3348 		//
       
  3349 		if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  3350 				ipCompHandle,
       
  3351 				OMX_CommandStateSet,
       
  3352 				OMX_StatePause,
       
  3353 				0))
       
  3354 			{
       
  3355 			return StopTest(KErrGeneral, EFail);
       
  3356 			}
       
  3357 
       
  3358 		OMX_STATETYPE compState;
       
  3359 		if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  3360 													&compState))
       
  3361 			{
       
  3362 			return StopTest(KErrGeneral, EFail);
       
  3363 			}
       
  3364 
       
  3365 		PrintOmxState(compState);
       
  3366 		if (OMX_StatePause != compState)
       
  3367 			{
       
  3368 			return StopTest(KErrGeneral, EFail);
       
  3369 			}
       
  3370 		}
       
  3371 
       
  3372 	CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3373 	ipTestFile->ReadNextBuffer(dataBuffer);
       
  3374 	
       
  3375 	if (dataBuffer.BufferSize() > 0)
       
  3376 		{
       
  3377 		// Send a buffer to the input port
       
  3378 		ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3379 		
       
  3380 		if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3381 				ipCompHandle, ipBufferHeaderInput))
       
  3382 			{
       
  3383 			StopTest(KErrGeneral, EFail);
       
  3384 			}
       
  3385 		}
       
  3386 	else
       
  3387 		{
       
  3388 		TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0005Step03, this);
       
  3389 		delete ipKickoff03;
       
  3390 		ipKickoff03 = NULL;
       
  3391 		ipKickoff03 =
       
  3392 			new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  3393 		ipKickoff03->Call();
       
  3394 		}
       
  3395 	}
       
  3396 
       
  3397 //
       
  3398 // RAsyncTestStepOmxILPcmRenderer0010
       
  3399 //
       
  3400 RAsyncTestStepOmxILPcmRenderer0010::RAsyncTestStepOmxILPcmRenderer0010(const TDesC& aTestName, TInt aComponentUid)
       
  3401 	:
       
  3402 	RAsyncTestStepOmxILPcmRenderer0008(aTestName, aComponentUid)
       
  3403 	{
       
  3404     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0010::RAsyncTestStepOmxILPcmRenderer0010"));
       
  3405     iSamplingRate = 44100;
       
  3406 	}
       
  3407 
       
  3408 
       
  3409 void
       
  3410 RAsyncTestStepOmxILPcmRenderer0010::KickoffTestL()
       
  3411 	{
       
  3412     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0010::KickoffTestL"));
       
  3413 	iTestState = EStateLoadKickoffTestLComplete;
       
  3414 
       
  3415 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test10 "));
       
  3416 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  3417 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  3418 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Repeat these two steps until the whole file has beeen empited "));
       
  3419 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2a. - Call EmptyThisBuffer on PCM Renderer "));
       
  3420 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2b. - EmptyBufferDone callback received "));
       
  3421 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Executing->Idle and Idle->Executing (after 5 and again after 10 buffers played) "));
       
  3422 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Executing->Idle(BufferFlushing) "));
       
  3423 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Idle->Loaded(Depopulation) "));
       
  3424 
       
  3425 	// This will change the test file
       
  3426 	iTestFileName.Set(KPcmRendererTestFile2);
       
  3427 	
       
  3428 	// This will install one callback
       
  3429 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  3430 
       
  3431 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0005Step01, this);
       
  3432 	delete ipKickoff01;
       
  3433 	ipKickoff01 = NULL;
       
  3434 	ipKickoff01 =
       
  3435 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  3436 	ipKickoff01->Call();
       
  3437 	}
       
  3438 
       
  3439 void
       
  3440 RAsyncTestStepOmxILPcmRenderer0010::DoEventHandlerL(OMX_HANDLETYPE /*aComponent*/,
       
  3441 											  OMX_EVENTTYPE aEvent,
       
  3442 											  TUint aData1,
       
  3443 											  TUint aData2,
       
  3444 											  TAny* /*aExtra*/)
       
  3445 	{
       
  3446     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0010::DoEventHandlerL"));
       
  3447 
       
  3448 	switch (aEvent)
       
  3449 		{
       
  3450 	case OMX_EventError:
       
  3451 		{
       
  3452 		//  Ignore underflow errors...
       
  3453 		if (OMX_ErrorUnderflow == (OMX_S32)aData1)
       
  3454 			{
       
  3455 			INFO_PRINTF1(_L("DoEventHandlerL: [OMX_ErrorUnderflow]"));
       
  3456 			}
       
  3457 		else
       
  3458 			{
       
  3459 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_EventError [%x]"), aData1);
       
  3460 			return StopTest(KErrGeneral, EFail);
       
  3461 			}
       
  3462 		}
       
  3463 		break;
       
  3464 
       
  3465 	case OMX_EventCmdComplete:
       
  3466 		{
       
  3467 		switch(aData1)
       
  3468 			{
       
  3469 		case OMX_CommandStateSet:
       
  3470 			{
       
  3471 			switch(aData2)
       
  3472 				{
       
  3473 			case OMX_StateLoaded:
       
  3474 				{
       
  3475 				if (EStateTransitionToIdleComplete == iTestState)
       
  3476 					{
       
  3477 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateLoaded [EStateTransitionToIdleComplete]"));
       
  3478 					iTestState = EStateTransitionToLoadedComplete;
       
  3479 					OMX_STATETYPE compState;
       
  3480 					if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  3481 																&compState))
       
  3482 						{
       
  3483 						return StopTest(KErrGeneral, EFail);
       
  3484 						}
       
  3485 
       
  3486 					PrintOmxState(compState);
       
  3487 
       
  3488 					if (OMX_StateLoaded != compState)
       
  3489 						{
       
  3490 						return StopTest(KErrGeneral, EFail);
       
  3491 						}
       
  3492 
       
  3493 					// The successful termination...
       
  3494 					TCallBack callbackStop (RAsyncTestStepOmxILComponentBase::StopTestCallBack, this);
       
  3495 					delete ipKickoffStop;
       
  3496 					ipKickoffStop = NULL;
       
  3497 					ipKickoffStop =
       
  3498 						new (ELeave) CAsyncCallBack (callbackStop, CActive::EPriorityLow);
       
  3499 					ipKickoffStop->Call();
       
  3500 					}
       
  3501 				}
       
  3502 				break;
       
  3503 			case OMX_StateIdle:
       
  3504 				{
       
  3505 				if (EStateLoadKickoffTestLComplete == iTestState)
       
  3506 					{
       
  3507 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateLoadKickoffTestLComplete]"));
       
  3508 					iTestState = EStateTransitionToIdleComplete;
       
  3509 					TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0005Step02, this);
       
  3510 					delete ipKickoff02;
       
  3511 					ipKickoff02 = NULL;
       
  3512 					ipKickoff02 =
       
  3513 						new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  3514 					ipKickoff02->Call();
       
  3515 
       
  3516 					}
       
  3517 				else if (EStateTransitionToExecutingComplete == iTestState)
       
  3518 					{
       
  3519 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [EStateTransitionToExecutingComplete]"));
       
  3520 					iTestState = EStateTransitionToIdleComplete;
       
  3521 					
       
  3522 					if(iNumOfEmptiedBuffers <= 20)
       
  3523 						{
       
  3524 						// Wait for a second...
       
  3525 						User::After(1000000);
       
  3526 						
       
  3527 						// Resume playing...
       
  3528 						TCallBack callback02 (RAsyncTestStepOmxILPcmRenderer0005Step02, this);
       
  3529 						delete ipKickoff02;
       
  3530 						ipKickoff02 = NULL;
       
  3531 						ipKickoff02 =
       
  3532 							new (ELeave) CAsyncCallBack (callback02, CActive::EPriorityLow);
       
  3533 						ipKickoff02->Call();
       
  3534 						}
       
  3535 					else
       
  3536 						{
       
  3537 						// Playback finished
       
  3538 						TCallBack callback04 (RAsyncTestStepOmxILPcmRenderer0005Step04, this);
       
  3539 						delete ipKickoff04;
       
  3540 						ipKickoff04 = NULL;
       
  3541 						ipKickoff04 =
       
  3542 							new (ELeave) CAsyncCallBack (callback04, CActive::EPriorityLow);
       
  3543 						ipKickoff04->Call();
       
  3544 						}
       
  3545 					}
       
  3546 				else
       
  3547 					{
       
  3548 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateIdle [Other]"));
       
  3549 					return StopTest(KErrGeneral, EFail);
       
  3550 					}
       
  3551 				}
       
  3552 				break;
       
  3553 			case OMX_StateExecuting:
       
  3554 				{
       
  3555 				if (EStateTransitionToIdleComplete == iTestState)
       
  3556 					{
       
  3557 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  3558 					iTestState = EStateTransitionToExecutingComplete;
       
  3559 					
       
  3560 					CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3561 					ipTestFile->ReadNextBuffer(dataBuffer);
       
  3562 					
       
  3563 					// Send a buffer to the input port
       
  3564 					ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3565 					
       
  3566 					if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3567 							ipCompHandle, ipBufferHeaderInput))
       
  3568 						{
       
  3569 						StopTest(KErrGeneral, EFail);
       
  3570 						}
       
  3571 					}
       
  3572 				else if (EStateTransitionToPauseComplete == iTestState)
       
  3573 					{
       
  3574 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [EStateTransitionToIdleComplete]"));
       
  3575 					iTestState = EStateTransitionToExecutingComplete;
       
  3576 					}
       
  3577 				else
       
  3578 					{
       
  3579 					INFO_PRINTF1(_L("DoEventHandlerL: OMX_StateExecuting [Other]"));
       
  3580 					return StopTest(KErrGeneral, EFail);
       
  3581 					}
       
  3582 				}
       
  3583 				break;
       
  3584 			default:
       
  3585 				{
       
  3586 				INFO_PRINTF2(_L("DoEventHandlerL: OMX_State [%d]"), aData2);
       
  3587 				return StopTest(KErrGeneral, EFail);
       
  3588 				}
       
  3589 				};
       
  3590 			}
       
  3591 			break;
       
  3592 		default:
       
  3593 			{
       
  3594 			INFO_PRINTF2(_L("DoEventHandlerL: OMX_Command [%d]"), aData1);
       
  3595 			return StopTest(KErrGeneral, EFail);
       
  3596 			}
       
  3597 			};
       
  3598 		}
       
  3599 		break;
       
  3600 	default:
       
  3601 		{
       
  3602 		INFO_PRINTF2(_L("DoEventHandlerL: OMX Event [%d]"), aEvent);
       
  3603 		return StopTest(KErrGeneral, EFail);
       
  3604 		}
       
  3605 		};
       
  3606 
       
  3607 	}
       
  3608 
       
  3609 void
       
  3610 RAsyncTestStepOmxILPcmRenderer0010::DoEmptyBufferDoneL(OMX_HANDLETYPE /*aComponent*/,
       
  3611 													 OMX_BUFFERHEADERTYPE* /*aBuffer*/)
       
  3612 	{
       
  3613     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0010::DoEmptyBufferDoneL"));
       
  3614 	INFO_PRINTF1(_L("DoEmptyBufferDoneL : Callback received "));
       
  3615 	
       
  3616 	iNumOfEmptiedBuffers++;
       
  3617 	if (iNumOfEmptiedBuffers == 5 || iNumOfEmptiedBuffers == 10)
       
  3618 		{
       
  3619 		//
       
  3620 		// Move component to OMX_StateIdle
       
  3621 		//
       
  3622 
       
  3623 		if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  3624 				ipCompHandle,
       
  3625 				OMX_CommandStateSet,
       
  3626 				OMX_StateIdle,
       
  3627 				0))
       
  3628 			{
       
  3629 			return StopTest(KErrGeneral, EFail);
       
  3630 			}
       
  3631 
       
  3632 		OMX_STATETYPE compState;
       
  3633 		if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  3634 													&compState))
       
  3635 			{
       
  3636 			return StopTest(KErrGeneral, EFail);
       
  3637 			}
       
  3638 
       
  3639 		PrintOmxState(compState);
       
  3640 
       
  3641 		if (OMX_StateIdle != compState)
       
  3642 			{
       
  3643 			return StopTest(KErrGeneral, EFail);
       
  3644 			}
       
  3645 		
       
  3646 		// Reset the file position
       
  3647 		ipTestFile->ResetPos();
       
  3648 		}
       
  3649 	else
       
  3650 		{
       
  3651 		CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3652 		ipTestFile->ReadNextBuffer(dataBuffer);
       
  3653 		
       
  3654 		if (dataBuffer.BufferSize() > 0)
       
  3655 			{
       
  3656 			// Send a buffer to the input port
       
  3657 			ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3658 			
       
  3659 			if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3660 					ipCompHandle, ipBufferHeaderInput))
       
  3661 				{
       
  3662 				StopTest(KErrGeneral, EFail);
       
  3663 				}
       
  3664 			}
       
  3665 		else
       
  3666 			{
       
  3667 			TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0005Step03, this);
       
  3668 			delete ipKickoff03;
       
  3669 			ipKickoff03 = NULL;
       
  3670 			ipKickoff03 =
       
  3671 				new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  3672 			ipKickoff03->Call();
       
  3673 			}
       
  3674 		}
       
  3675 	}
       
  3676 
       
  3677 TInt
       
  3678 RAsyncTestStepOmxILPcmRenderer0010::RAsyncTestStepOmxILPcmRenderer0010Step01(TAny* aPtr)
       
  3679 	{
       
  3680     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0010::RAsyncTestStepOmxILPcmRenderer0010Step01"));
       
  3681 	RAsyncTestStepOmxILPcmRenderer0010* self =
       
  3682 		static_cast<RAsyncTestStepOmxILPcmRenderer0010*> (aPtr);
       
  3683 	self->DoRAsyncTestStepOmxILPcmRenderer0010Step01();
       
  3684 	return KErrNone;
       
  3685 	}
       
  3686 
       
  3687 void
       
  3688 RAsyncTestStepOmxILPcmRenderer0010::DoRAsyncTestStepOmxILPcmRenderer0010Step01()
       
  3689 	{
       
  3690     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0010::DoRAsyncTestStepOmxILPcmRenderer0010Step01"));
       
  3691 
       
  3692 	//
       
  3693 	// Provide callbacks to component
       
  3694 	//
       
  3695 	OMX_CALLBACKTYPE* omxCallbacks = *ipCallbackHandler;
       
  3696 
       
  3697 	if (OMX_ErrorNone != ipCompHandle->SetCallbacks(
       
  3698 			ipCompHandle,
       
  3699 			omxCallbacks,
       
  3700 			ipCallbackHandler))
       
  3701 		{
       
  3702 		return StopTest(KErrGeneral, EFail);
       
  3703 		}
       
  3704 
       
  3705 	INFO_PRINTF2(_L("Component Callbacks set successfully: %X"), ipCallbackHandler);
       
  3706 
       
  3707 	//
       
  3708 	// Obtain the port def params for Port #0
       
  3709 	//
       
  3710 	OMX_PARAM_PORTDEFINITIONTYPE portParamsInputPort;
       
  3711 	portParamsInputPort.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
       
  3712 	portParamsInputPort.nVersion = TOmxILSpecVersion();
       
  3713 	portParamsInputPort.nPortIndex = 0;
       
  3714 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
  3715 			ipCompHandle,
       
  3716 			OMX_IndexParamPortDefinition,
       
  3717 			&portParamsInputPort))
       
  3718 		{
       
  3719 		return StopTest(KErrGeneral, EFail);
       
  3720 		}
       
  3721 	
       
  3722 	//
       
  3723 	// Change the sampling rate on PCM Renderer's port #0
       
  3724 	//
       
  3725 	OMX_AUDIO_PARAM_PCMMODETYPE pcmMode;
       
  3726 	pcmMode.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
       
  3727 	pcmMode.nVersion = TOmxILSpecVersion();
       
  3728 	pcmMode.nPortIndex = 0;
       
  3729 	if (OMX_ErrorNone != ipCompHandle->GetParameter(
       
  3730 			ipCompHandle,
       
  3731 			OMX_IndexParamAudioPcm,
       
  3732 			&pcmMode))
       
  3733 		{
       
  3734 		return StopTest(KErrGeneral, EFail);
       
  3735 		}
       
  3736 	pcmMode.nSamplingRate = 44100;
       
  3737 	if (OMX_ErrorNone != ipCompHandle->SetParameter(
       
  3738 			ipCompHandle,
       
  3739 			OMX_IndexParamAudioPcm,
       
  3740 			&pcmMode))
       
  3741 		{
       
  3742 		return StopTest(KErrGeneral, EFail);
       
  3743 		}
       
  3744 
       
  3745 	//
       
  3746 	// Move component to OMX_StateIdle
       
  3747 	//
       
  3748 
       
  3749 	if (OMX_ErrorNone != ipCompHandle->SendCommand(
       
  3750 			ipCompHandle,
       
  3751 			OMX_CommandStateSet,
       
  3752 			OMX_StateIdle,
       
  3753 			0))
       
  3754 		{
       
  3755 		return StopTest(KErrGeneral, EFail);
       
  3756 		}
       
  3757 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Moving component to OMX_StateIdle"));
       
  3758 
       
  3759 	OMX_STATETYPE compState;
       
  3760 	if (OMX_ErrorNone != ipCompHandle->GetState(ipCompHandle,
       
  3761 												&compState))
       
  3762 		{
       
  3763 		return StopTest(KErrGeneral, EFail);
       
  3764 		}
       
  3765 
       
  3766 	PrintOmxState(compState);
       
  3767 
       
  3768 	if (OMX_StateLoaded != compState)
       
  3769 		{
       
  3770 		return StopTest(KErrGeneral, EFail);
       
  3771 		}
       
  3772 
       
  3773 
       
  3774 	//
       
  3775 	// Allocate buffer on input port
       
  3776 	//
       
  3777 	if (OMX_ErrorNone != ipCompHandle->AllocateBuffer(
       
  3778 			ipCompHandle,
       
  3779 			&ipBufferHeaderInput,
       
  3780 			0, // input port
       
  3781 			0,
       
  3782 			portParamsInputPort.nBufferSize))
       
  3783 		{
       
  3784 		return StopTest(KErrGeneral, EFail);
       
  3785 		}
       
  3786 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Populated buffer (AllocateBuffer) in INPUT port"));
       
  3787 	}
       
  3788 
       
  3789 
       
  3790 //
       
  3791 // RAsyncTestStepOmxILPcmRenderer0030
       
  3792 //
       
  3793 RAsyncTestStepOmxILPcmRenderer0030::RAsyncTestStepOmxILPcmRenderer0030(const TDesC& aTestName, TInt aComponentUid)
       
  3794 	:
       
  3795 	RAsyncTestStepOmxILPcmRenderer0008(aTestName, aComponentUid)
       
  3796 	{
       
  3797     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0030::RAsyncTestStepOmxILPcmRenderer0030"));
       
  3798 	}
       
  3799 
       
  3800 
       
  3801 void
       
  3802 RAsyncTestStepOmxILPcmRenderer0030::KickoffTestL()
       
  3803 	{
       
  3804     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0030::KickoffTestL"));
       
  3805 	iTestState = EStateLoadKickoffTestLComplete;
       
  3806 
       
  3807 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test30 "));
       
  3808 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  3809 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  3810 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Repeat these two steps until the whole file has beeen empited "));
       
  3811 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2a. - Call EmptyThisBuffer on PCM Renderer "));
       
  3812 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2b. - EmptyBufferDone callback received "));
       
  3813 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2c. - Get Bytes Played parameter and compare with the bytes readed from file "));
       
  3814 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Executing->Idle(BufferFlushing) "));
       
  3815 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Idle->Loaded(Depopulation) "));
       
  3816 
       
  3817 	// This will change the test file
       
  3818 	iTestFileName.Set(KPcmRendererTestFile);
       
  3819 	
       
  3820 	// This will install one callback
       
  3821 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  3822 
       
  3823 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0005Step01, this);
       
  3824 	delete ipKickoff01;
       
  3825 	ipKickoff01 = NULL;
       
  3826 	ipKickoff01 =
       
  3827 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  3828 	ipKickoff01->Call();
       
  3829 	}
       
  3830 
       
  3831 void
       
  3832 RAsyncTestStepOmxILPcmRenderer0030::DoEmptyBufferDoneL(OMX_HANDLETYPE /*aComponent*/,
       
  3833 													 OMX_BUFFERHEADERTYPE* /*aBuffer*/)
       
  3834 	{
       
  3835     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0030::DoEmptyBufferDoneL"));
       
  3836 	INFO_PRINTF1(_L("DoEmptyBufferDoneL : Callback received "));
       
  3837 	
       
  3838 	// Check that GetConfig is returning the correct amount of bytes played
       
  3839 	OMX_SYMBIAN_AUDIO_CONFIG_PCM_BYTESPLAYED bytesPlayedStruct;
       
  3840 	bytesPlayedStruct.nSize = sizeof(OMX_SYMBIAN_AUDIO_CONFIG_PCM_BYTESPLAYED);
       
  3841 	bytesPlayedStruct.nVersion = TOmxILSpecVersion();
       
  3842 	if (OMX_ErrorNone != ipCompHandle->GetConfig(ipCompHandle, 
       
  3843 												 static_cast<OMX_INDEXTYPE>(OMX_SymbianIndexConfigAudioBytesPlayed), 
       
  3844 												 &bytesPlayedStruct))
       
  3845 		{
       
  3846 		StopTest(KErrGeneral, EFail);
       
  3847 		}
       
  3848 	//check the number of bytes played by the device corresponds
       
  3849 	//to the number of bytes readed from file
       
  3850 	//allow an extra margin of one buffer.
       
  3851 	TUint maxAllowedBytesPlayed =ipTestFile->GetPos();
       
  3852 	if (bytesPlayedStruct.nBytesPlayed > maxAllowedBytesPlayed)
       
  3853 		{
       
  3854 		StopTest(KErrGeneral, EFail);
       
  3855 		}
       
  3856 	
       
  3857 	CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3858 	ipTestFile->ReadNextBuffer(dataBuffer);
       
  3859 	
       
  3860 	if (dataBuffer.BufferSize() > 0)
       
  3861 		{
       
  3862 		// Send a buffer to the input port
       
  3863 		ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3864 		
       
  3865 		if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3866 				ipCompHandle, ipBufferHeaderInput))
       
  3867 			{
       
  3868 			StopTest(KErrGeneral, EFail);
       
  3869 			}
       
  3870 		}
       
  3871 	else
       
  3872 		{
       
  3873 		TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0005Step03, this);
       
  3874 		delete ipKickoff03;
       
  3875 		ipKickoff03 = NULL;
       
  3876 		ipKickoff03 =
       
  3877 			new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  3878 		ipKickoff03->Call();
       
  3879 		}
       
  3880 	}
       
  3881 
       
  3882 //
       
  3883 // RAsyncTestStepOmxILPcmRenderer0031
       
  3884 //
       
  3885 RAsyncTestStepOmxILPcmRenderer0031::RAsyncTestStepOmxILPcmRenderer0031(const TDesC& aTestName, TInt aComponentUid)
       
  3886 	:
       
  3887 	RAsyncTestStepOmxILPcmRenderer0008(aTestName, aComponentUid)
       
  3888 	{
       
  3889     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0031::RAsyncTestStepOmxILPcmRenderer0031"));
       
  3890     iSamplingRate = 44100;    
       
  3891 	}
       
  3892 
       
  3893 
       
  3894 void
       
  3895 RAsyncTestStepOmxILPcmRenderer0031::KickoffTestL()
       
  3896 	{
       
  3897     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0031::KickoffTestL"));
       
  3898 	iTestState = EStateLoadKickoffTestLComplete;
       
  3899 
       
  3900 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : Test31 "));
       
  3901 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 1.- Loaded->Idle(AllocateBuffer-population) "));
       
  3902 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Idle->Executing "));
       
  3903 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2.- Repeat these two steps until the whole file has beeen empited "));
       
  3904 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2a. - Call EmptyThisBuffer on PCM Renderer "));
       
  3905 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 2b. - EmptyBufferDone callback received "));
       
  3906 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 3.- Set Volume Ramp to 2s (after 5 buffers played) "));
       
  3907 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 4.- Executing->Idle(BufferFlushing) "));
       
  3908 	INFO_PRINTF1(_L("UNIT TEST OMX IL PCM RENDERER : 5.- Idle->Loaded(Depopulation) "));
       
  3909 
       
  3910 	// This will change the test file
       
  3911 	iTestFileName.Set(KPcmRendererTestFile2);
       
  3912 	
       
  3913 	// This will install one callback
       
  3914 	RAsyncTestStepOmxILComponentBase::KickoffTestL();
       
  3915 
       
  3916 	TCallBack callback01 (RAsyncTestStepOmxILPcmRenderer0005Step01, this);
       
  3917 	delete ipKickoff01;
       
  3918 	ipKickoff01 = NULL;
       
  3919 	ipKickoff01 =
       
  3920 		new (ELeave) CAsyncCallBack (callback01, CActive::EPriorityLow);
       
  3921 	ipKickoff01->Call();
       
  3922 	}
       
  3923 
       
  3924 void
       
  3925 RAsyncTestStepOmxILPcmRenderer0031::DoEmptyBufferDoneL(OMX_HANDLETYPE /*aComponent*/,
       
  3926 													 OMX_BUFFERHEADERTYPE* /*aBuffer*/)
       
  3927 	{
       
  3928     DEBUG_PRINTF(_L8("RAsyncTestStepOmxILPcmRenderer0031::DoEmptyBufferDoneL"));
       
  3929 	INFO_PRINTF1(_L("DoEmptyBufferDoneL : Callback received "));
       
  3930 	
       
  3931 	iNumOfEmptiedBuffers++;
       
  3932 	if (iNumOfEmptiedBuffers == 5)
       
  3933 		{
       
  3934 		OMX_SYMBIAN_AUDIO_CONFIG_PCM_VOLUMERAMP volumeRampStruct;
       
  3935 		volumeRampStruct.nSize = sizeof(OMX_SYMBIAN_AUDIO_CONFIG_PCM_VOLUMERAMP);
       
  3936 		volumeRampStruct.nVersion = TOmxILSpecVersion();
       
  3937 		volumeRampStruct.nPortIndex = 0;
       
  3938 		if (OMX_ErrorNone != ipCompHandle->GetConfig(ipCompHandle, 
       
  3939 													 static_cast<OMX_INDEXTYPE>(OMX_SymbianIndexConfigAudioPcmVolumeRamp), 
       
  3940 													 &volumeRampStruct))
       
  3941 			{
       
  3942 			StopTest(KErrGeneral, EFail);
       
  3943 			}
       
  3944 		volumeRampStruct.nRampDuration = 2000000;	// 2 second
       
  3945 		if (OMX_ErrorNone != ipCompHandle->SetConfig(ipCompHandle, 
       
  3946 													 static_cast<OMX_INDEXTYPE>(OMX_SymbianIndexConfigAudioPcmVolumeRamp), 
       
  3947 													 &volumeRampStruct))
       
  3948 			{
       
  3949 			StopTest(KErrGeneral, EFail);
       
  3950 			}
       
  3951 		INFO_PRINTF1(_L("Volume ramp set"));
       
  3952 		}
       
  3953 
       
  3954 	CMMFDataBuffer& dataBuffer = *(static_cast<CMMFDataBuffer*>(ipBufferHeaderInput->pInputPortPrivate));
       
  3955 	ipTestFile->ReadNextBuffer(dataBuffer);
       
  3956 	
       
  3957 	if (dataBuffer.BufferSize() > 0)
       
  3958 		{
       
  3959 		// Send a buffer to the input port
       
  3960 		ipBufferHeaderInput->nFilledLen = dataBuffer.BufferSize();
       
  3961 		
       
  3962 		if (OMX_ErrorNone != ipCompHandle->EmptyThisBuffer(
       
  3963 				ipCompHandle, ipBufferHeaderInput))
       
  3964 			{
       
  3965 			StopTest(KErrGeneral, EFail);
       
  3966 			}
       
  3967 		}
       
  3968 	else
       
  3969 		{
       
  3970 		TCallBack callback03 (RAsyncTestStepOmxILPcmRenderer0005Step03, this);
       
  3971 		delete ipKickoff03;
       
  3972 		ipKickoff03 = NULL;
       
  3973 		ipKickoff03 =
       
  3974 			new (ELeave) CAsyncCallBack (callback03, CActive::EPriorityLow);
       
  3975 		ipKickoff03->Call();
       
  3976 		}
       
  3977 	}