os/mm/mmlibs/mmfw/tsrc/mmfunittest/Actrl/TestStepController.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// TestStepContropller.cpp
sl@0
    15
//
sl@0
    16
sl@0
    17
#include <e32std.h>
sl@0
    18
#include <e32base.h>
sl@0
    19
#include <mmf/common/mmfcontroller.h>
sl@0
    20
#include <mmf/server/mmffile.h>
sl@0
    21
#include <mmf/server/mmfdes.h>
sl@0
    22
#include <mmf/plugin/mmfcontrollerimplementationuids.hrh>
sl@0
    23
#include <mmf/common/mmfstandardcustomcommands.h>
sl@0
    24
sl@0
    25
// Test system includes
sl@0
    26
#include <testframework.h>
sl@0
    27
sl@0
    28
// Specific includes for this test suite
sl@0
    29
#include "TS_MMF_ACTRL_TestStep.h"
sl@0
    30
#include "TS_MMF_ACTRL_TestSuite.h"
sl@0
    31
sl@0
    32
#include "ActrlTestUids.h"
sl@0
    33
sl@0
    34
// Specific includes for these test steps
sl@0
    35
#include "TestStepController.h"
sl@0
    36
sl@0
    37
// constants destined for header file
sl@0
    38
//const TInt KPlayDelayNewMail = 100000000 ;	// EABI warning removal
sl@0
    39
const TInt KMemoryAllocCmd = 0xaaaaa;
sl@0
    40
sl@0
    41
/**
sl@0
    42
*
sl@0
    43
* CTestStepResetController
sl@0
    44
*
sl@0
    45
*/
sl@0
    46
CTestStepResetController::CTestStepResetController()
sl@0
    47
	{
sl@0
    48
	iTestStepName = _L("MM-MMF-ACTRL-U-0016-HP");
sl@0
    49
	}
sl@0
    50
sl@0
    51
/**
sl@0
    52
*
sl@0
    53
* ~CTestStepResetController
sl@0
    54
*
sl@0
    55
*/
sl@0
    56
CTestStepResetController::~CTestStepResetController()
sl@0
    57
	{
sl@0
    58
	}
sl@0
    59
sl@0
    60
/**
sl@0
    61
*
sl@0
    62
* DoTestStepL
sl@0
    63
* This method tests the controllers reset function
sl@0
    64
*
sl@0
    65
*/
sl@0
    66
