devsound/a3fcharacterisationtest/src/char_a3f_devsound_initializationtest.cpp
changeset 24 2672ba96448e
equal deleted inserted replaced
21:1c0a769d0cc5 24:2672ba96448e
       
     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 // User includes
       
    17 #include "char_a3f_devsound_initializationtest.h"
       
    18 
       
    19 /*
       
    20  *========================================================================================================
       
    21  * MM-A3F-DEVSOUND-CHRTZ-INIT-0001
       
    22  */
       
    23 RA3FDevSoundToneInitializationTest::RA3FDevSoundToneInitializationTest(const TDesC& aTestName) 
       
    24 	:	RA3FDevSoundTestBase(aTestName)
       
    25 	{
       
    26 	}
       
    27 
       
    28 RA3FDevSoundToneInitializationTest* RA3FDevSoundToneInitializationTest::NewL(const TDesC& aTestName)
       
    29 	{
       
    30 	RA3FDevSoundToneInitializationTest* self = new (ELeave) RA3FDevSoundToneInitializationTest(aTestName);
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 void RA3FDevSoundToneInitializationTest::DoKickoffTestL()
       
    35 	{
       
    36 	}
       
    37 
       
    38 void RA3FDevSoundToneInitializationTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
    39 	{
       
    40 	switch(iDevSoundState)
       
    41 		{
       
    42 		case EStateCreated:
       
    43 			{
       
    44 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializationTest"),EFsmIncorrectErrorPassed));
       
    45 			if(aDevSoundEvent == EEventInitialize)
       
    46 				{
       
    47 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
    48 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
    49 				if(err != KErrNone)
       
    50 					{
       
    51 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
    52 					StopTest(err);
       
    53 					break;
       
    54 					}
       
    55 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
    56 				iDevSoundState = EStateInitializing;
       
    57 				}
       
    58 			else
       
    59 				{
       
    60 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
    61 				StopTest(aError, EFail);
       
    62 				}
       
    63 			break;
       
    64 			}
       
    65 		case EStateInitializing:
       
    66 			{
       
    67 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
    68 				{
       
    69 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
    70 				StopTest();
       
    71 				}
       
    72 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
    73 				{
       
    74 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
    75 				StopTest(aError);		
       
    76 				}
       
    77 			else
       
    78 				{
       
    79 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
    80 				StopTest(aError, EFail);
       
    81 				}
       
    82 			break;
       
    83 			}	
       
    84 		default:
       
    85 			{
       
    86 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
    87 			StopTest(aError, EFail);
       
    88 			}
       
    89 		}
       
    90 	}
       
    91 
       
    92 /*
       
    93  *========================================================================================================
       
    94  * MM-A3F-DEVSOUND-CHRTZ-INIT-0002
       
    95  */
       
    96 RA3FDevSoundToneCancelInitializeTest::RA3FDevSoundToneCancelInitializeTest(const TDesC& aTestName) 
       
    97 	:	RA3FDevSoundTestBase(aTestName),iInitCompleteReceived(EFalse),
       
    98 		iSampleRate(0), iChannels(0)
       
    99 	{
       
   100 	}
       
   101 
       
   102 RA3FDevSoundToneCancelInitializeTest* RA3FDevSoundToneCancelInitializeTest::NewL(const TDesC& aTestName)
       
   103 	{
       
   104 	RA3FDevSoundToneCancelInitializeTest* self = new (ELeave) RA3FDevSoundToneCancelInitializeTest(aTestName);
       
   105 	return self;
       
   106 	}
       
   107 
       
   108 void RA3FDevSoundToneCancelInitializeTest::DoKickoffTestL()
       
   109 	{
       
   110 	if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate))
       
   111 		{
       
   112 		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
       
   113 		StopTest(KErrNotFound);
       
   114 		return;
       
   115 		}
       
   116 	if (!GetIntFromConfig(iTestStepName, KChannel, iChannels))
       
   117 		{
       
   118 		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
       
   119 		StopTest(KErrNotFound);
       
   120 		return;
       
   121 		}
       
   122 	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
       
   123 	}
       
   124 
       
   125 void RA3FDevSoundToneCancelInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   126 	{
       
   127 	switch(iDevSoundState)
       
   128 		{
       
   129 		case EStateCreated:
       
   130 			{
       
   131 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneCancelInitializeTest"),EFsmIncorrectErrorPassed));
       
   132 			if(aDevSoundEvent == EEventInitialize)
       
   133 				{
       
   134 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   135 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
   136 				if(err != KErrNone)
       
   137 					{
       
   138 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   139 					StopTest(err);
       
   140 					break;
       
   141 					}		
       
   142 				StartTimer(KMicroSecsTwoSec);
       
   143 				INFO_PRINTF1(_L("Calling CMMFDevSound::CancelInitialize")); 
       
   144 				err = iMMFDevSound->CancelInitialize();
       
   145 				if(err != KErrNone)
       
   146 					{
       
   147 					ERR_PRINTF2(_L("Unexpected error on CancelInitialize = %d"), err);
       
   148 					StopTest(err);
       
   149 					}
       
   150 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   151 				iDevSoundState = EStateInitializing;
       
   152 				}
       
   153 			else
       
   154 				{
       
   155 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   156 				StopTest(aError, EFail);
       
   157 				}
       
   158 			break;
       
   159 			}
       
   160 		case EStateInitializing:
       
   161 			{
       
   162 			if(aDevSoundEvent == EEventInitComplete)
       
   163 				{
       
   164 				iInitCompleteReceived = ETrue;
       
   165 				}
       
   166 			break;
       
   167 			}	
       
   168 		default:
       
   169 			{
       
   170 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   171 			StopTest(aError, EFail);
       
   172 			}
       
   173 		}
       
   174 	}
       
   175 void RA3FDevSoundToneCancelInitializeTest::DoTimerCallback()
       
   176 	{
       
   177 	if(!iInitCompleteReceived)
       
   178 		{
       
   179 		INFO_PRINTF1(_L("Waiting for InitializeComplete event"));
       
   180 		iInitCompleteReceived = ETrue;
       
   181 		}
       
   182 	else
       
   183 		{
       
   184 		iTimer->Cancel();
       
   185 		TMMFCapabilities capabilitiesSet;
       
   186 		TBuf<KMaxSampleRateStringLength> stringSampleRateSet;
       
   187 		TBuf<KMaxChannelsStringLength> stringChannelsSet;
       
   188 		SampleRateFromTIntToTMMFSampleRate (iSampleRate, iESampleRate);
       
   189 		capabilitiesSet.iRate = iESampleRate;
       
   190 		capabilitiesSet.iChannels = iChannels;
       
   191 		SampleRateFromTUintToString (capabilitiesSet.iRate,	stringSampleRateSet);
       
   192 		ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet);
       
   193 		INFO_PRINTF3(_L("Settings for Sample rate an channel mode. %S %S"), &stringSampleRateSet, &stringChannelsSet);
       
   194 		INFO_PRINTF1(_L("Calling CMMFDevSound::SetConfigL"));
       
   195 		TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet));
       
   196 		if (err ==  KErrNotReady)
       
   197 			{
       
   198 			INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with the expected error = %d"), err);
       
   199 			StopTest();
       
   200 			}
       
   201 		else
       
   202 			{
       
   203 			INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err);
       
   204 			ERR_PRINTF2(_L("Expected error value = %d"), KErrNotReady);
       
   205 			StopTest(err, EFail);
       
   206 			}
       
   207 		}
       
   208 	}
       
   209 
       
   210 void RA3FDevSoundToneCancelInitializeTest::InitializeComplete(TInt aError)
       
   211 	{
       
   212 	ERR_PRINTF1(_L("DevSound called InitializeComplete after calling CMMFDevSound::CancelInitialize"));
       
   213 	StopTest(aError, EFail);
       
   214 	}
       
   215 
       
   216 
       
   217 /*
       
   218  *========================================================================================================
       
   219  * MM-A3F-DEVSOUND-CHRTZ-INIT-0003
       
   220  */
       
   221 RA3FDevSoundToneInitializeToPlayTonesTwiceTest::RA3FDevSoundToneInitializeToPlayTonesTwiceTest(const TDesC& aTestName) 
       
   222 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
   223 	{
       
   224 	}
       
   225 
       
   226 RA3FDevSoundToneInitializeToPlayTonesTwiceTest* RA3FDevSoundToneInitializeToPlayTonesTwiceTest::NewL(const TDesC& aTestName)
       
   227 	{
       
   228 	RA3FDevSoundToneInitializeToPlayTonesTwiceTest* self = new (ELeave) RA3FDevSoundToneInitializeToPlayTonesTwiceTest(aTestName);
       
   229 	return self;
       
   230 	}
       
   231 
       
   232 void RA3FDevSoundToneInitializeToPlayTonesTwiceTest::DoKickoffTestL()
       
   233 	{
       
   234 	}
       
   235 
       
   236 void RA3FDevSoundToneInitializeToPlayTonesTwiceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   237 	{
       
   238 	switch(iDevSoundState)
       
   239 		{
       
   240 		case EStateCreated:
       
   241 			{
       
   242 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeTwiceToPlayTonesTest"),EFsmIncorrectErrorPassed));
       
   243 			if(aDevSoundEvent == EEventInitialize)
       
   244 				{
       
   245 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   246 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
   247 				if(err != KErrNone)
       
   248 					{
       
   249 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   250 					StopTest(err);
       
   251 					break;
       
   252 					}
       
   253 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   254 				iDevSoundState = EStateInitializing;
       
   255 				}
       
   256 			else
       
   257 				{
       
   258 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   259 				StopTest(aError, EFail);
       
   260 				}
       
   261 			break;
       
   262 			}
       
   263 		case EStateInitializing:
       
   264 			{
       
   265 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
   266 				{
       
   267 				if(!iReinitialized)
       
   268 					{
       
   269 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
   270 					iReinitialized = ETrue;
       
   271 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
   272 					TRAPD(err, iMMFDevSound->InitializeL(*this,EMMFStateTonePlaying));
       
   273 					if(err != KErrNone)
       
   274 						{
       
   275 						StopTest(err);
       
   276 						break;
       
   277 						}
       
   278 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   279 					iDevSoundState = EStateInitializing;
       
   280 					}
       
   281 				else
       
   282 					{
       
   283 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
   284 					StopTest();
       
   285 					}
       
   286 				}
       
   287 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
   288 				{
       
   289 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
   290 				StopTest(aError);		
       
   291 				}
       
   292 			else
       
   293 				{
       
   294 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
   295 				StopTest(aError, EFail);
       
   296 				}
       
   297 			break;
       
   298 			}	
       
   299 		default:
       
   300 			{
       
   301 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   302 			StopTest(aError, EFail);
       
   303 			}
       
   304 		}
       
   305 	}
       
   306 
       
   307 /*
       
   308  *========================================================================================================
       
   309  * MM-A3F-DEVSOUND-CHRTZ-INIT-0004
       
   310  */
       
   311 RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::RA3FDevSoundToneInitializeToPlayTonesThenAudioTest(const TDesC& aTestName) 
       
   312 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
   313 	{
       
   314 	}
       
   315 
       
   316 RA3FDevSoundToneInitializeToPlayTonesThenAudioTest* RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::NewL(const TDesC& aTestName)
       
   317 	{
       
   318 	RA3FDevSoundToneInitializeToPlayTonesThenAudioTest* self = new (ELeave) RA3FDevSoundToneInitializeToPlayTonesThenAudioTest(aTestName);
       
   319 	return self;
       
   320 	}
       
   321 
       
   322 void RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::DoKickoffTestL()
       
   323 	{
       
   324 	}
       
   325 
       
   326 void RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   327 	{
       
   328 	switch(iDevSoundState)
       
   329 		{
       
   330 		case EStateCreated:
       
   331 			{
       
   332 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeToPlayTonesThenAudioTest"),EFsmIncorrectErrorPassed));
       
   333 			if(aDevSoundEvent == EEventInitialize)
       
   334 				{
       
   335 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   336 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
   337 				if(err != KErrNone)
       
   338 					{
       
   339 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   340 					StopTest(err);
       
   341 					break;
       
   342 					}
       
   343 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   344 				iDevSoundState = EStateInitializing;
       
   345 				}
       
   346 			else
       
   347 				{
       
   348 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   349 				StopTest(aError, EFail);
       
   350 				}
       
   351 			break;
       
   352 			}
       
   353 		case EStateInitializing:
       
   354 			{
       
   355 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
   356 				{
       
   357 				if(!iReinitialized)
       
   358 					{
       
   359 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
   360 					iReinitialized = ETrue;
       
   361 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
   362 					TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStatePlaying));
       
   363 					if(err != KErrNone)
       
   364 						{
       
   365 						StopTest(err);
       
   366 						break;
       
   367 						}
       
   368 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   369 					iDevSoundState = EStateInitializing;
       
   370 					}
       
   371 				else
       
   372 					{
       
   373 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
   374 					StopTest();
       
   375 					}
       
   376 				}
       
   377 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
   378 				{
       
   379 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
   380 				StopTest(aError);		
       
   381 				}
       
   382 			else
       
   383 				{
       
   384 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
   385 				StopTest(aError, EFail);
       
   386 				}
       
   387 			break;
       
   388 			}	
       
   389 		default:
       
   390 			{
       
   391 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   392 			StopTest(aError, EFail);
       
   393 			}
       
   394 		}
       
   395 	}
       
   396 
       
   397 /*
       
   398  *========================================================================================================
       
   399  * MM-A3F-DEVSOUND-CHRTZ-INIT-0005
       
   400  */
       
   401 RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest(const TDesC& aTestName) 
       
   402 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
   403 	{
       
   404 	}
       
   405 
       
   406 RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest* RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::NewL(const TDesC& aTestName)
       
   407 	{
       
   408 	RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest* self = new (ELeave) RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest(aTestName);
       
   409 	return self;
       
   410 	}
       
   411 
       
   412 void RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::DoKickoffTestL()
       
   413 	{
       
   414 	}
       
   415 
       
   416 void RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   417 	{
       
   418 	switch(iDevSoundState)
       
   419 		{
       
   420 		case EStateCreated:
       
   421 			{
       
   422 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest"),EFsmIncorrectErrorPassed));
       
   423 			if(aDevSoundEvent == EEventInitialize)
       
   424 				{
       
   425 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   426 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
   427 				if(err != KErrNone)
       
   428 					{
       
   429 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   430 					StopTest(err);
       
   431 					break;
       
   432 					}
       
   433 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   434 				iDevSoundState = EStateInitializing;
       
   435 				}
       
   436 			else
       
   437 				{
       
   438 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   439 				StopTest(aError, EFail);
       
   440 				}
       
   441 			break;
       
   442 			}
       
   443 		case EStateInitializing:
       
   444 			{
       
   445 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
   446 				{
       
   447 				if(!iReinitialized)
       
   448 					{
       
   449 					INFO_PRINTF1(_L("========== First initialization successfully completed=========="));
       
   450 					iReinitialized = ETrue;
       
   451 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
   452 					TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording));
       
   453 					if(err != KErrNone)
       
   454 						{
       
   455 						StopTest(err);
       
   456 						break;
       
   457 						}
       
   458 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   459 					iDevSoundState = EStateInitializing;
       
   460 					}
       
   461 				else
       
   462 					{
       
   463 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
   464 					StopTest();
       
   465 					}
       
   466 				}
       
   467 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
   468 				{
       
   469 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
   470 				StopTest(aError);		
       
   471 				}
       
   472 			else
       
   473 				{
       
   474 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
   475 				StopTest(aError, EFail);
       
   476 				}
       
   477 			break;
       
   478 			}	
       
   479 		default:
       
   480 			{
       
   481 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   482 			StopTest(aError, EFail);
       
   483 			}
       
   484 		}
       
   485 	}
       
   486 
       
   487 /*
       
   488  *========================================================================================================
       
   489  * MM-A3F-DEVSOUND-CHRTZ-INIT-0006
       
   490  */
       
   491 RA3FDevSoundToneInitializeTFourCCTest::RA3FDevSoundToneInitializeTFourCCTest(const TDesC& aTestName) 
       
   492 	: 	RA3FDevSoundTestBase(aTestName)
       
   493 	{
       
   494 	}
       
   495 
       
   496 RA3FDevSoundToneInitializeTFourCCTest* RA3FDevSoundToneInitializeTFourCCTest::NewL(const TDesC& aTestName)
       
   497 	{
       
   498 	RA3FDevSoundToneInitializeTFourCCTest* self = new (ELeave) RA3FDevSoundToneInitializeTFourCCTest(aTestName);
       
   499 	return self;
       
   500 	}
       
   501 
       
   502 void RA3FDevSoundToneInitializeTFourCCTest::DoKickoffTestL()
       
   503 	{
       
   504 	TPtrC fourccCode;
       
   505 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
   506 		{
       
   507 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
   508 		StopTest(KErrNotFound);
       
   509 		return;
       
   510 		}
       
   511 	EncodingFromStringToTFourCC(fourccCode);
       
   512 	}
       
   513 
       
   514 void RA3FDevSoundToneInitializeTFourCCTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   515 	{
       
   516 	switch(iDevSoundState)
       
   517 		{
       
   518 		case EStateCreated:
       
   519 			{
       
   520 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeTFourCCTest"),EFsmIncorrectErrorPassed));
       
   521 			if(aDevSoundEvent == EEventInitialize)
       
   522 				{
       
   523 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   524 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateTonePlaying));
       
   525 				if(err == KErrNotSupported)
       
   526 					{
       
   527 					ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL to play tones using a FourCC code left with expected error = %d"), err);
       
   528 					StopTest(err, EPass);
       
   529 					break;
       
   530 					}
       
   531 				else
       
   532 					{
       
   533 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   534 					INFO_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
       
   535 					StopTest(err, EFail);
       
   536 					}
       
   537 				}
       
   538 			}
       
   539 		default:
       
   540 			{
       
   541 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   542 			StopTest(aError, EFail);
       
   543 			}
       
   544 		}
       
   545 	}
       
   546 
       
   547 /*
       
   548  *========================================================================================================
       
   549  * MM-A3F-DEVSOUND-CHRTZ-INIT-0007
       
   550  */
       
   551 RA3FDevSoundInitializeInvalidModeTest::RA3FDevSoundInitializeInvalidModeTest(const TDesC& aTestName) 
       
   552 	: 	RA3FDevSoundTestBase(aTestName)
       
   553 	{
       
   554 	}
       
   555 
       
   556 RA3FDevSoundInitializeInvalidModeTest* RA3FDevSoundInitializeInvalidModeTest::NewL(const TDesC& aTestName)
       
   557 	{
       
   558 	RA3FDevSoundInitializeInvalidModeTest* self = new (ELeave) RA3FDevSoundInitializeInvalidModeTest(aTestName);
       
   559 	return self;
       
   560 	}
       
   561 
       
   562 void RA3FDevSoundInitializeInvalidModeTest::DoKickoffTestL()
       
   563 	{
       
   564 	}
       
   565 
       
   566 void RA3FDevSoundInitializeInvalidModeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   567 	{
       
   568 	switch(iDevSoundState)
       
   569 		{
       
   570 		case EStateCreated:
       
   571 			{
       
   572 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundInitializeInvalidModeTest"),EFsmIncorrectErrorPassed));
       
   573 			if(aDevSoundEvent == EEventInitialize)
       
   574 				{
       
   575 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   576 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateConverting));
       
   577 				if(err == KErrNotSupported)
       
   578 					{
       
   579 					ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TMMFState argument left with expected error code = %d"), err);
       
   580 					StopTest(err, EPass);
       
   581 					break;
       
   582 					}
       
   583 				else
       
   584 					{
       
   585 					INFO_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TMMFState argument left with unexpected error code = %d"), err);
       
   586 					INFO_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
       
   587 					StopTest(err, EFail);
       
   588 					}
       
   589 				}
       
   590 			}
       
   591 		default:
       
   592 			{
       
   593 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   594 			StopTest(aError, EFail);
       
   595 			}
       
   596 		}
       
   597 	}
       
   598 	
       
   599 
       
   600 /*
       
   601  *========================================================================================================
       
   602  * MM-A3F-DEVSOUND-CHRTZ-INIT-0008
       
   603  */
       
   604 RA3FDevSoundPlayInitializationTest::RA3FDevSoundPlayInitializationTest(const TDesC& aTestName) 
       
   605 	: 	RA3FDevSoundTestBase(aTestName)
       
   606 	{
       
   607 	}
       
   608 
       
   609 RA3FDevSoundPlayInitializationTest* RA3FDevSoundPlayInitializationTest::NewL(const TDesC& aTestName)
       
   610 	{
       
   611 	RA3FDevSoundPlayInitializationTest* self = new (ELeave) RA3FDevSoundPlayInitializationTest(aTestName);
       
   612 	return self;
       
   613 	}
       
   614 
       
   615 void RA3FDevSoundPlayInitializationTest::DoKickoffTestL()
       
   616 	{
       
   617 	TPtrC fourccCode;
       
   618 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
   619 		{
       
   620 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
   621 		StopTest(KErrNotFound);
       
   622 		return;
       
   623 		}
       
   624 	EncodingFromStringToTFourCC(fourccCode);
       
   625 	}
       
   626 
       
   627 void RA3FDevSoundPlayInitializationTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   628 	{
       
   629 	switch(iDevSoundState)
       
   630 		{
       
   631 		case EStateCreated:
       
   632 			{
       
   633 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializationTest"),EFsmIncorrectErrorPassed));
       
   634 			if(aDevSoundEvent == EEventInitialize)
       
   635 				{
       
   636 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   637 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
   638 				if(err != KErrNone)
       
   639 					{
       
   640 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   641 					StopTest(err);
       
   642 					break;
       
   643 					}
       
   644 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   645 				iDevSoundState = EStateInitializing;
       
   646 				}
       
   647 			else
       
   648 				{
       
   649 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   650 				StopTest(aError, EFail);
       
   651 				}
       
   652 			break;
       
   653 			}
       
   654 		case EStateInitializing:
       
   655 			{
       
   656 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
   657 				{
       
   658 				INFO_PRINTF1(_L("CMMFDevSound::InitializeL succeeded"));
       
   659 				StopTest();
       
   660 				}
       
   661 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
   662 				{
       
   663 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
   664 				StopTest(aError);		
       
   665 				}
       
   666 			else
       
   667 				{
       
   668 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
   669 				StopTest(aError, EFail);
       
   670 				}
       
   671 			break;
       
   672 			}	
       
   673 		default:
       
   674 			{
       
   675 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   676 			StopTest(aError, EFail);
       
   677 			}
       
   678 		}
       
   679 	}
       
   680 
       
   681 /*
       
   682  *========================================================================================================
       
   683  * MM-A3F-DEVSOUND-CHRTZ-INIT-0009
       
   684  */
       
   685 RA3FDevSoundPlayCancelInitializeTest::RA3FDevSoundPlayCancelInitializeTest(const TDesC& aTestName) 
       
   686 	:	RA3FDevSoundTestBase(aTestName),iInitCompleteReceived(EFalse),
       
   687 		iSampleRate(0), iChannels(0)
       
   688 	{
       
   689 	}
       
   690 
       
   691 RA3FDevSoundPlayCancelInitializeTest* RA3FDevSoundPlayCancelInitializeTest::NewL(const TDesC& aTestName)
       
   692 	{
       
   693 	RA3FDevSoundPlayCancelInitializeTest* self = new (ELeave) RA3FDevSoundPlayCancelInitializeTest(aTestName);
       
   694 	return self;
       
   695 	}
       
   696 
       
   697 void RA3FDevSoundPlayCancelInitializeTest::DoKickoffTestL()
       
   698 	{
       
   699 	if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate))
       
   700 		{
       
   701 		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
       
   702 		StopTest(KErrNotFound);
       
   703 		return;
       
   704 		}
       
   705 	if (!GetIntFromConfig(iTestStepName, KChannel, iChannels))
       
   706 		{
       
   707 		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
       
   708 		StopTest(KErrNotFound);
       
   709 		return;
       
   710 		}
       
   711 	TPtrC fourccCode;
       
   712 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
   713 		{
       
   714 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
   715 		StopTest(KErrNotFound);
       
   716 		return;
       
   717 		}
       
   718 	EncodingFromStringToTFourCC(fourccCode);
       
   719 	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
       
   720 	}
       
   721 
       
   722 void RA3FDevSoundPlayCancelInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   723 	{
       
   724 	switch(iDevSoundState)
       
   725 		{
       
   726 		case EStateCreated:
       
   727 			{
       
   728 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayCancelInitializeTest"),EFsmIncorrectErrorPassed));
       
   729 			if(aDevSoundEvent == EEventInitialize)
       
   730 				{
       
   731 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   732 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
   733 				if(err != KErrNone)
       
   734 					{
       
   735 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   736 					StopTest(err);
       
   737 					break;
       
   738 					}		
       
   739 				StartTimer(KMicroSecsTwoSec);
       
   740 				INFO_PRINTF1(_L("Calling CMMFDevSound::CancelInitialize"));
       
   741 				err = iMMFDevSound->CancelInitialize();
       
   742 				if(err != KErrNone)
       
   743 					{
       
   744 					ERR_PRINTF2(_L("Unexpected error on CancelInitialize = %d"), err);
       
   745 					StopTest(err);
       
   746 					}
       
   747 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   748 				iDevSoundState = EStateInitializing;
       
   749 				}
       
   750 			else
       
   751 				{
       
   752 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   753 				StopTest(aError, EFail);
       
   754 				}
       
   755 			break;
       
   756 			}
       
   757 		case EStateInitializing:
       
   758 			{
       
   759 			if(aDevSoundEvent == EEventInitComplete)
       
   760 				{
       
   761 				iInitCompleteReceived = ETrue;
       
   762 				}
       
   763 			break;
       
   764 			}	
       
   765 		default:
       
   766 			{
       
   767 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   768 			StopTest(aError, EFail);
       
   769 			}
       
   770 		}
       
   771 	}
       
   772 
       
   773 void RA3FDevSoundPlayCancelInitializeTest::DoTimerCallback()
       
   774 	{
       
   775 	if(!iInitCompleteReceived)
       
   776 		{
       
   777 		INFO_PRINTF1(_L("Waiting for InitializeComplete event"));
       
   778 		iInitCompleteReceived = ETrue;
       
   779 		}
       
   780 	else
       
   781 		{
       
   782 		iTimer->Cancel();
       
   783 		TMMFCapabilities capabilitiesSet;
       
   784 		TBuf<KMaxSampleRateStringLength> stringSampleRateSet;
       
   785 		TBuf<KMaxChannelsStringLength> stringChannelsSet;
       
   786 		SampleRateFromTIntToTMMFSampleRate (iSampleRate, iESampleRate);
       
   787 		capabilitiesSet.iRate = iESampleRate;
       
   788 		capabilitiesSet.iChannels = iChannels;
       
   789 		SampleRateFromTUintToString (capabilitiesSet.iRate,	stringSampleRateSet);
       
   790 		ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet);
       
   791 		INFO_PRINTF3(_L("Settings for Sample rate an channel mode. %S %S"), &stringSampleRateSet, &stringChannelsSet);
       
   792 		INFO_PRINTF1(_L("Calling CMMFDevSound::SetConfigL"));
       
   793 		TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet));
       
   794 		if (err ==  KErrNotReady)
       
   795 			{
       
   796 			INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with the expected error = %d"), err);
       
   797 			StopTest();
       
   798 			}
       
   799 		else
       
   800 			{
       
   801 			INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err);
       
   802 			ERR_PRINTF2(_L("Expected error value = %d"), KErrNotReady);
       
   803 			StopTest(err, EFail);
       
   804 			}
       
   805 		}
       
   806 	}
       
   807 
       
   808 void RA3FDevSoundPlayCancelInitializeTest::InitializeComplete(TInt aError)
       
   809 	{
       
   810 	ERR_PRINTF1(_L("DevSound called InitializeComplete after calling CMMFDevSound::CancelInitialize"));
       
   811 	StopTest(aError, EFail);
       
   812 	}
       
   813 
       
   814 
       
   815 /*
       
   816  *========================================================================================================
       
   817  * MM-A3F-DEVSOUND-CHRTZ-INIT-0010
       
   818  */
       
   819 RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest(const TDesC& aTestName) 
       
   820 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
   821 	{
       
   822 	}
       
   823 
       
   824 RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest* RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::NewL(const TDesC& aTestName)
       
   825 	{
       
   826 	RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest* self = new (ELeave) RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest(aTestName);
       
   827 	return self;
       
   828 	}
       
   829 
       
   830 void RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::DoKickoffTestL()
       
   831 	{
       
   832 	TPtrC fourccCode;
       
   833 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
   834 		{
       
   835 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
   836 		StopTest(KErrNotFound);
       
   837 		return;
       
   838 		}
       
   839 	EncodingFromStringToTFourCC(fourccCode);
       
   840 	}
       
   841 
       
   842 void RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   843 	{
       
   844 	switch(iDevSoundState)
       
   845 		{
       
   846 		case EStateCreated:
       
   847 			{
       
   848 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest"),EFsmIncorrectErrorPassed));
       
   849 			if(aDevSoundEvent == EEventInitialize)
       
   850 				{
       
   851 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   852 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
   853 				if(err != KErrNone)
       
   854 					{
       
   855 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   856 					StopTest(err);
       
   857 					break;
       
   858 					}
       
   859 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   860 				iDevSoundState = EStateInitializing;
       
   861 				}
       
   862 			else
       
   863 				{
       
   864 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   865 				StopTest(aError, EFail);
       
   866 				}
       
   867 			break;
       
   868 			}
       
   869 		case EStateInitializing:
       
   870 			{
       
   871 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
   872 				{
       
   873 				if(!iReinitialized)
       
   874 					{
       
   875 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
   876 					iReinitialized = ETrue;
       
   877 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
   878 					TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
   879 					if(err != KErrNone)
       
   880 						{
       
   881 						StopTest(err);
       
   882 						break;
       
   883 						}
       
   884 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   885 					iDevSoundState = EStateInitializing;
       
   886 					}
       
   887 				else
       
   888 					{
       
   889 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
   890 					StopTest();
       
   891 					}
       
   892 				}
       
   893 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
   894 				{
       
   895 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
   896 				StopTest(aError);		
       
   897 				}
       
   898 			else
       
   899 				{
       
   900 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
   901 				StopTest(aError, EFail);
       
   902 				}
       
   903 			break;
       
   904 			}	
       
   905 		default:
       
   906 			{
       
   907 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
   908 			StopTest(aError, EFail);
       
   909 			}
       
   910 		}
       
   911 	}
       
   912 
       
   913 /*
       
   914  *========================================================================================================
       
   915  * MM-A3F-DEVSOUND-CHRTZ-INIT-0011
       
   916  */
       
   917 RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::RA3FDevSoundPlayInitializeToPlayAudioTwiceTest(const TDesC& aTestName) 
       
   918 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
   919 	{
       
   920 	}
       
   921 
       
   922 RA3FDevSoundPlayInitializeToPlayAudioTwiceTest* RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::NewL(const TDesC& aTestName)
       
   923 	{
       
   924 	RA3FDevSoundPlayInitializeToPlayAudioTwiceTest* self = new (ELeave) RA3FDevSoundPlayInitializeToPlayAudioTwiceTest(aTestName);
       
   925 	return self;
       
   926 	}
       
   927 
       
   928 void RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::DoKickoffTestL()
       
   929 	{
       
   930 	TPtrC fourccCode;
       
   931 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
   932 		{
       
   933 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
   934 		StopTest(KErrNotFound);
       
   935 		return;
       
   936 		}
       
   937 	EncodingFromStringToTFourCC(fourccCode);
       
   938 	}
       
   939 
       
   940 void RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
   941 	{
       
   942 	switch(iDevSoundState)
       
   943 		{
       
   944 		case EStateCreated:
       
   945 			{
       
   946 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeTwiceToPlayAudioTest"),EFsmIncorrectErrorPassed));
       
   947 			if(aDevSoundEvent == EEventInitialize)
       
   948 				{
       
   949 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
   950 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
   951 				if(err != KErrNone)
       
   952 					{
       
   953 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
   954 					StopTest(err);
       
   955 					break;
       
   956 					}
       
   957 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   958 				iDevSoundState = EStateInitializing;
       
   959 				}
       
   960 			else
       
   961 				{
       
   962 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
   963 				StopTest(aError, EFail);
       
   964 				}
       
   965 			break;
       
   966 			}
       
   967 		case EStateInitializing:
       
   968 			{
       
   969 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
   970 				{
       
   971 				if(!iReinitialized)
       
   972 					{
       
   973 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
   974 					iReinitialized = ETrue;
       
   975 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
   976 					TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
   977 					if(err != KErrNone)
       
   978 						{
       
   979 						StopTest(err);
       
   980 						break;
       
   981 						}
       
   982 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
   983 					iDevSoundState = EStateInitializing;
       
   984 					}
       
   985 				else
       
   986 					{
       
   987 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
   988 					StopTest();
       
   989 					}
       
   990 				}
       
   991 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
   992 				{
       
   993 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
   994 				StopTest(aError);		
       
   995 				}
       
   996 			else
       
   997 				{
       
   998 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
   999 				StopTest(aError, EFail);
       
  1000 				}
       
  1001 			break;
       
  1002 			}	
       
  1003 		default:
       
  1004 			{
       
  1005 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1006 			StopTest(aError, EFail);
       
  1007 			}
       
  1008 		}
       
  1009 	}
       
  1010 
       
  1011 
       
  1012 /*
       
  1013  *========================================================================================================
       
  1014  * MM-A3F-DEVSOUND-CHRTZ-INIT-0012
       
  1015  */
       
  1016 RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest(const TDesC& aTestName) 
       
  1017 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
  1018 	{
       
  1019 	}
       
  1020 
       
  1021 RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest* RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::NewL(const TDesC& aTestName)
       
  1022 	{
       
  1023 	RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest* self = new (ELeave) RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest(aTestName);
       
  1024 	return self;
       
  1025 	}
       
  1026 
       
  1027 void RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::DoKickoffTestL()
       
  1028 	{
       
  1029 	TPtrC fourccCode;
       
  1030 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  1031 		{
       
  1032 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  1033 		StopTest(KErrNotFound);
       
  1034 		return;
       
  1035 		}
       
  1036 	EncodingFromStringToTFourCC(fourccCode);
       
  1037 	}
       
  1038 
       
  1039 void RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1040 	{
       
  1041 	switch(iDevSoundState)
       
  1042 		{
       
  1043 		case EStateCreated:
       
  1044 			{
       
  1045 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest"),EFsmIncorrectErrorPassed));
       
  1046 			if(aDevSoundEvent == EEventInitialize)
       
  1047 				{
       
  1048 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1049 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
  1050 				if(err != KErrNone)
       
  1051 					{
       
  1052 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  1053 					StopTest(err);
       
  1054 					break;
       
  1055 					}
       
  1056 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1057 				iDevSoundState = EStateInitializing;
       
  1058 				}
       
  1059 			else
       
  1060 				{
       
  1061 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1062 				StopTest(aError, EFail);
       
  1063 				}
       
  1064 			break;
       
  1065 			}
       
  1066 		case EStateInitializing:
       
  1067 			{
       
  1068 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  1069 				{
       
  1070 				if(!iReinitialized)
       
  1071 					{
       
  1072 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
  1073 					iReinitialized = ETrue;
       
  1074 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
  1075 					TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  1076 					if(err != KErrNone)
       
  1077 						{
       
  1078 						StopTest(err);
       
  1079 						break;
       
  1080 						}
       
  1081 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1082 					iDevSoundState = EStateInitializing;
       
  1083 					}
       
  1084 				else
       
  1085 					{
       
  1086 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
  1087 					StopTest();
       
  1088 					}
       
  1089 				}
       
  1090 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  1091 				{
       
  1092 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  1093 				StopTest(aError);		
       
  1094 				}
       
  1095 			else
       
  1096 				{
       
  1097 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  1098 				StopTest(aError, EFail);
       
  1099 				}
       
  1100 			break;
       
  1101 			}	
       
  1102 		default:
       
  1103 			{
       
  1104 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1105 			StopTest(aError, EFail);
       
  1106 			}
       
  1107 		}
       
  1108 	}
       
  1109 
       
  1110 /*
       
  1111  *========================================================================================================
       
  1112  * MM-A3F-DEVSOUND-CHRTZ-INIT-0013
       
  1113  */
       
  1114 RA3FDevSoundPlayInitializeInvalidTFourCCTest::RA3FDevSoundPlayInitializeInvalidTFourCCTest(const TDesC& aTestName) 
       
  1115 	: 	RA3FDevSoundTestBase(aTestName)
       
  1116 	{
       
  1117 	}
       
  1118 
       
  1119 RA3FDevSoundPlayInitializeInvalidTFourCCTest* RA3FDevSoundPlayInitializeInvalidTFourCCTest::NewL(const TDesC& aTestName)
       
  1120 	{
       
  1121 	RA3FDevSoundPlayInitializeInvalidTFourCCTest* self = new (ELeave) RA3FDevSoundPlayInitializeInvalidTFourCCTest(aTestName);
       
  1122 	return self;
       
  1123 	}
       
  1124 
       
  1125 void RA3FDevSoundPlayInitializeInvalidTFourCCTest::DoKickoffTestL()
       
  1126 	{
       
  1127 	}
       
  1128 
       
  1129 void RA3FDevSoundPlayInitializeInvalidTFourCCTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1130 	{
       
  1131 	switch(iDevSoundState)
       
  1132 		{
       
  1133 		case EStateCreated:
       
  1134 			{
       
  1135 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeInvalidTFourCCTest"),EFsmIncorrectErrorPassed));
       
  1136 			if(aDevSoundEvent == EEventInitialize)
       
  1137 				{
       
  1138 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1139 				TRAPD(err, iMMFDevSound->InitializeL(*this, 0x00000000, EMMFStatePlaying));
       
  1140 				if(err == KErrNotSupported)
       
  1141 					{
       
  1142 					INFO_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TFourCC argument left with expected error = %d"), err);
       
  1143 					StopTest(err, EPass);
       
  1144 					break;
       
  1145 					}
       
  1146 				else
       
  1147 					{
       
  1148 					ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TFourCC argument left with expected error = %d"), err);
       
  1149 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported);
       
  1150 					StopTest(err, EFail);
       
  1151 					}
       
  1152 				}
       
  1153 			break;
       
  1154 			}
       
  1155 		default:
       
  1156 			{
       
  1157 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1158 			StopTest(aError, EFail);
       
  1159 			}
       
  1160 		}
       
  1161 	}
       
  1162 
       
  1163 /*
       
  1164  *========================================================================================================
       
  1165  * MM-A3F-DEVSOUND-CHRTZ-INIT-0014
       
  1166  */
       
  1167 RA3FDevSoundRecordInitializationTest::RA3FDevSoundRecordInitializationTest(const TDesC& aTestName) 
       
  1168 	: 	RA3FDevSoundTestBase(aTestName)
       
  1169 	{
       
  1170 	}
       
  1171 
       
  1172 RA3FDevSoundRecordInitializationTest* RA3FDevSoundRecordInitializationTest::NewL(const TDesC& aTestName)
       
  1173 	{
       
  1174 	RA3FDevSoundRecordInitializationTest* self = new (ELeave) RA3FDevSoundRecordInitializationTest(aTestName);
       
  1175 	return self;
       
  1176 	}
       
  1177 
       
  1178 void RA3FDevSoundRecordInitializationTest::DoKickoffTestL()
       
  1179 	{
       
  1180 	TPtrC fourccCode;
       
  1181 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  1182 		{
       
  1183 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  1184 		StopTest(KErrNotFound);
       
  1185 		return;
       
  1186 		}
       
  1187 	EncodingFromStringToTFourCC(fourccCode);
       
  1188 	}
       
  1189 
       
  1190 void RA3FDevSoundRecordInitializationTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1191 	{
       
  1192 	switch(iDevSoundState)
       
  1193 		{
       
  1194 		case EStateCreated:
       
  1195 			{
       
  1196 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializationTest"),EFsmIncorrectErrorPassed));
       
  1197 			if(aDevSoundEvent == EEventInitialize)
       
  1198 				{
       
  1199 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1200 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  1201 				if(err != KErrNone)
       
  1202 					{
       
  1203 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  1204 					StopTest(err);
       
  1205 					break;
       
  1206 					}
       
  1207 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1208 				iDevSoundState = EStateInitializing;
       
  1209 				}
       
  1210 			else
       
  1211 				{
       
  1212 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1213 				StopTest(aError, EFail);
       
  1214 				}
       
  1215 			break;
       
  1216 			}
       
  1217 		case EStateInitializing:
       
  1218 			{
       
  1219 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  1220 				{
       
  1221 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  1222 				StopTest();
       
  1223 				}
       
  1224 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  1225 				{
       
  1226 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  1227 				StopTest(aError);		
       
  1228 				}
       
  1229 			else
       
  1230 				{
       
  1231 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  1232 				StopTest(aError, EFail);
       
  1233 				}
       
  1234 			break;
       
  1235 			}	
       
  1236 		default:
       
  1237 			{
       
  1238 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1239 			StopTest(aError, EFail);
       
  1240 			}
       
  1241 		}
       
  1242 	}
       
  1243 
       
  1244 /*
       
  1245  *========================================================================================================
       
  1246  * MM-A3F-DEVSOUND-CHRTZ-INIT-0015
       
  1247  */
       
  1248 RA3FDevSoundRecordCancelInitializeTest::RA3FDevSoundRecordCancelInitializeTest(const TDesC& aTestName) 
       
  1249 	:	RA3FDevSoundTestBase(aTestName),iInitCompleteReceived(EFalse),
       
  1250 	iSampleRate(0), iChannels(0)
       
  1251 	{
       
  1252 	}
       
  1253 
       
  1254 RA3FDevSoundRecordCancelInitializeTest* RA3FDevSoundRecordCancelInitializeTest::NewL(const TDesC& aTestName)
       
  1255 	{
       
  1256 	RA3FDevSoundRecordCancelInitializeTest* self = new (ELeave) RA3FDevSoundRecordCancelInitializeTest(aTestName);
       
  1257 	return self;
       
  1258 	}
       
  1259 
       
  1260 void RA3FDevSoundRecordCancelInitializeTest::DoKickoffTestL()
       
  1261 	{
       
  1262 	if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate))
       
  1263 		{
       
  1264 		ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate);
       
  1265 		StopTest(KErrNotFound);
       
  1266 		return;
       
  1267 		}
       
  1268 	if (!GetIntFromConfig(iTestStepName, KChannel, iChannels))
       
  1269 		{
       
  1270 		ERR_PRINTF2(KMsgErrorGetParameter, &KChannel);
       
  1271 		StopTest(KErrNotFound);
       
  1272 		return;
       
  1273 		}
       
  1274 	TPtrC fourccCode;
       
  1275 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  1276 		{
       
  1277 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  1278 		StopTest(KErrNotFound);
       
  1279 		return;
       
  1280 		}
       
  1281 	EncodingFromStringToTFourCC(fourccCode);
       
  1282 	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
       
  1283 	}
       
  1284 
       
  1285 void RA3FDevSoundRecordCancelInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1286 	{
       
  1287 	switch(iDevSoundState)
       
  1288 		{
       
  1289 		case EStateCreated:
       
  1290 			{
       
  1291 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordCancelInitializeTest"),EFsmIncorrectErrorPassed));
       
  1292 			if(aDevSoundEvent == EEventInitialize)
       
  1293 				{
       
  1294 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1295 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  1296 				if(err != KErrNone)
       
  1297 					{
       
  1298 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  1299 					StopTest(err);
       
  1300 					break;
       
  1301 					}		
       
  1302 				StartTimer(KMicroSecsTwoSec);
       
  1303 				INFO_PRINTF1(_L("Calling CMMFDevSound::CancelInitialize"));
       
  1304 				err = iMMFDevSound->CancelInitialize();
       
  1305 				if(err != KErrNone)
       
  1306 					{
       
  1307 					ERR_PRINTF2(_L("Unexpected error on CancelInitialize = %d"), err);
       
  1308 					StopTest(err);
       
  1309 					}
       
  1310 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1311 				iDevSoundState = EStateInitializing;
       
  1312 				}
       
  1313 			else
       
  1314 				{
       
  1315 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1316 				StopTest(aError, EFail);
       
  1317 				}
       
  1318 			break;
       
  1319 			}
       
  1320 		case EStateInitializing:
       
  1321 			{
       
  1322 			if(aDevSoundEvent == EEventInitComplete)
       
  1323 				{
       
  1324 				iInitCompleteReceived = ETrue;
       
  1325 				}
       
  1326 			break;
       
  1327 			}	
       
  1328 		default:
       
  1329 			{
       
  1330 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1331 			StopTest(aError, EFail);
       
  1332 			}
       
  1333 		}
       
  1334 	}
       
  1335 
       
  1336 void RA3FDevSoundRecordCancelInitializeTest::DoTimerCallback()
       
  1337 	{
       
  1338 	if(!iInitCompleteReceived)
       
  1339 		{
       
  1340 		INFO_PRINTF1(_L("Waiting for InitializeComplete event"));
       
  1341 		iInitCompleteReceived = ETrue;
       
  1342 		}
       
  1343 	else
       
  1344 		{
       
  1345 		iTimer->Cancel();
       
  1346 		TMMFCapabilities capabilitiesSet;
       
  1347 		TBuf<KMaxSampleRateStringLength> stringSampleRateSet;
       
  1348 		TBuf<KMaxChannelsStringLength> stringChannelsSet;
       
  1349 		SampleRateFromTIntToTMMFSampleRate (iSampleRate, iESampleRate);
       
  1350 		capabilitiesSet.iRate = iESampleRate;
       
  1351 		capabilitiesSet.iChannels = iChannels;
       
  1352 		SampleRateFromTUintToString (capabilitiesSet.iRate,	stringSampleRateSet);
       
  1353 		ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet);
       
  1354 		INFO_PRINTF3(_L("Settings for Sample rate an channel mode. %S %S"), &stringSampleRateSet, &stringChannelsSet);
       
  1355 		INFO_PRINTF1(_L("Calling CMMFDevSound::SetConfigL"));
       
  1356 		TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet));
       
  1357 		if (err ==  KErrNotReady)
       
  1358 			{
       
  1359 			INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with the expected error = %d"), err);
       
  1360 			StopTest();
       
  1361 			}
       
  1362 		else
       
  1363 			{
       
  1364 			INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err);
       
  1365 			ERR_PRINTF2(_L("Expected error value = %d"), KErrNotReady);
       
  1366 			StopTest(err, EFail);
       
  1367 			}
       
  1368 		}
       
  1369 	}
       
  1370 
       
  1371 void RA3FDevSoundRecordCancelInitializeTest::InitializeComplete(TInt aError)
       
  1372 	{
       
  1373 	ERR_PRINTF1(_L("DevSound called InitializeComplete after calling CMMFDevSound::CancelInitialize"));
       
  1374 	StopTest(aError, EFail);
       
  1375 	}
       
  1376 
       
  1377 
       
  1378 /*
       
  1379  *========================================================================================================
       
  1380  * MM-A3F-DEVSOUND-CHRTZ-INIT-0016
       
  1381  */
       
  1382 RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::RA3FDevSoundRecordInitializeThenPlayToneInitializeTest(const TDesC& aTestName) 
       
  1383 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
  1384 	{
       
  1385 	}
       
  1386 
       
  1387 RA3FDevSoundRecordInitializeThenPlayToneInitializeTest* RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::NewL(const TDesC& aTestName)
       
  1388 	{
       
  1389 	RA3FDevSoundRecordInitializeThenPlayToneInitializeTest* self = new (ELeave) RA3FDevSoundRecordInitializeThenPlayToneInitializeTest(aTestName);
       
  1390 	return self;
       
  1391 	}
       
  1392 
       
  1393 void RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::DoKickoffTestL()
       
  1394 	{
       
  1395 	TPtrC fourccCode;
       
  1396 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  1397 		{
       
  1398 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  1399 		StopTest(KErrNotFound);
       
  1400 		return;
       
  1401 		}
       
  1402 	EncodingFromStringToTFourCC(fourccCode);
       
  1403 	}
       
  1404 
       
  1405 void RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1406 	{
       
  1407 	switch(iDevSoundState)
       
  1408 		{
       
  1409 		case EStateCreated:
       
  1410 			{
       
  1411 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializeThenPlayToneInitializeTest"),EFsmIncorrectErrorPassed));
       
  1412 			if(aDevSoundEvent == EEventInitialize)
       
  1413 				{
       
  1414 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1415 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  1416 				if(err != KErrNone)
       
  1417 					{
       
  1418 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  1419 					StopTest(err);
       
  1420 					break;
       
  1421 					}
       
  1422 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1423 				iDevSoundState = EStateInitializing;
       
  1424 				}
       
  1425 			else
       
  1426 				{
       
  1427 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1428 				StopTest(aError, EFail);
       
  1429 				}
       
  1430 			break;
       
  1431 			}
       
  1432 		case EStateInitializing:
       
  1433 			{
       
  1434 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  1435 				{
       
  1436 				if(!iReinitialized)
       
  1437 					{
       
  1438 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
  1439 					iReinitialized = ETrue;
       
  1440 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
  1441 					TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
  1442 					if(err != KErrNone)
       
  1443 						{
       
  1444 						StopTest(err);
       
  1445 						break;
       
  1446 						}
       
  1447 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1448 					iDevSoundState = EStateInitializing;
       
  1449 					}
       
  1450 				else
       
  1451 					{
       
  1452 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
  1453 					StopTest();
       
  1454 					}
       
  1455 				}
       
  1456 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  1457 				{
       
  1458 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  1459 				StopTest(aError);		
       
  1460 				}
       
  1461 			else
       
  1462 				{
       
  1463 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  1464 				StopTest(aError, EFail);
       
  1465 				}
       
  1466 			break;
       
  1467 			}	
       
  1468 		default:
       
  1469 			{
       
  1470 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1471 			StopTest(aError, EFail);
       
  1472 			}
       
  1473 		}
       
  1474 	}
       
  1475 
       
  1476 
       
  1477 /*
       
  1478  *========================================================================================================
       
  1479  * MM-A3F-DEVSOUND-CHRTZ-INIT-0017
       
  1480  */
       
  1481 RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest(const TDesC& aTestName) 
       
  1482 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
  1483 	{
       
  1484 	}
       
  1485 
       
  1486 RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest* RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::NewL(const TDesC& aTestName)
       
  1487 	{
       
  1488 	RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest* self = new (ELeave) RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest(aTestName);
       
  1489 	return self;
       
  1490 	}
       
  1491 
       
  1492 void RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::DoKickoffTestL()
       
  1493 	{
       
  1494 	TPtrC fourccCode;
       
  1495 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  1496 		{
       
  1497 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  1498 		StopTest(KErrNotFound);
       
  1499 		return;
       
  1500 		}
       
  1501 	EncodingFromStringToTFourCC(fourccCode);
       
  1502 	}
       
  1503 
       
  1504 void RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1505 	{
       
  1506 	switch(iDevSoundState)
       
  1507 		{
       
  1508 		case EStateCreated:
       
  1509 			{
       
  1510 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest"),EFsmIncorrectErrorPassed));
       
  1511 			if(aDevSoundEvent == EEventInitialize)
       
  1512 				{
       
  1513 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1514 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  1515 				if(err != KErrNone)
       
  1516 					{
       
  1517 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  1518 					StopTest(err);
       
  1519 					break;
       
  1520 					}
       
  1521 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1522 				iDevSoundState = EStateInitializing;
       
  1523 				}
       
  1524 			else
       
  1525 				{
       
  1526 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1527 				StopTest(aError, EFail);
       
  1528 				}
       
  1529 			break;
       
  1530 			}
       
  1531 		case EStateInitializing:
       
  1532 			{
       
  1533 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  1534 				{
       
  1535 				if(!iReinitialized)
       
  1536 					{
       
  1537 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
  1538 					iReinitialized = ETrue;
       
  1539 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
  1540 					TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
  1541 					if(err != KErrNone)
       
  1542 						{
       
  1543 						StopTest(err);
       
  1544 						break;
       
  1545 						}
       
  1546 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1547 					iDevSoundState = EStateInitializing;
       
  1548 					}
       
  1549 				else
       
  1550 					{
       
  1551 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
  1552 					StopTest();
       
  1553 					}
       
  1554 				}
       
  1555 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  1556 				{
       
  1557 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  1558 				StopTest(aError);		
       
  1559 				}
       
  1560 			else
       
  1561 				{
       
  1562 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  1563 				StopTest(aError, EFail);
       
  1564 				}
       
  1565 			break;
       
  1566 			}	
       
  1567 		default:
       
  1568 			{
       
  1569 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1570 			StopTest(aError, EFail);
       
  1571 			}
       
  1572 		}
       
  1573 	}
       
  1574 
       
  1575 
       
  1576 /*
       
  1577  *========================================================================================================
       
  1578  * MM-A3F-DEVSOUND-CHRTZ-INIT-0018
       
  1579  */
       
  1580 RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::RA3FDevSoundRecordInitializeToRecordAudioTwiceTest(const TDesC& aTestName) 
       
  1581 	: 	RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse)
       
  1582 	{
       
  1583 	}
       
  1584 
       
  1585 RA3FDevSoundRecordInitializeToRecordAudioTwiceTest* RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::NewL(const TDesC& aTestName)
       
  1586 	{
       
  1587 	RA3FDevSoundRecordInitializeToRecordAudioTwiceTest* self = new (ELeave) RA3FDevSoundRecordInitializeToRecordAudioTwiceTest(aTestName);
       
  1588 	return self;
       
  1589 	}
       
  1590 
       
  1591 void RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::DoKickoffTestL()
       
  1592 	{
       
  1593 	TPtrC fourccCode;
       
  1594 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  1595 		{
       
  1596 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  1597 		StopTest(KErrNotFound);
       
  1598 		return;
       
  1599 		}
       
  1600 	EncodingFromStringToTFourCC(fourccCode);
       
  1601 	}
       
  1602 
       
  1603 void RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1604 	{
       
  1605 	switch(iDevSoundState)
       
  1606 		{
       
  1607 		case EStateCreated:
       
  1608 			{
       
  1609 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializeToRecordAudioTwiceTest"),EFsmIncorrectErrorPassed));
       
  1610 			if(aDevSoundEvent == EEventInitialize)
       
  1611 				{
       
  1612 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1613 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  1614 				if(err != KErrNone)
       
  1615 					{
       
  1616 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  1617 					StopTest(err);
       
  1618 					break;
       
  1619 					}
       
  1620 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1621 				iDevSoundState = EStateInitializing;
       
  1622 				}
       
  1623 			else
       
  1624 				{
       
  1625 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1626 				StopTest(aError, EFail);
       
  1627 				}
       
  1628 			break;
       
  1629 			}
       
  1630 		case EStateInitializing:
       
  1631 			{
       
  1632 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  1633 				{
       
  1634 				if(!iReinitialized)
       
  1635 					{
       
  1636 					INFO_PRINTF1(_L("========== First initialization successfully completed =========="));
       
  1637 					iReinitialized = ETrue;
       
  1638 					INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL"));
       
  1639 					TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  1640 					if(err != KErrNone)
       
  1641 						{
       
  1642 						StopTest(err);
       
  1643 						break;
       
  1644 						}
       
  1645 					INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1646 					iDevSoundState = EStateInitializing;
       
  1647 					}
       
  1648 				else
       
  1649 					{
       
  1650 					INFO_PRINTF1(_L("========== Second initialization successfully completed =========="));
       
  1651 					StopTest();
       
  1652 					}
       
  1653 				}
       
  1654 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  1655 				{
       
  1656 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  1657 				StopTest(aError);		
       
  1658 				}
       
  1659 			else
       
  1660 				{
       
  1661 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  1662 				StopTest(aError, EFail);
       
  1663 				}
       
  1664 			break;
       
  1665 			}	
       
  1666 		default:
       
  1667 			{
       
  1668 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1669 			StopTest(aError, EFail);
       
  1670 			}
       
  1671 		}
       
  1672 	}
       
  1673 
       
  1674 
       
  1675 /*
       
  1676  *========================================================================================================
       
  1677  * MM-A3F-DEVSOUND-CHRTZ-INIT-0019
       
  1678  */
       
  1679 RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest(const TDesC& aTestName) 
       
  1680 	:	RA3FDevSoundTestBase(aTestName)
       
  1681 	{
       
  1682 	}
       
  1683 
       
  1684 RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest* RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::NewL(const TDesC& aTestName)
       
  1685 	{
       
  1686 	RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest* self = new (ELeave) RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest(aTestName);
       
  1687 	return self;
       
  1688 	}
       
  1689 
       
  1690 void RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::DoKickoffTestL()
       
  1691 	{
       
  1692 	}
       
  1693 
       
  1694 void RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1695 	{
       
  1696 	switch(iDevSoundState)
       
  1697 		{
       
  1698 		case EStateCreated:
       
  1699 			{
       
  1700 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundReocordCancelInitializeNoFormatSpecificationPresentedTest"),EFsmIncorrectErrorPassed));
       
  1701 			if(aDevSoundEvent == EEventInitialize)
       
  1702 				{
       
  1703 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  1704 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording));
       
  1705 				if(err != KErrNone)
       
  1706 					{
       
  1707 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  1708 					StopTest(err);
       
  1709 					break;
       
  1710 					}		
       
  1711 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  1712 				iDevSoundState = EStateInitializing;
       
  1713 				}
       
  1714 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  1715 				{
       
  1716 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  1717 				StopTest(aError);		
       
  1718 				}
       
  1719 			else
       
  1720 				{
       
  1721 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1722 				StopTest(aError, EFail);
       
  1723 				}
       
  1724 			break;
       
  1725 			}
       
  1726 		case EStateInitializing:
       
  1727 			{
       
  1728 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  1729 				{
       
  1730 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  1731 				StopTest();
       
  1732 				}
       
  1733 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  1734 				{
       
  1735 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  1736 				StopTest(aError);		
       
  1737 				}
       
  1738 			else
       
  1739 				{
       
  1740 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  1741 				StopTest(aError, EFail);
       
  1742 				}
       
  1743 			break;
       
  1744 			}	
       
  1745 		default:
       
  1746 			{
       
  1747 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1748 			StopTest(aError, EFail);
       
  1749 			}
       
  1750 		}
       
  1751 	}
       
  1752 
       
  1753 
       
  1754 /*
       
  1755  *========================================================================================================
       
  1756  * MM-A3F-DEVSOUND-CHRTZ-INIT-0020
       
  1757  */
       
  1758 RA3FDevSoundPlayDataWithoutInitializeTest::RA3FDevSoundPlayDataWithoutInitializeTest(const TDesC& aTestName) 
       
  1759 	:	RA3FDevSoundTestBase(aTestName)
       
  1760 	{
       
  1761 	}
       
  1762 
       
  1763 RA3FDevSoundPlayDataWithoutInitializeTest* RA3FDevSoundPlayDataWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  1764 	{
       
  1765 	RA3FDevSoundPlayDataWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayDataWithoutInitializeTest(aTestName);
       
  1766 	return self;
       
  1767 	}
       
  1768 
       
  1769 void RA3FDevSoundPlayDataWithoutInitializeTest::DoKickoffTestL()
       
  1770 	{
       
  1771 	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
       
  1772 	}
       
  1773 
       
  1774 void RA3FDevSoundPlayDataWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1775 	{
       
  1776 	switch(iDevSoundState)
       
  1777 		{
       
  1778 		case EStateCreated:
       
  1779 			{
       
  1780 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayDataWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  1781 			if(aDevSoundEvent == EEventInitialize)
       
  1782 				{
       
  1783 				INFO_PRINTF1(_L("Call CMMFDevSound::PlayData without calling CMMFDevSound::InitializeL..."));
       
  1784 				iMMFDevSound->PlayData();
       
  1785 				StartTimer(KMicroSecsTwoSec);
       
  1786 				}
       
  1787 			else
       
  1788 				{
       
  1789 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1790 				StopTest(aError, EFail);
       
  1791 				}
       
  1792 			break;
       
  1793 			}
       
  1794 		default:
       
  1795 			{
       
  1796 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1797 			StopTest(aError, EFail);
       
  1798 			}
       
  1799 		}
       
  1800 	}
       
  1801 
       
  1802 void RA3FDevSoundPlayDataWithoutInitializeTest::DoTimerCallback()
       
  1803 	{
       
  1804 	iTimer->Cancel();
       
  1805 	ERR_PRINTF1(_L("Panic did not occur as expected when calling PlayData()."));
       
  1806 	StopTest(KErrNone, EFail);
       
  1807 	}
       
  1808 
       
  1809 /*
       
  1810  *========================================================================================================
       
  1811  * MM-A3F-DEVSOUND-CHRTZ-INIT-0021
       
  1812  */
       
  1813 RA3FDevSoundPlayDTMFStringWithoutInitializeTest::RA3FDevSoundPlayDTMFStringWithoutInitializeTest(const TDesC& aTestName) 
       
  1814 	:	RA3FDevSoundTestBase(aTestName), iDTMFString(KNullDesC)
       
  1815 	{
       
  1816 	}
       
  1817 
       
  1818 RA3FDevSoundPlayDTMFStringWithoutInitializeTest* RA3FDevSoundPlayDTMFStringWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  1819 	{
       
  1820 	RA3FDevSoundPlayDTMFStringWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayDTMFStringWithoutInitializeTest(aTestName);
       
  1821 	return self;
       
  1822 	}
       
  1823 
       
  1824 void RA3FDevSoundPlayDTMFStringWithoutInitializeTest::DoKickoffTestL()
       
  1825 	{
       
  1826 	TPtrC DTMF;
       
  1827 	if(!GetStringFromConfig(iTestStepName, KDTMFString, DTMF))
       
  1828 		{
       
  1829 		ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString);
       
  1830 		StopTest(KErrNotFound);
       
  1831 		return;
       
  1832 		}
       
  1833 	iDTMFString.Copy(DTMF);
       
  1834 	}
       
  1835 
       
  1836 void RA3FDevSoundPlayDTMFStringWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1837 	{
       
  1838 	switch(iDevSoundState)
       
  1839 		{
       
  1840 		case EStateCreated:
       
  1841 			{
       
  1842 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayDTMFStringWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  1843 			if(aDevSoundEvent == EEventInitialize)
       
  1844 				{
       
  1845 				INFO_PRINTF1(_L("Call CMMFDevSound::PlayDTMFStringL..."));
       
  1846 				TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString));
       
  1847 				if(err == KErrNotReady)
       
  1848 					{
       
  1849 					ERR_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL  without calling CMMFDevSound::InitializeL left with expected error = %d"), err);
       
  1850 					StopTest(err, EPass);
       
  1851 					break;
       
  1852 					}
       
  1853 				else
       
  1854 					{
       
  1855 					ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL  without calling CMMFDevSound::InitializeL left with error = %d"), err);
       
  1856 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  1857 					StopTest(err, EFail);
       
  1858 					}
       
  1859 				}
       
  1860 			else
       
  1861 				{
       
  1862 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1863 				StopTest(aError, EFail);
       
  1864 				}
       
  1865 			break;
       
  1866 			}
       
  1867 		default:
       
  1868 			{
       
  1869 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1870 			StopTest(aError, EFail);
       
  1871 			}
       
  1872 		}
       
  1873 	}
       
  1874 
       
  1875 
       
  1876 /*
       
  1877  *========================================================================================================
       
  1878  * MM-A3F-DEVSOUND-CHRTZ-INIT-0022
       
  1879  */
       
  1880 RA3FDevSoundPlayDualToneWithoutInitializeTest::RA3FDevSoundPlayDualToneWithoutInitializeTest(const TDesC& aTestName) 
       
  1881 	:	RA3FDevSoundTestBase(aTestName), iFrequencyTone1(0), iFrequencyTone2(0)
       
  1882 	{
       
  1883 	}
       
  1884 
       
  1885 RA3FDevSoundPlayDualToneWithoutInitializeTest* RA3FDevSoundPlayDualToneWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  1886 	{
       
  1887 	RA3FDevSoundPlayDualToneWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayDualToneWithoutInitializeTest(aTestName);
       
  1888 	return self;
       
  1889 	}
       
  1890 
       
  1891 void RA3FDevSoundPlayDualToneWithoutInitializeTest::DoKickoffTestL()
       
  1892 	{
       
  1893 	if(!GetIntFromConfig(iTestStepName, KDuration, iDuration)) 
       
  1894 		{
       
  1895 		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
       
  1896 		StopTest(KErrNotFound);
       
  1897 		return;
       
  1898 		}
       
  1899 	if(!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1)) 
       
  1900 		{
       
  1901 		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
       
  1902 		StopTest(KErrNotFound);
       
  1903 		return;
       
  1904 		}
       
  1905 	if(!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2)) 
       
  1906 		{
       
  1907 		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2);
       
  1908 		StopTest(KErrNotFound);
       
  1909 		return;
       
  1910 		}
       
  1911 	}
       
  1912 
       
  1913 void RA3FDevSoundPlayDualToneWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1914 	{
       
  1915 	switch(iDevSoundState)
       
  1916 		{
       
  1917 		case EStateCreated:
       
  1918 			{
       
  1919 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayDualToneWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  1920 			if(aDevSoundEvent == EEventInitialize)
       
  1921 				{
       
  1922 				INFO_PRINTF1(_L("Call CMMFDevSound::PlayDualToneL..."));
       
  1923 				TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1,iFrequencyTone2,iDuration));
       
  1924 				if(err == KErrNotReady)
       
  1925 					{
       
  1926 					ERR_PRINTF2(_L("Calling CMMFDevSound::PlayDualToneL  without calling CMMFDevSound::InitializeL left with expected error = %d"), err);
       
  1927 					StopTest(err, EPass);
       
  1928 					break;
       
  1929 					}
       
  1930 				else
       
  1931 					{
       
  1932 					ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL  without calling CMMFDevSound::InitializeL left with error = %d"), err);
       
  1933 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  1934 					StopTest(err, EFail);
       
  1935 					}
       
  1936 				}
       
  1937 			else
       
  1938 				{
       
  1939 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1940 				StopTest(aError, EFail);
       
  1941 				}
       
  1942 			break;
       
  1943 			}
       
  1944 		default:
       
  1945 			{
       
  1946 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  1947 			StopTest(aError, EFail);
       
  1948 			}
       
  1949 		}
       
  1950 	}
       
  1951 
       
  1952 
       
  1953 /*
       
  1954  *========================================================================================================
       
  1955  * MM-A3F-DEVSOUND-CHRTZ-INIT-0023
       
  1956  */
       
  1957 RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::RA3FDevSoundPlayFixedSequenceWithoutInitializeTest(const TDesC& aTestName) 
       
  1958 	:	RA3FDevSoundTestBase(aTestName)
       
  1959 	{
       
  1960 	}
       
  1961 
       
  1962 RA3FDevSoundPlayFixedSequenceWithoutInitializeTest* RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  1963 	{
       
  1964 	RA3FDevSoundPlayFixedSequenceWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayFixedSequenceWithoutInitializeTest(aTestName);
       
  1965 	return self;
       
  1966 	}
       
  1967 
       
  1968 void RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::DoKickoffTestL()
       
  1969 	{
       
  1970 	}
       
  1971 
       
  1972 void RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  1973 	{
       
  1974 	switch(iDevSoundState)
       
  1975 		{
       
  1976 		case EStateCreated:
       
  1977 			{
       
  1978 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayFixedSequenceWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  1979 			if(aDevSoundEvent == EEventInitialize)
       
  1980 				{
       
  1981 				INFO_PRINTF1(_L("Call CMMFDevSound::PlayFixedSequenceL..."));
       
  1982 				TRAPD(err, iMMFDevSound->PlayFixedSequenceL(0));
       
  1983 				if(err == KErrNotSupported)
       
  1984 					{
       
  1985 					ERR_PRINTF2(_L("Calling CMMFDevSound::PlayFixedSequenceL  without calling CMMFDevSound::InitializeL left with expected error = %d"), err);
       
  1986 					StopTest(err, EPass);
       
  1987 					break;
       
  1988 					}
       
  1989 				else
       
  1990 					{
       
  1991 					ERR_PRINTF2(_L("CMMFDevSound::PlayFixedSequenceL  without calling CMMFDevSound::InitializeL left with error = %d"), err);
       
  1992 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  1993 					StopTest(err, EFail);
       
  1994 					}
       
  1995 				}
       
  1996 			else
       
  1997 				{
       
  1998 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  1999 				StopTest(aError, EFail);
       
  2000 				}
       
  2001 			break;
       
  2002 			}
       
  2003 		default:
       
  2004 			{
       
  2005 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2006 			StopTest(aError, EFail);
       
  2007 			}
       
  2008 		}
       
  2009 	}
       
  2010 
       
  2011 
       
  2012 /*
       
  2013  *========================================================================================================
       
  2014  * MM-A3F-DEVSOUND-CHRTZ-INIT-0024
       
  2015  */
       
  2016 RA3FDevSoundPlayInitWithoutInitializeTest::RA3FDevSoundPlayInitWithoutInitializeTest(const TDesC& aTestName) 
       
  2017 	:	RA3FDevSoundTestBase(aTestName)
       
  2018 	{
       
  2019 	}
       
  2020 
       
  2021 RA3FDevSoundPlayInitWithoutInitializeTest* RA3FDevSoundPlayInitWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  2022 	{
       
  2023 	RA3FDevSoundPlayInitWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayInitWithoutInitializeTest(aTestName);
       
  2024 	return self;
       
  2025 	}
       
  2026 
       
  2027 void RA3FDevSoundPlayInitWithoutInitializeTest::DoKickoffTestL()
       
  2028 	{
       
  2029 	}
       
  2030 
       
  2031 void RA3FDevSoundPlayInitWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2032 	{
       
  2033 	switch(iDevSoundState)
       
  2034 		{
       
  2035 		case EStateCreated:
       
  2036 			{
       
  2037 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  2038 			if(aDevSoundEvent == EEventInitialize)
       
  2039 				{
       
  2040 				INFO_PRINTF1(_L("Call CMMFDevSound::PlayInitL without calling CMMFDevSound::InitializeL..."));
       
  2041 				TRAPD(err,iMMFDevSound->PlayInitL());
       
  2042 				if(err == KErrNotReady)
       
  2043 					{
       
  2044 					ERR_PRINTF2(_L("Calling CMMFDevSound::PlayInitL  without calling CMMFDevSound::InitializeL left with expected error = %d"), err);
       
  2045 					StopTest(err, EPass);
       
  2046 					break;
       
  2047 					}
       
  2048 				else
       
  2049 					{
       
  2050 					ERR_PRINTF2(_L("CMMFDevSound::PlayInitL  without calling CMMFDevSound::InitializeL left with error = %d"), err);
       
  2051 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  2052 					StopTest(err, EFail);
       
  2053 					}
       
  2054 				}
       
  2055 			else
       
  2056 				{
       
  2057 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2058 				StopTest(aError, EFail);
       
  2059 				}
       
  2060 			break;
       
  2061 			}
       
  2062 		default:
       
  2063 			{
       
  2064 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2065 			StopTest(aError, EFail);
       
  2066 			}
       
  2067 		}
       
  2068 	}
       
  2069 
       
  2070 
       
  2071 /*
       
  2072  *========================================================================================================
       
  2073  * MM-A3F-DEVSOUND-CHRTZ-INIT-0025
       
  2074  */
       
  2075 RA3FDevSoundPlayToneWithoutInitializeTest::RA3FDevSoundPlayToneWithoutInitializeTest(const TDesC& aTestName) 
       
  2076 	:	RA3FDevSoundTestBase(aTestName), iFrequencyTone1(0)
       
  2077 	{
       
  2078 	}
       
  2079 
       
  2080 RA3FDevSoundPlayToneWithoutInitializeTest* RA3FDevSoundPlayToneWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  2081 	{
       
  2082 	RA3FDevSoundPlayToneWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayToneWithoutInitializeTest(aTestName);
       
  2083 	return self;
       
  2084 	}
       
  2085 
       
  2086 void RA3FDevSoundPlayToneWithoutInitializeTest::DoKickoffTestL()
       
  2087 	{
       
  2088 	if(!GetIntFromConfig(iTestStepName, KDuration, iDuration)) 
       
  2089 		{
       
  2090 		ERR_PRINTF2(KMsgErrorGetParameter, &KDuration);
       
  2091 		StopTest(KErrNotFound);
       
  2092 		return;
       
  2093 		}
       
  2094 	if(!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1)) 
       
  2095 		{
       
  2096 		ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1);
       
  2097 		StopTest(KErrNotFound);
       
  2098 		return;
       
  2099 		}
       
  2100 	}
       
  2101 
       
  2102 void RA3FDevSoundPlayToneWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2103 	{
       
  2104 	switch(iDevSoundState)
       
  2105 		{
       
  2106 		case EStateCreated:
       
  2107 			{
       
  2108 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayToneWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  2109 			if(aDevSoundEvent == EEventInitialize)
       
  2110 				{
       
  2111 				INFO_PRINTF1(_L("Call CMMFDevSound::PlayToneL..."));
       
  2112 				TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration));
       
  2113 				if(err == KErrNotReady)
       
  2114 					{
       
  2115 					ERR_PRINTF2(_L("Calling CMMFDevSound::PlayToneL  without calling CMMFDevSound::InitializeL left with expected error = %d"), err);
       
  2116 					StopTest(err, EPass);
       
  2117 					break;
       
  2118 					}
       
  2119 				else
       
  2120 					{
       
  2121 					ERR_PRINTF2(_L("CMMFDevSound::PlayToneL  without calling CMMFDevSound::InitializeL left with error = %d"), err);
       
  2122 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  2123 					StopTest(err, EFail);
       
  2124 					}
       
  2125 				}
       
  2126 			else
       
  2127 				{
       
  2128 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2129 				StopTest(aError, EFail);
       
  2130 				}
       
  2131 			break;
       
  2132 			}
       
  2133 		default:
       
  2134 			{
       
  2135 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2136 			StopTest(aError, EFail);
       
  2137 			}
       
  2138 		}
       
  2139 	}
       
  2140 
       
  2141 
       
  2142 /*
       
  2143  *========================================================================================================
       
  2144  * MM-A3F-DEVSOUND-CHRTZ-INIT-0026
       
  2145  */
       
  2146 RA3FDevSoundPlayToneSequenceWithoutInitializeTest::RA3FDevSoundPlayToneSequenceWithoutInitializeTest(const TDesC& aTestName) 
       
  2147 	:	RA3FDevSoundTestBase(aTestName)
       
  2148 	{
       
  2149 	}
       
  2150 
       
  2151 RA3FDevSoundPlayToneSequenceWithoutInitializeTest* RA3FDevSoundPlayToneSequenceWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  2152 	{
       
  2153 	RA3FDevSoundPlayToneSequenceWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayToneSequenceWithoutInitializeTest(aTestName);
       
  2154 	return self;
       
  2155 	}
       
  2156 
       
  2157 void RA3FDevSoundPlayToneSequenceWithoutInitializeTest::DoKickoffTestL()
       
  2158 	{
       
  2159 	}
       
  2160 
       
  2161 void RA3FDevSoundPlayToneSequenceWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2162 	{
       
  2163 	switch(iDevSoundState)
       
  2164 		{
       
  2165 		case EStateCreated:
       
  2166 			{
       
  2167 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayToneSequenceWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  2168 			if(aDevSoundEvent == EEventInitialize)
       
  2169 				{
       
  2170 				TUint8* tablePointer = const_cast<TUint8*>( &(KFixedSequenceTestSequenceDataX[0] )); 
       
  2171 				TPtrC8 KFixedSequenceData(tablePointer,  sizeof(KFixedSequenceTestSequenceDataX));
       
  2172 				INFO_PRINTF1(_L("Call CMMFDevSound::PlayToneSequenceL..."));
       
  2173 				TRAPD(err, iMMFDevSound->PlayToneSequenceL(KFixedSequenceData));
       
  2174 				if(err == KErrNotReady)
       
  2175 					{
       
  2176 					ERR_PRINTF2(_L("Calling CMMFDevSound::PlayToneSequenceL  without calling CMMFDevSound::InitializeL left with expected error = %d"), err);
       
  2177 					StopTest(err, EPass);
       
  2178 					break;
       
  2179 					}
       
  2180 				else
       
  2181 					{
       
  2182 					ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL  without calling CMMFDevSound::InitializeL left with error = %d"), err);
       
  2183 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  2184 					StopTest(err, EFail);
       
  2185 					}
       
  2186 				}
       
  2187 			else
       
  2188 				{
       
  2189 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2190 				StopTest(aError, EFail);
       
  2191 				}
       
  2192 			break;
       
  2193 			}
       
  2194 		default:
       
  2195 			{
       
  2196 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2197 			StopTest(aError, EFail);
       
  2198 			}
       
  2199 		}
       
  2200 	}
       
  2201 
       
  2202 
       
  2203 /*
       
  2204  *========================================================================================================
       
  2205  * MM-A3F-DEVSOUND-CHRTZ-INIT-0027
       
  2206  */
       
  2207 RA3FDevSoundRecordDataWithoutInitializeTest::RA3FDevSoundRecordDataWithoutInitializeTest(const TDesC& aTestName) 
       
  2208 	:	RA3FDevSoundTestBase(aTestName)
       
  2209 	{
       
  2210 	}
       
  2211 
       
  2212 RA3FDevSoundRecordDataWithoutInitializeTest* RA3FDevSoundRecordDataWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  2213 	{
       
  2214 	RA3FDevSoundRecordDataWithoutInitializeTest* self = new (ELeave) RA3FDevSoundRecordDataWithoutInitializeTest(aTestName);
       
  2215 	return self;
       
  2216 	}
       
  2217 
       
  2218 void RA3FDevSoundRecordDataWithoutInitializeTest::DoKickoffTestL()
       
  2219 	{
       
  2220 	iTimer = CPeriodic::NewL(CActive::EPriorityHigh);
       
  2221 	}
       
  2222 
       
  2223 void RA3FDevSoundRecordDataWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2224 	{
       
  2225 	switch(iDevSoundState)
       
  2226 		{
       
  2227 		case EStateCreated:
       
  2228 			{
       
  2229 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordDataWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  2230 			if(aDevSoundEvent == EEventInitialize)
       
  2231 				{
       
  2232 				INFO_PRINTF1(_L("Call CMMFDevSound::RecordData without calling CMMFDevSound::InitializeL..."));
       
  2233 				iMMFDevSound->RecordData();
       
  2234 				StartTimer(KMicroSecsTwoSec);
       
  2235 				}
       
  2236 			else
       
  2237 				{
       
  2238 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2239 				StopTest(aError, EFail);
       
  2240 				}
       
  2241 			break;
       
  2242 			}
       
  2243 		default:
       
  2244 			{
       
  2245 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2246 			StopTest(aError, EFail);
       
  2247 			}
       
  2248 		}
       
  2249 	}
       
  2250 
       
  2251 void RA3FDevSoundRecordDataWithoutInitializeTest::DoTimerCallback()
       
  2252 	{
       
  2253 	iTimer->Cancel();
       
  2254 	ERR_PRINTF1(_L("Panic did not occur as expected when calling RecordData()."));
       
  2255 	StopTest(KErrNone, EFail);
       
  2256 	}
       
  2257 
       
  2258 /*
       
  2259  *========================================================================================================
       
  2260  * MM-A3F-DEVSOUND-CHRTZ-INIT-0028
       
  2261  */
       
  2262 RA3FDevSoundRecordInitWithoutInitializeTest::RA3FDevSoundRecordInitWithoutInitializeTest(const TDesC& aTestName) 
       
  2263 	:	RA3FDevSoundTestBase(aTestName)
       
  2264 	{
       
  2265 	}
       
  2266 
       
  2267 RA3FDevSoundRecordInitWithoutInitializeTest* RA3FDevSoundRecordInitWithoutInitializeTest::NewL(const TDesC& aTestName)
       
  2268 	{
       
  2269 	RA3FDevSoundRecordInitWithoutInitializeTest* self = new (ELeave) RA3FDevSoundRecordInitWithoutInitializeTest(aTestName);
       
  2270 	return self;
       
  2271 	}
       
  2272 
       
  2273 void RA3FDevSoundRecordInitWithoutInitializeTest::DoKickoffTestL()
       
  2274 	{
       
  2275 	}
       
  2276 
       
  2277 void RA3FDevSoundRecordInitWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2278 	{
       
  2279 	switch(iDevSoundState)
       
  2280 		{
       
  2281 		case EStateCreated:
       
  2282 			{
       
  2283 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitWithoutInitializeTest"),EFsmIncorrectErrorPassed));
       
  2284 			if(aDevSoundEvent == EEventInitialize)
       
  2285 				{
       
  2286 				INFO_PRINTF1(_L("Call CMMFDevSound::RecordInitL without calling CMMFDevSound::InitializeL..."));
       
  2287 				TRAPD(err,iMMFDevSound->RecordInitL());
       
  2288 				if(err == KErrNotReady)
       
  2289 					{
       
  2290 					ERR_PRINTF2(_L("Calling CMMFDevSound::RecordInitL  without calling CMMFDevSound::InitializeL left with expected error = %d"), err);
       
  2291 					StopTest(err, EPass);
       
  2292 					break;
       
  2293 					}
       
  2294 				else
       
  2295 					{
       
  2296 					ERR_PRINTF2(_L("CMMFDevSound::RecordInitL  without calling CMMFDevSound::InitializeL left with error = %d"), err);
       
  2297 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  2298 					StopTest(err, EFail);
       
  2299 					}
       
  2300 				}
       
  2301 			else
       
  2302 				{
       
  2303 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2304 				StopTest(aError, EFail);
       
  2305 				}
       
  2306 			break;
       
  2307 			}
       
  2308 		default:
       
  2309 			{
       
  2310 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2311 			StopTest(aError, EFail);
       
  2312 			}
       
  2313 		}
       
  2314 	}
       
  2315 
       
  2316 
       
  2317 /*
       
  2318  *========================================================================================================
       
  2319  * MM-A3F-DEVSOUND-CHRTZ-INIT-0029
       
  2320  */
       
  2321 RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest(const TDesC& aTestName) 
       
  2322 	:	RA3FDevSoundTestBase(aTestName)
       
  2323 	{
       
  2324 	}
       
  2325 
       
  2326 RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest* RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::NewL(const TDesC& aTestName)
       
  2327 	{
       
  2328 	RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest* self = new (ELeave) RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest(aTestName);
       
  2329 	return self;
       
  2330 	}
       
  2331 
       
  2332 void RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::DoKickoffTestL()
       
  2333 	{
       
  2334 	}
       
  2335 
       
  2336 void RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2337 	{
       
  2338 	switch(iDevSoundState)
       
  2339 		{
       
  2340 		case EStateCreated:
       
  2341 			{
       
  2342 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest"),EFsmIncorrectErrorPassed));
       
  2343 			if(aDevSoundEvent == EEventInitialize)
       
  2344 				{
       
  2345 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  2346 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
  2347 				if(err != KErrNone)
       
  2348 					{
       
  2349 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2350 					StopTest(err);
       
  2351 					break;
       
  2352 					}
       
  2353 				INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice before init complete"));
       
  2354 				TRAP(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
  2355 				if(err != KErrNotReady)
       
  2356 					{
       
  2357 					ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL more than once before init complete left with error = %d"), err);
       
  2358 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  2359 					StopTest(err, EFail);
       
  2360 					}
       
  2361 				else
       
  2362 					{
       
  2363 					INFO_PRINTF1(_L("Second call to CMMFDevSound::InitializeL leaves with KErrNotReady as expected"));
       
  2364 					}
       
  2365 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  2366 				iDevSoundState = EStateInitializing;
       
  2367 				}
       
  2368 			else
       
  2369 				{
       
  2370 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2371 				StopTest(aError, EFail);
       
  2372 				}
       
  2373 			break;
       
  2374 			}
       
  2375 		case EStateInitializing:
       
  2376 			{
       
  2377 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  2378 				{
       
  2379 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  2380 				StopTest();
       
  2381 				}
       
  2382 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  2383 				{
       
  2384 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  2385 				StopTest(aError);		
       
  2386 				}
       
  2387 			else
       
  2388 				{
       
  2389 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  2390 				StopTest(aError, EFail);
       
  2391 				}
       
  2392 			break;
       
  2393 			}	
       
  2394 		default:
       
  2395 			{
       
  2396 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2397 			StopTest(aError, EFail);
       
  2398 			}
       
  2399 		}
       
  2400 	}
       
  2401 
       
  2402 
       
  2403 /*
       
  2404  *========================================================================================================
       
  2405  * MM-A3F-DEVSOUND-CHRTZ-INIT-0030
       
  2406  */
       
  2407 RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest(const TDesC& aTestName) 
       
  2408 	:	RA3FDevSoundTestBase(aTestName)
       
  2409 	{
       
  2410 	}
       
  2411 
       
  2412 RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest* RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::NewL(const TDesC& aTestName)
       
  2413 	{
       
  2414 	RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest* self = new (ELeave) RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest(aTestName);
       
  2415 	return self;
       
  2416 	}
       
  2417 
       
  2418 void RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::DoKickoffTestL()
       
  2419 	{
       
  2420 	TPtrC fourccCode;
       
  2421 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  2422 		{
       
  2423 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  2424 		StopTest(KErrNotFound);
       
  2425 		return;
       
  2426 		}
       
  2427 	EncodingFromStringToTFourCC(fourccCode);
       
  2428 	}
       
  2429 
       
  2430 void RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2431 	{
       
  2432 	switch(iDevSoundState)
       
  2433 		{
       
  2434 		case EStateCreated:
       
  2435 			{
       
  2436 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest"),EFsmIncorrectErrorPassed));
       
  2437 			if(aDevSoundEvent == EEventInitialize)
       
  2438 				{
       
  2439 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  2440 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
  2441 				if(err != KErrNone)
       
  2442 					{
       
  2443 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2444 					StopTest(err);
       
  2445 					break;
       
  2446 					}
       
  2447 				INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice before init complete"));
       
  2448 				TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
  2449 				if(err != KErrNotReady)
       
  2450 					{
       
  2451 					ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL more than once before init complete left with error = %d"), err);
       
  2452 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  2453 					StopTest(err, EFail);
       
  2454 					}
       
  2455 				else
       
  2456 					{
       
  2457 					INFO_PRINTF1(_L("Second call to CMMFDevSound::InitializeL leaves with KErrNotReady as expected"));
       
  2458 					}
       
  2459 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  2460 				iDevSoundState = EStateInitializing;
       
  2461 				}
       
  2462 			else
       
  2463 				{
       
  2464 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2465 				StopTest(aError, EFail);
       
  2466 				}
       
  2467 			break;
       
  2468 			}
       
  2469 		case EStateInitializing:
       
  2470 			{
       
  2471 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  2472 				{
       
  2473 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  2474 				StopTest();
       
  2475 				}
       
  2476 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  2477 				{
       
  2478 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  2479 				StopTest(aError);		
       
  2480 				}
       
  2481 			else
       
  2482 				{
       
  2483 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  2484 				StopTest(aError, EFail);
       
  2485 				}
       
  2486 			break;
       
  2487 			}	
       
  2488 		default:
       
  2489 			{
       
  2490 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2491 			StopTest(aError, EFail);
       
  2492 			}
       
  2493 		}
       
  2494 	}
       
  2495 
       
  2496 
       
  2497 /*
       
  2498  *========================================================================================================
       
  2499  * MM-A3F-DEVSOUND-CHRTZ-INIT-0031
       
  2500  */
       
  2501 RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest(const TDesC& aTestName) 
       
  2502 	:	RA3FDevSoundTestBase(aTestName)
       
  2503 	{
       
  2504 	}
       
  2505 
       
  2506 RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest* RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::NewL(const TDesC& aTestName)
       
  2507 	{
       
  2508 	RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest* self = new (ELeave) RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest(aTestName);
       
  2509 	return self;
       
  2510 	}
       
  2511 
       
  2512 void RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::DoKickoffTestL()
       
  2513 	{
       
  2514 	TPtrC fourccCode;
       
  2515 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  2516 		{
       
  2517 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  2518 		StopTest(KErrNotFound);
       
  2519 		return;
       
  2520 		}
       
  2521 	EncodingFromStringToTFourCC(fourccCode);
       
  2522 	}
       
  2523 
       
  2524 void RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2525 	{
       
  2526 	switch(iDevSoundState)
       
  2527 		{
       
  2528 		case EStateCreated:
       
  2529 			{
       
  2530 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest"),EFsmIncorrectErrorPassed));
       
  2531 			if(aDevSoundEvent == EEventInitialize)
       
  2532 				{
       
  2533 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL"));
       
  2534 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  2535 				if(err != KErrNone)
       
  2536 					{
       
  2537 					INFO_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2538 					StopTest(err);
       
  2539 					break;
       
  2540 					}
       
  2541 				INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice before init complete"));
       
  2542 				TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  2543 				if(err != KErrNotReady)
       
  2544 					{
       
  2545 					ERR_PRINTF2(_L("Calling MMFDevSound::InitializeL more than once before init complete left with error = %d"), err);
       
  2546 					ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady);
       
  2547 					StopTest(err, EFail);
       
  2548 					}
       
  2549 				else
       
  2550 					{
       
  2551 					INFO_PRINTF1(_L("Second call to CMMFDevSound::InitializeL leaves with KErrNotReady as expected"));
       
  2552 					}
       
  2553 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  2554 				iDevSoundState = EStateInitializing;
       
  2555 				}
       
  2556 			else
       
  2557 				{
       
  2558 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2559 				StopTest(aError, EFail);
       
  2560 				}
       
  2561 			break;
       
  2562 			}
       
  2563 		case EStateInitializing:
       
  2564 			{
       
  2565 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  2566 				{
       
  2567 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  2568 				StopTest();
       
  2569 				}
       
  2570 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  2571 				{
       
  2572 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  2573 				StopTest(aError);		
       
  2574 				}
       
  2575 			else
       
  2576 				{
       
  2577 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  2578 				StopTest(aError, EFail);
       
  2579 				}
       
  2580 			break;
       
  2581 			}	
       
  2582 		default:
       
  2583 			{
       
  2584 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2585 			StopTest(aError, EFail);
       
  2586 			}
       
  2587 		}
       
  2588 	}
       
  2589 
       
  2590 
       
  2591 /*
       
  2592  *========================================================================================================
       
  2593  * MM-A3F-DEVSOUND-CHRTZ-INIT-0032
       
  2594  */
       
  2595 RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds(const TDesC& aTestName) 
       
  2596 	:	RA3FDevSoundTestBase(aTestName)
       
  2597 	{
       
  2598 	}
       
  2599 
       
  2600 RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds* RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::NewL(const TDesC& aTestName)
       
  2601 	{
       
  2602 	RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds* self = new (ELeave) RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds(aTestName);
       
  2603 	return self;
       
  2604 	}
       
  2605 
       
  2606 void RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::DoKickoffTestL()
       
  2607 	{
       
  2608 	}
       
  2609 
       
  2610 void RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2611 	{
       
  2612 	switch(iDevSoundState)
       
  2613 		{
       
  2614 		case EStateCreated:
       
  2615 			{
       
  2616 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceed"),EFsmIncorrectErrorPassed));
       
  2617 			if(aDevSoundEvent == EEventInitialize)
       
  2618 				{
       
  2619 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL to make it leave"));
       
  2620 				TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateConverting));
       
  2621 				if(err != KErrNone)
       
  2622 					{
       
  2623 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2624 					}
       
  2625 				else
       
  2626 					{
       
  2627 					ERR_PRINTF1(_L("CMMFDevSound::InitializeL  did not leave as expected"));
       
  2628 					StopTest(err, EFail);
       
  2629 					}
       
  2630 				INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice, but now using right parameters"));
       
  2631 				TRAP(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying));
       
  2632 				if(err != KErrNone)
       
  2633 					{
       
  2634 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2635 					StopTest(err);
       
  2636 					break;
       
  2637 					}
       
  2638 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  2639 				iDevSoundState = EStateInitializing;
       
  2640 				}
       
  2641 			else
       
  2642 				{
       
  2643 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2644 				StopTest(aError, EFail);
       
  2645 				}
       
  2646 			break;
       
  2647 			}
       
  2648 		case EStateInitializing:
       
  2649 			{
       
  2650 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  2651 				{
       
  2652 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  2653 				StopTest();
       
  2654 				}
       
  2655 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  2656 				{
       
  2657 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  2658 				StopTest(aError);		
       
  2659 				}
       
  2660 			else
       
  2661 				{
       
  2662 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  2663 				StopTest(aError, EFail);
       
  2664 				}
       
  2665 			break;
       
  2666 			}	
       
  2667 		default:
       
  2668 			{
       
  2669 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2670 			StopTest(aError, EFail);
       
  2671 			}
       
  2672 		}
       
  2673 	}
       
  2674 
       
  2675 
       
  2676 /*
       
  2677  *========================================================================================================
       
  2678  * MM-A3F-DEVSOUND-CHRTZ-INIT-0033
       
  2679  */
       
  2680 RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds(const TDesC& aTestName) 
       
  2681 	:	RA3FDevSoundTestBase(aTestName)
       
  2682 	{
       
  2683 	}
       
  2684 
       
  2685 RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds* RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::NewL(const TDesC& aTestName)
       
  2686 	{
       
  2687 	RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds* self = new (ELeave) RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds(aTestName);
       
  2688 	return self;
       
  2689 	}
       
  2690 
       
  2691 void RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::DoKickoffTestL()
       
  2692 	{
       
  2693 	TPtrC fourccCode;
       
  2694 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  2695 		{
       
  2696 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  2697 		StopTest(KErrNotFound);
       
  2698 		return;
       
  2699 		}
       
  2700 	EncodingFromStringToTFourCC(fourccCode);
       
  2701 	}
       
  2702 
       
  2703 void RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2704 	{
       
  2705 	switch(iDevSoundState)
       
  2706 		{
       
  2707 		case EStateCreated:
       
  2708 			{
       
  2709 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceed"),EFsmIncorrectErrorPassed));
       
  2710 			if(aDevSoundEvent == EEventInitialize)
       
  2711 				{
       
  2712 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL to make it leave"));
       
  2713 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateConverting));
       
  2714 				if(err != KErrNone)
       
  2715 					{
       
  2716 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2717 					}
       
  2718 				else
       
  2719 					{
       
  2720 					ERR_PRINTF1(_L("CMMFDevSound::InitializeL  did not leave as expected"));
       
  2721 					StopTest(err, EFail);
       
  2722 					}
       
  2723 				INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice, but now using right parameters"));
       
  2724 				TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying));
       
  2725 				if(err != KErrNone)
       
  2726 					{
       
  2727 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2728 					StopTest(err);
       
  2729 					break;
       
  2730 					}
       
  2731 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  2732 				iDevSoundState = EStateInitializing;
       
  2733 				}
       
  2734 			else
       
  2735 				{
       
  2736 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2737 				StopTest(aError, EFail);
       
  2738 				}
       
  2739 			break;
       
  2740 			}
       
  2741 		case EStateInitializing:
       
  2742 			{
       
  2743 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  2744 				{
       
  2745 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  2746 				StopTest();
       
  2747 				}
       
  2748 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  2749 				{
       
  2750 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  2751 				StopTest(aError);		
       
  2752 				}
       
  2753 			else
       
  2754 				{
       
  2755 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  2756 				StopTest(aError, EFail);
       
  2757 				}
       
  2758 			break;
       
  2759 			}	
       
  2760 		default:
       
  2761 			{
       
  2762 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2763 			StopTest(aError, EFail);
       
  2764 			}
       
  2765 		}
       
  2766 	}
       
  2767 
       
  2768 
       
  2769 /*
       
  2770  *========================================================================================================
       
  2771  * MM-A3F-DEVSOUND-CHRTZ-INIT-0034
       
  2772  */
       
  2773 RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds(const TDesC& aTestName) 
       
  2774 	:	RA3FDevSoundTestBase(aTestName)
       
  2775 	{
       
  2776 	}
       
  2777 
       
  2778 RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds* RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::NewL(const TDesC& aTestName)
       
  2779 	{
       
  2780 	RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds* self = new (ELeave) RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds(aTestName);
       
  2781 	return self;
       
  2782 	}
       
  2783 
       
  2784 void RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::DoKickoffTestL()
       
  2785 	{
       
  2786 	TPtrC fourccCode;
       
  2787 	if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode))
       
  2788 		{
       
  2789 		ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode);
       
  2790 		StopTest(KErrNotFound);
       
  2791 		return;
       
  2792 		}
       
  2793 	EncodingFromStringToTFourCC(fourccCode);
       
  2794 	}
       
  2795 
       
  2796 void RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError)
       
  2797 	{
       
  2798 	switch(iDevSoundState)
       
  2799 		{
       
  2800 		case EStateCreated:
       
  2801 			{
       
  2802 			__ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceed"),EFsmIncorrectErrorPassed));
       
  2803 			if(aDevSoundEvent == EEventInitialize)
       
  2804 				{
       
  2805 				INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL to make it leave"));
       
  2806 				TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateConverting));
       
  2807 				if(err != KErrNone)
       
  2808 					{
       
  2809 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2810 					}
       
  2811 				else
       
  2812 					{
       
  2813 					ERR_PRINTF1(_L("CMMFDevSound::InitializeL  did not leave as expected"));
       
  2814 					StopTest(err, EFail);
       
  2815 					}
       
  2816 				INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice, but now using right parameters"));
       
  2817 				TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording));
       
  2818 				if(err != KErrNone)
       
  2819 					{
       
  2820 					ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err);
       
  2821 					StopTest(err);
       
  2822 					break;
       
  2823 					}
       
  2824 				INFO_PRINTF1(_L("DevSound State: EStateInitializing"));
       
  2825 				iDevSoundState = EStateInitializing;
       
  2826 				}
       
  2827 			else
       
  2828 				{
       
  2829 				ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent);
       
  2830 				StopTest(aError, EFail);
       
  2831 				}
       
  2832 			break;
       
  2833 			}
       
  2834 		case EStateInitializing:
       
  2835 			{
       
  2836 			if(aDevSoundEvent == EEventInitComplete && aError == KErrNone)
       
  2837 				{
       
  2838 				INFO_PRINTF1(_L("========== Test Case Successfully Completed =========="));
       
  2839 				StopTest();
       
  2840 				}
       
  2841 			else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone)
       
  2842 				{
       
  2843 				ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError);
       
  2844 				StopTest(aError);		
       
  2845 				}
       
  2846 			else
       
  2847 				{
       
  2848 				ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent);
       
  2849 				StopTest(aError, EFail);
       
  2850 				}
       
  2851 			break;
       
  2852 			}	
       
  2853 		default:
       
  2854 			{
       
  2855 			ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState);
       
  2856 			StopTest(aError, EFail);
       
  2857 			}
       
  2858 		}
       
  2859 	}