mmlibs/mmfw/tsrc/mmfintegrationtest/Ctlfrm/TSI_MmfCtlfrmNeg.cpp
changeset 0 40261b775718
child 31 ae0addfe117e
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2002-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 // TSIMmfCtlfrmNeg.cpp
       
    15 // Negative integration testing for MMF CTLFRM
       
    16 // 
       
    17 //
       
    18 
       
    19 // EPOC includes
       
    20 #include <e32base.h>
       
    21 
       
    22 // Test system includes
       
    23 #include <testframework.h>
       
    24 #include "TSI_MmfCtlfrmNeg.h"
       
    25 #include "TSI_MmfCtlfrmStep.h"
       
    26 #include "TSI_MmfCtlfrmSuite.h"
       
    27 #include "TSI_MmfCodes.h"
       
    28 #include "TSI_MmfEventIds.h"
       
    29 #include "ActrlTestUids.h"
       
    30 
       
    31 #include <mmf/common/mmfcontroller.h>
       
    32 #include <mmf/plugin/mmfcontrollerimplementationuids.hrh>
       
    33 
       
    34 //const TUid KTestControllerUid = {KTSIMmfControllerUid};	// EABI warning removal
       
    35 //const TUid KTestController2Uid = {KTSIMmfController2Uid};	// EABI warning removal
       
    36 const TUid KTestDataSourceUid = {KTSIMmfDataSourceUid};
       
    37 //const TUid KTestDataSinkUid   = {KTSIMmfDataSinkUid};		// EABI warning removal
       
    38 
       
    39 // audio controller, from mmfControllerImplementationUIDs.hrh
       
    40 //const TUid KTestAudioControllerUid = {KMmfUidControllerAudio};	// EABI warning removal
       
    41 // ---------------------------
       
    42 // RTestMmfCtlfrmI0502
       
    43 //
       
    44 // Load controller plugin for unsupported file format
       
    45 //
       
    46 // REQ172.5.3
       
    47 
       
    48 RTestMmfCtlfrmI0502* RTestMmfCtlfrmI0502::NewL()
       
    49 	{
       
    50 	RTestMmfCtlfrmI0502* self = new(ELeave) RTestMmfCtlfrmI0502;
       
    51 	return self;
       
    52 	}
       
    53 
       
    54 RTestMmfCtlfrmI0502::RTestMmfCtlfrmI0502()
       
    55 	{
       
    56 	iTestStepName = _L("MM-MMF-CTLFRM-I-0502");
       
    57 	}
       
    58 
       
    59 
       
    60 TVerdict RTestMmfCtlfrmI0502::DoTestStepL()
       
    61 	{
       
    62 	INFO_PRINTF1(_L("open controller by unsupported extension"));
       
    63 
       
    64 //  TO DO 
       
    65 //  This test needs to be looked at to clarify if we need TMMFPrioritySettings 
       
    66 //
       
    67 //	TMMFPrioritySettings settings;					
       
    68 
       
    69 //	settings.iPriority = ETSIMmfPriorityLow;
       
    70 //	settings.iPref = EMdaPriorityPreferenceTime;
       
    71 //	settings.iState = EMMFStateIdle;
       
    72 
       
    73 	CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
       
    74 	CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
       
    75 
       
    76 	// Set the format match data
       
    77 	fSelect->SetMatchToFileNameL(_L("test.xls"));
       
    78 	// Set the controller plugin play format match data
       
    79 	cSelect->SetRequiredPlayFormatSupportL(*fSelect); 
       
    80 
       
    81 	RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
       
    82 	CleanupResetAndDestroyPushL(controllers);
       
    83 	cSelect->ListImplementationsL(controllers);  // Populates the array with all the suitable controllers
       
    84 	TInt numControllers = controllers.Count();
       
    85 	if(numControllers)
       
    86 		{
       
    87 		ERR_PRINTF1(_L("Error : found a suitable controller"));
       
    88 		CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
       
    89 		return iTestStepResult = EFail;
       
    90 		}
       
    91 
       
    92 	INFO_PRINTF1(_L("Success : found no suitable controllers"));
       
    93 	CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
       
    94 	return iTestStepResult = EPass;
       
    95 	}
       
    96 
       
    97 // ---------------------------
       
    98 // RTestMmfCtlfrmI0504
       
    99 //
       
   100 // Load a controller by preferred supplier where only compatible controller
       
   101 // available is from a rival
       
   102 //
       
   103 // REQ172.5.5.1
       
   104 
       
   105 RTestMmfCtlfrmI0504* RTestMmfCtlfrmI0504::NewL()
       
   106 	{
       
   107 	RTestMmfCtlfrmI0504* self = new(ELeave) RTestMmfCtlfrmI0504;
       
   108 	return self;
       
   109 	}
       
   110 
       
   111 RTestMmfCtlfrmI0504::RTestMmfCtlfrmI0504()
       
   112 	{
       
   113 	iTestStepName = _L("MM-MMF-CTLFRM-I-0504");
       
   114 	}
       
   115 
       
   116 
       
   117 TVerdict RTestMmfCtlfrmI0504::DoTestStepL()
       
   118 	{
       
   119 	// try to open a controller by preferred supplier
       
   120 	// where only a rival's is available
       
   121 
       
   122 	INFO_PRINTF1(_L("open controller by preferred supplier"));
       
   123 
       
   124 	CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
       
   125 	CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
       
   126 
       
   127 	// Set the format match data
       
   128 	fSelect->SetMatchToFileNameL(_L("test.wav"));
       
   129 	// Set the controller plugin play format match data
       
   130 	cSelect->SetRequiredPlayFormatSupportL(*fSelect); 
       
   131 
       
   132 	// Set for only those plugins supplied by "ACME Industries"
       
   133 	_LIT(KPrefSupplierAcme, "ACME Industries");
       
   134 	cSelect->SetPreferredSupplierL(KPrefSupplierAcme, CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned);
       
   135 
       
   136 	RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
       
   137 	CleanupResetAndDestroyPushL(controllers);
       
   138 	cSelect->ListImplementationsL(controllers);  // Populates the array with all the suitable controllers
       
   139 	TInt numControllers = controllers.Count();
       
   140 	if(numControllers)
       
   141 		{
       
   142 		ERR_PRINTF1(_L("Error : found a suitable controller"));
       
   143 		CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
       
   144 		return iTestStepResult = EFail;
       
   145 		}
       
   146 
       
   147 	INFO_PRINTF1(_L("Success : found no suitable controllers"));
       
   148 	CleanupStack::PopAndDestroy(3);//controllers, fSelect, cSelect
       
   149 	return iTestStepResult = EPass;
       
   150 	}
       
   151 
       
   152 // ---------------------------
       
   153 // RTestMmfCtlfrmI0511
       
   154 //
       
   155 // Add a data source to a controller which does not support dynamic addition of sources / sinks
       
   156 //
       
   157 // REQ172.5.5.1
       
   158 
       
   159 RTestMmfCtlfrmI0511* RTestMmfCtlfrmI0511::NewL()
       
   160 	{
       
   161 	RTestMmfCtlfrmI0511* self = new(ELeave) RTestMmfCtlfrmI0511;
       
   162 	return self;
       
   163 	}
       
   164 
       
   165 RTestMmfCtlfrmI0511::RTestMmfCtlfrmI0511()
       
   166 	{
       
   167 	iTestStepName = _L("MM-MMF-CTLFRM-I-0511");
       
   168 	}
       
   169 
       
   170 
       
   171 TVerdict RTestMmfCtlfrmI0511::DoTestStepL()
       
   172 	{
       
   173 	INFO_PRINTF1(_L("add data source where not supported"));
       
   174 
       
   175 	// TSI_MmfController2 does not support adding source / sink
       
   176 
       
   177 
       
   178 	// first : add a data source without a handle
       
   179 	_LIT8(KInitData,"TEST");
       
   180 
       
   181 	TInt error = KErrNone;
       
   182 	error = iController.AddDataSource(KTestDataSourceUid, KInitData);
       
   183 	if (!error)
       
   184 		{
       
   185 		ERR_PRINTF1(_L("Error : AddDataSource succeeded"));
       
   186 		return iTestStepResult = EFail;
       
   187 		}
       
   188 	else if (error != KErrNotSupported)
       
   189 		{
       
   190 		ERR_PRINTF2(_L("AddDataSource failed with unexpected error %d"), error);
       
   191 		return iTestStepResult = EFail;
       
   192 		}
       
   193 
       
   194 	INFO_PRINTF1(_L("AddDataSource failed, error KErrNotSupported"));
       
   195 
       
   196 	// next : add a data source with a handle
       
   197 	TMMFMessageDestination* sourceHandlePtr = new (ELeave) TMMFMessageDestination();
       
   198 	TMMFMessageDestination& sourceHandle = *sourceHandlePtr;
       
   199 	error = iController.AddDataSource(KTestDataSourceUid, KInitData, sourceHandle);
       
   200 	if (!error)
       
   201 		{
       
   202 		ERR_PRINTF1(_L("Error : AddDataSource (with handle) succeeded"));
       
   203 		delete sourceHandlePtr;
       
   204 		return iTestStepResult = EFail;
       
   205 		}
       
   206 	else if (error != KErrNotSupported)
       
   207 		{
       
   208 		ERR_PRINTF2(_L("AddDataSource (with handle) failed with unexpected error %d"), error);
       
   209 		delete sourceHandlePtr;
       
   210 		return iTestStepResult = EFail;
       
   211 		}
       
   212 
       
   213 	INFO_PRINTF1(_L("AddDataSource (with handle) failed, error KErrNotSupported"));
       
   214 	delete sourceHandlePtr;
       
   215 	return iTestStepResult = EPass;
       
   216 	}
       
   217 
       
   218 // ---------------------------
       
   219 // RTestMmfCtlfrmI0512
       
   220 //
       
   221 // Add a data source which has already been added to a controller
       
   222 //
       
   223 // REQ172.5.5.1
       
   224 
       
   225 RTestMmfCtlfrmI0512* RTestMmfCtlfrmI0512::NewL()
       
   226 	{
       
   227 	RTestMmfCtlfrmI0512* self = new(ELeave) RTestMmfCtlfrmI0512;
       
   228 	return self;
       
   229 	}
       
   230 
       
   231 RTestMmfCtlfrmI0512::RTestMmfCtlfrmI0512()
       
   232 	{
       
   233 	iTestStepName = _L("MM-MMF-CTLFRM-I-0512");
       
   234 	}
       
   235 
       
   236 
       
   237 TVerdict RTestMmfCtlfrmI0512::DoTestStepL()
       
   238 	{
       
   239 	INFO_PRINTF1(_L("add data source where already added"));
       
   240 	TInt error = KErrNone;
       
   241 
       
   242 	// this source already exists in the controller
       
   243 	_LIT(KTestWavFile, "c:\\TsiMmfCtlfrmData\\test.wav");
       
   244 	iFileConfig().iPath = KTestWavFile;
       
   245 	error = iController.AddDataSource(KUidMmfFileSource, iFileConfig);
       
   246 	if (!error)
       
   247 		{
       
   248 		ERR_PRINTF1(_L("Error : AddDataSource succeeded"));
       
   249 		return iTestStepResult = EFail;
       
   250 		}
       
   251 	else if (error != KErrAlreadyExists)
       
   252 		{
       
   253 		ERR_PRINTF2(_L("AddDataSource failed with unexpected error %d"), error);
       
   254 		return iTestStepResult = EFail;
       
   255 		}
       
   256 
       
   257 	INFO_PRINTF1(_L("AddDataSource failed, error KErrAlreadyExists"));
       
   258 	return iTestStepResult = EPass;
       
   259 	}
       
   260 
       
   261 // ---------------------------
       
   262 // RTestMmfCtlfrmI0513
       
   263 //
       
   264 // Remove a source or sink which is currently in use (track playing)
       
   265 //
       
   266 // REQ172.5.5.1
       
   267 
       
   268 RTestMmfCtlfrmI0513* RTestMmfCtlfrmI0513::NewL()
       
   269 	{
       
   270 	RTestMmfCtlfrmI0513* self = new(ELeave) RTestMmfCtlfrmI0513;
       
   271 	return self;
       
   272 	}
       
   273 
       
   274 RTestMmfCtlfrmI0513::RTestMmfCtlfrmI0513()
       
   275 	{
       
   276 	iTestStepName = _L("MM-MMF-CTLFRM-I-0513");
       
   277 	}
       
   278 
       
   279 TVerdict RTestMmfCtlfrmI0513::DoTestStepL()
       
   280 	{
       
   281 	// *** TODO : we may have problems here. the only controller we have is the
       
   282 	// Audio Controller and this does not yet support removal of sources/sinks,
       
   283 	// whether it's playing or not...
       
   284 
       
   285 	INFO_PRINTF1(_L("remove a source / sink when track playing"));
       
   286 
       
   287 	TInt error = KErrNone;
       
   288 
       
   289 	// set it playing
       
   290  	error = iController.Play();
       
   291 	if(error)
       
   292 		{
       
   293 		ERR_PRINTF2(_L("Play failed, error %d"), error);
       
   294 		return iTestStepResult = EInconclusive;
       
   295 		}
       
   296 	
       
   297 	// wait a little
       
   298 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
   299 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   300 	User::After(KPlayPosition32);
       
   301 
       
   302 	// try and remove the data source
       
   303 	TMMFMessageDestination& sourceHandle = *iSourceHandlePtr;
       
   304 	error = iController.RemoveDataSource(sourceHandle);
       
   305 	if (error != KErrNotReady)
       
   306 		{
       
   307 		ERR_PRINTF2(_L("Error : RemoveDataSource returned error %d"), error);
       
   308 		return iTestStepResult = EFail;
       
   309 		}
       
   310 
       
   311 	INFO_PRINTF1(_L("RemoveDataSource returned KErrNotReady"));
       
   312 	return iTestStepResult = EPass;
       
   313 	}
       
   314 
       
   315 // ---------------------------
       
   316 // RTestMmfCtlfrmI0514
       
   317 //
       
   318 // Remove a source or sink which is not present in controller
       
   319 //
       
   320 // REQ172.5.5.2
       
   321 
       
   322 RTestMmfCtlfrmI0514* RTestMmfCtlfrmI0514::NewL()
       
   323 	{
       
   324 	RTestMmfCtlfrmI0514* self = new(ELeave) RTestMmfCtlfrmI0514;
       
   325 	return self;
       
   326 	}
       
   327 
       
   328 RTestMmfCtlfrmI0514::RTestMmfCtlfrmI0514()
       
   329 	{
       
   330 	iTestStepName = _L("MM-MMF-CTLFRM-I-0514");
       
   331 	}
       
   332 
       
   333 
       
   334 TVerdict RTestMmfCtlfrmI0514::DoTestStepL()
       
   335 	{
       
   336 	INFO_PRINTF1(_L("remove a nonexistent source / sink"));
       
   337 
       
   338 	TInt error = KErrNone;
       
   339 
       
   340 	// reset will remove the sources/sinks we added in the preamble
       
   341 	error = iController.Reset();
       
   342 	if(error)
       
   343 		{
       
   344 		ERR_PRINTF2(_L("Error : Reset failed, error %d"), error);	
       
   345 		return iTestStepResult = EFail;
       
   346 		}
       
   347 
       
   348 	// try and remove the data source
       
   349 	TMMFMessageDestination& sourceHandle = *iSourceHandlePtr;
       
   350 	error = iController.RemoveDataSource(sourceHandle);
       
   351 	if (!error)
       
   352 		{
       
   353 		ERR_PRINTF1(_L("Error : RemoveDataSource succeeded"));
       
   354 		return iTestStepResult = EInconclusive;
       
   355 		}
       
   356 	else if (error != KErrNotFound)
       
   357 		{
       
   358 		ERR_PRINTF2(_L("RemoveDataSource failed with unexpected error %d"), error);
       
   359 		return iTestStepResult = EInconclusive;
       
   360 		}
       
   361 
       
   362 	INFO_PRINTF1(_L("RemoveDataSource failed with error KErrNotFound"));
       
   363 	return iTestStepResult = EPass;
       
   364 	}
       
   365 
       
   366 // ---------------------------
       
   367 // RTestMmfCtlfrmI0515
       
   368 //
       
   369 // Add a data source by UID, but with source info incompatible with the plugin
       
   370 //
       
   371 // REQ172.5.5.2
       
   372 
       
   373 RTestMmfCtlfrmI0515* RTestMmfCtlfrmI0515::NewL()
       
   374 	{
       
   375 	RTestMmfCtlfrmI0515* self = new(ELeave) RTestMmfCtlfrmI0515;
       
   376 	return self;
       
   377 	}
       
   378 
       
   379 RTestMmfCtlfrmI0515::RTestMmfCtlfrmI0515()
       
   380 	{
       
   381 	iTestStepName = _L("MM-MMF-CTLFRM-I-0515");
       
   382 	}
       
   383 
       
   384 TVerdict RTestMmfCtlfrmI0515::OpenL()
       
   385 	{
       
   386 	return iTestStepResult = EPass;
       
   387 	// so we don't run the parent preamble
       
   388 	}
       
   389 
       
   390 void RTestMmfCtlfrmI0515::Close()
       
   391 	{
       
   392 	// so we don't run the parent postamble
       
   393 	}
       
   394 
       
   395 TVerdict RTestMmfCtlfrmI0515::DoTestStepL()
       
   396 	{
       
   397 	// NB : this test is no longer valid - see DEF001550 in TeamTrack.
       
   398 
       
   399 	// Reject Report :
       
   400 	// This is 'as designed' behaviour. The CMMFAudioController::AddDataSourceL function traps 
       
   401 	// the call to CMMFFormatDecode::NewL, which leaves in this instance with error KErrNotSupported.
       
   402 	// However it completes silently if KErrNotSupported is the error (see the comment on line 182
       
   403 	// of MmfAudioController.cpp) 
       
   404 
       
   405 	INFO_PRINTF1(_L("add incompatible data source by UID"));
       
   406 	INFO_PRINTF1(_L("test no longer valid - see DEF001550 in TeamTrack"));
       
   407 /*
       
   408 	TInt error = KErrNone;
       
   409 
       
   410 	iSettings.iPriority = ETSIMmfPriorityHigh;
       
   411 	iSettings.iPref = EMdaPriorityPreferenceQuality;
       
   412 	iSettings.iState = EMMFStateIdle;
       
   413 
       
   414 	// Open a controller
       
   415 	error = iController.Open(KTestAudioControllerUid, iSettings);
       
   416 	if (error)
       
   417 		{
       
   418 		ERR_PRINTF2(_L("controller failed to open, error %d"), error);
       
   419 		return iTestStepResult = EInconclusive;
       
   420 		}
       
   421 
       
   422 	// Attempt to add an incompatible source and sink
       
   423 	_LIT(KTestXlsFile, "c:\\TsiMmfCtlfrmData\\test.xls");
       
   424 	iFileConfig().iPath = KTestXlsFile;
       
   425 	error = iController.AddDataSource(KUidMmfFileSource, iFileConfig);
       
   426 	if (!error)
       
   427 		{
       
   428 		ERR_PRINTF1(_L("Error : AddDataSource succeeded"));
       
   429 		return iTestStepResult = EFail;
       
   430 		}
       
   431 	else if (error != KErrNotSupported)
       
   432 		{
       
   433 		ERR_PRINTF2(_L("AddDataSource failed with unexpected error %d"), error);
       
   434 		return iTestStepResult = EFail;
       
   435 		}
       
   436 
       
   437 	INFO_PRINTF1(_L("AddDataSource failed, error KErrNotSupported"));
       
   438 
       
   439 	error = iController.AddDataSink(KUidMmfFileSource, iFileConfig);
       
   440 	if (!error)
       
   441 		{
       
   442 		ERR_PRINTF1(_L("Error : AddDataSink succeeded"));
       
   443 		return iTestStepResult = EFail;
       
   444 		}
       
   445 	else if (error != KErrNotSupported)
       
   446 		{
       
   447 		ERR_PRINTF2(_L("AddDataSink failed with unexpected error %d"), error);
       
   448 		return iTestStepResult = EFail;
       
   449 		}
       
   450 
       
   451 	INFO_PRINTF1(_L("AddDataSink failed, error KErrNotSupported"));
       
   452 */
       
   453 	return iTestStepResult = EPass;
       
   454 	}
       
   455 
       
   456 // ---------------------------
       
   457 // RTestMmfCtlfrmI0521
       
   458 //
       
   459 // Play an unprimed controller
       
   460 //
       
   461 // REQ172.5.5.6
       
   462 
       
   463 RTestMmfCtlfrmI0521* RTestMmfCtlfrmI0521::NewL()
       
   464 	{
       
   465 	RTestMmfCtlfrmI0521* self = new(ELeave) RTestMmfCtlfrmI0521;
       
   466 	return self;
       
   467 	}
       
   468 
       
   469 RTestMmfCtlfrmI0521::RTestMmfCtlfrmI0521()
       
   470 	{
       
   471 	iTestStepName = _L("MM-MMF-CTLFRM-I-0521");
       
   472 	}
       
   473 
       
   474 
       
   475 TVerdict RTestMmfCtlfrmI0521::DoTestStepL()
       
   476 	{
       
   477 	INFO_PRINTF1(_L("play an unprimed controller"));
       
   478 	TInt error = KErrNone;
       
   479 
       
   480 	// controller is fully setup in the preamble, but not primed
       
   481 	// try to set it playing
       
   482  	error = iController.Play();
       
   483 	if(error != KErrNotReady)
       
   484 		{
       
   485 		ERR_PRINTF2(_L("Error : play returned error %d"), error);
       
   486 		return iTestStepResult = EFail;
       
   487 		}
       
   488 	INFO_PRINTF1(_L("Play failed with error KErrNotReady"));
       
   489 	return iTestStepResult = EPass;
       
   490 	}
       
   491 
       
   492 // ---------------------------
       
   493 // RTestMmfCtlfrmI0522
       
   494 //
       
   495 // Prime a controller which is already primed
       
   496 //
       
   497 // REQ172.5.5.6
       
   498 
       
   499 RTestMmfCtlfrmI0522* RTestMmfCtlfrmI0522::NewL()
       
   500 	{
       
   501 	RTestMmfCtlfrmI0522* self = new(ELeave) RTestMmfCtlfrmI0522;
       
   502 	return self;
       
   503 	}
       
   504 
       
   505 RTestMmfCtlfrmI0522::RTestMmfCtlfrmI0522()
       
   506 	{
       
   507 	iTestStepName = _L("MM-MMF-CTLFRM-I-0522");
       
   508 	}
       
   509 
       
   510 
       
   511 TVerdict RTestMmfCtlfrmI0522::DoTestStepL()
       
   512 	{
       
   513 	INFO_PRINTF1(_L("prime an already primed controller"));
       
   514 	TInt error = KErrNone;
       
   515 
       
   516 	// controller is fully setup in the preamble, but not primed
       
   517 	// prime it, then prime it again
       
   518  	error = iController.Prime();
       
   519 	if(error)
       
   520 		{
       
   521 		ERR_PRINTF2(_L("Error : first prime returned error %d"), error);
       
   522 		return iTestStepResult = EInconclusive;
       
   523 		}
       
   524 
       
   525 	// wait a while, to give it chance to prime
       
   526 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
   527 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   528 	User::After(KPlayPosition32);
       
   529 
       
   530 	// prime a second time. this should succeed (KErrNone)
       
   531 	// (defined in Audio Controller)
       
   532  	error = iController.Prime();
       
   533 	if(error)
       
   534 		{
       
   535 		ERR_PRINTF2(_L("Error : second prime returned error %d"), error);
       
   536 		return iTestStepResult = EFail;
       
   537 		}
       
   538 	INFO_PRINTF1(_L("Second prime returned success"));
       
   539 
       
   540 	return iTestStepResult = EPass;
       
   541 	}
       
   542 
       
   543 // ---------------------------
       
   544 // RTestMmfCtlfrmI0523
       
   545 //
       
   546 // Play a controller where there is no defined source
       
   547 //
       
   548 // REQ172.5.5.6
       
   549 
       
   550 RTestMmfCtlfrmI0523* RTestMmfCtlfrmI0523::NewL()
       
   551 	{
       
   552 	RTestMmfCtlfrmI0523* self = new(ELeave) RTestMmfCtlfrmI0523;
       
   553 	return self;
       
   554 	}
       
   555 
       
   556 RTestMmfCtlfrmI0523::RTestMmfCtlfrmI0523()
       
   557 	{
       
   558 	iTestStepName = _L("MM-MMF-CTLFRM-I-0523");
       
   559 	}
       
   560 
       
   561 TVerdict RTestMmfCtlfrmI0523::DoTestStepL()
       
   562 	{
       
   563 	INFO_PRINTF1(_L("play a controller with no defined source"));
       
   564 	TInt error = KErrNone;
       
   565 
       
   566 	// controller is setup in the preamble, but has no source
       
   567 	// try to set it playing
       
   568  	error = iController.Play();
       
   569 	if(error != KErrNotReady)
       
   570 		{
       
   571 		ERR_PRINTF2(_L("Error : play returned error %d"), error);
       
   572 		return iTestStepResult = EFail;
       
   573 		}
       
   574 	INFO_PRINTF1(_L("Play failed with error KErrNotReady"));
       
   575 	return iTestStepResult = EPass;
       
   576 	}
       
   577 
       
   578 // ---------------------------
       
   579 // RTestMmfCtlfrmI0524
       
   580 //
       
   581 // Play a controller which is already playing
       
   582 //
       
   583 // REQ172.5.5.6
       
   584 
       
   585 RTestMmfCtlfrmI0524* RTestMmfCtlfrmI0524::NewL()
       
   586 	{
       
   587 	RTestMmfCtlfrmI0524* self = new(ELeave) RTestMmfCtlfrmI0524;
       
   588 	return self;
       
   589 	}
       
   590 
       
   591 RTestMmfCtlfrmI0524::RTestMmfCtlfrmI0524()
       
   592 	{
       
   593 	iTestStepName = _L("MM-MMF-CTLFRM-I-0524");
       
   594 	}
       
   595 
       
   596 
       
   597 TVerdict RTestMmfCtlfrmI0524::DoTestStepL()
       
   598 	{
       
   599 	INFO_PRINTF1(_L("play a controller which is already playing"));
       
   600 	TInt error = KErrNone;
       
   601 
       
   602 	// controller is fully setup in the preamble, and primed
       
   603 	// set it playing
       
   604  	error = iController.Play();
       
   605 	if(error)
       
   606 		{
       
   607 		ERR_PRINTF2(_L("Error : play returned error %d"), error);
       
   608 		return iTestStepResult = EInconclusive;
       
   609 		}
       
   610 
       
   611 	// wait a while, to give it chance to start playing
       
   612 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
   613 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   614 	User::After(KPlayPosition32);
       
   615 
       
   616 	// do it again :- should return KErrNotReady (this is defined in the
       
   617 	// Audio Controller)
       
   618  	error = iController.Play();
       
   619 	if(error != KErrNotReady)
       
   620 		{
       
   621 		ERR_PRINTF2(_L("Error : second play returned error %d"), error);
       
   622 		return iTestStepResult = EFail;
       
   623 		}
       
   624 
       
   625 	INFO_PRINTF1(_L("Second play returned KErrNotReady"));
       
   626 	return iTestStepResult = EPass;
       
   627 	}
       
   628 
       
   629 // ---------------------------
       
   630 // RTestMmfCtlfrmI0525
       
   631 //
       
   632 // Stop a controller which is not playing
       
   633 //
       
   634 // REQ172.5.5.7
       
   635 
       
   636 RTestMmfCtlfrmI0525* RTestMmfCtlfrmI0525::NewL()
       
   637 	{
       
   638 	RTestMmfCtlfrmI0525* self = new(ELeave) RTestMmfCtlfrmI0525;
       
   639 	return self;
       
   640 	}
       
   641 
       
   642 RTestMmfCtlfrmI0525::RTestMmfCtlfrmI0525()
       
   643 	{
       
   644 	iTestStepName = _L("MM-MMF-CTLFRM-I-0525");
       
   645 	}
       
   646 
       
   647 
       
   648 TVerdict RTestMmfCtlfrmI0525::DoTestStepL()
       
   649 	{
       
   650 	INFO_PRINTF1(_L("stop a controller which is not playing"));
       
   651 	TInt error = KErrNone;
       
   652 
       
   653 	// controller is fully setup in the preamble, and primed
       
   654 	// play it, stop, try and stop again
       
   655  	error = iController.Play();
       
   656 	if(error)
       
   657 		{
       
   658 		ERR_PRINTF2(_L("Error : play returned error %d"), error);
       
   659 		return iTestStepResult = EInconclusive;
       
   660 		}
       
   661 	// wait a while, to give it chance to start playing
       
   662 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
   663 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   664 	User::After(KPlayPosition32);
       
   665 	// stop it
       
   666 	error = iController.Stop();
       
   667 	if(error)
       
   668 		{
       
   669 		ERR_PRINTF2(_L("Error : stop returned error %d"), error);
       
   670 		return iTestStepResult = EInconclusive;
       
   671 		}
       
   672 
       
   673 	// wait a while, to give it chance to stop
       
   674 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   675 	User::After(KPlayPosition32);
       
   676 
       
   677 	// now try and stop it a second time - should return KErrNone
       
   678 	// (this is defined in Audio Controller)
       
   679 	error = iController.Stop();
       
   680 	if(error)
       
   681 		{
       
   682 		ERR_PRINTF2(_L("Error : stop returned error %d"), error);
       
   683 		return iTestStepResult = EFail;
       
   684 		}
       
   685 	INFO_PRINTF1(_L("Stop returned KErrNone"));
       
   686 
       
   687 	return iTestStepResult = EPass;
       
   688 	}
       
   689 
       
   690 // ---------------------------
       
   691 // RTestMmfCtlfrmI0526
       
   692 //
       
   693 // Stop a controller where there is no defined source
       
   694 //
       
   695 // REQ172.5.5.7
       
   696 
       
   697 RTestMmfCtlfrmI0526* RTestMmfCtlfrmI0526::NewL()
       
   698 	{
       
   699 	RTestMmfCtlfrmI0526* self = new(ELeave) RTestMmfCtlfrmI0526;
       
   700 	return self;
       
   701 	}
       
   702 
       
   703 RTestMmfCtlfrmI0526::RTestMmfCtlfrmI0526()
       
   704 	{
       
   705 	iTestStepName = _L("MM-MMF-CTLFRM-I-0526");
       
   706 	}
       
   707 
       
   708 
       
   709 TVerdict RTestMmfCtlfrmI0526::DoTestStepL()
       
   710 	{
       
   711 	INFO_PRINTF1(_L("stop a controller with no defined source"));
       
   712 	TInt error = KErrNone;
       
   713 
       
   714 	// controller is setup in the preamble, but has no source
       
   715 	// try to stop it
       
   716  	error = iController.Stop();
       
   717 	if(error)
       
   718 		{
       
   719 		ERR_PRINTF2(_L("Error : stop returned error %d"), error);
       
   720 		return iTestStepResult = EFail;
       
   721 		}
       
   722 	INFO_PRINTF1(_L("Stop returned KErrNone"));
       
   723 	return iTestStepResult = EPass;
       
   724 	}
       
   725 
       
   726 // ---------------------------
       
   727 // RTestMmfCtlfrmI0527
       
   728 //
       
   729 // Pause a controller which is stopped
       
   730 //
       
   731 // REQ172.5.5.8
       
   732 
       
   733 RTestMmfCtlfrmI0527* RTestMmfCtlfrmI0527::NewL()
       
   734 	{
       
   735 	RTestMmfCtlfrmI0527* self = new(ELeave) RTestMmfCtlfrmI0527;
       
   736 	return self;
       
   737 	}
       
   738 
       
   739 RTestMmfCtlfrmI0527::RTestMmfCtlfrmI0527()
       
   740 	{
       
   741 	iTestStepName = _L("MM-MMF-CTLFRM-I-0527");
       
   742 	}
       
   743 
       
   744 
       
   745 TVerdict RTestMmfCtlfrmI0527::DoTestStepL()
       
   746 	{
       
   747 	INFO_PRINTF1(_L("pause a controller which is stopped"));
       
   748 	TInt error = KErrNone;
       
   749 
       
   750 	// controller is fully setup in the preamble, and primed
       
   751 	// play it, stop, try and pause
       
   752  	error = iController.Play();
       
   753 	if(error)
       
   754 		{
       
   755 		ERR_PRINTF2(_L("Error : play returned error %d"), error);
       
   756 		return iTestStepResult = EInconclusive;
       
   757 		}
       
   758 	// wait a while, to give it chance to start playing
       
   759 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
   760 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   761 	User::After(KPlayPosition32);
       
   762 	// stop it
       
   763 	error = iController.Stop();
       
   764 	if(error)
       
   765 		{
       
   766 		ERR_PRINTF2(_L("Error : stop returned error %d"), error);
       
   767 		return iTestStepResult = EInconclusive;
       
   768 		}
       
   769 	// wait a while, to give it chance to stop
       
   770 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   771 	User::After(KPlayPosition32);
       
   772 
       
   773 	// now try and pause. this should return KErrNotReady
       
   774 	error = iController.Pause();
       
   775 	if(error != KErrNotReady)
       
   776 		{
       
   777 		ERR_PRINTF2(_L("Error : pause returned error %d"), error);
       
   778 		return iTestStepResult = EFail;
       
   779 		}
       
   780 	INFO_PRINTF1(_L("Pause returned KErrNotReady"));
       
   781 
       
   782 	return iTestStepResult = EPass;
       
   783 	}
       
   784 
       
   785 // ---------------------------
       
   786 // RTestMmfCtlfrmI0531
       
   787 //
       
   788 // Assign a priority to a controller where it is the only controller loaded
       
   789 //
       
   790 // REQ172.5.5.9
       
   791 
       
   792 RTestMmfCtlfrmI0531* RTestMmfCtlfrmI0531::NewL()
       
   793 	{
       
   794 	RTestMmfCtlfrmI0531* self = new(ELeave) RTestMmfCtlfrmI0531;
       
   795 	return self;
       
   796 	}
       
   797 
       
   798 RTestMmfCtlfrmI0531::RTestMmfCtlfrmI0531()
       
   799 	{
       
   800 	iTestStepName = _L("MM-MMF-CTLFRM-I-0531");
       
   801 	}
       
   802 
       
   803 TVerdict RTestMmfCtlfrmI0531::DoTestStepL()
       
   804 	{
       
   805 	INFO_PRINTF1(_L("Assign priority to lone controller"));
       
   806 	TInt error = KErrNone;
       
   807 
       
   808 	// this will succeed - priorities are relative, not absolute
       
   809 	iSettings.iPriority = ETSIMmfPriorityLow;
       
   810 	iSettings.iPref = EMdaPriorityPreferenceTime;
       
   811 	iSettings.iState = EMMFStateIdle;
       
   812 
       
   813 	// NB controller should be Stopped (not Primed) to do this)
       
   814 	error = iController.SetPrioritySettings(iSettings);
       
   815 	if(error)
       
   816 		{
       
   817 		ERR_PRINTF2(_L("Error : SetPrioritySettings returned %d"), error);	
       
   818 		return iTestStepResult = EFail;
       
   819 		}
       
   820 
       
   821 	INFO_PRINTF1(_L("SetPrioritySettings succeeded"));
       
   822 
       
   823 	return iTestStepResult = EPass;
       
   824 	}
       
   825 
       
   826 // ---------------------------
       
   827 // RTestMmfCtlfrmI0532
       
   828 //
       
   829 // Assign identical or conflicting priorities to two controllers
       
   830 //
       
   831 // REQ172.5.5.9
       
   832 
       
   833 RTestMmfCtlfrmI0532* RTestMmfCtlfrmI0532::NewL()
       
   834 	{
       
   835 	RTestMmfCtlfrmI0532* self = new(ELeave) RTestMmfCtlfrmI0532;
       
   836 	return self;
       
   837 	}
       
   838 
       
   839 RTestMmfCtlfrmI0532::RTestMmfCtlfrmI0532()
       
   840 	{
       
   841 	iTestStepName = _L("MM-MMF-CTLFRM-I-0532");
       
   842 	}
       
   843 
       
   844 TVerdict RTestMmfCtlfrmI0532::DoTestStepL()
       
   845 	{
       
   846 	INFO_PRINTF1(_L("Assign identical priority to two controllers"));
       
   847 	TInt error = KErrNone;
       
   848 
       
   849 	// NB : the preamble for this class sets the controllers with identical settings
       
   850 	// including priority
       
   851 
       
   852 	// prime them
       
   853 	error = iController1.Prime();
       
   854 	if(error)
       
   855 		{
       
   856 		ERR_PRINTF2(_L("controller1 prime failed, error %d"), error);
       
   857 		return iTestStepResult = EInconclusive;
       
   858 		}
       
   859 	error = iController2.Prime();
       
   860 	if(error)
       
   861 		{
       
   862 		ERR_PRINTF2(_L("controller2 prime failed, error %d"), error);
       
   863 		return iTestStepResult = EInconclusive;
       
   864 		}
       
   865 
       
   866 	// at last we are ready to do the test...
       
   867 	// play both controllers. give the first time to start before playing the second.
       
   868 	// we should get an error.
       
   869 	error = iController1.Play();
       
   870 	if(error)
       
   871 		{
       
   872 		ERR_PRINTF2(_L("iController1 play failed, error %d"), error);
       
   873 		return iTestStepResult = EInconclusive;
       
   874 		}
       
   875 	// wait a while, to give it chance to play
       
   876 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
   877 	INFO_PRINTF2(_L("Waiting %d mcs..."), KPlayPosition32.Int());
       
   878 	User::After(KPlayPosition32);
       
   879 	error = iController2.Play();
       
   880 	if(error)
       
   881 		{
       
   882 		ERR_PRINTF2(_L("iController2 play failed, error %d"), error);
       
   883 		return iTestStepResult = EInconclusive;
       
   884 		}
       
   885 
       
   886 	// search for a KErrInUse event from the MMF controller framework on controller 2
       
   887 	TMMFEvent inUseEvent( KMMFEventCategoryPlaybackComplete, KErrInUse );
       
   888 	TVerdict result;
       
   889 	result = SearchForEvent( inUseEvent, 2 );
       
   890 	if( result == EFail )
       
   891 		{
       
   892 		ERR_PRINTF1(_L("MMF controller framework did not return a KErrInUse event"));
       
   893 		return iTestStepResult = EFail;
       
   894 		}
       
   895 	
       
   896 	ERR_PRINTF1(_L("MMF controller framework returned a KErrInUse event"));
       
   897 	return iTestStepResult = EPass;
       
   898 	}
       
   899 
       
   900 // ---------------------------
       
   901 // RTestMmfCtlfrmI0541
       
   902 //
       
   903 // Get position of a source where there is no defined source
       
   904 //
       
   905 // REQ172.5.5.10
       
   906 
       
   907 RTestMmfCtlfrmI0541* RTestMmfCtlfrmI0541::NewL()
       
   908 	{
       
   909 	RTestMmfCtlfrmI0541* self = new(ELeave) RTestMmfCtlfrmI0541;
       
   910 	return self;
       
   911 	}
       
   912 
       
   913 RTestMmfCtlfrmI0541::RTestMmfCtlfrmI0541()
       
   914 	{
       
   915 	iTestStepName = _L("MM-MMF-CTLFRM-I-0541");
       
   916 	}
       
   917 
       
   918 TVerdict RTestMmfCtlfrmI0541::DoTestStepL()
       
   919 	{
       
   920 	INFO_PRINTF1(_L("Get position of undefined source"));
       
   921 	TInt error = KErrNone;
       
   922 
       
   923 	// controller is setup in the preamble, but has no source
       
   924 	// try to get a clip position
       
   925 	TTimeIntervalMicroSeconds clipPos;
       
   926 	error = iController.GetPosition(clipPos);
       
   927 	if(error != KErrNotReady)
       
   928 		{
       
   929 		ERR_PRINTF2(_L("Error : GetPosition returned error %d"), error);	
       
   930 		return iTestStepResult = EFail;
       
   931 		}
       
   932 
       
   933 	INFO_PRINTF1(_L("GetPosition returned KErrNotReady"));
       
   934 	return iTestStepResult = EPass;
       
   935 	}
       
   936 
       
   937 // ---------------------------
       
   938 // RTestMmfCtlfrmI0542
       
   939 //
       
   940 // Set position of a source to beyond the end of the data
       
   941 //
       
   942 // REQ172.5.5.11
       
   943 
       
   944 RTestMmfCtlfrmI0542* RTestMmfCtlfrmI0542::NewL()
       
   945 	{
       
   946 	RTestMmfCtlfrmI0542* self = new(ELeave) RTestMmfCtlfrmI0542;
       
   947 	return self;
       
   948 	}
       
   949 
       
   950 RTestMmfCtlfrmI0542::RTestMmfCtlfrmI0542()
       
   951 	{
       
   952 	iTestStepName = _L("MM-MMF-CTLFRM-I-0542");
       
   953 	}
       
   954 
       
   955 TVerdict RTestMmfCtlfrmI0542::DoTestStepL()
       
   956 	{
       
   957 	// NB this test has changed
       
   958 	// originally we expected the position to set to the end of the clip.
       
   959 	// the Audio Controller is now in fact returning KErrArgument
       
   960 	INFO_PRINTF1(_L("Set position to beyond end of source data"));
       
   961 	TInt error = KErrNone;
       
   962 	
       
   963 	// we know our clip is 5.33 sec :- set to way past the end
       
   964 	const TTimeIntervalMicroSeconds KPastEndPosition(20000000);	// 20 sec
       
   965 	const TTimeIntervalMicroSeconds KPlayPosition(5330000);	
       
   966 	// NB allow for resolution of the controller itself
       
   967 	const TTimeIntervalMicroSeconds KPlayPositionPlusError(5830000);
       
   968 	const TTimeIntervalMicroSeconds KPlayPositionMinusError(4830000); // allow +/-0.5 sec
       
   969 	error = iController.SetPosition(KPastEndPosition);
       
   970 	if(error != KErrArgument)
       
   971 		{
       
   972 		ERR_PRINTF3(_L("SetPosition returned error %d (expected %d)"), error, KErrArgument);
       
   973 		return iTestStepResult = EFail;
       
   974 		}
       
   975 
       
   976 	INFO_PRINTF1(_L("SetPosition returned KErrArgument"));
       
   977 	// now set it to the actual end of the clip, and try again
       
   978 	error = iController.SetPosition(KPlayPosition);
       
   979 	if(error)
       
   980 		{
       
   981 		ERR_PRINTF3(_L("SetPosition returned error %d (expected %d)"), error, KErrNone);
       
   982 		return iTestStepResult = EFail;
       
   983 		}
       
   984 
       
   985 	TTimeIntervalMicroSeconds clipPos;
       
   986 	error = iController.GetPosition(clipPos);
       
   987 	if(error)
       
   988 		{
       
   989 		ERR_PRINTF2(_L("Error : GetPosition failed, error %d"), error);	
       
   990 		return iTestStepResult = EInconclusive;
       
   991 		}
       
   992 
       
   993 	INFO_PRINTF3(_L("Clip position : %ld Expected : %ld"), I64LOW(clipPos.Int64()), I64LOW(KPlayPosition.Int64()));
       
   994 	if( (clipPos < (KPlayPositionMinusError)) || (clipPos > (KPlayPositionPlusError)) )
       
   995 		{
       
   996 		ERR_PRINTF1(_L("Error : clip position not set correctly"));
       
   997 		return iTestStepResult = EFail;
       
   998 		}
       
   999 
       
  1000 	// EPass if we got here
       
  1001 	return iTestStepResult = EPass;
       
  1002 	}
       
  1003 
       
  1004 // ---------------------------
       
  1005 // RTestMmfCtlfrmI0551
       
  1006 //
       
  1007 // Close a controller when source is still playing
       
  1008 //
       
  1009 // REQ172.5.5.12
       
  1010 
       
  1011 RTestMmfCtlfrmI0551* RTestMmfCtlfrmI0551::NewL()
       
  1012 	{
       
  1013 	RTestMmfCtlfrmI0551* self = new(ELeave) RTestMmfCtlfrmI0551;
       
  1014 	return self;
       
  1015 	}
       
  1016 
       
  1017 RTestMmfCtlfrmI0551::RTestMmfCtlfrmI0551()
       
  1018 	{
       
  1019 	iTestStepName = _L("MM-MMF-CTLFRM-I-0551");
       
  1020 	}
       
  1021 
       
  1022 TVerdict RTestMmfCtlfrmI0551::DoTestStepL()
       
  1023 	{
       
  1024 	INFO_PRINTF1(_L("Close controller while still playing"));
       
  1025 	TInt error = KErrNone;
       
  1026 	
       
  1027 	// controller is fully setup in the preamble, and primed
       
  1028 	// play it, then close
       
  1029  	error = iController.Play();
       
  1030 	if(error)
       
  1031 		{
       
  1032 		ERR_PRINTF2(_L("Error : play returned error %d"), error);
       
  1033 		return iTestStepResult = EInconclusive;
       
  1034 		}
       
  1035 
       
  1036 	// wait a while, to give it chance to start playing
       
  1037 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
  1038 	INFO_PRINTF2(_L("Waiting %d mcs..."), I64LOW(KPlayPosition32.Int()));
       
  1039 	User::After(KPlayPosition32);
       
  1040 
       
  1041 	iController.Close();
       
  1042 
       
  1043 	// Close() returns void - so instead demonstrate that the controller
       
  1044 	// has been closed - Reset will return KErrNotReady on a closed controller;
       
  1045 	// on an open controller it will succeed in any state.
       
  1046 
       
  1047  	error = iController.Reset();
       
  1048 	if(error != KErrNotReady)
       
  1049 		{
       
  1050 		ERR_PRINTF2(_L("Error : reset returned error %d"), error);
       
  1051 		return iTestStepResult = EFail;
       
  1052 		}
       
  1053 
       
  1054 	INFO_PRINTF1(_L("Reset returned KErrNotReady; close succeeded"));
       
  1055 	return iTestStepResult = EPass;
       
  1056 	}
       
  1057 
       
  1058 // ---------------------------
       
  1059 // RTestMmfCtlfrmI0552
       
  1060 //
       
  1061 // Reset a controller when source is still playing
       
  1062 //
       
  1063 // REQ172.5.5.12
       
  1064 
       
  1065 RTestMmfCtlfrmI0552* RTestMmfCtlfrmI0552::NewL()
       
  1066 	{
       
  1067 	RTestMmfCtlfrmI0552* self = new(ELeave) RTestMmfCtlfrmI0552;
       
  1068 	return self;
       
  1069 	}
       
  1070 
       
  1071 RTestMmfCtlfrmI0552::RTestMmfCtlfrmI0552()
       
  1072 	{
       
  1073 	iTestStepName = _L("MM-MMF-CTLFRM-I-0552");
       
  1074 	}
       
  1075 
       
  1076 TVerdict RTestMmfCtlfrmI0552::DoTestStepL()
       
  1077 	{
       
  1078 	INFO_PRINTF1(_L("Reset controller while still playing"));
       
  1079 	TInt error = KErrNone;
       
  1080 	
       
  1081 	// controller is fully setup in the preamble, and primed
       
  1082 	// play it, then reset
       
  1083  	error = iController.Play();
       
  1084 	if(error)
       
  1085 		{
       
  1086 		ERR_PRINTF2(_L("Error : play returned error %d"), error);
       
  1087 		return iTestStepResult = EInconclusive;
       
  1088 		}
       
  1089 
       
  1090 	// wait a while, to give it chance to start playing
       
  1091 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
  1092 	INFO_PRINTF2(_L("Waiting %d mcs..."), I64LOW(KPlayPosition32.Int()));
       
  1093 	User::After(KPlayPosition32);
       
  1094 
       
  1095 	error = iController.Reset();
       
  1096 	if(error)
       
  1097 		{
       
  1098 		ERR_PRINTF2(_L("Error : Reset failed, error %d"), error);	
       
  1099 		return iTestStepResult = EFail;
       
  1100 		}
       
  1101 
       
  1102 	INFO_PRINTF1(_L("Reset succeeded"));
       
  1103 	return iTestStepResult = EPass;
       
  1104 	}
       
  1105 
       
  1106 // ---------------------------
       
  1107 // RTestMmfCtlfrmI0553
       
  1108 //
       
  1109 // Close an already closed controller
       
  1110 //
       
  1111 // REQ172.5.5.12
       
  1112 
       
  1113 RTestMmfCtlfrmI0553* RTestMmfCtlfrmI0553::NewL()
       
  1114 	{
       
  1115 	RTestMmfCtlfrmI0553* self = new(ELeave) RTestMmfCtlfrmI0553;
       
  1116 	return self;
       
  1117 	}
       
  1118 
       
  1119 RTestMmfCtlfrmI0553::RTestMmfCtlfrmI0553()
       
  1120 	{
       
  1121 	iTestStepName = _L("MM-MMF-CTLFRM-I-0553");
       
  1122 	}
       
  1123 
       
  1124 TVerdict RTestMmfCtlfrmI0553::DoTestStepL()
       
  1125 	{
       
  1126 	INFO_PRINTF1(_L("Close an already closed controller"));
       
  1127 	TInt error = KErrNone;
       
  1128 	
       
  1129 	// controller is fully setup in the preamble, and primed
       
  1130 	// close it, check that code on reset is KErrNotReady,
       
  1131 	// then close it again
       
  1132 
       
  1133 	iController.Close();
       
  1134  	error = iController.Reset();
       
  1135 	if(error != KErrNotReady)
       
  1136 		{
       
  1137 		ERR_PRINTF2(_L("Error : reset returned error %d"), error);
       
  1138 		return iTestStepResult = EFail;
       
  1139 		}
       
  1140 	INFO_PRINTF1(_L("Reset (1) returned KErrNotReady; close succeeded"));
       
  1141 
       
  1142 	// if the second close caused problems, we will leave or get an error from Reset
       
  1143 	iController.Close();
       
  1144  	error = iController.Reset();
       
  1145 	if(error != KErrNotReady)
       
  1146 		{
       
  1147 		ERR_PRINTF2(_L("Error : reset returned error %d"), error);
       
  1148 		return iTestStepResult = EFail;
       
  1149 		}
       
  1150 
       
  1151 	INFO_PRINTF1(_L("Reset (2) returned KErrNotReady; close succeeded"));
       
  1152 
       
  1153 	return iTestStepResult = EPass;
       
  1154 	}
       
  1155 
       
  1156 // ---------------------------
       
  1157 // RTestMmfCtlfrmI0554
       
  1158 //
       
  1159 // Reset an already closed controller
       
  1160 //
       
  1161 // REQ172.5.5.12
       
  1162 
       
  1163 RTestMmfCtlfrmI0554* RTestMmfCtlfrmI0554::NewL()
       
  1164 	{
       
  1165 	RTestMmfCtlfrmI0554* self = new(ELeave) RTestMmfCtlfrmI0554;
       
  1166 	return self;
       
  1167 	}
       
  1168 
       
  1169 RTestMmfCtlfrmI0554::RTestMmfCtlfrmI0554()
       
  1170 	{
       
  1171 	iTestStepName = _L("MM-MMF-CTLFRM-I-0554");
       
  1172 	}
       
  1173 
       
  1174 TVerdict RTestMmfCtlfrmI0554::DoTestStepL()
       
  1175 	{
       
  1176 	INFO_PRINTF1(_L("Reset an already closed controller"));
       
  1177 	TInt error = KErrNone;
       
  1178 	
       
  1179 	// controller is fully setup in the preamble, and primed
       
  1180 	// close it, then attempt a reset
       
  1181 
       
  1182 	iController.Close();
       
  1183 	// Close() returns void
       
  1184  	// wait a while, to give it a chance to complete
       
  1185 	const TTimeIntervalMicroSeconds32 KPlayPosition32 = 500000L;
       
  1186 	INFO_PRINTF2(_L("Waiting %d mcs..."), I64LOW(KPlayPosition32.Int()));
       
  1187 	User::After(KPlayPosition32);
       
  1188 
       
  1189 	error = iController.Reset();
       
  1190 	if(error != KErrNotReady)
       
  1191 		{
       
  1192 		// this will fail if the controller hasn't been closed
       
  1193 		ERR_PRINTF2(_L("Error : reset returned error %d"), error);
       
  1194 		return iTestStepResult = EFail;
       
  1195 		}
       
  1196 
       
  1197 	INFO_PRINTF1(_L("Reset returned KErrNotReady"));
       
  1198 	return iTestStepResult = EPass;
       
  1199 	}
       
  1200