TVerdict CTestStepResetController::DoTestStepL( void )
sl@0
    67
	{
sl@0
    68
	__MM_HEAP_MARK;
sl@0
    69
	
sl@0
    70
	TVerdict result = EPass;
sl@0
    71
	
sl@0
    72
	_LIT( KTestPlay, "Reset Test");
sl@0
    73
	Log( KTestPlay );
sl@0
    74
	
sl@0
    75
	_LIT( KTestStepReset, "This test checks a controller reset");
sl@0
    76
	Log( KTestStepReset );
sl@0
    77
	
sl@0
    78
	// [ audio file to play ]
sl@0
    79
	_LIT(KTestWavFile, "newmail.wav");
sl@0
    80
	SetReadFileNameL( KTestWavFile );
sl@0
    81
	
sl@0
    82
   	TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
sl@0
    83
	User::LeaveIfError( errorCode );
sl@0
    84
	
sl@0
    85
	//[ok lets reset the controller from it initial state]
sl@0
    86
	errorCode = iController.Reset();
sl@0
    87
	User::LeaveIfError( errorCode );
sl@0
    88
	//[ search for reset event ]
sl@0
    89
	TMMFEvent resetEvent( KResetTestId, KErrNone);
sl@0
    90
	result = SearchForEvent( resetEvent );
sl@0
    91
	if( result == EFail )
sl@0
    92
		{
sl@0
    93
		return result;
sl@0
    94
		}
sl@0
    95
	
sl@0
    96
	//[ lets try a second reset ]
sl@0
    97
	errorCode = iController.Reset();
sl@0
    98
	User::LeaveIfError( errorCode );
sl@0
    99
	//[ search for reset event ]
sl@0
   100
	result = SearchForEvent( resetEvent );
sl@0
   101
	if( result == EFail )
sl@0
   102
		{
sl@0
   103
		return result;
sl@0
   104
		}
sl@0
   105
	
sl@0
   106
	//[ add data source and sink and prime the controller ]
sl@0
   107
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
sl@0
   108
	User::LeaveIfError( errorCode );
sl@0
   109
	
sl@0
   110
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
sl@0
   111
    User::LeaveIfError( errorCode );
sl@0
   112
	
sl@0
   113
	//[ok lets reset the controller from it initial state]
sl@0
   114
	errorCode = iController.Reset();
sl@0
   115
	User::LeaveIfError( errorCode );
sl@0
   116
	
sl@0
   117
	//[ search for reset event ]
sl@0
   118
	result = SearchForEvent( resetEvent );
sl@0
   119
	if( result == EFail )
sl@0
   120
		{
sl@0
   121
		return result;
sl@0
   122
		}
sl@0
   123
	
sl@0
   124
	//[ lets try a second reset ]
sl@0
   125
	errorCode = iController.Reset();
sl@0
   126
	User::LeaveIfError( errorCode );
sl@0
   127
	//[ search for reset event ]
sl@0
   128
	result = SearchForEvent( resetEvent );
sl@0
   129
	if( result == EFail )
sl@0
   130
		{
sl@0
   131
		return result;
sl@0
   132
		}
sl@0
   133
sl@0
   134
	//[ add data source and sink and prime the controller ]
sl@0
   135
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
sl@0
   136
	User::LeaveIfError( errorCode );
sl@0
   137
	
sl@0
   138
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
sl@0
   139
    User::LeaveIfError( errorCode );
sl@0
   140
	
sl@0
   141
	errorCode =	iController.Prime();
sl@0
   142
	User::LeaveIfError( errorCode );
sl@0
   143
	
sl@0
   144
	// [ wait for and process the return event from the audio output ]
sl@0
   145
	TMMFEvent primeEvent( KPrimeTestId, KErrNone);
sl@0
   146
	result = SearchForEvent( primeEvent );
sl@0
   147
	if( result == EFail )
sl@0
   148
		{
sl@0
   149
		return result;
sl@0
   150
		}
sl@0
   151
	
sl@0
   152
	//[ lets reset again in the primed state ]
sl@0
   153
	errorCode = iController.Reset();
sl@0
   154
	User::LeaveIfError( errorCode );
sl@0
   155
	
sl@0
   156
	//[ search for reset event ]
sl@0
   157
	result = SearchForEvent( resetEvent );
sl@0
   158
	if( result == EFail )
sl@0
   159
		{
sl@0
   160
		return result;
sl@0
   161
		}
sl@0
   162
	
sl@0
   163
	// [ get back to primed state ]
sl@0
   164
	//[ add data source and sink and prime the controller ]
sl@0
   165
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
sl@0
   166
	User::LeaveIfError( errorCode );
sl@0
   167
	
sl@0
   168
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
sl@0
   169
    User::LeaveIfError( errorCode );
sl@0
   170
	
sl@0
   171
	errorCode =	iController.Prime();
sl@0
   172
	User::LeaveIfError( errorCode );
sl@0
   173
	result = SearchForEvent( primeEvent );
sl@0
   174
	if( result == EFail )
sl@0
   175
		{
sl@0
   176
		return result;
sl@0
   177
		}
sl@0
   178
sl@0
   179
    User::LeaveIfError( iController.Play() );
sl@0
   180
	
sl@0
   181
	// note this test does not wait around 
sl@0
   182
	// to detect that the audio has been played
sl@0
   183
	// [ now process the confirmation event that play has reached audio output
sl@0
   184
	//   this is the raison detre of the test ]
sl@0
   185
	TMMFEvent playEvent( KPlayTestId, KErrNone );
sl@0
   186
	result = SearchForEvent( playEvent );
sl@0
   187
	if( result == EFail )
sl@0
   188
		{
sl@0
   189
		return result;
sl@0
   190
		}
sl@0
   191
	
sl@0
   192
	//[ lets reset again in the primed state ]
sl@0
   193
	errorCode = iController.Reset();
sl@0
   194
	User::LeaveIfError( errorCode );
sl@0
   195
	
sl@0
   196
	//[ search for reset event ]
sl@0
   197
	result = SearchForEvent( resetEvent );
sl@0
   198
	if( result == EFail )
sl@0
   199
		{
sl@0
   200
		return result;
sl@0
   201
		}
sl@0
   202
sl@0
   203
	errorCode = iController.Reset();
sl@0
   204
	User::LeaveIfError( errorCode );
sl@0
   205
	
sl@0
   206
	//[ search for reset event ]
sl@0
   207
	result = SearchForEvent( resetEvent );
sl@0
   208
	if( result == EFail )
sl@0
   209
		{
sl@0
   210
		return result;
sl@0
   211
		}
sl@0
   212
sl@0
   213
	//[ ensure the controller is unloaded so that it does 
sl@0
   214
	// not interfere with the following test ]
sl@0
   215
	// There is error in this code and the stop followed by reset
sl@0
   216
	// ensure the controller resources are released.
sl@0
   217
	iController.Stop();
sl@0
   218
	iController.Reset();
sl@0
   219
	iController.Close();  
sl@0
   220
	
sl@0
   221
	__MM_HEAP_MARKEND;
sl@0
   222
	   
sl@0
   223
	// [test steps return a result]
sl@0
   224
	return result;
sl@0
   225
	}
