os/mm/mmplugins/lib3gpunittest/src/parserapinegative.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 #include <mmf/common/mmferrors.h>
    17 #include <caf/caf.h>
    18 using namespace ContentAccess;
    19 #include "tsu3gplibraryapinegative.h"
    20 
    21 // --------------------------
    22 // C3GPLibParser_Negative 
    23 // --------------------------
    24 //
    25 void C3GPLibParser_Negative::CallAudioApiL(C3GPParse* aParse, TInt aExpectedError)
    26 	{
    27 	TInt err = KErrNone;
    28 	// Retrieve audio stream attributes
    29 	T3GPAudioType audioType;
    30 	TInt framesPerSample;
    31 	TUint length; 
    32 	TUint avgBitRate;
    33 	TUint timeScale;
    34 		
    35 	err = aParse->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
    36 	User::LeaveIfError(CheckError(err, aExpectedError, _L("aParse->GetAudioProperties")));
    37 
    38 	TBool available;
    39 	T3GPFrameType type = E3GPAudio;
    40 	err = aParse->GetFrameAvailability(type, available);
    41 	if (aExpectedError == KErrNotSupported)
    42 		{
    43 		// GetFrameAvailability will return KErrNotFound when there is no audio in the 3gp files
    44 		User::LeaveIfError(CheckError(err, KErrNotFound, _L("GetFrameAvailability")));
    45 		}
    46 	else
    47 		{
    48 		User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameAvailability")));
    49 		}
    50 	
    51 	TUint size;
    52 	err = aParse->GetAudioFramesSize(size);
    53 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioFramesSize")));
    54 	
    55 	RBuf8 buffer;
    56 	CleanupClosePushL(buffer);
    57 	
    58 	if (aExpectedError == KErrNone)
    59 		{
    60 		buffer.CreateL(size); // Use size retrieved from GetVideoFrameSize
    61 		}
    62 	else
    63 		{
    64 		buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
    65 		}
    66 	
    67 	TUint timeStampInMs; 
    68 	TUint timeStampInTimescale;
    69 	TInt returnedFrames;
    70 	err = aParse->ReadAudioFrames(buffer, returnedFrames, timeStampInMs, timeStampInTimescale);
    71 	User::LeaveIfError(CheckError(err, aExpectedError, _L("ReadAudioFrames")));
    72 	CleanupStack::PopAndDestroy(&buffer);
    73 	
    74 	TUint index;
    75 	err = aParse->GetAudioSampleEntryIndex(index);
    76 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioSampleEntryIndex")));
    77 	
    78 	T3GPQcelpStorageMode mode;
    79 	err = aParse->GetQcelpStorageMode(mode);
    80 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetQcelpStorageMode")));
    81 	}
    82 
    83 void C3GPLibParser_Negative::CallVideoApiL(C3GPParse* aParse, TInt aExpectedError)
    84 	{
    85 	TInt err = KErrNone;
    86 	// Retrieve video & audio stream attributes
    87 	T3GPVideoType videoType;
    88 	TUint length; 
    89 	TReal frameRate;
    90 	TUint avgBitRate;
    91 	TSize videoSize;
    92 	TUint timeScale;
    93 	
    94 	err = aParse->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
    95 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoProperties")));
    96 	
    97 	TBool available;
    98 	T3GPFrameType type = E3GPVideo;
    99 	err = aParse->GetFrameAvailability(type, available);
   100 	if (aExpectedError == KErrNotSupported)
   101 		{
   102 		// GetFrameAvailability will return KErrNotFound when there is no video in the 3gp files
   103 		User::LeaveIfError(CheckError(err, KErrNotFound, _L("GetFrameAvailability")));
   104 		}
   105 	else
   106 		{
   107 		User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameAvailability")));
   108 		}
   109 	
   110 	TUint size;	
   111 	err = aParse->GetVideoFrameSize(size);
   112 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameSize")));
   113 		
   114 	RBuf8 buffer;
   115 	CleanupClosePushL(buffer);
   116 	if (aExpectedError == KErrNone)
   117 		{
   118 		buffer.CreateL(size); // Use size retrieved from GetVideoFrameSize
   119 		}
   120 	else
   121 		{
   122 		buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
   123 		}
   124 	TBool keyFrame;
   125 	TUint timeStampInMs; 
   126 	TUint timeStampInTimescale;
   127 	err = aParse->ReadVideoFrame(buffer, keyFrame, timeStampInMs, timeStampInTimescale);
   128 	User::LeaveIfError(CheckError(err, aExpectedError, _L("ReadVideoFrame")));
   129 	CleanupStack::PopAndDestroy(&buffer);
   130 	
   131 	err = aParse->GetVideoTimestamp(timeStampInMs, timeStampInTimescale);
   132 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoTimestamp")));
   133 
   134 	TUint num;
   135 	err = aParse->GetNumberOfVideoFrames(num);
   136 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetNumberOfVideoFrames")));
   137 	
   138 	TUint index;
   139 	err = aParse->GetVideoSampleEntryIndex(index);
   140 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoSampleEntryIndex")));
   141 	
   142 	err = aParse->GetVideoFrameSize(index, size);
   143 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameSize")));
   144 	
   145 	err = aParse->GetVideoFrameStartTime(index, timeStampInMs, timeStampInTimescale);
   146 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameStartTime")));
   147 	
   148 	err = aParse->GetVideoFrameKeyType(index, keyFrame);
   149 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameKeyType")));
   150 	
   151 	TInt level;
   152 	err = aParse->GetH263VideoLevel(level);
   153 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetH263VideoLevel")));
   154 	
   155 	T3GPFrameDependencies dependencies;
   156 	err = aParse->GetVideoFrameDependencies(dependencies);
   157 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameDependencies")));
   158 	
   159 	TUint numberOfFrames = 2;
   160 	RArray<T3GPFrameInfoParameters> array;
   161 	err = aParse->GetVideoFrameProperties(index, numberOfFrames, array);
   162 	array.Close();
   163 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoFrameProperties")));	
   164 	}
   165 
   166 void C3GPLibParser_Negative::CallVideoDecoderInfoApiL(C3GPParse* aParse, TInt aExpectedError)
   167 	{
   168 	RBuf8 buffer;
   169 	CleanupClosePushL(buffer);
   170 	
   171 	TInt dsiSize;
   172 	TInt err = aParse->GetVideoDecoderSpecificInfoSize(dsiSize);
   173 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoDecoderSpecificInfoSize")));
   174 	
   175 	if (aExpectedError == KErrNone)
   176 		{
   177 		buffer.CreateL(dsiSize);
   178 		}
   179 	else
   180 		{
   181 		buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
   182 		}
   183 	err = aParse->GetVideoDecoderSpecificInfo(buffer);
   184 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetVideoDecoderSpecificInfo")));
   185 	
   186 	CleanupStack::PopAndDestroy(&buffer);
   187 	}
   188 
   189 void C3GPLibParser_Negative::CallAudioDecoderInfoApiL(C3GPParse* aParse, TInt aExpectedError)
   190 	{
   191 	RBuf8 buffer;
   192 	CleanupClosePushL(buffer);
   193 	TInt dsiSize;
   194 	TInt err = aParse->GetAudioDecoderSpecificInfoSize(dsiSize);
   195 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioDecoderSpecificInfoSize")));
   196 	
   197 	if (aExpectedError == KErrNone)
   198 		{
   199 		buffer.CreateL(dsiSize);
   200 		}
   201 	else
   202 		{
   203 		buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
   204 		}
   205 	err = aParse->GetAudioDecoderSpecificInfo(buffer);
   206 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetAudioDecoderSpecificInfo")));
   207 	
   208 	CleanupStack::PopAndDestroy(&buffer);
   209 	}
   210 
   211 // Retrieve user data atom. 
   212 void C3GPLibParser_Negative::CallUDTApiL(C3GPParse* aParse, TUint32 aUdtType, TUint& aIndex, TInt aExpectedError, T3GPUdtaLocation aLocation)
   213 	{
   214 	TInt err = KErrNone;
   215 	TInt udtSize;
   216 	TUint tempIndex = aIndex;	// use the copy of the aIndex so it does not get overwritten by GetUserDataAtomSize
   217 
   218 	err = aParse->GetUserDataAtomSize(aUdtType, aLocation, tempIndex, udtSize);
   219 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetUserDataAtomSize")));
   220 	
   221 	RBuf8 buffer;	
   222 	CleanupClosePushL(buffer);
   223 	
   224 	if (aExpectedError == KErrNone && err == KErrNone)
   225 		{
   226 		buffer.CreateL(udtSize); // Use size retrieved from GetUserDataAtomSize
   227 		}
   228 	else
   229 		{
   230 		buffer.CreateL(KBufferSize); // size from above may not be assigned since this is negative tests.
   231 		}
   232 	err = aParse->GetUserDataAtom(aUdtType, aLocation, buffer, aIndex);
   233 	CleanupStack::PopAndDestroy(&buffer);
   234 	
   235 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetUserDataAtom")));
   236 	}
   237 
   238 void C3GPLibParser_Negative::CallCommonApiL(C3GPParse* aParse, TInt aExpectedError)
   239 	{
   240 	TInt err = KErrNone;
   241 	
   242 	TUint size;
   243 	TUint avgBitRate;
   244 	err = aParse->GetContainerProperties(size, avgBitRate);
   245 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetContainerProperties")));
   246 	
   247 	T3GPFrameType type;
   248 	err = aParse->C3GPParse::GetFrameType(type);
   249 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetFrameType")));
   250 	
   251 	TBool streamable;
   252 	err = aParse->GetStreamable(streamable);
   253 	User::LeaveIfError(CheckError(err, aExpectedError, _L("GetStreamable")));
   254 	
   255 	TUint position = 0;
   256 	TBool keyFrame = EFalse;
   257 	TUint audioPosition;
   258 	TUint videoPosition;
   259 	err = aParse->Seek(position, keyFrame, audioPosition, videoPosition);
   260 	User::LeaveIfError(CheckError(err, aExpectedError, _L("Seek")));
   261 	}
   262 
   263 // -----------------------------------------------------------------------------
   264 // Create 3GP Parser to read zero size file content and call all APIs except
   265 // asynchrounous read
   266 // -----------------------------------------------------------------------------
   267 //
   268 C3GPLibParser_0101::C3GPLibParser_0101()
   269 	{	
   270 	}
   271 
   272 TVerdict C3GPLibParser_0101::doTestStepL()
   273 	{
   274 	if(TestStepResult() == EPass)
   275 		{
   276 		C3GPParse* parser = C3GPParse::NewL();
   277 		CleanupStack::PushL(parser);
   278 		
   279 		TRAPD(err, EmptyFileFailedCorruptL(parser));
   280 		if (err != KErrNone)
   281 			{
   282 			SetTestStepResult(EFail);
   283 			}
   284 		
   285 		CleanupStack::PopAndDestroy(parser);
   286 		}
   287 	return TestStepResult();
   288 	}
   289 
   290 void C3GPLibParser_0101::EmptyFileFailedCorruptL(C3GPParse* aParse)
   291 	{
   292 	// all api test with empty file using file path
   293 	// When the parser is in use, calling parser open again should fail with KErrInUse
   294 	ParserOpenFileL(aParse, KErrInUse);
   295 	
   296 	CallCommonApiL(aParse, KErrCorrupt);
   297 	CallVideoApiL(aParse, KErrCorrupt);
   298 	CallAudioApiL(aParse, KErrCorrupt);
   299 	CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
   300 	CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
   301 	TUint32 udtType = 0x7469746c;
   302 	TUint index;
   303 	CallUDTApiL(aParse, udtType, index, KErrCorrupt);
   304 	T3GPUdtaLocation location = E3GPUdtaAudioTrak;
   305 	CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
   306 	ParserCompleteL(aParse);	
   307 	
   308 	// all api test with empty file using file handle
   309 	// When the parser is in use, calling parser open again should fail with KErrInUse
   310 	ParserOpenFileHandleL(aParse, EFileRead | EFileShareReadersOnly, KErrInUse);
   311 
   312 	CallCommonApiL(aParse, KErrCorrupt);
   313 	CallVideoApiL(aParse, KErrCorrupt);
   314 	CallAudioApiL(aParse, KErrCorrupt);
   315 	CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
   316 	CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
   317 	CallUDTApiL(aParse, udtType, index, KErrCorrupt);
   318 	CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
   319 	ParserCompleteHandleL(aParse);
   320 
   321 	// all api test with empty file using CAF
   322 	// When the parser is in use, calling parser open again should fail with KErrInUse
   323 	ParserOpenCafLC(aParse, KErrInUse);
   324 	
   325 	CallCommonApiL(aParse, KErrCorrupt);
   326 	CallVideoApiL(aParse, KErrCorrupt);
   327 	CallAudioApiL(aParse, KErrCorrupt);
   328 	CallVideoDecoderInfoApiL(aParse, KErrCorrupt);
   329 	CallAudioDecoderInfoApiL(aParse, KErrCorrupt);
   330 	CallUDTApiL(aParse, udtType, index, KErrCorrupt);
   331 	CallUDTApiL(aParse, udtType, index, KErrCorrupt, location);
   332 	ParserCompleteCafL(aParse);
   333 	
   334 	// test open using buffer mode
   335 	// When the parser is in use, calling parser open again should fail with KErrInUse
   336 	ParserOpenL(aParse, KErrInUse);
   337 	ParserCompleteL(aParse);
   338 	// Call complete again, should pass with no error
   339 	ParserCompleteL(aParse);
   340 	}
   341 
   342 // -----------------------------------------------------------------------------
   343 // Initialise a 3GP file parse with an empty filename and file path pointing 
   344 // at non-existent files
   345 // -----------------------------------------------------------------------------
   346 //
   347 C3GPLibParser_0102::C3GPLibParser_0102()
   348 	{	
   349 	}
   350 
   351 TVerdict C3GPLibParser_0102::doTestStepL()
   352 	{
   353 	if(TestStepResult() == EPass)
   354 		{
   355 		C3GPParse* parser = C3GPParse::NewL();
   356 		CleanupStack::PushL(parser);
   357 		
   358 		// Initialise a 3GP file parse with an empty filename and it should fail with KErrUnderflow
   359 		TInt err = parser->Open(KEmptyFileString);		
   360 		if (err != KErrUnderflow)
   361 			{
   362 			ERR_PRINTF2(_L("parser->Open(KEmptyFileString) expects KErrUnderflow. Returns with %d"), err);
   363 			SetTestStepResult(EFail);
   364 			}
   365 		
   366 		// Setup 3GP Parser with a file path of a non-existing file.  This should fail with KErrAccessDenied.
   367 		err = parser->Open(KInvalidFileString);
   368 		if (err != KErrAccessDenied)
   369 			{
   370 			ERR_PRINTF2(_L("parser->Open(KEmptyFileString) expects KErrAccessDenied. Returns with %d"), err);
   371 			SetTestStepResult(EFail);
   372 			}
   373 		
   374 		CleanupStack::PopAndDestroy(parser);
   375 		}
   376 	return TestStepResult();
   377 	}
   378 
   379 // -----------------------------------------------------------------------------
   380 // Create parser by passing in a file path of a file already opened in 
   381 // EFileShareExclusive mode. 
   382 // -----------------------------------------------------------------------------
   383 //
   384 C3GPLibParser_0104::C3GPLibParser_0104()
   385 	{	
   386 	}
   387 
   388 TVerdict C3GPLibParser_0104::doTestStepL()
   389 	{
   390 	if(TestStepResult() == EPass)
   391 		{
   392 		C3GPParse* parser = C3GPParse::NewL();
   393 		CleanupStack::PushL(parser);
   394 		
   395 		// Open a valid mp4/3gp/3g2 file with EFileShareExclusive mode
   396 		// Instantiate a 3GP parser object with the same file path already opened above
   397 		FileOpenL(EFileShareExclusive);
   398 		TInt err = parser->Open(iInputFile);
   399 		if (err != KErrAccessDenied)
   400 			{
   401 			ERR_PRINTF2(_L("parser->Open(iInputFile) expects KErrAccessDenied. Returns with %d"), err);
   402 			SetTestStepResult(EFail);
   403 			}
   404 		ParserCompleteL(parser);
   405 		FileClose();
   406 
   407 		CleanupStack::PopAndDestroy(parser);
   408 		}
   409 	return TestStepResult();
   410 	}
   411 
   412 // -----------------------------------------------------------------------------
   413 // Use 3GP Parser to parse file before it has been setup
   414 // -----------------------------------------------------------------------------
   415 //
   416 C3GPLibParser_0106::C3GPLibParser_0106()
   417 	{	
   418 	}
   419 
   420 TVerdict C3GPLibParser_0106::doTestStepL()
   421 	{
   422 	if(TestStepResult() == EPass)
   423 		{
   424 		C3GPParse* parser = C3GPParse::NewL();
   425 		CleanupStack::PushL(parser);
   426 
   427 		TRAPD(err, AllApiFailedNotReadyL(parser));
   428 		if (err != KErrNone)
   429 			{
   430 			SetTestStepResult(EFail);
   431 			}
   432 		
   433 		CleanupStack::PopAndDestroy(parser);
   434 		}
   435 	return TestStepResult();
   436 	}
   437 
   438 void C3GPLibParser_0106::AllApiFailedNotReadyL(C3GPParse* aParse)
   439 	{
   440 	CallCommonApiL(aParse, KErrNotReady);
   441 	CallVideoApiL(aParse, KErrNotReady);
   442 	CallAudioApiL(aParse, KErrNotReady);
   443 	CallVideoDecoderInfoApiL(aParse, KErrNotReady);
   444 	CallAudioDecoderInfoApiL(aParse, KErrNotReady);
   445 	TUint32 udtType = 0x7469746c;
   446 	TUint index;
   447 	CallUDTApiL(aParse, udtType, index, KErrNotReady);
   448 	
   449 	RBuf8 buffer;
   450 	CleanupClosePushL(buffer);
   451 	// create 0 size buffer for negative test when API is called before parse is opened
   452 	buffer.CreateL(0); 
   453 	TInt err = aParse->InsertData(buffer);
   454 	User::LeaveIfError(CheckError(err, KErrNotReady, _L("aParse->InsertData")));
   455 	CleanupStack::PopAndDestroy(&buffer);
   456 	
   457 	TInt num;
   458 	err = aParse->GetNumBufferedBytes(num);
   459 	User::LeaveIfError(CheckError(err, KErrNotReady, _L("aParse->InsertData")));
   460 	}
   461 
   462 // -----------------------------------------------------------------------------
   463 // Use invalid frame type for all frame type API.
   464 // -----------------------------------------------------------------------------
   465 //
   466 C3GPLibParser_0107::C3GPLibParser_0107()
   467 	{
   468 	}
   469 
   470 TVerdict C3GPLibParser_0107::doTestStepL()
   471 	{
   472 	if(TestStepResult() == EPass)
   473 		{
   474 		C3GPParse* parser = C3GPParse::NewL();
   475 		CleanupStack::PushL(parser);
   476 
   477 		TRAPD(err, InvalidFrameTypeL(parser));
   478 		if (err != KErrNone)
   479 			{
   480 			SetTestStepResult(EFail);
   481 			}
   482 		
   483 		CleanupStack::PopAndDestroy(parser);
   484 		}
   485 	return TestStepResult();
   486 	}
   487 
   488 void C3GPLibParser_0107::InvalidFrameTypeL(C3GPParse* aParse)
   489 	{
   490 	// file mode
   491 	ParserOpenFileL(aParse);
   492 	
   493 	// Invalid type tests
   494 	TInt invalidType = 10;	
   495 	T3GPVideoType invalidVideoType = static_cast<T3GPVideoType>(invalidType);
   496 	TUint length; 
   497 	TReal frameRate;
   498 	TUint avgBitRate;
   499 	TSize videoSize;
   500 	TUint timeScale;
   501 	 // should pass
   502 	TInt err = aParse->GetVideoProperties(invalidVideoType, length, frameRate, avgBitRate, videoSize, timeScale);
   503 	User::LeaveIfError(CheckError(err, KErrNone, _L("GetVideoProperties")));
   504 	
   505 	T3GPAudioType invalidAudioType = static_cast<T3GPAudioType>(invalidType);
   506 	TInt framesPerSample;
   507 	 // should pass
   508 	err = aParse->GetAudioProperties(invalidAudioType, length, framesPerSample, avgBitRate, timeScale);
   509 	User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetAudioProperties")));
   510 	
   511 	T3GPFrameType invalidFrameType = static_cast<T3GPFrameType>(invalidType);
   512 	// should pass
   513 	err = aParse->GetFrameType(invalidFrameType); 
   514 	User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetAudioProperties")));
   515 	
   516 	T3GPQcelpStorageMode invalidMode = static_cast<T3GPQcelpStorageMode>(invalidType);
   517 	 //Should pass
   518 	err = aParse->GetQcelpStorageMode(invalidMode);
   519 	User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetVideoProperties() invalid type")));
   520 
   521 	ParserCompleteL(aParse);
   522 	}
   523 
   524 // -----------------------------------------------------------------------------
   525 // Use invalid frame index for video frame APIs and Get video frame properties for more 
   526 // than the total number of video frames in the video clip
   527 // -----------------------------------------------------------------------------
   528 //
   529 C3GPLibParser_0108::C3GPLibParser_0108()
   530 	{	
   531 	}
   532 
   533 TVerdict C3GPLibParser_0108::doTestStepL()
   534 	{
   535 	if(TestStepResult() == EPass)
   536 		{
   537 		C3GPParse* parser = C3GPParse::NewL();
   538 		CleanupStack::PushL(parser);
   539 
   540 		TRAPD(err, AllInvalidFrameIndexL(parser));
   541 		if (err != KErrNone)
   542 			{
   543 			SetTestStepResult(EFail);
   544 			}
   545 		
   546 		CleanupStack::PopAndDestroy(parser);
   547 		}
   548 	return TestStepResult();
   549 	}
   550 
   551 void C3GPLibParser_0108::AllInvalidFrameIndexL(C3GPParse* aParse)
   552 	{
   553 	// file mode
   554 	ParserOpenFileL(aParse);
   555 	
   556 	TUint numOfVideoFrames;
   557 	TInt err = aParse->GetNumberOfVideoFrames(numOfVideoFrames);
   558 	User::LeaveIfError(CheckError(err, KErrNone, _L("aParse->GetNumberOfVideoFrames()")));
   559 	
   560 	// Invalid index. 
   561 	TUint size;
   562 	err = aParse->GetVideoFrameSize(numOfVideoFrames + 100, size);
   563 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameSize() invalid index")));
   564 	
   565 	err = aParse->GetVideoFrameSize((KMaxTUint-15), size);
   566 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameSize() negative index")));
   567 	
   568 	TUint timeStampInMs;
   569 	TUint timeStampInTimescale;
   570 	err = aParse->GetVideoFrameStartTime(numOfVideoFrames + 10, timeStampInMs, timeStampInTimescale);
   571 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameStartTime() invalid index")));
   572 	
   573 	err = aParse->GetVideoFrameStartTime((KMaxTUint-15), timeStampInMs, timeStampInTimescale);
   574 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameStartTime() negative index")));
   575 	
   576 	TBool keyFrame;
   577 	err = aParse->GetVideoFrameKeyType(numOfVideoFrames + 10, keyFrame);
   578 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameKeyType() invalid index")));
   579 	
   580 	err = aParse->GetVideoFrameKeyType((KMaxTUint-15), keyFrame);
   581 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameKeyType() negative index")));
   582 	
   583 	TUint numberOfFrames = 2;
   584 	RArray<T3GPFrameInfoParameters> array;
   585 	CleanupClosePushL(array);
   586 
   587 	err = aParse->GetVideoFrameProperties(numOfVideoFrames + 10, numberOfFrames, array);
   588 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() invalid index")));
   589 	
   590 	// Get video frame properties for more than the total number of video frames in the video clip
   591 	err = aParse->GetVideoFrameProperties(0, numOfVideoFrames + 10, array);
   592 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() invalid number of frame")));
   593 	
   594 	err = aParse->GetVideoFrameProperties((KMaxTUint-1), numOfVideoFrames, array);
   595 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative index")));
   596 	
   597 	err = aParse->GetVideoFrameProperties(15, (KMaxTUint-10), array);
   598 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative numOfVideoFrames")));
   599 
   600 	err = aParse->GetVideoFrameProperties((KMaxTUint-15), numOfVideoFrames + 10, array);
   601 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("aParse->GetVideoFrameProperties() with negative index and invalid numOfVideoFrames")));
   602 
   603 	CleanupStack::PopAndDestroy(&array);
   604 	
   605 	ParserCompleteL(aParse);
   606 	}
   607 
   608 // -----------------------------------------------------------------------------
   609 // Instantiate a 3GP Parser and Call all Parser API that uses frame type as 
   610 // input parameter with invalid frame types 
   611 // -----------------------------------------------------------------------------
   612 //
   613 C3GPLibParser_0109::C3GPLibParser_0109()
   614 	{	
   615 	}
   616 
   617 TVerdict C3GPLibParser_0109::doTestStepL()
   618 	{
   619 	if(TestStepResult() == EPass)
   620 		{
   621 		C3GPParse* parser = C3GPParse::NewL();
   622 		CleanupStack::PushL(parser);
   623 
   624 		TRAPD(err, InvalidFrameTypePanicL(parser));
   625 		if (err != KErrNone)
   626 			{
   627 			SetTestStepResult(EFail);
   628 			}
   629 		
   630 		CleanupStack::PopAndDestroy(parser);
   631 		}
   632 	return TestStepResult();
   633 	}
   634 
   635 void C3GPLibParser_0109::InvalidFrameTypePanicL(C3GPParse* aParse)
   636 	{
   637 	// file mode
   638 	ParserOpenFileL(aParse);
   639 	
   640 	TInt invalidType = 10;	
   641 	TBool available;
   642 	T3GPFrameType invalidFrameType = static_cast<T3GPFrameType>(invalidType);
   643 	 //Should panic
   644 	aParse->GetFrameAvailability(invalidFrameType, available);
   645 	
   646 	ParserCompleteL(aParse);
   647 	}
   648 
   649 // -----------------------------------------------------------------------------
   650 // Get user data atom by passing in an invalid user atom location.
   651 // -----------------------------------------------------------------------------
   652 //
   653 C3GPLibParser_0110::C3GPLibParser_0110()
   654 	{	
   655 	}
   656 
   657 TVerdict C3GPLibParser_0110::doTestStepL()
   658 	{
   659 	if(TestStepResult() == EPass)
   660 		{
   661 		C3GPParse* parser = C3GPParse::NewL();
   662 		CleanupStack::PushL(parser);
   663 
   664 		TRAPD(err, InvalidUdtLocationL(parser));
   665 		if (err != KErrNone)
   666 			{
   667 			SetTestStepResult(EFail);
   668 			}
   669 		
   670 		CleanupStack::PopAndDestroy(parser);
   671 		}
   672 	return TestStepResult();
   673 	}
   674 
   675 void C3GPLibParser_0110::InvalidUdtLocationL(C3GPParse* aParse)
   676 	{
   677 	// file mode
   678 	ParserOpenFileL(aParse);
   679 	
   680 	// Invalid type tests
   681 	TInt invalidType = 10;	
   682 	TUint index;
   683 	TUint32 udtType = 0x7469746c;
   684 	T3GPUdtaLocation invalidLocation = static_cast<T3GPUdtaLocation>(invalidType);	
   685 	RBuf8 buffer;
   686 	CleanupClosePushL(buffer);
   687 	buffer.CreateL(KBufferSize);	
   688 	 //Should panic
   689 	aParse->GetUserDataAtom(udtType, invalidLocation, buffer, index);
   690 	CleanupStack::PopAndDestroy(&buffer);
   691 	
   692 	ParserCompleteL(aParse);
   693 	}
   694 
   695 // -----------------------------------------------------------------------------
   696 // Retrieve information when that info is not in the file or the info is not
   697 // supported by the library
   698 // -----------------------------------------------------------------------------
   699 //
   700 C3GPLibParser_0111::C3GPLibParser_0111()
   701 	{	
   702 	}
   703 
   704 TVerdict C3GPLibParser_0111::doTestStepL()
   705 	{
   706 	if(TestStepResult() == EPass)
   707 		{
   708 		C3GPParse* parser = C3GPParse::NewL();
   709 		CleanupStack::PushL(parser);
   710 		
   711 		TRAPD(err, AllVideoAudioApiFailedL(parser));
   712 		if (err != KErrNone)
   713 			{
   714 			SetTestStepResult(EFail);
   715 			}
   716 		
   717 		CleanupStack::PopAndDestroy(parser);
   718 		}
   719 	return TestStepResult();
   720 	}
   721 
   722 void C3GPLibParser_0111::AllVideoAudioApiFailedL(C3GPParse* aParse)
   723 	{
   724 	// file mode
   725 	ParserOpenFileL(aParse);
   726 	
   727 	TInt expectedErr = KErrNone;
   728 	TUint32 udtType = 0x7469746c;
   729 	TUint index;
   730 	T3GPUdtaLocation location = E3GPUdtaVideoTrak;  
   731 	if (iTestSection.Compare(KAudioOnly) == 0 || iTestSection.Compare(KUnsupportedVideo) == 0)
   732 		{
   733 		CallVideoApiL(aParse, KErrNotSupported);
   734 		CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
   735 		}
   736 	else if (iTestSection.Compare(KVideoOnly) == 0 || iTestSection.Compare(KUnsupportedAudioCodec) == 0 ||
   737 			iTestSection.Compare(KUnsupportedAudioStream) == 0)
   738 		{
   739 		CallAudioApiL(aParse, KErrNotSupported);
   740 		CallAudioDecoderInfoApiL(aParse, KErrNotSupported);
   741 		
   742 		location = E3GPUdtaAudioTrak;
   743 		}
   744 	else if (iTestSection.Compare(KWmaFile) == 0)
   745 		{
   746 		expectedErr = KErrCorrupt;
   747 		CallVideoDecoderInfoApiL(aParse, expectedErr);
   748 		CallUDTApiL(aParse, udtType, index, expectedErr, location); 
   749 		}
   750 	else if (iTestSection.Compare(KMisMatch) == 0)
   751 		{
   752 		// The test file doesn't contain MPEG-4 / AVC video stream. The decoder info should fail. 
   753 		CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
   754 		CallUDTApiL(aParse, udtType, index, KErrNotFound, location); 
   755 		}
   756 	else if (iTestSection.Compare(KNoAudioNoVideo) == 0)
   757 		{
   758 		expectedErr = KErrNotSupported;
   759 		CallVideoApiL(aParse, expectedErr);
   760 		CallVideoDecoderInfoApiL(aParse, expectedErr);
   761 		CallAudioApiL(aParse, expectedErr);
   762 		CallAudioDecoderInfoApiL(aParse, expectedErr);
   763 		CallCommonApiL(aParse, KErrGeneral);
   764 		}
   765 	if (iTestSection.Compare(KWmaFile) == 0 || iTestSection.Compare(KMisMatch) == 0)
   766 		{
   767 		CallVideoApiL(aParse, expectedErr);
   768 		CallAudioApiL(aParse, expectedErr);
   769 		CallAudioDecoderInfoApiL(aParse, expectedErr);
   770 		CallCommonApiL(aParse, expectedErr);
   771 		}
   772 	else
   773 		{
   774 		CallUDTApiL(aParse, udtType, index, KErrNotFound, location); 
   775 		}
   776 	ParserCompleteL(aParse);
   777 	}
   778 
   779 // -----------------------------------------------------------------------------
   780 // Seek to an invalid position of the file.
   781 // -----------------------------------------------------------------------------
   782 //
   783 C3GPLibParser_0119::C3GPLibParser_0119()
   784 	{
   785 	}
   786 
   787 TVerdict C3GPLibParser_0119::doTestStepL()
   788 	{
   789 	if(TestStepResult() == EPass)
   790 		{
   791 		C3GPParse* parser = C3GPParse::NewL();
   792 		CleanupStack::PushL(parser);
   793 		
   794 		TRAPD(err, SeekTestL(parser));
   795 		if (err != KErrNone)
   796 			{
   797 			SetTestStepResult(EFail);
   798 			}
   799 		
   800 		CleanupStack::PopAndDestroy(parser);
   801 		}
   802 	return TestStepResult();
   803 	}
   804 
   805 void C3GPLibParser_0119::SeekTestL(C3GPParse* aParse)
   806 	{
   807 	// file mode
   808 	ParserOpenFileL(aParse);
   809 	
   810 	TUint audioPos;
   811 	TUint videoPos;
   812 	TUint timeStampInMs = 0;
   813 	
   814 	// Seek to position 0.
   815 	TInt err = KErrNone; 
   816 	err = aParse->Seek(timeStampInMs, ETrue, audioPos, videoPos);
   817 	if (iTestSection.Compare(KNoAudioNoVideo) == 0)
   818 		{
   819 		User::LeaveIfError(CheckError(err, KErrGeneral, 
   820 				_L("aParser->Seek(timeStampInMs, ETrue, audioPos, videoPos) with file without audio nor video")));
   821 		err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
   822 		User::LeaveIfError(CheckError(err, KErrGeneral, 
   823 				_L("aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos) with file without audio nor video")));
   824 		}	
   825 	else
   826 		{
   827 		User::LeaveIfError(CheckError(err, KErrNone, 
   828 				_L("aParser->Seek(timeStampInMs, ETrue, audioPos, videoPos) with file with audio/video")));
   829 		err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
   830 		User::LeaveIfError(CheckError(err, KErrNone, 
   831 				_L("aParser->Seek(timeStampInMs, EFalse, audioPos, videoPos) with file with audio/video")));
   832 		}
   833 	
   834 	if (iTestSection.Compare(KNoAudioNoVideo) != 0)
   835 		{
   836 		// Retrieve video & audio stream length
   837 		TUint videoLength; 
   838 		TUint audioLength; 
   839 		TInt videoError;
   840 
   841 		err = GetClipProperties(aParse, videoError, videoLength, audioLength);
   842 		if (iTestSection.Compare(KAudioOnly) == 0)
   843 			{
   844 			// audio only, GetVideoProperties should fail with KErrNotSupported. Set video length to 0
   845 			User::LeaveIfError(CheckError(videoError, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength))")));
   846 			videoLength = 0;
   847 			}
   848 		else if (iTestSection.Compare(KVideoOnly) == 0)
   849 			{
   850 			// video only, GetAudioProperties should fail with KErrNotSupported. Set audio length to 0
   851 			User::LeaveIfError(CheckError(err, KErrNotSupported, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
   852 			audioLength = 0;
   853 			}
   854 		else 
   855 			{
   856 			// All other files contains audio data
   857 			User::LeaveIfError(CheckError(videoError, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
   858 			User::LeaveIfError(CheckError(err, KErrNone, _L("GetClipProperties(aParse, videoError, videoLength, audioLength)")));
   859 			}
   860 		
   861 		if (audioLength >= videoLength)
   862 			{
   863 			timeStampInMs = audioLength + 10000;
   864 			}
   865 		else
   866 			{
   867 			timeStampInMs = videoLength + 10000;
   868 			}
   869 		
   870 		// Seek returns KErrNone even thought the position is more than the audio/video length. AudioPos/videoPos should
   871 		// be the the last audio/video position
   872 		err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
   873 		User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->Seek() to an invalid position")));
   874 		
   875 		timeStampInMs = 0;
   876 		err = aParse->Seek(timeStampInMs, EFalse, audioPos, videoPos);
   877 		User::LeaveIfError(CheckError(err, KErrNone, _L("aParser->Seek(0, EFalse, audioPos, videoPos)")));
   878 		}
   879 	ParserCompleteL(aParse);
   880 	}
   881 
   882 // -----------------------------------------------------------------------------
   883 // Read Video Decoder Info, video frame dependencies and user atom when these 
   884 // info is not in the file
   885 // -----------------------------------------------------------------------------
   886 //
   887 C3GPLibParser_0120::C3GPLibParser_0120()
   888 	{
   889 	}
   890 
   891 TVerdict C3GPLibParser_0120::doTestStepL()
   892 	{
   893 	if(TestStepResult() == EPass)
   894 		{
   895 		TInt readBufferSize = 1000;
   896 		C3GPParse* parser = C3GPParse::NewL(readBufferSize);
   897 		CleanupStack::PushL(parser);
   898 		
   899 		TRAPD(err, VideoAttributesL(parser));
   900 		if (err != KErrNone)
   901 			{
   902 			SetTestStepResult(EFail);
   903 			}
   904 		
   905 		CleanupStack::PopAndDestroy(parser);
   906 		}
   907 	return TestStepResult();
   908 	}
   909 
   910 void C3GPLibParser_0120::VideoAttributesL(C3GPParse* aParse)
   911 	{
   912 	// file mode
   913 	ParserOpenFileL(aParse);
   914 	
   915 	// Read Video Decoder Info from a mp4/3gp/3g2 file containing H263 video.
   916 	CallVideoDecoderInfoApiL(aParse, KErrNotSupported);
   917 	
   918 	ParserCompleteL(aParse);
   919 	}
   920 
   921 // -----------------------------------------------------------------------------
   922 // Instantiate parser with  read buffer size < 0. 
   923 // -----------------------------------------------------------------------------
   924 //
   925 C3GPLibParser_0126::C3GPLibParser_0126()
   926 	{	
   927 	}
   928 
   929 TVerdict C3GPLibParser_0126::doTestStepL()
   930 	{
   931 	if(TestStepResult() == EPass)
   932 		{
   933 		TInt readBufferSize = -1;
   934 		C3GPParse* parser = C3GPParse::NewL(readBufferSize);
   935 		if (parser)
   936 			{
   937 			SetTestStepResult(EFail);
   938 			delete parser;
   939 			parser = NULL;
   940 			}		
   941 		}
   942 	return TestStepResult();
   943 	}
   944 
   945 // -----------------------------------------------------------------------------
   946 // Retrieve video and audio info using empty buffer and size 1 buffer for all 
   947 // buffer related API.
   948 // -----------------------------------------------------------------------------
   949 //
   950 C3GPLibParser_0127::C3GPLibParser_0127()
   951 	{
   952 	}
   953 
   954 TVerdict C3GPLibParser_0127::doTestStepL()
   955 	{
   956 	if(TestStepResult() == EPass)
   957 		{
   958 		TInt readBufferSize = 1000;
   959 		C3GPParse* parser = C3GPParse::NewL(readBufferSize);
   960 		CleanupStack::PushL(parser);
   961 		
   962 		TRAPD(err, TestEmptyBufferL(parser));
   963 		if (err != KErrNone)
   964 			{
   965 			SetTestStepResult(EFail);
   966 			}
   967 		
   968 		CleanupStack::PopAndDestroy(parser);
   969 		}
   970 	return TestStepResult();
   971 	}
   972 
   973 void C3GPLibParser_0127::TestEmptyBufferL(C3GPParse* aParse)
   974 	{
   975 	// file mode
   976 	ParserOpenFileL(aParse);
   977 	
   978 	// Create an empty buffer
   979 	TInt expectedErr = KErrOverflow;
   980 	RBuf8 buffer;	
   981 	CleanupClosePushL(buffer);
   982 	
   983 	TUint32 udtType = 0x6d657461; // The udt type of test file is 'meta'
   984 	TUint index = 0;
   985 	T3GPUdtaLocation location = E3GPUdtaVideoTrak;
   986 	
   987 	if (iTestSection.Compare(KAudioMore) != 0)
   988 		{
   989 		buffer.CreateL(1);
   990 		}
   991 	else
   992 		{
   993 		buffer.CreateL(0);
   994 		}
   995 	
   996 	TInt err = aParse->GetUserDataAtom(udtType, location, buffer, index);
   997 	User::LeaveIfError(CheckError(err, expectedErr, _L("GetUserDataAtom")));
   998 	
   999 	err = aParse->GetVideoDecoderSpecificInfo(buffer);
  1000 	User::LeaveIfError(CheckError(err, expectedErr, _L("GetVideoDecoderSpecificInfo")));
  1001 	
  1002 	err = aParse->GetAudioDecoderSpecificInfo(buffer);
  1003 	User::LeaveIfError(CheckError(err, expectedErr, _L("GetAudioDecoderSpecificInfo")));
  1004 	
  1005 	err = aParse->InsertData(buffer);
  1006 	User::LeaveIfError(CheckError(err, KErrGeneral, _L("InsertData")));
  1007 	
  1008 	TUint timeStampInMs;
  1009 	TUint timeStampInTimescale;
  1010 	TInt returnedFrames;
  1011 	err = aParse->ReadAudioFrames(buffer, returnedFrames, timeStampInMs, timeStampInTimescale);
  1012 	User::LeaveIfError(CheckError(err, expectedErr, _L("ReadAudioFrames")));
  1013 	
  1014 	TBool keyframe;
  1015 	err = aParse->ReadVideoFrame(buffer, keyframe, timeStampInMs, timeStampInTimescale);
  1016 	User::LeaveIfError(CheckError(err, expectedErr, _L("ReadVideoFrame")));
  1017 	
  1018 	iSchedulerWait = new (ELeave) CActiveSchedulerWait;
  1019 	if(!iSchedulerWait)
  1020 		{
  1021 		User::Leave(KErrNoMemory);
  1022 		}
  1023 
  1024 	iWaitForNotification = ETrue;
  1025 	aParse->ReadVideoFrame(*this, buffer);
  1026 	
  1027 	if (iWaitForNotification)
  1028 	    {
  1029 		iSchedulerWait->Start();
  1030 	    }
  1031 	err = iAsyncError;
  1032 	User::LeaveIfError(CheckError(err, expectedErr, _L("ReadVideoFrame async")));
  1033 	
  1034 	iWaitForNotification = ETrue;
  1035 	aParse->ReadAudioFrames(*this, buffer);
  1036 	CleanupStack::PopAndDestroy(&buffer);
  1037 	
  1038 	if (iWaitForNotification)
  1039 	    {
  1040 		iSchedulerWait->Start();
  1041 	    }
  1042 	err = iAsyncError;
  1043 	User::LeaveIfError(CheckError(err, expectedErr, _L("ReadAudioFrames async")));
  1044 	
  1045 	if ( iSchedulerWait->IsStarted() )
  1046         {
  1047         iSchedulerWait->AsyncStop();
  1048 	    }
  1049 	ParserCompleteL(aParse);
  1050 	}
  1051 
  1052 // -----------------------------------------------------------------------------
  1053 // Async read before the parser has been setup.
  1054 // -----------------------------------------------------------------------------
  1055 //
  1056 C3GPLibParser_0130::C3GPLibParser_0130()
  1057 	{
  1058 	}
  1059 
  1060 TVerdict C3GPLibParser_0130::doTestStepPreambleL()
  1061 	{
  1062 	C3GPLib_AsyncObserver::doTestStepPreambleL();	
  1063 	if (TestStepResult() == EPass)
  1064 		{
  1065 		iScheduler = new (ELeave) CActiveScheduler;
  1066 		CActiveScheduler::Install(iScheduler);
  1067 		}
  1068 	return TestStepResult();
  1069 	}
  1070 
  1071 TVerdict C3GPLibParser_0130::doTestStepPostambleL()
  1072 	{
  1073 	C3GPLibParser_base::doTestStepPostambleL();
  1074 	if( iScheduler )
  1075 		{
  1076 		INFO_PRINTF1(_L("delete iScheduler"));
  1077 		CActiveScheduler::Install(NULL);
  1078 		delete iScheduler;
  1079 		iScheduler = NULL;
  1080 		}
  1081 
  1082 	return TestStepResult();
  1083 	}
  1084 
  1085 TVerdict C3GPLibParser_0130::doTestStepL()
  1086 	{
  1087 	if(TestStepResult() == EPass)
  1088 		{
  1089 		C3GPParse* parser = C3GPParse::NewL();
  1090 		CleanupStack::PushL(parser);
  1091 		
  1092 		TRAPD(err, ReadFrameAsyncWoOpenL(parser));
  1093 		if (err != KErrNone)
  1094 			{
  1095 			SetTestStepResult(EFail);
  1096 			}
  1097 		
  1098 		CleanupStack::PopAndDestroy(parser);
  1099 		}
  1100 	return TestStepResult();
  1101 	}
  1102 
  1103 void C3GPLibParser_0130::ReadFrameAsyncWoOpenL(C3GPParse* aParser)
  1104 	{
  1105 	TInt err = ReadAudioVideoFrameAsync(aParser, ETrue);
  1106 	User::LeaveIfError(CheckError(err, KErrNotReady, _L("ReadAudioVideoFrameAsync audio")));
  1107 
  1108 	err = ReadAudioVideoFrameAsync(aParser, EFalse);
  1109 	User::LeaveIfError(CheckError(err, KErrNotReady, _L("ReadAudioVideoFrameAsync video")));
  1110 	
  1111 	aParser->CancelReadFrame();
  1112 	}
  1113 
  1114 // -----------------------------------------------------------------------------
  1115 // Async read negative test after the parser has been setup.
  1116 // -----------------------------------------------------------------------------
  1117 //
  1118 C3GPLibParser_0131::C3GPLibParser_0131()
  1119 	{
  1120 	}
  1121 
  1122 TVerdict C3GPLibParser_0131::doTestStepPreambleL()
  1123 	{
  1124 	C3GPLib_AsyncObserver::doTestStepPreambleL();	
  1125 	if (TestStepResult() == EPass)
  1126 		{
  1127 		iScheduler = new (ELeave) CActiveScheduler;
  1128 		CActiveScheduler::Install(iScheduler);
  1129 		}
  1130 	return TestStepResult();
  1131 	}
  1132 
  1133 TVerdict C3GPLibParser_0131::doTestStepPostambleL()
  1134 	{
  1135 	C3GPLib_AsyncObserver::doTestStepPostambleL();
  1136 	if( iScheduler )
  1137 		{
  1138 		INFO_PRINTF1(_L("delete iScheduler"));
  1139 		CActiveScheduler::Install(NULL);
  1140 		delete iScheduler;
  1141 		iScheduler = NULL;
  1142 		}
  1143 
  1144 	return TestStepResult();
  1145 	}
  1146 
  1147 TVerdict C3GPLibParser_0131::doTestStepL()
  1148 	{
  1149 	if(TestStepResult() == EPass)
  1150 		{
  1151 		C3GPParse* parser = C3GPParse::NewL();
  1152 		CleanupStack::PushL(parser);
  1153 		
  1154 		TRAPD(err, ReadFrameAsyncAfterOpenL(parser));
  1155 		if (err != KErrNone)
  1156 			{
  1157 			SetTestStepResult(EFail);
  1158 			}
  1159 		
  1160 		CleanupStack::PopAndDestroy(parser);
  1161 		}
  1162 	return TestStepResult();
  1163 	}
  1164 
  1165 void C3GPLibParser_0131::ReadFrameAsyncAfterOpenL(C3GPParse* aParser)
  1166 	{
  1167 	// file mode
  1168 	ParserOpenFileL(aParser);
  1169 	
  1170 	TInt videoError;
  1171 	TUint videoLength;
  1172 	TUint audioLength;
  1173 	TInt AudioErr = GetClipProperties(aParser, videoError, videoLength, audioLength);
  1174 	
  1175 	if (AudioErr != KErrNone && AudioErr != KErrNotSupported && AudioErr == KErrCorrupt)
  1176 		{
  1177 		SetTestStepError(AudioErr);
  1178 		if (!ShouldRunOOMTest())
  1179 			{
  1180 			ERR_PRINTF2(_L("audioErr %d;  "), AudioErr);
  1181 			}
  1182 		ParserCompleteL(aParser);
  1183 		return;
  1184 		}
  1185 	if (videoError != KErrNone && videoError != KErrNotSupported && videoError != KErrCorrupt)
  1186 		{
  1187 		SetTestStepError(videoError);
  1188 		ERR_PRINTF2(_L("videoError %d;  "), videoError);
  1189 		ParserCompleteL(aParser);
  1190 		return;
  1191 		}
  1192 	
  1193 	TInt err = KErrNone;
  1194 	
  1195 	// Call read audio frame async when there is no audio. Expects error
  1196 	if (AudioErr == KErrNotSupported || AudioErr == KErrCorrupt)
  1197 		{
  1198 		err = ReadAudioVideoFrameAsync(aParser, ETrue);
  1199 		}
  1200 	
  1201 	if (err != KErrNone)
  1202 		{
  1203 		if (!ShouldRunOOMTest())
  1204 			{
  1205 			ERR_PRINTF2(_L("ReadAudioVideoFrameAsync audio err %d "), err);
  1206 			}
  1207 		SetTestStepError(err);
  1208 		}
  1209 
  1210 	// Call read video frame async when there is no video. Expects error
  1211 	if (videoError == KErrNotSupported && AudioErr != KErrNotSupported)
  1212 		{
  1213 		err = ReadAudioVideoFrameAsync(aParser, EFalse);
  1214 		if (err != KErrNone)
  1215 			{
  1216 			if (!ShouldRunOOMTest())
  1217 				{
  1218 				ERR_PRINTF2(_L("ReadAudioVideoFrameAsync video err %d "), err);
  1219 				}
  1220 			SetTestStepError(err);
  1221 			}
  1222 		}
  1223 	
  1224 	// call Cancel Async read  when there is no outstanding async read request
  1225 	aParser->CancelReadFrame();
  1226 	
  1227 	ParserCompleteL(aParser);
  1228 	}
  1229 
  1230 // -----------------------------------------------------------------------------
  1231 // Retrieve video & audio frames async in buffer mode.
  1232 // -----------------------------------------------------------------------------
  1233 //
  1234 C3GPLibParser_0136::C3GPLibParser_0136()
  1235 	{
  1236 	}
  1237 
  1238 TVerdict C3GPLibParser_0136::doTestStepPreambleL()
  1239 	{
  1240 	C3GPLib_AsyncObserver::doTestStepPreambleL();	
  1241 	if (TestStepResult() == EPass)
  1242 		{
  1243 		iScheduler = new (ELeave) CActiveScheduler;
  1244 		CActiveScheduler::Install(iScheduler);
  1245 		}
  1246 	return TestStepResult();
  1247 	}
  1248 
  1249 TVerdict C3GPLibParser_0136::doTestStepPostambleL()
  1250 	{
  1251 	C3GPLib_AsyncObserver::doTestStepPostambleL();
  1252 	if( iScheduler )
  1253 		{
  1254 		INFO_PRINTF1(_L("delete iScheduler"));
  1255 		CActiveScheduler::Install(NULL);
  1256 		delete iScheduler;
  1257 		iScheduler = NULL;
  1258 		}
  1259 
  1260 	return TestStepResult();
  1261 	}
  1262 
  1263 TVerdict C3GPLibParser_0136::doTestStepL()
  1264 	{
  1265 	if(TestStepResult() == EPass)
  1266 		{
  1267 		C3GPParse* parser = C3GPParse::NewL();
  1268 		CleanupStack::PushL(parser);
  1269 		
  1270 		TRAPD(err, ReadFrameAsyncInBufferModeL(parser));
  1271 		if (err != KErrNone)
  1272 			{
  1273 			SetTestStepResult(EFail);
  1274 			}
  1275 		
  1276 		CleanupStack::PopAndDestroy(parser);
  1277 		}
  1278 	return TestStepResult();
  1279 	}
  1280 
  1281 void C3GPLibParser_0136::OpenFileInBufferModeL(C3GPParse& aParser)
  1282 	{
  1283 	// open parser in buffer mode
  1284 	User::LeaveIfError(aParser.Open());
  1285 	
  1286 	RFs fs;
  1287 	User::LeaveIfError(fs.Connect());
  1288 	CleanupClosePushL(fs);
  1289 	
  1290 	RFile file;
  1291 	User::LeaveIfError(file.Open(fs, iInputFile, EFileRead | EFileStream));
  1292 	CleanupClosePushL(file);
  1293 	
  1294 	RBuf8 buffer;
  1295 	buffer.CreateL(1000);
  1296 	CleanupClosePushL(buffer);
  1297 
  1298 	TInt bufferRead = 0;
  1299 	do 
  1300 		{
  1301 		User::LeaveIfError(file.Read(buffer));
  1302 		bufferRead = buffer.Length();
  1303 		if (bufferRead > 0)
  1304 			{
  1305 			User::LeaveIfError(aParser.InsertData(buffer));
  1306 			}
  1307 		} while (bufferRead > 0);
  1308 			
  1309 	CleanupStack::PopAndDestroy(&buffer);
  1310 	CleanupStack::PopAndDestroy(&file);
  1311 	CleanupStack::PopAndDestroy(&fs);			
  1312 	}
  1313 
  1314 void C3GPLibParser_0136::ReadFrameAsyncInBufferModeL(C3GPParse* aParser)
  1315 	{
  1316 	ASSERT(aParser);
  1317 	
  1318 	// buffer mode
  1319 	OpenFileInBufferModeL(*aParser);
  1320 	
  1321 	// Get Video & Audio properties to ensure both source exist
  1322 	T3GPVideoType videoType;
  1323 	T3GPAudioType audioType;	
  1324 	TReal frameRate;
  1325 	TUint avgBitRate;
  1326 	TSize videoSize;
  1327 	TUint timeScale;
  1328 	TInt framesPerSample;
  1329 	TUint length;	
  1330 	
  1331 	User::LeaveIfError(aParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale));	
  1332 	User::LeaveIfError(aParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale));
  1333 	
  1334 	TInt audioFrameErr = ReadAudioVideoFrameAsync(aParser, ETrue);
  1335 	TInt videoFrameErr = ReadAudioVideoFrameAsync(aParser, EFalse);
  1336 	if (audioFrameErr != videoFrameErr)
  1337 		{
  1338 		ERR_PRINTF1(_L("Unexpected error returned"));
  1339 		SetTestStepResult(EInconclusive);
  1340 		}
  1341 	else 
  1342 		{
  1343 		SetTestStepError(audioFrameErr);
  1344 		}
  1345 	
  1346 	// call Cancel Async read  when there is no outstanding async read request
  1347 	aParser->CancelReadFrame();
  1348 	
  1349 	ParserCompleteL(aParser);
  1350 	}
  1351 
  1352 
  1353 // -----------------------------------------------------------------------------
  1354 // Get frame type using file path
  1355 // -----------------------------------------------------------------------------
  1356 //
  1357 C3GPLibParser_0135::C3GPLibParser_0135()
  1358 	{	
  1359 	}
  1360 
  1361 
  1362 TVerdict C3GPLibParser_0135::doTestStepL()
  1363 	{
  1364 	if(TestStepResult() == EPass)
  1365 		{
  1366 		C3GPParse* parser = C3GPParse::NewL();
  1367 		CleanupStack::PushL(parser);
  1368 		
  1369 		TRAPD(err, GetFrameTypeNegativeL(parser));
  1370 		if (err != KErrNone)
  1371 			{
  1372 			SetTestStepResult(EFail);
  1373 			}
  1374 		
  1375 		CleanupStack::PopAndDestroy(parser);
  1376 		}
  1377 	return TestStepResult();
  1378 	}
  1379 
  1380 void C3GPLibParser_0135::GetFrameTypeNegativeL(C3GPParse* aParser)
  1381 	{
  1382 	ParserOpenFileL(aParser);
  1383 	
  1384 	T3GPFrameType type;
  1385 	TInt err = KErrNone;
  1386 	TInt videoError;
  1387 	TUint videoLength;
  1388 	TUint audioLength;
  1389 	TInt AudioErr = GetClipProperties(aParser, videoError, videoLength, audioLength);
  1390 
  1391 	if ((AudioErr != KErrNone && AudioErr != KErrNotSupported))
  1392 		{
  1393 		SetTestStepError(AudioErr);
  1394 		ERR_PRINTF2(_L("audioErr %d;  "), AudioErr);
  1395 		ParserCompleteL(aParser);
  1396 		return;
  1397 		}
  1398 	if ((videoError != KErrNone && videoError != KErrNotSupported))
  1399 		{
  1400 		SetTestStepError(videoError);
  1401 		ERR_PRINTF2(_L("videoError %d;  "), videoError);
  1402 		ParserCompleteL(aParser);
  1403 		return;
  1404 		}
  1405 	
  1406 	if (AudioErr == KErrNone)
  1407 		{
  1408 		// read all audio frames and then check the next frame type
  1409 		err = ReadAudioVideoFrame(aParser, ETrue, ETrue);
  1410 		User::LeaveIfError(CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame")));
  1411 		}
  1412 	
  1413 	if (videoError == KErrNone )
  1414 		{	
  1415 		// read all video frames
  1416 		err = ReadAudioVideoFrame(aParser, ETrue);
  1417 		User::LeaveIfError(CheckError(err, KErrNotFound, _L("ReadAudioVideoFrame")));
  1418 		}
  1419 
  1420 	if (err == KErrNotFound && (AudioErr == KErrNone || videoError == KErrNone))
  1421 		{
  1422 		err = aParser->GetFrameType(type);
  1423 		}
  1424 	
  1425 	if (err != KErrNone)
  1426 		{
  1427 		SetTestStepError(err);
  1428 		}
  1429 	
  1430 	ParserCompleteL(aParser);
  1431 	}
  1432 
  1433 // -----------------------------------------------------------------------------
  1434 // Get audio/video attributes of a large file (>2GB) using 32bit APIs
  1435 // -----------------------------------------------------------------------------
  1436 //
  1437 C3GPLibParser_0137::C3GPLibParser_0137()
  1438 	{	
  1439 	}
  1440 
  1441 TVerdict C3GPLibParser_0137::doTestStepL()
  1442 	{
  1443 	if(TestStepResult() == EPass)
  1444 		{
  1445 		C3GPParse* parser = C3GPParse::NewL();
  1446 		CleanupStack::PushL(parser);
  1447 		
  1448 		TRAPD(err, GetVideoAudioAttributesL(parser));
  1449 		if (err != KErrNone)
  1450 			{
  1451 			SetTestStepError(err); 
  1452 			}
  1453 		
  1454 		CleanupStack::PopAndDestroy(parser);
  1455 		}
  1456 	return TestStepResult();
  1457 	}
  1458 
  1459 void C3GPLibParser_0137::GetVideoAudioAttributesL(C3GPParse* aParser)
  1460 	{
  1461 	// open parser in 32bit file handle
  1462 	ParserOpenFileHandleL(aParser);
  1463 	DoGetVideoAudioAttributesL(aParser);
  1464 	ParserCompleteHandleL(aParser);
  1465 	}
  1466 
  1467 // -----------------------------------------------------------------------------
  1468 // Get audio/video frames of a large file (>2GB) using 32bit APIs
  1469 // -----------------------------------------------------------------------------
  1470 //
  1471 C3GPLibParser_0138::C3GPLibParser_0138()
  1472 	{	
  1473 	}
  1474 
  1475 TVerdict C3GPLibParser_0138::doTestStepL()
  1476 	{
  1477 	if(TestStepResult() == EPass)
  1478 		{
  1479 		C3GPParse* parser = C3GPParse::NewL();
  1480 		CleanupStack::PushL(parser);
  1481 		
  1482 		TRAPD(err, ReadFrameL(parser));
  1483 		if (err != KErrNone)
  1484 			{
  1485 			SetTestStepError(err); 
  1486 			}
  1487 		
  1488 		CleanupStack::PopAndDestroy(parser);
  1489 		}
  1490 	return TestStepResult();
  1491 	}
  1492 
  1493 void C3GPLibParser_0138::ReadFrameL(C3GPParse* aParser)
  1494 	{
  1495 	// open parser in 32bit file handle
  1496 	ParserOpenFileHandleL(aParser);
  1497 	User::LeaveIfError(DoReadFrame(aParser));
  1498 	ParserCompleteHandleL(aParser);
  1499 	}
  1500 
  1501 // -----------------------------------------------------------------------------
  1502 // Get audio/video frames of a large file (>2GB) using 32bit APIs
  1503 // -----------------------------------------------------------------------------
  1504 //
  1505 C3GPLibParser_0139::C3GPLibParser_0139()
  1506 	{	
  1507 	}
  1508 
  1509 TVerdict C3GPLibParser_0139::doTestStepPreambleL()
  1510 	{
  1511 	C3GPLib_AsyncObserver::doTestStepPreambleL();	
  1512 	if (TestStepResult() == EPass)
  1513 		{
  1514 		iScheduler = new (ELeave) CActiveScheduler;
  1515 		CActiveScheduler::Install(iScheduler);
  1516 		}
  1517 	return TestStepResult();
  1518 	}
  1519 
  1520 TVerdict C3GPLibParser_0139::doTestStepPostambleL()
  1521 	{
  1522 	C3GPLib_AsyncObserver::doTestStepPostambleL();
  1523 	if( iScheduler )
  1524 		{
  1525 		INFO_PRINTF1(_L("delete iScheduler"));
  1526 		CActiveScheduler::Install(NULL);
  1527 		delete iScheduler;
  1528 		iScheduler = NULL;
  1529 		}
  1530 
  1531 	return TestStepResult();
  1532 	}
  1533 
  1534 TVerdict C3GPLibParser_0139::doTestStepL()
  1535 	{
  1536 	if(TestStepResult() == EPass)
  1537 		{
  1538 		C3GPParse* parser = C3GPParse::NewL();
  1539 		CleanupStack::PushL(parser);
  1540 		
  1541 		TRAPD(err, ReadFrameAsyncL(parser));
  1542 		if (err != KErrNone)
  1543 			{
  1544 			SetTestStepError(err); 
  1545 			}
  1546 		
  1547 		CleanupStack::PopAndDestroy(parser);
  1548 		}
  1549 	return TestStepResult();
  1550 	}
  1551 
  1552 void C3GPLibParser_0139::ReadFrameAsyncL(C3GPParse* aParser)
  1553 	{	
  1554 	ParserOpenFileHandleL(aParser);
  1555 	User::LeaveIfError(DoReadFrameAsync(aParser));
  1556 	if (!ShouldRunOOMTest())
  1557 		{
  1558 		INFO_PRINTF1(_L("C3GPLibParser_0014::ReadFrameAsyncL() using file handler"));
  1559 		}
  1560 	ParserCompleteHandleL(aParser);
  1561 	}
  1562 
  1563 TInt C3GPLibParser_0139::DoReadFrameAsync(C3GPParse* aParser, TBool aCancel)
  1564 	{    
  1565     TInt err = KErrNone;
  1566     
  1567     if (!aCancel)
  1568     	{
  1569     	err = ReadAudioVideoFrameAsync(aParser, ETrue);
  1570     	if (err == KErrNone)
  1571     		{
  1572     		err = ReadAudioVideoFrameAsync(aParser, EFalse);
  1573     		} 
  1574     	}
  1575     else
  1576     	{
  1577     	err = ReadAudioVideoFrameAsync(aParser, EFalse, ETrue);
  1578     	}
  1579  
  1580     return err;
  1581     }
  1582 
  1583 // -----------------------------------------------------------------------------
  1584 // Test the retrieval of Get video / audio properties when the properties are filled
  1585 // in but the file does not contain any actual data
  1586 // -----------------------------------------------------------------------------
  1587 //
  1588 TVerdict C3GPSingleDataSourceTest::doTestStepPreambleL()
  1589 	{
  1590 	TPtrC inputFile;
  1591 	if(!GetStringFromConfig(ConfigSection(),_L("inputFile"), inputFile))
  1592 		{		
  1593 		SetTestStepResult(EFail);
  1594 		}
  1595 	else 
  1596 		{
  1597 		iParser = C3GPParse::NewL();
  1598 		User::LeaveIfError(iParser->Open(inputFile));			
  1599 		SetTestStepResult(EPass);
  1600 		SetTestStepError(KErrNone);
  1601 		}
  1602 		
  1603 	return TestStepResult();
  1604 	}
  1605 
  1606 TVerdict C3GPSingleDataSourceTest::doTestStepPostambleL()
  1607 	{
  1608 	if (iParser)
  1609 	{
  1610 		iParser->Complete();
  1611 		delete iParser;		
  1612 		
  1613 	}
  1614 	
  1615 	return TestStepResult();	
  1616 	}
  1617 	
  1618 	
  1619 TVerdict C3GPSingleDataSourceTest::doTestStepL()
  1620 	{
  1621 	if (TestStepResult() != EPass)	
  1622 		{
  1623 		return TestStepResult();		
  1624 		}
  1625 	
  1626 	if (ConfigSection() == _L("MM-3GP-PARSE-U-0112-CP-2"))
  1627 		{
  1628 		// for a video only file containing audio properties but no real audio data		
  1629 		T3GPVideoType videoType;
  1630 		TUint length; 
  1631 		TReal frameRate;
  1632 		TUint avgBitRate;
  1633 		TSize videoSize;
  1634 		TUint timeScale;
  1635 		TInt err = iParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
  1636 		if (err == KErrNone)
  1637 			{
  1638 			T3GPAudioType audioType;
  1639 			TInt framesPerSample;
  1640 			TUint length; 
  1641 			TUint avgBitRate;
  1642 			TUint timeScale;
  1643 				
  1644 			err = iParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
  1645 			if (err == KErrNone)
  1646 				{
  1647 				if (audioType == E3GPMpeg4Audio)
  1648 					{
  1649 					TInt size = 0;
  1650 					err = iParser->GetAudioDecoderSpecificInfoSize(size);
  1651 					if (err != KErrNone)
  1652 						{						
  1653 						if (!ShouldRunOOMTest())
  1654 							{						
  1655 							ERR_PRINTF2(_L("C3GPParse::GetAudioDecoderSpecificInfoSize returns %d."), err);						
  1656 							}
  1657 						User::Leave(err);
  1658 						}
  1659 					}
  1660 
  1661 				TBool available = EFalse;	
  1662 				err = iParser->GetFrameAvailability(E3GPAudio, available);				
  1663 				if (err != KErrNone && err != KErrNotFound)
  1664 					{	
  1665 					if (!ShouldRunOOMTest())
  1666 						{										
  1667 						ERR_PRINTF2(_L("C3GPParse::GetFrameAvailability returns %d."), err);
  1668 						}
  1669 					User::Leave(err);
  1670 					}
  1671 					
  1672 				TUint frameSize = 0;
  1673 				err = iParser->GetAudioFramesSize(frameSize);
  1674 				if (err == KErrNone)
  1675 					{
  1676 					// Expect retrieval of audio properties to fail, doesn't matter what error code 
  1677 					// is returned
  1678 					if (!ShouldRunOOMTest())
  1679 						{					
  1680 						ERR_PRINTF1(_L("C3GPParse::GetAudioFramesSize expects to fail but does not"));
  1681 						}
  1682 					SetTestStepResult(EFail);
  1683 					}
  1684 					
  1685 				if (TestStepResult() == EPass)	
  1686 					{
  1687 					TUint frameIndex = 0;					
  1688 					err = iParser->GetAudioSampleEntryIndex(frameIndex);
  1689 					if (err == KErrNone)
  1690 						{
  1691 						// Expect retrieval of audio properties to fail, doesn't matter what error code 
  1692 						// is returned
  1693 						if (!ShouldRunOOMTest())
  1694 							{						
  1695 							ERR_PRINTF1(_L("C3GPParse::GetAudioSampleEntryIndex expects to fail but does not"));
  1696 							}
  1697 						SetTestStepResult(EFail);
  1698 						}						
  1699 					}
  1700 				}
  1701 			else
  1702 				{
  1703 				if (!ShouldRunOOMTest())
  1704 					{				
  1705 					ERR_PRINTF2(_L("C3GPParse::GetAudioProperties returns %d"), err);
  1706 					}
  1707 				User::Leave(err);
  1708 				}	
  1709 			}			
  1710 		}
  1711 	else if (ConfigSection() == _L("MM-3GP-PARSE-U-0111-CP-2"))
  1712 		{
  1713 		// for a file containing audio data & video properties and a video track, but the video track
  1714 		// contains NO video data
  1715 		T3GPAudioType audioType;
  1716 		TInt framesPerSample;
  1717 		TUint length; 
  1718 		TUint avgBitRate;
  1719 		TUint timeScale;
  1720 			
  1721 		TInt err = iParser->GetAudioProperties(audioType, length, framesPerSample, avgBitRate, timeScale);
  1722 		if (err == KErrNone)
  1723 			{
  1724 			T3GPVideoType videoType;
  1725 			TUint length; 
  1726 			TReal frameRate;
  1727 			TUint avgBitRate;
  1728 			TSize videoSize;
  1729 			TUint timeScale;
  1730 			err = iParser->GetVideoProperties(videoType, length, frameRate, avgBitRate, videoSize, timeScale);
  1731 			if (err == KErrNone)
  1732 				{
  1733 				if (videoType == E3GPMpeg4Video || videoType == E3GPAvcProfileBaseline)
  1734 					{
  1735 					TInt size = 0;
  1736 					err = iParser->GetVideoDecoderSpecificInfoSize(size);
  1737 					if (err != KErrNone)
  1738 						{		
  1739 						if (!ShouldRunOOMTest())
  1740 							{										
  1741 							ERR_PRINTF2(_L("C3GPParse::GetVideoDecoderSpecificInfoSize returns %d."), err);
  1742 							}
  1743 						User::Leave(err);
  1744 						}
  1745 					}
  1746 				}
  1747 			else
  1748 				{
  1749 				if (!ShouldRunOOMTest())
  1750 					{				
  1751 					ERR_PRINTF2(_L("C3GPParse::GetVideoProperties returns %d"), err);
  1752 					}
  1753 				User::Leave(err);
  1754 				}	
  1755 				
  1756 			TBool available = EFalse;	
  1757 			err = iParser->GetFrameAvailability(E3GPVideo, available);				
  1758 			if (err != KErrNone && err != KErrNotFound)
  1759 				{		
  1760 				if (!ShouldRunOOMTest())
  1761 					{								
  1762 					ERR_PRINTF2(_L("C3GPParse::GetFrameAvailability returns %d."), err);
  1763 					}
  1764 				User::Leave(err);
  1765 				}
  1766 				
  1767 			TUint numberOfFrames = 0;
  1768 			if (TestStepResult() == EPass)
  1769 				{
  1770 				err = iParser->GetNumberOfVideoFrames(numberOfFrames);	
  1771 				if (err != KErrNone)
  1772 					{
  1773 					if (!ShouldRunOOMTest())
  1774 						{					
  1775 						ERR_PRINTF2(_L("C3GPParse::GetNumberOfVideoFrames returns %d"), err);
  1776 						}
  1777 					User::Leave(err);
  1778 					}
  1779 				if (numberOfFrames != 0)
  1780 					{
  1781 					if (!ShouldRunOOMTest())
  1782 						{					
  1783 						ERR_PRINTF2(_L("C3GPParse::GetNumberOfVideoFrames retrieves %d frames when expecting 0"), numberOfFrames);
  1784 						}
  1785 					SetTestStepResult(EFail);
  1786 					}
  1787 				}
  1788 				
  1789 			if (TestStepResult() == EPass)
  1790 				{
  1791 				TUint frameSize;
  1792 				TInt err = iParser->GetVideoFrameSize(frameSize);
  1793 				if (err == KErrNone)
  1794 					{
  1795 					if (!ShouldRunOOMTest())
  1796 						{					
  1797 						ERR_PRINTF1(_L("C3GPParse::GetVideoFrameSize expects to fail but does not"));
  1798 						}
  1799 					SetTestStepResult(EFail);
  1800 					}
  1801 				}
  1802 				
  1803 			if (TestStepResult() == EPass)
  1804 				{
  1805 				TUint tsInMs = 0;
  1806 				TUint tsInTs = 0;
  1807 				TInt err = iParser->GetVideoTimestamp(tsInMs, tsInTs);
  1808 				if (err == KErrNone)
  1809 					{
  1810 					if (!ShouldRunOOMTest())
  1811 						{					
  1812 						ERR_PRINTF1(_L("C3GPParse::GetVideoTimestamp expects to fail but does not"));
  1813 						}
  1814 					SetTestStepResult(EFail);
  1815 					}
  1816 				}
  1817 				
  1818 			if (TestStepResult() == EPass)
  1819 				{
  1820 				TUint index = 0;
  1821 				TInt err = iParser->GetVideoSampleEntryIndex(index);
  1822 				if (err == KErrNone)
  1823 					{
  1824 					if (!ShouldRunOOMTest())
  1825 						{					
  1826 						ERR_PRINTF1(_L("C3GPParse::GetVideoSampleEntryIndex expects to fail but does not"));
  1827 						}
  1828 					SetTestStepResult(EFail);
  1829 					}
  1830 				}
  1831 			}
  1832 		}
  1833 	else
  1834 		{
  1835 		SetTestStepResult(ETestSuiteError);
  1836 		}
  1837 		
  1838 	return TestStepResult();
  1839 	}
  1840 	
  1841 
  1842