os/ossrv/compressionlibs/ziplib/test/rtest/gziptest/gziptest.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-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 <e32test.h>
    17 #include <ezgzip.h>
    18 
    19 #if !defined(__WINS__)
    20 _LIT(KPath, "Z:\\test\\gzip\\");
    21 #else
    22 _LIT(KPath, "C:\\test\\gzip\\");
    23 #endif
    24 
    25 _LIT(KOutputFilePath, "C:\\test\\gzip\\");
    26 
    27 _LIT(KInputFile, "Hello.txt");
    28 _LIT(KCompressFile,"Hello.gz");
    29 _LIT(KDecompressFile,"Hello_Decompress.txt");
    30 
    31 
    32 static RTest				test(_L("gziptest.exe"));
    33 static RFs					TheFs;
    34 static CTrapCleanup* 		TheTrapCleanup 		= NULL;
    35 static TInt 				TheBufferSize		= 500;
    36 static TFileName 			TheInputFile(KInputFile);
    37 static TFileName 			TheCompressFile(KCompressFile);
    38 static TFileName 			TheDecompressFile(KDecompressFile);
    39 
    40 static void CompressFileL(TFileName& aInputFile, TFileName& aCompressFile, TInt aBufferSize = TheBufferSize);
    41 static void DecompressFileL(TFileName& aInputFile, TFileName& aDecompressFile, TInt aBufferSize = TheBufferSize);
    42 static void CompareFileDataL(TFileName& aSourceFile, TFileName& aDestFile, TInt& aCompare);
    43 static void ThreadForPanicTest(TThreadFunction aPanicThreadFunc);
    44 
    45 inline void DeleteFile(TFileName& aFileName, TBool aPathSpecified = EFalse)
    46 	{
    47 	TFileName deleteFilePath;
    48 	if(!aPathSpecified)
    49 		{
    50 		deleteFilePath.Append(KOutputFilePath);
    51 		}
    52 	deleteFilePath.Append(aFileName);
    53 
    54 	TRAPD(error, TheFs.Delete(deleteFilePath));
    55 	if(error != KErrNone)
    56 		test.Printf(_L("File not deleted: %S"), &deleteFilePath);
    57 	}
    58 	
    59 static void CompressFileL(TFileName& aInputFile, TFileName& aCompressFile, TInt aBufferSize)
    60 	{
    61 	TFileName inputFilePath(KPath);
    62 	inputFilePath.Append(aInputFile);
    63 	
    64 	TFileName compressFilePath(KOutputFilePath);
    65 	compressFilePath.Append(aCompressFile);
    66 	
    67 	RFile input;
    68 	User::LeaveIfError(input.Open(TheFs,inputFilePath, EFileStream | EFileRead | EFileShareReadersOnly));
    69 	CleanupClosePushL(input);
    70 	
    71 	CEZFileToGZip *fileToGzip = NULL;
    72 	TRAPD(error, fileToGzip = CEZFileToGZip::NewL(TheFs, compressFilePath, input, aBufferSize));
    73 	test(error == KErrNone);
    74 	CleanupStack::PushL(fileToGzip);
    75 	
    76 	while(fileToGzip->DeflateL()){/*do nothing*/}
    77 	
    78 	CleanupStack::PopAndDestroy(2);
    79 	}
    80 	
    81 static void DecompressFileL(TFileName& aCompressFile, TFileName& aDecompressFile, TInt aBufferSize)
    82 	{
    83 
    84 	TFileName compressFilePath(KPath);
    85 	compressFilePath.Append(aCompressFile);
    86 	
    87 	TFileName decompressFilePath(KOutputFilePath);
    88 	decompressFilePath.Append(aDecompressFile);
    89 
    90 	RFile output;
    91 	User::LeaveIfError(output.Replace(TheFs, decompressFilePath, EFileStream | EFileWrite | EFileShareExclusive));
    92 	CleanupClosePushL(output);
    93 
    94 	CEZGZipToFile *gzipToFile = NULL;
    95 	TRAPD(error, gzipToFile = CEZGZipToFile::NewL(TheFs, compressFilePath, output, aBufferSize));
    96 	test(error == KErrNone);
    97 	CleanupStack::PushL(gzipToFile);
    98 	
    99 	while (gzipToFile->InflateL()){/*do nothing*/}
   100 
   101 	CleanupStack::PopAndDestroy(2);
   102 	
   103 	}
   104 	
   105 static void CompareFileDataL(TFileName& aSourceFile, TFileName& aDestFile, TInt& aCompare)
   106 	{
   107 	
   108 	TFileName sourceFilePath(KPath);
   109 	sourceFilePath.Append(aSourceFile);
   110 
   111 	TFileName destFilePath(KOutputFilePath);
   112 	destFilePath.Append(aDestFile);
   113 
   114 	RFile source;
   115 	User::LeaveIfError(source.Open(TheFs,sourceFilePath, EFileStream | EFileRead | EFileShareReadersOnly));
   116 	CleanupClosePushL(source);
   117 		
   118 	TInt sourceSize;
   119 	source.Size(sourceSize);
   120 	test(sourceSize > 0);
   121 		
   122 	HBufC8* sourceData = NULL;
   123 	TRAPD(error, sourceData = HBufC8::NewMaxL(sourceSize));
   124 	test(error == KErrNone);
   125 	CleanupStack::PushL(sourceData);
   126 			
   127 	TPtr8 tSourceBufPtr = sourceData->Des();
   128 	User::LeaveIfError(source.Read(0, tSourceBufPtr, sourceSize));
   129 	
   130 	RFile dest;
   131 	User::LeaveIfError(dest.Open(TheFs,destFilePath, EFileStream | EFileWrite | EFileShareExclusive));
   132 	CleanupClosePushL(dest);
   133 
   134 	TInt destSize;
   135 	dest.Size(destSize);
   136 	test(destSize > 0);
   137 	
   138 	HBufC8* destData = NULL;
   139 	TRAP(error, destData = HBufC8::NewMaxL(destSize));
   140 	test(error == KErrNone);
   141 	CleanupStack::PushL(destData);
   142 			
   143 	TPtr8 tDestBufPtr = destData->Des();
   144 	User::LeaveIfError(dest.Read(0, tDestBufPtr, destSize));
   145 		
   146 	aCompare = sourceData->Compare(*destData);
   147 
   148 	CleanupStack::PopAndDestroy(4);
   149 	
   150 	}
   151 
   152 static void ThreadForPanicTest(TThreadFunction aPanicThreadFunc)
   153 	{
   154    	TRequestStatus threadStatus(KRequestPending);
   155    	TRequestStatus threadStatus1(KRequestPending); 
   156    	
   157    	RThread thread;
   158 	TBool justInTime = User::JustInTime();
   159 	User::SetJustInTime(EFalse);
   160 		
   161 	test.Printf(_L("Starting thread for invalid panic test...\n"));
   162 	TInt err=thread.Create(	_L("Panic thread"),aPanicThreadFunc,KDefaultStackSize,0x1000,0x1000,NULL,EOwnerThread );
   163 	
   164 	test.Printf(_L("Thread Creation returned following error code: %d \n"), err);
   165 	test(err == KErrNone);
   166 
   167 	thread.Logon(threadStatus);
   168 	thread.Resume();
   169 	User::WaitForRequest(threadStatus);
   170 
   171 #ifdef _DEBUG
   172 	__ASSERT_ALWAYS(thread.ExitType() == EExitPanic,User::Panic(_L("Thread panic mismatch."),KErrGeneral));
   173 	test.Printf(_L("Invalid Panic test completed successfully for udeb build.\n"));
   174 #else
   175 	test.Printf(_L("Invalid Panic test completed successfully for urel build.\n"));
   176 #endif
   177 	
   178 	thread.Logon(threadStatus1);
   179 	thread.Kill(KErrNone);
   180 	User::WaitForRequest(threadStatus1);
   181 	test(threadStatus1 == KErrNone);
   182 	
   183     CLOSE_AND_WAIT(thread);
   184     
   185 	User::SetJustInTime(justInTime);
   186 	}
   187 
   188 /**
   189 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4286
   190 @SYMTestCaseDesc	    To ensure a file can be compressed to a gzip file and then correctly 
   191 						decompressed back to its original state using classes from gzip.cpp.  
   192 						Overwrite output file to verify existing file can be re-used.
   193 @SYMTestPriority 	    High
   194 @SYMTestActions  	    1.	Open existing test file and pass it to CEZFileToGZip::NewL() & 
   195 							compress using CEZFileToGZip::DeflateL() function
   196 						2.	Create or open output decompressed file and pass compressed file to
   197 							CEZGZipToFile::NewL() & decompress using CEZGZipToFile::InflateL() function
   198 						3.	Compare original and new file, they should be identical
   199 						4.	Repeat Steps 1 - 3 overwriting existing compressed output file
   200 @SYMTestExpectedResults Original test file should be the same as the file generated 
   201 						after decompressing it & the test must not fail
   202 @SYMDEF                 REQ8024
   203 */
   204 void TestCompressDecompressGzip()
   205 	{
   206 	TRAPD(error, CompressFileL(TheInputFile, TheCompressFile));
   207 	test(error == KErrNone);
   208 	TRAP(error, DecompressFileL(TheCompressFile, TheDecompressFile));
   209 	test(error == KErrNone);
   210 	
   211 	TInt compare;
   212 	//compare the files
   213 	TRAP(error, CompareFileDataL(TheInputFile, TheDecompressFile, compare));
   214 	test(error == KErrNone);
   215 	
   216 	if(compare == 0)
   217 		RDebug::Printf("Input file data is same as the Decompressed file data");
   218 	else
   219 		RDebug::Printf("Input file data differs from Decompressed file data");
   220 	
   221 #if !defined(__WINS__)
   222 	DeleteFile(TheCompressFile);
   223 	DeleteFile(TheDecompressFile);
   224 #endif
   225 
   226 	//Compress & decompress the same file again to overwrite the existing file & 
   227 	//..to verify that the existing files can be re-used
   228 	TRAP(error, CompressFileL(TheInputFile, TheCompressFile));
   229 	test(error == KErrNone);
   230 	TRAP(error, DecompressFileL(TheCompressFile, TheDecompressFile));
   231 	test(error == KErrNone);
   232 	
   233 #if !defined(__WINS__)
   234 	DeleteFile(TheCompressFile);
   235 	DeleteFile(TheDecompressFile);
   236 #endif
   237 	}
   238 
   239 /**
   240 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4287
   241 @SYMTestCaseDesc	    To ensure a file can be compressed to a gzip file and then correctly 
   242 						decompressed back using buffer size as small & big.
   243 						
   244 @SYMTestPriority 	    High
   245 @SYMTestActions  	    1.	Open existing test file and pass it to CEZFileToGZip::NewL() & 
   246 							compress using CEZFileToGZip::DeflateL() with buffer size as "11"
   247 						2.	Create or open output decompressed file and pass compressed file 
   248 							to CEZGZipToFile::NewL() & decompress using CEZGZipToFile::InflateL() 
   249 							with buffer size as "10"
   250 						3.	Repeat Steps 1 & 2 using buffer size as 10 times the file size
   251 @SYMTestExpectedResults Files should be compressed with no errors i.e. KErrNone & the test must not fail 
   252 @SYMDEF                 REQ8024
   253 */
   254 void TestOutputBuffSize()
   255 	{	
   256 	
   257 	TRAPD(error, CompressFileL(TheInputFile, TheCompressFile, 10));
   258 	test(error == KErrNone);
   259 
   260 	TRAP(error, DecompressFileL(TheCompressFile, TheDecompressFile, 10));
   261 	test(error == KErrNone);
   262 	
   263 	TInt bufferSize = 10 * TheBufferSize;
   264 	
   265 #if !defined(__WINS__)
   266 	DeleteFile(TheCompressFile);
   267 	DeleteFile(TheDecompressFile);
   268 #endif
   269 
   270 	//Compress & decompress the same file again to overwrite the existing file & 
   271 	//..to verify that the existing files can be re-used & with buffer size as big
   272 	TRAP(error, CompressFileL(TheInputFile, TheCompressFile, bufferSize));
   273 	test(error == KErrNone);
   274 	
   275 	TRAP(error, DecompressFileL(TheCompressFile, TheDecompressFile, bufferSize));
   276 	test(error == KErrNone);
   277 	
   278 #if !defined(__WINS__)
   279 	DeleteFile(TheCompressFile);
   280 	DeleteFile(TheDecompressFile);
   281 #endif
   282 
   283 	}
   284 
   285 TInt RfileInitForCEZFileToGZip(TAny*)
   286 	{
   287 	RFile rfile;
   288 	TFileName compressFilePath(KOutputFilePath);
   289 	compressFilePath.Append(TheCompressFile);
   290 	
   291 	CTrapCleanup* cleanup = CTrapCleanup::New();
   292 	TRAPD(error, CEZFileToGZip::NewL(TheFs, compressFilePath, rfile, TheBufferSize));
   293 	delete cleanup;
   294 	
   295 	return error;
   296 	}
   297 	
   298 TInt RfileInitForCEZGZipToFile(TAny*)
   299 	{
   300 	RFile rfile;
   301 	TFileName compressFilePath(KOutputFilePath);
   302 	compressFilePath.Append(TheCompressFile);
   303 
   304 	CTrapCleanup* cleanup = CTrapCleanup::New();
   305 	TRAPD(error, CEZGZipToFile::NewL(TheFs, compressFilePath, rfile, TheBufferSize));
   306 	delete cleanup;
   307 	
   308 	return error;
   309 	
   310 	}
   311 
   312 /**
   313 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4288
   314 @SYMTestCaseDesc	    CEZFileToGZip & CEZGZipToFile class initialisation fails when 
   315 						invalid input RFile object supplied
   316 @SYMTestPriority 	    High
   317 @SYMTestActions  	    1.	Pass NULL RFile input parameter to CEZFileToGZip::NewL()
   318 						2.	Pass NULL RFile input parameter to CEZGZipToFile::NewL()
   319 @SYMTestExpectedResults NewL() method should panic & the test must not fail 
   320 @SYMDEF                 REQ8024
   321 */
   322 void TestRFileInitialisation()
   323 	{
   324 	test.Printf(_L("Panic Thread: CEZFileToGzip Class initialisation fails when invalid input rfile supplied"));	
   325 	ThreadForPanicTest(RfileInitForCEZFileToGZip);
   326 	test.Printf(_L("Panic Thread: CEZGZipToFile Class initialisation fails when invalid input rfile supplied"));
   327 	ThreadForPanicTest(RfileInitForCEZGZipToFile);
   328 	}
   329 	
   330 /**
   331 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4289
   332 @SYMTestCaseDesc	    CEZFileToGZip, CEZGZipToFile class initialisation fails 
   333 						when invalid output filename supplied
   334 @SYMTestPriority 	    High
   335 @SYMTestActions  	    1.	Pass invalid filename output parameter to CEZFileToGZip::NewL()
   336 						2.	Pass invalid filename output parameter to CEZGZipToFile::NewL() 
   337 						Note: Filename contains invalid characters
   338 @SYMTestExpectedResults NewL() method should leave with error message & the test must not fail 
   339 @SYMDEF                 REQ8024
   340 */	
   341 void TestInvalidFilenameL()
   342 	{
   343 	
   344 	_LIT(KInvalidGzip, "*******.gz");
   345 	TFileName invalidGzip(KOutputFilePath);
   346 	invalidGzip.Append(KInvalidGzip);
   347 
   348 	_LIT(KInvalidFile, "*******.txt");
   349 	TFileName invalidFile(KOutputFilePath);
   350 	invalidFile.Append(KInvalidFile);
   351 	
   352 	TFileName inputFilePath(KPath);
   353 	inputFilePath.Append(TheInputFile);
   354 
   355 	RFile input;
   356 	User::LeaveIfError(input.Open(TheFs,inputFilePath,EFileStream | EFileRead | EFileShareReadersOnly));
   357 	CleanupClosePushL(input);
   358 
   359 	TRAPD(error, CEZFileToGZip::NewL(TheFs, invalidGzip, input, TheBufferSize));
   360 	test(error != KErrNone);
   361 
   362 	CleanupStack::PopAndDestroy(1);
   363 	
   364 	RFile output;
   365 	TInt err = output.Create(TheFs, invalidFile,EFileStream | EFileWrite | EFileShareExclusive);
   366 	test(error != KErrNone);
   367 
   368 	}
   369 
   370 /**
   371 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4290
   372 @SYMTestCaseDesc	    Ensure if output file exists and is read only then it cannot be 
   373 						overwritten with CEZFileToGZip & CEZGZipToFile class
   374 @SYMTestPriority 	    High
   375 @SYMTestActions  	    1.	Pass existing read only output filename parameter to CEZFileToGZip::NewL()
   376 						2.	Pass existing read only output filename parameter to CEZGZipToFile::NewL() 
   377 						& decompress using CEZGZipToFile::InflateL()
   378 @SYMTestExpectedResults CEZFileToGZip::NewL() method should leave with error message, CEZGZipToFile::Inflate()
   379 						should leave with error message & the test must not fail 
   380 @SYMDEF                 REQ8024
   381 */	
   382 void TestOverwriteOutputFileL()
   383 	{
   384 	_LIT(KReadOnlyGzip, "Hello_Read_Only.gz");	
   385 	TFileName readOnlyNewGZip(KOutputFilePath);
   386 	readOnlyNewGZip.Append(KReadOnlyGzip);
   387 	
   388 	_LIT(KReadOnlyFile, "Hello_Read_Only.txt");
   389 	TFileName readOnlyNewFile(KOutputFilePath);
   390 	readOnlyNewFile.Append(KReadOnlyFile);
   391 
   392 	CFileMan* fMan=CFileMan::NewL(TheFs);
   393 	test(fMan!=NULL);
   394 	CleanupStack::PushL(fMan);
   395 	
   396 #if !defined(__WINS__)
   397 	TFileName readOnlyOldGZip(KPath);
   398 	readOnlyOldGZip.Append(KReadOnlyGzip);
   399 	TFileName readOnlyOldFile(KPath);
   400 	readOnlyOldFile.Append(KReadOnlyFile);
   401 
   402 	RFile source;
   403 	User::LeaveIfError(source.Open(TheFs,readOnlyOldGZip, EFileStream | EFileRead | EFileShareReadersOnly));
   404 	CleanupClosePushL(source);
   405 	TRAPD(error, fMan->Copy(source, readOnlyNewGZip));
   406 	test(error == KErrNone);
   407 	
   408 	RFile source1;
   409 	User::LeaveIfError(source1.Open(TheFs,readOnlyOldFile, EFileStream | EFileRead | EFileShareReadersOnly));
   410 	CleanupClosePushL(source1);
   411 	TRAP(error, fMan->Copy(source1, readOnlyNewFile));
   412 	test(error == KErrNone);
   413 
   414 	CleanupStack::PopAndDestroy(2);
   415 #endif
   416 
   417 	TFileName inputFilePath(KPath);
   418 	inputFilePath.Append(TheInputFile);
   419 
   420 	RFile input;
   421 	User::LeaveIfError(input.Open(TheFs,inputFilePath,EFileStream | EFileRead | EFileShareReadersOnly));
   422 	CleanupClosePushL(input);
   423 
   424 	//setting attributes to read only for readOnlyGZip & readOnlyFile
   425    	TInt err = fMan->Attribs(readOnlyNewGZip, KEntryAttReadOnly, 0, 0);
   426 	test(err == KErrNone);
   427 	err = fMan->Attribs(readOnlyNewFile, KEntryAttReadOnly, 0, 0);
   428 	test(err == KErrNone);
   429 		
   430 	TRAP(err, CEZFileToGZip::NewL(TheFs, readOnlyNewGZip, input, TheBufferSize));
   431 	test(err != KErrNone);
   432 
   433 	RFile output;
   434 	User::LeaveIfError(output.Open(TheFs,readOnlyNewFile,EFileStream | EFileRead | EFileShareReadersOnly));
   435 	CleanupClosePushL(output);
   436 
   437 	CEZGZipToFile * gzipToFile = NULL;
   438 	TRAP(err, gzipToFile = CEZGZipToFile::NewL(TheFs, readOnlyNewGZip, output, TheBufferSize));
   439 	test(err == KErrNone);
   440 	CleanupStack::PushL(gzipToFile);
   441 	
   442 	while (err == KErrNone)
   443 	{
   444 		TRAP(err, gzipToFile->InflateL());
   445 	}
   446 	
   447 	test(err != KErrNone); 	
   448 
   449 	CleanupStack::PopAndDestroy(4);
   450 	
   451 	//removing the read only attrib before deleting the file
   452    	fMan=CFileMan::NewL(TheFs);
   453    	test(fMan!=NULL);
   454    	CleanupStack::PushL(fMan);
   455    	err = fMan->Attribs(readOnlyNewGZip, 0, KEntryAttReadOnly, 0);
   456 	test(err == KErrNone);
   457 	err = fMan->Attribs(readOnlyNewFile, 0, KEntryAttReadOnly, 0);
   458 	test(err == KErrNone);
   459 	
   460 	CleanupStack::PopAndDestroy(1);
   461 	
   462 #if !defined(__WINS__)
   463 	DeleteFile(readOnlyNewGZip, ETrue);
   464 	DeleteFile(readOnlyNewFile, ETrue);
   465 #endif
   466 	}
   467 
   468 TInt RFSInitForCEZFileToGZipL(TAny*)
   469 	{
   470 	TFileName inputFilePath(KPath);
   471 	inputFilePath.Append(TheInputFile);
   472 
   473 	RFile input;
   474 	User::LeaveIfError(input.Open(TheFs,inputFilePath,EFileStream | EFileRead | EFileShareReadersOnly));
   475 	CleanupClosePushL(input);
   476 
   477 	TFileName compressFilePath(KOutputFilePath);
   478 	compressFilePath.Append(TheCompressFile);
   479 
   480 	CTrapCleanup* cleanup = CTrapCleanup::New();
   481 	RFs rfs; 
   482 	TRAPD(error, CEZFileToGZip::NewL(rfs, compressFilePath, input, TheBufferSize));
   483 	delete cleanup;
   484 	
   485 	CleanupStack::PopAndDestroy(1);
   486 	return error;
   487 	
   488 	}
   489 
   490 TInt RFSInitForCEZGZipToFileL(TAny*)
   491 	{
   492 	TFileName compressFilePath(KPath);
   493 	compressFilePath.Append(TheCompressFile);
   494 	
   495 	TFileName decompressFilePath(KOutputFilePath);
   496 	decompressFilePath.Append(TheDecompressFile);
   497 
   498 	RFile output;
   499 	User::LeaveIfError(output.Replace(TheFs,decompressFilePath,EFileStream | EFileRead | EFileShareReadersOnly));
   500 	CleanupClosePushL(output);
   501 
   502 	CTrapCleanup* cleanup = CTrapCleanup::New();
   503 	RFs rfs; 
   504 	TRAPD(error, CEZGZipToFile::NewL(rfs, compressFilePath, output, TheBufferSize));
   505 	delete cleanup;
   506 	
   507 	CleanupStack::PopAndDestroy(1);
   508 	return error;
   509 	
   510 	}
   511 
   512 /**
   513 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4291
   514 @SYMTestCaseDesc	    CEZFileToGZip & CEZGZipToFile class initialisation fails when 
   515 						invalid RFs object is passed
   516 @SYMTestPriority 	    High
   517 @SYMTestActions  	    1.	Pass NULL RFs input parameter to CEZFileToGZip::NewL() 
   518 						2.	Pass NULL RFs input parameter to CEZGZipToFile::NewL()
   519 @SYMTestExpectedResults NewL() method should panic & the test must not fail 
   520 @SYMDEF                 REQ8024
   521 */	
   522 void TestRFSInitialisation()
   523 	{
   524 	test.Printf(_L("Panic Thread: CEZFileToGZip Class initialisation fails when invalid RFS object is passed"));	
   525 	ThreadForPanicTest(RFSInitForCEZFileToGZipL);
   526 	test.Printf(_L("Panic Thread: CEZGZipToFile Class initialisation fails when invalid RFS object is passed"));
   527 	ThreadForPanicTest(RFSInitForCEZGZipToFileL);
   528 	}
   529 
   530 TInt BuffForEZFileToGZipAsZeroL(TAny*)
   531 	{
   532 	CTrapCleanup* cleanup = CTrapCleanup::New();
   533 	CompressFileL(TheInputFile, TheCompressFile, 0);
   534 	delete cleanup;
   535 	return KErrNone;
   536 	}
   537 
   538 TInt BuffForEZFileToGZipAsNegativeL(TAny*)
   539 	{
   540 	CTrapCleanup* cleanup = CTrapCleanup::New();
   541 	CompressFileL(TheInputFile, TheCompressFile, -1);
   542 	delete cleanup;
   543 	return KErrNone;
   544 	}
   545 
   546 TInt BuffForEZGZipToFileAsZeroL(TAny*)
   547 	{
   548 	CTrapCleanup* cleanup = CTrapCleanup::New();
   549 	DecompressFileL(TheCompressFile, TheDecompressFile, 0);
   550 	delete cleanup;
   551 	return KErrNone;
   552 	}
   553 
   554 TInt BuffForEZGZipToFileAsNegativeL(TAny*)
   555 	{
   556 	CTrapCleanup* cleanup = CTrapCleanup::New();
   557 	DecompressFileL(TheCompressFile, TheDecompressFile, -1);
   558 	delete cleanup;
   559 	return KErrNone;	
   560 	}
   561 
   562 /**
   563 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4292
   564 @SYMTestCaseDesc	    CEZFileToGZip & CEZGZipToFile class initialisation 
   565 						fails when invalid buffer size parameter passed in
   566 @SYMTestPriority 	    High
   567 @SYMTestActions  	    1.	Pass buffer size parameter value as 0 to CEZFileToGZip::NewL()  
   568 						2.	Pass buffer size parameter as a negative value to CEZFileToGZip::NewL()
   569 						3.	Pass buffer size parameter value as 0 to CEZGZipToFile::NewL()  
   570 						4.	Pass buffer size parameter as a negative value to CEZGZipToFile::NewL()
   571 @SYMTestExpectedResults NewL() method should panic & the test must not fail 
   572 @SYMDEF                 REQ8024
   573 */	
   574 void TestInvalidBufferSize()
   575 	{
   576 	
   577 	test.Printf(_L("Panic Thread: CEZFileToGZip Class initialisation fails when buffer size is passed as Zero"));	
   578 	ThreadForPanicTest(BuffForEZFileToGZipAsZeroL);
   579 	test.Printf(_L("Panic Thread: CEZFileToGZip Class initialisation fails when buffer size is passed as Negative"));
   580 	ThreadForPanicTest(BuffForEZFileToGZipAsNegativeL);
   581 	test.Printf(_L("Panic Thread: CEZGZipToFile Class initialisation fails when buffer size is passed as Zero"));
   582 	ThreadForPanicTest(BuffForEZGZipToFileAsZeroL);
   583 	test.Printf(_L("Panic Thread: CEZGZipToFile Class initialisation fails when buffer size is passed as Negative"));
   584 	ThreadForPanicTest(BuffForEZGZipToFileAsNegativeL);
   585 
   586 	}
   587 
   588 /**
   589 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4293
   590 @SYMTestCaseDesc	    Compress & Decompress another file with CEZFileToGZip & CEZGZipToFile 
   591 						after calling ResetL method
   592 @SYMTestPriority 	    High
   593 @SYMTestActions  	    1.	Open existing test file and pass it to CEZFileToGZip::NewL() & compress using CEZFileToGZip::DeflateL function
   594 						2.	Call CEZFileToGZip::ResetL() with new file parameters
   595 						3.	Compress the new file with CEZFileToGZip::DeflateL()
   596 						4.	Create or open output decompressed file and pass compressed file to CEZGZipToFile::NewL() & decompress using CEZGZipToFile::InflateL() function
   597 						5.	Call CEZGZipToFile::ResetL() with new compressed file parameters
   598 						6.	Decompress the new compressed file with CEZGZipToFile::InflateL()
   599 @SYMTestExpectedResults Files should be compressed with no errors i.e. KErrNone & the test must not fail 
   600 @SYMDEF                 REQ8024
   601 */	
   602 void TestCompressDecompressResetL()
   603 	{
   604     
   605 	TFileName inputFilePath(KPath);
   606 	inputFilePath.Append(TheInputFile);
   607 
   608 	_LIT(KGzipFile,"Hello_Reset.gz");
   609 	TFileName gzipFileName(KGzipFile);
   610 	TFileName compressfile(KOutputFilePath);
   611 	compressfile.Append(gzipFileName);
   612 	
   613 	RFile input;
   614 	User::LeaveIfError(input.Open(TheFs,inputFilePath,EFileStream | EFileRead | EFileShareReadersOnly));
   615 	CleanupClosePushL(input);
   616 	
   617 	CEZFileToGZip *fileToGzip = CEZFileToGZip::NewLC(TheFs, compressfile, input, TheBufferSize);
   618 	while(fileToGzip->DeflateL()){/*do nothing*/}
   619 	
   620 	fileToGzip->ResetL(TheFs, compressfile, input, TheBufferSize);
   621 	while(fileToGzip->DeflateL()){/*do nothing*/}
   622 	
   623 	CleanupStack::PopAndDestroy(2);
   624 	
   625 #if !defined(__WINS__)
   626 	DeleteFile(gzipFileName);
   627 #endif
   628 
   629 	TFileName compressFilePath(KPath);
   630 	compressFilePath.Append(TheCompressFile);
   631 
   632 	_LIT(KTxtFile,"Hello_Reset.txt");
   633 	TFileName txtFileName(KTxtFile);
   634 	TFileName decompressfile(KOutputFilePath);
   635 	decompressfile.Append(txtFileName);
   636 
   637 	RFile output;
   638 	User::LeaveIfError(output.Replace(TheFs, decompressfile,EFileStream | EFileWrite | EFileShareExclusive));
   639 	CleanupClosePushL(output);
   640 
   641 	CEZGZipToFile *gzipToFile = CEZGZipToFile::NewLC(TheFs, compressFilePath, output, TheBufferSize);
   642 	while(gzipToFile->InflateL()){/*do nothing*/}
   643 
   644 	gzipToFile->ResetL(TheFs, compressFilePath, output, TheBufferSize);
   645 	while(gzipToFile->InflateL()){/*do nothing*/}
   646 	
   647 	CleanupStack::PopAndDestroy(2);
   648 	
   649 #if !defined(__WINS__)
   650 	DeleteFile(txtFileName);
   651 #endif
   652 
   653 	}
   654 
   655 /**
   656 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4294
   657 @SYMTestCaseDesc	    CEZGZipToFile class initialisation fails when source 
   658 						gzip file header is malformed: Header is too small
   659 @SYMTestPriority 	    High
   660 @SYMTestActions  	    Pass corrupted gzip file as an input parameter to CEZGZipToFile::NewL()  
   661 						Note: Change the header of existing gzip file by removing few characters
   662 @SYMTestExpectedResults NewL() method should leave with error message KEZlibErrBadGZipHeader 
   663 						& the test must not fail 
   664 @SYMDEF                 REQ8024
   665 */	
   666 void TestGzipHeaderSmallL()
   667 	{
   668 	
   669 	_LIT(KGzFile,"Hello_HeaderChanged.gz");	
   670 	TFileName compressfile(KPath);
   671 	compressfile.Append(KGzFile);
   672 
   673 	TFileName decompressFilePath(KOutputFilePath);
   674 	decompressFilePath.Append(TheDecompressFile);
   675 
   676 	RFile output;
   677 	User::LeaveIfError(output.Replace(TheFs, decompressFilePath,EFileStream | EFileWrite | EFileShareExclusive));
   678 	CleanupClosePushL(output);
   679 	
   680 	TRAPD(error, CEZGZipToFile::NewL(TheFs, compressfile, output, TheBufferSize));
   681 	test(error == KEZlibErrBadGZipHeader);
   682 
   683 	CleanupStack::PopAndDestroy(1);
   684 
   685 	}
   686 
   687 /**
   688 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4295
   689 @SYMTestCaseDesc	    CEZGZipToFile class initialisation fails when source gzip file 
   690 						header is malformed: Header ID number is incorrect
   691 @SYMTestPriority 	    High
   692 @SYMTestActions  	    Pass corrupted gzip file as an input parameter to CEZGZipToFile::NewL()  
   693 						Note: Change the header ID of existing gzip file
   694 @SYMTestExpectedResults NewL() method should leave with error message KEZlibErrBadGZipHeader 
   695 						& the test must not fail 
   696 @SYMDEF                 REQ8024
   697 */	
   698 void TestGzipHeaderIdIncorrectL()
   699 	{	
   700 
   701 	_LIT(KGzFile,"Hello_HeaderIdChanged.gz");
   702 	TFileName compressfile(KPath);
   703 	compressfile.Append(KGzFile);
   704 
   705 	TFileName decompressFilePath(KOutputFilePath);
   706 	decompressFilePath.Append(TheDecompressFile);
   707 
   708 	RFile output;
   709 	User::LeaveIfError(output.Replace(TheFs, decompressFilePath,EFileStream | EFileWrite | EFileShareExclusive));
   710 	CleanupClosePushL(output);
   711 	
   712 	TRAPD(error, CEZGZipToFile::NewL(TheFs, compressfile, output, TheBufferSize));
   713 	test(error == KEZlibErrBadGZipHeader);
   714 	
   715 	CleanupStack::PopAndDestroy(1);
   716 	
   717 	}
   718 
   719 /**
   720 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4296
   721 @SYMTestCaseDesc	    CEZGZipToFile class fails while decompressing the gzip 
   722 						file with the CRC changed in the trailer
   723 @SYMTestPriority 	    High
   724 @SYMTestActions  	    Pass corrupted gzip file as an input parameter to CEZGZipToFile::NewL()
   725 						Note: Change the CRC within the Trailer of existing gzip file
   726 @SYMTestExpectedResults NewL() method should leave with error message KErrNotFound & the test must not fail
   727 						Note: KErrNotFound error is fired while opening the corrupted gzip file
   728 @SYMDEF                 REQ8024
   729 */	
   730 void TestGzipTrailerCRCL()
   731 	{
   732 
   733 	_LIT(KGzFile,"Hello_TrailerIdChanged.gz");	
   734 	TFileName compressfile(KPath);
   735 	compressfile.Append(KGzFile);
   736 
   737 	TFileName decompressFilePath(KOutputFilePath);
   738 	decompressFilePath.Append(TheDecompressFile);
   739 
   740 	RFile output;
   741 	User::LeaveIfError(output.Replace(TheFs, decompressFilePath,EFileStream | EFileWrite | EFileShareExclusive));
   742 	CleanupClosePushL(output);
   743 	
   744 	TRAPD(error, CEZGZipToFile::NewL(TheFs, compressfile, output, TheBufferSize));
   745 	test(error == KErrNotFound);
   746 	
   747 	CleanupStack::PopAndDestroy(1);
   748 
   749 	}
   750 
   751 void TestCompressDecompressL()
   752 	{
   753 
   754 	TFileName inputFilePath(KPath);
   755 	inputFilePath.Append(TheInputFile);
   756 	
   757 	TFileName compressFilePath(KOutputFilePath);
   758 	compressFilePath.Append(TheCompressFile);
   759 
   760 	RFile input;
   761 	User::LeaveIfError(input.Open(TheFs,inputFilePath,EFileStream | EFileRead | EFileShareReadersOnly));
   762 	CleanupClosePushL(input);
   763 	
   764 	CEZFileToGZip *fileToGzip = CEZFileToGZip::NewLC(TheFs, compressFilePath, input, TheBufferSize);
   765 	while(fileToGzip->DeflateL()){/*do nothing*/}
   766 	
   767 	TFileName decompressFilePath(KOutputFilePath);
   768 	decompressFilePath.Append(TheDecompressFile);
   769 
   770 	TFileName compressFilePath1(KPath);
   771 	compressFilePath1.Append(TheCompressFile);
   772 
   773 	RFile output;
   774 	User::LeaveIfError(output.Replace(TheFs, decompressFilePath,EFileStream | EFileWrite | EFileShareExclusive));
   775 	CleanupClosePushL(output);
   776 
   777 	CEZGZipToFile *gzipToFile = CEZGZipToFile::NewLC(TheFs, compressFilePath1, output, TheBufferSize);
   778 	while(gzipToFile->InflateL()){/*do nothing*/}
   779 
   780 	CleanupStack::PopAndDestroy(4);
   781 	
   782 #if !defined(__WINS__)
   783 	DeleteFile(TheCompressFile);
   784 	DeleteFile(TheDecompressFile);
   785 #endif
   786 	}
   787 	
   788 /**
   789 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4297
   790 @SYMTestCaseDesc	    Out of Memory(OOM) test for CEZFileToGZip &  CEZGZipToFile class
   791 @SYMTestPriority 	    High
   792 @SYMTestActions  	    1.	Set Heap Failure using the macro as:
   793 							__UHEAP_SETFAIL(RHeap::EDeterministic, count)
   794 						2.	Mark the heap using macro: __UHEAP_MARK
   795 						3.	Open existing test file and pass it to CEZFileToGZip::NewL() compress using CEZFileToGZip::DeflateL() function
   796 						4.	Create or open output decompressed file and pass compressed file to CEZGZipToFile::NewL() & decompress using CEZGZipToFile::InflateL() function
   797 						5.	Check there is no memory leak using the macro: __UHEAP_MARKEND
   798 						6.	Repeat the Steps 1-5 increasing the heap value rate i.e. count
   799 @SYMTestExpectedResults The test succeeds with no memory leak on the heap as well as no errors (i.e. KErrNone)
   800 						& the test must not fail 
   801 @SYMDEF                 REQ8024
   802 */	
   803 void TestOOMGzipL()
   804 	{
   805    	TInt processHandlesS = 0;
   806 	TInt threadHandlesS = 0;
   807 	TInt processHandlesE = 0;
   808 	TInt threadHandlesE = 0;
   809 	TInt err = KErrNone;
   810 	RThread().HandleCount(processHandlesS, threadHandlesS);
   811 	for(TInt count=1; count<=100; ++count)
   812 		{
   813 		// Setting Heap failure for OOM test
   814 		__UHEAP_SETFAIL(RHeap::EDeterministic, count);
   815 		__UHEAP_MARK;
   816 		
   817 		TRAP(err,TestCompressDecompressL());
   818 		__UHEAP_MARKEND;
   819 		if(err == KErrNone)
   820 			{
   821 			RDebug::Print(_L("The test succeeded at heap failure rate=%d.\n"), count);
   822 			break;
   823 			}
   824 		else 
   825 			{
   826 			test(err == KErrNoMemory);
   827 			}
   828 		__UHEAP_RESET;
   829 		}
   830 	
   831 	test(err == KErrNone);
   832 	__UHEAP_RESET;
   833 	
   834 	RThread().HandleCount(processHandlesE, threadHandlesE);
   835 	
   836 	test(processHandlesS == processHandlesE);
   837 	test(threadHandlesS == threadHandlesE);
   838 
   839 	}
   840 /*
   841  * Helper function for TestDEF117325ToGZipL
   842  * Deflates a file and then calls ResetL()
   843  */
   844 void DeflateResetL()
   845 	{
   846 	_LIT(KGzipFile,"Hello_Reset.gz");
   847 	TFileName compressFile(KOutputFilePath);
   848 	compressFile.Append(KGzipFile);
   849 
   850 	TFileName inputFilePath(KPath);
   851 	inputFilePath.Append(TheInputFile);
   852 	
   853 	RFile input;	
   854 	User::LeaveIfError(input.Open(TheFs, inputFilePath, EFileStream | EFileRead | EFileShareReadersOnly));
   855 	CleanupClosePushL(input);
   856 		
   857 	CEZFileToGZip *fileToGzip = CEZFileToGZip::NewLC(TheFs, compressFile, input, TheBufferSize);
   858 	while(fileToGzip->DeflateL()) {/*do nothing*/}
   859 	
   860 	fileToGzip->ResetL(TheFs, compressFile, input, TheBufferSize);
   861 	
   862 	CleanupStack::PopAndDestroy(2);
   863 	
   864 	#if !defined(__WINS__)
   865 	DeleteFile(TheInputFile);
   866 	#endif
   867 	}
   868 
   869 /*
   870  * Helper function for TestDEF117325ToFileL
   871  * Inflates a GZip file and then calls ResetL()
   872  */
   873 void InflateResetL()
   874 	{
   875 	_LIT(KTxtFile, "Hello_Reset.txt");
   876 	TFileName decompressFile(KOutputFilePath);
   877 	decompressFile.Append(KTxtFile);
   878 
   879 	TFileName compressFilePath(KPath);
   880 	compressFilePath.Append(TheCompressFile);
   881 		
   882 	RFile output;
   883 	User::LeaveIfError(output.Replace(TheFs, decompressFile, EFileStream | EFileWrite | EFileShareExclusive));
   884 	CleanupClosePushL(output);
   885 	
   886 	CEZGZipToFile *gzipToFile = CEZGZipToFile::NewLC(TheFs, compressFilePath, output, TheBufferSize);
   887 	while(gzipToFile->InflateL()){/*do nothing*/}
   888 	
   889 	gzipToFile->ResetL(TheFs, compressFilePath, output, TheBufferSize);
   890 	
   891 	CleanupStack::PopAndDestroy(2);
   892 	
   893 	#if !defined(__WINS__)
   894 	DeleteFile(TheCompressFile);
   895 	#endif
   896 	}
   897 
   898 /*
   899  * Helper function for TestDEF117325ToGZipL and TestDEF117325ToFileL.
   900  * Checks for memory leaks in OOM situations.
   901  */
   902 void DEF117325L(void (*aResetL)())
   903 	{
   904 	TInt err = KErrNone;
   905 	for(TInt count = 0; count <= 100; count++)
   906 		{
   907 		// Setting Heap failure for OOM test
   908 		__UHEAP_SETFAIL(RHeap::EDeterministic, count);
   909 		__UHEAP_MARK;	
   910 		
   911 		TRAP(err, aResetL());
   912 		
   913 		__UHEAP_MARKEND;
   914 		__UHEAP_RESET;
   915 		
   916 		if(err == KErrNone)
   917 			{
   918 			RDebug::Print(_L("The test succeeded at heap failure rate = %d.\n"), count);
   919 			break;
   920 			}
   921 		else 
   922 			{
   923 			test(err == KErrNoMemory);
   924 			}
   925 		}
   926 	}
   927 
   928 /**
   929 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4319
   930 @SYMTestCaseDesc	    To test that there are no memory leaks when calling ResetL from CEZFileToGZip
   931 @SYMTestPriority 	    Medium
   932 @SYMTestActions  	    1.	Set Heap Failure using the macro __UHEAP_SETFAIL(RHeap::EDeterministic, count)
   933 						2.	Mark the heap using macro __UHEAP_MARK
   934 						3.	Open an existing test file and pass it to CEZFileToGZip::NewL() and compress it using CEZFileToGZip::DeflateL function
   935 						4.	Call CEZFileToGZip::ResetL() with new file parameters
   936 						5.	Check there is no memory leak using the macro __UHEAP_MARKEND
   937 						6.	Repeat steps 1 - 5 increasing the heap value rate i.e. count
   938 @SYMTestExpectedResults The test succeeds with no memory leak on the heap as well as no errors (i.e. KErrNone) 
   939 @SYMDEF                 REQ8024
   940 */	
   941 void TestDEF117325ToGZipL()
   942 	{		
   943 	DEF117325L(&DeflateResetL);
   944 	}
   945 
   946 /**
   947 @SYMTestCaseID          SYSLIB-EZLIB2-UT-4320
   948 @SYMTestCaseDesc	    To test that there are no memory leaks when calling ResetL from CEZGZipToFile
   949 @SYMTestPriority 	    Medium
   950 @SYMTestActions  	    1.	Open an existing test file and pass it to CEZFileToGZip::NewL() and compress it using CEZFileToGZip::DeflateL 
   951 						2.	Set Heap Failure using the macro __UHEAP_SETFAIL(RHeap::EDeterministic, count)
   952 						3.	Mark the heap using macro __UHEAP_MARK
   953 						4.	Open the compressed test file and pass it to CEZGZipToFile::NewL() and decompress it using CEZGZipToFile::InflateL function
   954 						5.	Call CEZGZipToFile::ResetL() with new file parameters
   955 						6.	Check there is no memory leak using the macro __UHEAP_MARKEND
   956 						7.	Repeat steps 2 - 6 increasing the heap value rate i.e. count
   957 @SYMTestExpectedResults The test succeeds with no memory leak on the heap as well as no errors (i.e. KErrNone)
   958 @SYMDEF                 REQ8024
   959 */	
   960 void TestDEF117325ToFileL()
   961 	{	
   962 	
   963 	// Create a GZip file that can be used by CEZGZipToFile
   964 	CompressFileL(TheInputFile, TheCompressFile);
   965 	
   966 	DEF117325L(&InflateResetL);
   967 	
   968 	#if !defined(__WINS__)
   969 	DeleteFile(TheCompressFile);
   970 	#endif
   971 	}
   972 
   973 	
   974 
   975 void RunTestL()
   976 	{
   977 	
   978 	User::LeaveIfError(TheFs.Connect()); //Connect to file session
   979 	CleanupClosePushL(TheFs);
   980 	
   981 #if !defined(__WINS__)
   982 	TInt err = TheFs.MkDirAll(KOutputFilePath);  
   983 	if(err != KErrNone && err != KErrAlreadyExists)
   984 		{
   985 		test.Printf(_L("Error while creating dir => Error: %d"), err);
   986 		User::Leave(err);
   987 		}
   988 #endif
   989 	
   990 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4286 Compression - Decompression of Gzip file "));
   991 	TestCompressDecompressGzip();
   992 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4287 Compression - Decompression of Gzip file with big & small buffer size "));
   993 	TestOutputBuffSize();
   994 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4288 Class initialisation fails when invalid input rfile supplied "));
   995 	TestRFileInitialisation();
   996 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4289 Class initialisation fails when invalid output filename supplied "));
   997 	TestInvalidFilenameL();
   998 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4290 Class initialisation fails while overwriting the read only output file "));
   999 	TestOverwriteOutputFileL();
  1000 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4291 Class initialisation fails when invalid RFS object is passed "));
  1001 	TestRFSInitialisation();
  1002 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4292 Panic Thread: Class initialisation fails when invalid buffer size parameter passed in "));
  1003 	TestInvalidBufferSize();
  1004 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4293 Compress another file with CEZFileToGZip & CEZGZipToFile after calling ResetL method "));
  1005 	TestCompressDecompressResetL();
  1006 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4294 CEZGZipToFile class initialisation fails when source gzip file header is malformed: Header is too small "));
  1007 	TestGzipHeaderSmallL();
  1008 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4295 CEZGZipToFile class initialisation fails when source gzip file header is malformed: Header ID number is incorrect "));
  1009 	TestGzipHeaderIdIncorrectL();
  1010 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4296 CEZGZipToFile class fails while decompressing the gzip file with the CRC changed in the trailer "));
  1011 	TestGzipTrailerCRCL();
  1012 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4297 Out of Memory(OOM) test for CEZFileToGZip & CEZGZipToFile class "));
  1013 	TestOOMGzipL();
  1014 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4319 Out of Memory(OOM) test for DEF117325: Ezlib: ResetL() in gzip.cpp - a member variable can be deleted twice (CEZFileToGZip) "));
  1015 	TestDEF117325ToGZipL();
  1016 	test.Next(_L(" @SYMTestCaseID:SYSLIB-EZLIB2-UT-4320 Out of Memory(OOM) test for DEF117325: Ezlib: ResetL() in gzip.cpp - a member variable can be deleted twice (CEZGZipToFile) "));
  1017 	TestDEF117325ToFileL();
  1018 		
  1019 
  1020 #if !defined(__WINS__)
  1021 	CFileMan* fMan=CFileMan::NewL(TheFs);
  1022    	test(fMan!=NULL);
  1023    	CleanupStack::PushL(fMan);
  1024  	err = fMan->RmDir(_L("C:\\test\\gzip"));
  1025  	CleanupStack::PopAndDestroy(1);
  1026 #endif
  1027  	
  1028  	CleanupStack::PopAndDestroy(1);
  1029 	
  1030 	}	
  1031 
  1032 GLDEF_C TInt E32Main()
  1033 	{
  1034 	
  1035 	__UHEAP_MARK;
  1036 
  1037 	test.Printf(_L("\n"));
  1038 	test.Title();
  1039 	test.Start( _L("Starting Gzip Tests..") );
  1040 
  1041 	TheTrapCleanup=CTrapCleanup::New();
  1042 
  1043 	TRAPD(err,RunTestL());
  1044 	test (err==KErrNone);
  1045 
  1046 	test.End();
  1047 	test.Close();
  1048 	
  1049 	delete TheTrapCleanup;
  1050 
  1051 	__UHEAP_MARKEND;
  1052 	return KErrNone;
  1053 
  1054 	}