sl@0
   226
sl@0
   227
/**
sl@0
   228
*
sl@0
   229
* CTestStepRemoveDataSink
sl@0
   230
*
sl@0
   231
*/
sl@0
   232
CTestStepRemoveDataSink::CTestStepRemoveDataSink()
sl@0
   233
	{
sl@0
   234
	iTestStepName = _L("MM-MMF-ACTRL-U-0017-HP");
sl@0
   235
	}
sl@0
   236
sl@0
   237
/**
sl@0
   238
*
sl@0
   239
* ~CTestStepPauseController
sl@0
   240
*
sl@0
   241
*/ 
sl@0
   242
CTestStepRemoveDataSink::~CTestStepRemoveDataSink()
sl@0
   243
	{
sl@0
   244
	}
sl@0
   245
sl@0
   246
/**
sl@0
   247
*
sl@0
   248
* DoTestStepL
sl@0
   249
*
sl@0
   250
*/
sl@0
   251
TVerdict CTestStepRemoveDataSink::DoTestStepL( void )
sl@0
   252
	{
sl@0
   253
	 __MM_HEAP_MARK;
sl@0
   254
	
sl@0
   255
	TVerdict result = EPass;
sl@0
   256
	
sl@0
   257
	_LIT( KTestPlay, "Remove Data Sink Test");
sl@0
   258
	Log( KTestPlay );
sl@0
   259
	
sl@0
   260
	_LIT( KTestStepPause, "This test checks removing a data sink");
sl@0
   261
	Log( KTestStepPause );
sl@0
   262
	
sl@0
   263
	// [ audio file to play ]
sl@0
   264
	_LIT(KTestWavFile, "newmail.wav");
sl@0
   265
	SetReadFileNameL( KTestWavFile );
sl@0
   266
	
sl@0
   267
   	TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
sl@0
   268
	User::LeaveIfError( errorCode );
sl@0
   269
sl@0
   270
	//[ declare handles for removal of the data source and data sink]
sl@0
   271
	TMMFMessageDestination aSourceHandleInfo;
sl@0
   272
	TMMFMessageDestination aSinkHandleInfo  ;
sl@0
   273
sl@0
   274
	//[ add data source and sink and prime the controller ]
sl@0
   275
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig(), aSourceHandleInfo );
sl@0
   276
	User::LeaveIfError( errorCode );
sl@0
   277
	
sl@0
   278
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8, aSinkHandleInfo );
sl@0
   279
    User::LeaveIfError( errorCode );
sl@0
   280
sl@0
   281
	//[ lets try removing the data sink with the soure handle ]
sl@0
   282
	errorCode =	iController.RemoveDataSink( aSourceHandleInfo );
sl@0
   283
    if( errorCode == KErrNone )
sl@0
   284
		{
sl@0
   285
		result = EFail;
sl@0
   286
		return result;
sl@0
   287
		}
sl@0
   288
sl@0
   289
	//[ lets remove the data sink ]
sl@0
   290
	errorCode =	iController.RemoveDataSink( aSinkHandleInfo );
sl@0
   291
    User::LeaveIfError( errorCode );
sl@0
   292
	
sl@0
   293
	//[ search for remove event ]
sl@0
   294
	TMMFEvent removeDataSinkEvent( KRemoveDataSinkTestId, KErrNone );
sl@0
   295
	TVerdict removeResult = SearchForEvent( removeDataSinkEvent );
sl@0
   296
	if( removeResult == EFail )
sl@0
   297
		{
sl@0
   298
		return removeResult ;
sl@0
   299
		}
sl@0
   300
	
sl@0
   301
	//[ try removing the data sink a second time ]
sl@0
   302
	errorCode =	iController.RemoveDataSink( aSinkHandleInfo );
sl@0
   303
	if( errorCode == KErrNone )
sl@0
   304
		{
sl@0
   305
		result = EFail;
sl@0
   306
		return result ;
sl@0
   307
		}
sl@0
   308
sl@0
   309
	//[ no need to remove event since the message does not reach the custom controller ]
sl@0
   310
sl@0
   311
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8, aSinkHandleInfo );
sl@0
   312
    User::LeaveIfError( errorCode );
sl@0
   313
    	
sl@0
   314
	errorCode =	iController.Prime();
sl@0
   315
	User::LeaveIfError( errorCode );
sl@0
   316
	
sl@0
   317
	// [ wait for and process the return event from the audio output ]
sl@0
   318
	
sl@0
   319
	TMMFEvent primeEvent( KPrimeTestId, KErrNone);
sl@0
   320
	TVerdict primeResult = SearchForEvent( primeEvent );
sl@0
   321
	if( primeResult == EFail )
sl@0
   322
		{
sl@0
   323
		return primeResult;
sl@0
   324
		}
sl@0
   325
sl@0
   326
	//[ try removing the data sink ]
sl@0
   327
	errorCode =	iController.RemoveDataSink( aSinkHandleInfo );
sl@0
   328
	if( errorCode == KErrNone )
sl@0
   329
		{
sl@0
   330
		result = EFail;
sl@0
   331
		return result ;
sl@0
   332
		}
sl@0
   333
sl@0
   334
	// [ second event is not generated on failure ]
sl@0
   335
	
sl@0
   336
	User::LeaveIfError( iController.Play() );
sl@0
   337
	
sl@0
   338
	// note this test does not wait around 
sl@0
   339
	// to detect that the audio has been played
sl@0
   340
	// [ now process the confirmation event that play has reached audio output
sl@0
   341
	//   this is the raison detre of the test ]
sl@0
   342
	TMMFEvent playEvent( KPlayTestId, KErrNone );
sl@0
   343
	
sl@0
   344
	TVerdict playResult = SearchForEvent( playEvent );
sl@0
   345
	if( playResult == EFail )
sl@0
   346
		{
sl@0
   347
		return playResult ;
sl@0
   348
		}
sl@0
   349
sl@0
   350
	//[ try removing the data sink  ]
sl@0
   351
	errorCode =	iController.RemoveDataSink( aSinkHandleInfo );
sl@0
   352
	if( errorCode == KErrNone )
sl@0
   353
		{
sl@0
   354
		result = EFail;
sl@0
   355
		return result ;
sl@0
   356
		}
sl@0
   357
sl@0
   358
	//[ try removing the data sink  ]
sl@0
   359
	errorCode =	iController.RemoveDataSink( aSinkHandleInfo );
sl@0
   360
	if( errorCode == KErrNone )
sl@0
   361
		{
sl@0
   362
		result = EFail;
sl@0
   363
		return result ;
sl@0
   364
		}
sl@0
   365
sl@0
   366
	result = EPass ;
sl@0
   367
sl@0
   368
	//[ ensure the controller is unloaded so that it does 
sl@0
   369
	// not interfere with the following test ]
sl@0
   370
	// There is error in this code and the stop followed by reset
sl@0
   371
	// ensure the controller resources are released.
sl@0
   372
	iController.Stop();
sl@0
   373
	iController.Reset();
sl@0
   374
	iController.Close();  
sl@0
   375
		
sl@0
   376
	__MM_HEAP_MARKEND;
sl@0
   377
   
sl@0
   378
	// test steps return a result
sl@0
   379
	return result;
sl@0
   380
	}
sl@0
   381
sl@0
   382
/**
sl@0
   383
*
sl@0
   384
* CTestStepRemoveDataSource
sl@0
   385
*
sl@0
   386
*/
sl@0
   387
CTestStepRemoveDataSource::CTestStepRemoveDataSource()
sl@0
   388
	{
sl@0
   389
	iTestStepName = _L("MM-MMF-ACTRL-U-0019-HP");
sl@0
   390
	}
sl@0
   391
sl@0
   392
/**
sl@0
   393
*
sl@0
   394
* ~CTestStepRemoveDataSource
sl@0
   395
*
sl@0
   396
*/
sl@0
   397
CTestStepRemoveDataSource::~CTestStepRemoveDataSource()
sl@0
   398
	{
sl@0
   399
	}
sl@0
   400
sl@0
   401
/**
sl@0
   402
*
sl@0
   403
* DoTestStepL
sl@0
   404
* This method tests removing a Data Source
sl@0
   405
*/
sl@0
   406
TVerdict CTestStepRemoveDataSource::DoTestStepL( void )
sl@0
   407
	{
sl@0
   408
	 __MM_HEAP_MARK;
sl@0
   409
	
sl@0
   410
	TVerdict result = EPass;
sl@0
   411
	
sl@0
   412
	_LIT( KTestPlay, "Remove Data Source Test");
sl@0
   413
	Log( KTestPlay );
sl@0
   414
	
sl@0
   415
	_LIT( KTestStepSource, "This test checks removing a data source");
sl@0
   416
	Log( KTestStepSource );
sl@0
   417
	
sl@0
   418
	// [ audio file to play ]
sl@0
   419
	_LIT(KTestWavFile, "newmail.wav");
sl@0
   420
	SetReadFileNameL( KTestWavFile );
sl@0
   421
	
sl@0
   422
   	TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
sl@0
   423
	User::LeaveIfError( errorCode );
sl@0
   424
	//iFileConfig().iPath = KTestWavFile;
sl@0
   425
sl@0
   426
	//[ declare handles for removal of the data source and data sink]
sl@0
   427
	TMMFMessageDestination aSourceHandleInfo;
sl@0
   428
	TMMFMessageDestination aSinkHandleInfo  ;
sl@0
   429
sl@0
   430
	//[ add data source and sink and prime the controller ]
sl@0
   431
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig(), aSourceHandleInfo );
sl@0
   432
	User::LeaveIfError( errorCode );
sl@0
   433
	
sl@0
   434
	errorCode =	iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8, aSinkHandleInfo );
sl@0
   435
    User::LeaveIfError( errorCode );
sl@0
   436
sl@0
   437
	//[ lets remove the data source using the sink handle !! ]
sl@0
   438
	errorCode =	iController.RemoveDataSource( aSinkHandleInfo );
sl@0
   439
    if( errorCode == KErrNone )
sl@0
   440
		{
sl@0
   441
		result = EFail;
sl@0
   442
		return result ;
sl@0
   443
		}
sl@0
   444
sl@0
   445
	//[ lets remove the data source ]
sl@0
   446
	errorCode =	iController.RemoveDataSource( aSourceHandleInfo );
sl@0
   447
    User::LeaveIfError( errorCode );
sl@0
   448
sl@0
   449
	//[ search for remove event ]
sl@0
   450
	TMMFEvent removeDataSourceEvent( KRemoveDataSourceTestId, KErrNone );
sl@0
   451
	TVerdict removeResult = SearchForEvent( removeDataSourceEvent );
sl@0
   452
	if( removeResult == EFail )
sl@0
   453
		{
sl@0
   454
		return removeResult ;
sl@0
   455
		}
sl@0
   456
	
sl@0
   457
	//[ try removing the data source a second time ]
sl@0
   458
	errorCode =	iController.RemoveDataSource( aSourceHandleInfo );
sl@0
   459
	if( errorCode == KErrNone )
sl@0
   460
		{
sl@0
   461
		result = EFail;
sl@0
   462
		return result ;
sl@0
   463
		}
sl@0
   464
sl@0
   465
	//[ no need to remove event since the message does not reach the custom controller ]
sl@0
   466
sl@0
   467
	//[ add data source and sink and prime the controller ]
sl@0
   468
    errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig(), aSourceHandleInfo );
sl@0
   469
	User::LeaveIfError( errorCode );
sl@0
   470
    
sl@0
   471
	errorCode =	iController.Prime();
sl@0
   472
	User::LeaveIfError( errorCode );
sl@0
   473
	
sl@0
   474
	// [ wait for and process the return event from the audio output ]
sl@0
   475
	
sl@0
   476
	TMMFEvent primeEvent( KPrimeTestId, KErrNone);
sl@0
   477
	TVerdict primeResult = SearchForEvent( primeEvent );
sl@0
   478
	if( primeResult == EFail )
sl@0
   479
		{
sl@0
   480
		return primeResult;
sl@0
   481
		}
sl@0
   482
sl@0
   483
	//[ try removing the data source ]
sl@0
   484
	errorCode =	iController.RemoveDataSource( aSourceHandleInfo );
sl@0
   485
	if( errorCode == KErrNone )
sl@0
   486
		{
sl@0
   487
		result = EFail;
sl@0
   488
		return result ;
sl@0
   489
		}
sl@0
   490
sl@0
   491
	// [ second event is not generated on failure ]
sl@0
   492
	
sl@0
   493
	User::LeaveIfError( iController.Play() );
sl@0
   494
	
sl@0
   495
	// note this test does not wait around 
sl@0
   496
	// to detect that the audio has been played
sl@0
   497
	// [ now process the confirmation event that play has reached audio output
sl@0
   498
	//   this is the raison detre of the test ]
sl@0
   499
	TMMFEvent playEvent( KPlayTestId, KErrNone );
sl@0
   500
	
sl@0
   501
	TVerdict playResult = SearchForEvent( playEvent );
sl@0
   502
	if( playResult == EFail )
sl@0
   503
		{
sl@0
   504
		return playResult ;
sl@0
   505
		}
sl@0
   506
sl@0
   507
	//[ try removing the data sink  ]
sl@0
   508
	errorCode =	iController.RemoveDataSource( aSourceHandleInfo );
sl@0
   509
	if( errorCode == KErrNone )
sl@0
   510
		{
sl@0
   511
		result = EFail;
sl@0
   512
		return result ;
sl@0
   513
		}
sl@0
   514
sl@0
   515
	//[ try removing the data sink  ]
sl@0
   516
	errorCode =	iController.RemoveDataSource( aSourceHandleInfo );
sl@0
   517
	if( errorCode == KErrNone )
sl@0
   518
		{
sl@0
   519
		result = EFail;
sl@0
   520
		return result ;
sl@0
   521
		}
sl@0
   522
sl@0
   523
	result = EPass ;
sl@0
   524
sl@0
   525
	//[ ensure the controller is unloaded so that it does 
sl@0
   526
	// not interfere with the following test ]
sl@0
   527
	// There is error in this code and the stop followed by reset
sl@0
   528
	// ensure the controller resources are released.
sl@0
   529
	iController.Stop();
sl@0
   530
	iController.Reset();
sl@0
   531
	iController.Close();  
sl@0
   532
		
sl@0
   533
	__MM_HEAP_MARKEND;
sl@0
   534
	   
sl@0
   535
	// test steps return a result
sl@0
   536
	return result;
sl@0
   537
	}
sl@0
   538
sl@0
   539
/**
sl@0
   540
*
sl@0
   541
* CTestStepMemoryAllocation
sl@0
   542
*/
sl@0
   543
CTestStepMemoryAllocation::CTestStepMemoryAllocation()
sl@0
   544
	{
sl@0
   545
	iTestStepName = _L("MM-MMF-ACTRL-U-0020-HP");
sl@0
   546
	}
sl@0
   547
sl@0
   548
/**
sl@0
   549
*
sl@0
   550
* ~CTestStepMemoryAllocation
sl@0
   551
*/
sl@0
   552
CTestStepMemoryAllocation::~CTestStepMemoryAllocation()
sl@0
   553
	{
sl@0
   554
	}
sl@0
   555
sl@0
   556
/**
sl@0
   557
*
sl@0
   558
*DoTestStepL
sl@0
   559
*/
sl@0
   560
TVerdict CTestStepMemoryAllocation::DoTestStepL( void )
sl@0
   561
	{
sl@0
   562
	__MM_HEAP_MARK;
sl@0
   563
	
sl@0
   564
	TVerdict result = EPass;
sl@0
   565
	
sl@0
   566
	_LIT( KTestPlay, "Memory Allocation Test");
sl@0
   567
	Log( KTestPlay );
sl@0
   568
	
sl@0
   569
	_LIT( KTestStepSource, "This test checks memory allocation of the plugin");
sl@0
   570
	Log( KTestStepSource );
sl@0
   571
	
sl@0
   572
   	TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
sl@0
   573
	User::LeaveIfError( errorCode );
sl@0
   574
	//[ send the custom command to the custom audio controller ]
sl@0
   575
	TMMFMessageDestinationPckg destinationPckg(KMemoryAllocationTestId);
sl@0
   576
	
sl@0
   577
	//[ send memory alloc test to the custom plugin ]
sl@0
   578
	//[ we have only ensured that the controller is loaded into memory
sl@0
   579
	// and that all add sources etc will be don
sl@0
   580
	errorCode = iController.CustomCommandSync(destinationPckg, 
sl@0
   581
		KMemoryAllocCmd, 
sl@0
   582
		KNullDesC8,
sl@0
   583
		KNullDesC8);
sl@0
   584
	User::LeaveIfError( errorCode );
sl@0
   585
sl@0
   586
	//[ ensure the controller is unloaded so that it does 
sl@0
   587
	// not interfere with the following test ]
sl@0
   588
	// There is error in this code and the stop followed by reset
sl@0
   589
	// ensure the controller resources are released.
sl@0
   590
	iController.Stop();
sl@0
   591
	iController.Reset();
sl@0
   592
	iController.Close();  
sl@0
   593
sl@0
   594
	return result ;
sl@0
   595
	}