os/ossrv/lowlevellibsandfws/pluginfw/Framework/SimpleTests/t_finalclose.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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 <e32panic.h>
    18 #include <f32file.h>
    19 #include <bautils.h>
    20 #include "../EcomTestUtils/EcomTestUtils.h"
    21 #include "LoadManager.h"
    22 #include <ecom/ecom.h>
    23 #include "EComUidCodes.h"
    24 #include "Interface.h" // interface to Plugins
    25 
    26 _LIT(KEComExDllOnC, "c:\\sys\\bin\\EComExample5.dll");
    27 _LIT(KEComRscFileOnZ, "z:\\RAMOnly\\EComExample5.rsc");
    28 _LIT(KEComRscFileOnC, "c:\\resource\\plugins\\EComExample5.rsc");
    29 
    30 _LIT(KEComExampleDllOnC,		"C:\\sys\\bin\\EComExample.dll");
    31 _LIT(KEComExample2DllOnC,		"C:\\sys\\bin\\EComExample2.dll");
    32 _LIT(KEComExample3DllOnC,		"C:\\sys\\bin\\EComExample3.dll");
    33 
    34 _LIT(KEComExampleRscOnC,		"C:\\resource\\plugins\\EComExample.rsc");
    35 _LIT(KEComExample2RscOnC,		"C:\\resource\\plugins\\EComExample2.rsc");
    36 _LIT(KEComExample3RscOnC,		"C:\\resource\\plugins\\EComExample3.rsc");
    37 
    38 _LIT(KEComExampleRscOnZ,		"Z:\\RAMOnly\\EComExample.rsc");
    39 _LIT(KEComExample2RscOnZ,		"Z:\\RAMOnly\\EComExample2.rsc");
    40 _LIT(KEComExample3RscOnZ,		"Z:\\RAMOnly\\EComExample3.rsc");
    41 
    42 
    43 _LIT(KEComExDllOnZ, "z:\\RAMOnly\\EComExample5.dll");
    44 _LIT(KEComExampleDllOnZ,			"Z:\\RAMOnly\\EComExample.dll");
    45 _LIT(KEComExample2DllOnZ,		"Z:\\RAMOnly\\EComExample2.dll");
    46 _LIT(KEComExample3DllOnZ,		"Z:\\RAMOnly\\EComExample3.dll");
    47 
    48 /** Test cases covered in this test code:
    49 1.	Thread create imp destroy then not calling FinalClose() will cause a panic inside the thread( capture this panic)(memory leak)
    50 
    51 2.	Thread list implementation then not calling FinalClose() will cause a panic inside the thread(capture this panic)(memory leak).
    52 
    53 3.	Thread Create Impl1, Create Impl2, Destroy Impl2, Destory Impl1 then FinalClose() no memory leak.
    54 
    55 4.	Thread create Impl1, call FinalClose() 2x, Destroy Impl1 then FinalClose() to show that FinalClose() can be called many times with no unknown consequence.
    56 
    57 5.	REComSession::public constructor (without OpenL), called FinalClose () 2x, then Close(), no problem and memory leak.
    58 
    59 6.	REComSession::OpenL,call Close() then call FinalClose() to show no memory leak problem.
    60 
    61 7.  Test calling REComSession::FinalClose() to show no memory leak, errors, crash problem
    62 */
    63 
    64 LOCAL_D RTest test(_L("Final Close Test"));
    65 
    66 class RFinalCloseTest
    67 	{
    68 public:
    69 	//Test case 1
    70 	static TInt Create_Destroy_Without_FinalClose(TAny*);
    71 	static TInt Create_Destroy_With_FinalCloseL();
    72 	static TInt Create_Destroy_TestL();
    73 
    74 	//Test case 2
    75 	static TInt ListImpl_Without_FinalClose(TAny*);
    76 	static TInt ListImpl_With_FinalCloseL();
    77 	static void ListImplementation_TestL();
    78 
    79 	//Test case 3
    80 	static void Create_Destroy2_With_FinalCloseL();
    81 
    82 	//Test case 4
    83 	static void Create_Destroy3_With_FinalCloseL();
    84 
    85 	//Test case 5
    86 	static void Create_Destroy4_With_FinalCloseL();
    87 
    88 	//Test case 6
    89 	static void FinalClose();
    90 
    91 	//Test case 7
    92 	static void NonConstructL_Create_Destroy();
    93 
    94 	static void ThreadPanicTest(const TDesC& aName,TThreadFunction aFunction);
    95 	};
    96 
    97 /**
    98 Test creating an implementation, deleting the implementation
    99 and then call FinalClose(). Check that there is no crash and memory leak
   100 
   101 @SYMTestCaseID          SYSLIB-ECOM-CT-0759
   102 @SYMTestCaseDesc	    Tests for creating and destroying an implementation
   103 @SYMTestPriority 	    High
   104 @SYMTestActions  	    Create and delete a new implementation with UID and initialisation parameters.
   105                         Call up REComSession::FinalClose
   106 						Check for no crash and memory leaks.
   107 @SYMTestExpectedResults The test must not fail.
   108 @SYMREQ                 REQ0000
   109 */
   110 TInt RFinalCloseTest::Create_Destroy_With_FinalCloseL()
   111 	{
   112 	__UHEAP_MARK;
   113 
   114 	Create_Destroy_TestL();
   115 
   116 	REComSession::FinalClose();
   117 
   118 	__UHEAP_MARKEND;
   119 	return KErrNone;
   120 	}
   121 
   122 /**
   123 Test creating an implementation, deleting the implementation
   124 Never call FinalClose() to show memory leak panic
   125 
   126 @SYMTestCaseID          SYSLIB-ECOM-CT-0760
   127 @SYMTestCaseDesc	    Tests for creating and destroying an implementation
   128 @SYMTestPriority 	    High
   129 @SYMTestActions  	    Create and delete a new implementation with UID and initialisation parameters.
   130                     	FinalClose is omitted to show memory leak panic
   131 @SYMTestExpectedResults The test must not fail.
   132 @SYMREQ                 REQ0000
   133 */
   134 TInt RFinalCloseTest::Create_Destroy_Without_FinalClose(TAny*)
   135 	{
   136 	
   137 	__UHEAP_MARK;
   138 	CTrapCleanup* threadcleanup = CTrapCleanup::New();
   139 
   140 	TRAPD(err,Create_Destroy_TestL());
   141 
   142 	test(err==KErrNone);
   143 	//This FinalClose() is purposely omitted for testing the PANIC
   144 	//REComSession::FinalClose();
   145 
   146 	delete threadcleanup;
   147 	__UHEAP_MARKEND;
   148 	return KErrNone;
   149 	}
   150 
   151 //The test code for creating and destroying an implementation
   152 //To be used in the two test cases above
   153 TInt RFinalCloseTest::Create_Destroy_TestL()
   154 	{
   155 	TUid dTorKey;
   156 	TUid implUid={0x101F8478};
   157 
   158 	// Set up some empty initialisation parameters
   159 	CExampleInterface::TExampleInterfaceInitParams initParams;
   160 	initParams.integer		= 0;
   161 	initParams.descriptor	= NULL;
   162 
   163 	CExampleInterface* dllPtr = REINTERPRET_CAST(CExampleInterface*,
   164 							REComSession::CreateImplementationL(implUid,dTorKey,&initParams));
   165 
   166 	//Check the return implementation instantiation has the same implementation uid
   167 	test(dllPtr->ImplId()==implUid);
   168 	//The returned Uid to be used in Destruction should match the implementation uid as well
   169 	CInstanceInfoSimple* instanceInfo = reinterpret_cast <CInstanceInfoSimple*> (dTorKey.iUid);
   170 	test(instanceInfo->ImplementationUid()==implUid);
   171 
   172 	REComSession::DestroyedImplementation(dTorKey);
   173 
   174 	delete dllPtr;
   175 	dllPtr=0;
   176 
   177 	return KErrNone;
   178 	}
   179 
   180 //The test code for listing implementation of an interface Uid.
   181 //The test also verify all the implementations in the list by
   182 //checking all the implementation Uid and their version.
   183 void RFinalCloseTest::ListImplementation_TestL()
   184 	{
   185 	/**
   186 	Some Plugin in Z that can be used for testing purposes
   187 	Interface UID	DLL	UID		Implementation UID	Version		DllFile
   188 	-------------------------------------------------------------------
   189 	0x10009DC0		0x10009DB1	0x10009DC3			1		Z:\\..\\EComExample.dll		old_version
   190 					0x10009DB1	0x10009DC4			1		Z:\\..\\EComExample.dll		old_version
   191 					0x10009DB3	0x10009DC3			2		Z:\\..\\EComExample2.dll	=
   192 					0x10009DB3	0x10009DC4			2		Z:\\..\\EComExample2.dll	=
   193 					0x101F8477	0x101F8478			1		Z:\\..\\EComExample3.dll	=
   194 					0x101F8479  0x101F847A			1		Z:\\..\\EComExample4.dll	=
   195 					0x10009DB2	0x10009DC5			1		Z:\\..\\Suidical.dll		=
   196 
   197 	*/
   198 	TUid interfaceUid={0x10009DC0};
   199 	RImplInfoPtrArray implArray;
   200 
   201 	//Array of all the expected implementation Uid;
   202 	RArray<TInt> expectedUidArray;
   203 	expectedUidArray.Append(0x10009DC3);
   204 	expectedUidArray.Append(0x10009DC4);
   205 	expectedUidArray.Append(0x101F8478);
   206 	expectedUidArray.Append(0x101F847A);
   207 	expectedUidArray.Append(0x10009DC5);
   208 
   209 	REComSession::ListImplementationsL(interfaceUid,implArray);
   210 
   211 	//Expected number of implementations retured=5
   212 	//This line has been removed as it is not safe to always assume there will be
   213 	//a fixed number of implementations based on an the interface 0x10009DC0.
   214 	//test(implArray.Count()==5);
   215 
   216 
   217 	//Check that the implementation uid returned matched the specs above
   218 	for (TInt i=0;i<implArray.Count();i++)
   219 	{
   220 		TUid implUid=implArray[i]->ImplementationUid();
   221 		if (expectedUidArray.Find(implUid.iUid)!=KErrNotFound)
   222 			{
   223 			//check for the latest version for 10009DC3 & 10009DC4
   224 			if (implUid.iUid==0x10009DC3 || implUid.iUid==0x10009DC4)
   225 				test(implArray[i]->Version()==2);
   226 			//all the other implementations have version 1
   227 			else
   228 				test(implArray[i]->Version()==1);
   229 			}
   230 	}
   231 	expectedUidArray.Reset();
   232 	expectedUidArray.Close();
   233 	implArray.ResetAndDestroy();
   234 	}
   235 
   236 /**
   237 The test code for testing the proper use of ListImplementationsL where
   238 after calling that function we call REComSession::FinalClose()
   239 
   240 @SYMTestCaseID          SYSLIB-ECOM-CT-0761
   241 @SYMTestCaseDesc	    Tests for proper listing of implementation of an interface UID
   242 @SYMTestPriority 	    High
   243 @SYMTestActions  	    Call up REComSession::FinalClose after ListImplementation_TestL
   244 @SYMTestExpectedResults The test must not fail.
   245 @SYMREQ                 REQ0000
   246 */
   247 TInt RFinalCloseTest::ListImpl_With_FinalCloseL()
   248 	{
   249 	__UHEAP_MARK;
   250 
   251 	ListImplementation_TestL();
   252 
   253 	REComSession::FinalClose();
   254 
   255 	__UHEAP_MARKEND;
   256 
   257 	return KErrNone;
   258 	}
   259 
   260 /**
   261 The test code for testing the improper use of ListImplementationsL where
   262 after the call, we never invoke REComSession::FinalClose().This will
   263 result in some memory leak panic.
   264 
   265 @SYMTestCaseID          SYSLIB-ECOM-CT-0762
   266 @SYMTestCaseDesc	    Tests for proper listing of implementation of an interface UID
   267 @SYMTestPriority 	    High
   268 @SYMTestActions  	    Call to REComSession::FinalClose is omitted to show memory leak panic
   269 @SYMTestExpectedResults The test must not fail.
   270 @SYMREQ                 REQ0000
   271 */
   272 TInt RFinalCloseTest::ListImpl_Without_FinalClose(TAny*)
   273 	{
   274 	
   275 	__UHEAP_MARK;
   276 
   277 	CTrapCleanup* threadcleanup = CTrapCleanup::New();
   278 	TRAPD(err,ListImplementation_TestL());
   279 	test(err==KErrNone);
   280 
   281 	//This FinalClose() is purposely omitted for testing the PANIC
   282 	//REComSession::FinalClose();
   283 
   284 	delete threadcleanup;
   285 	__UHEAP_MARKEND;
   286 	return KErrNone;
   287 	}
   288 /**
   289 The test code for testing the implementation creation and deletion
   290 where we create two different implementation using two different plugins
   291 destroy them and call FinalClose() to show there is no problem and memory leak
   292 
   293 @SYMTestCaseID          SYSLIB-ECOM-CT-0763
   294 @SYMTestCaseDesc	    Tests for proper creation and deletion of implementation using two different plugins
   295 @SYMTestPriority 	    High
   296 @SYMTestActions  	    Create the implementation with a call to REComSession::CreateImplementationL twice with different UIDs
   297                         Signal the destruction of an interface implementation to ECOM with a call to REComSession::DestroyedImplementation
   298 						Call up REComSession::FinalClose
   299 @SYMTestExpectedResults The test must not fail.
   300 @SYMREQ                 REQ0000
   301 */
   302 void RFinalCloseTest::Create_Destroy2_With_FinalCloseL()
   303 	{
   304 	__UHEAP_MARK;
   305 
   306 	TUid implUid1={0x10009DC3};
   307 	TUid implUid2={0x101F847A};
   308 	TUid dTorKey1;
   309 	TUid dTorKey2;
   310 	// Set up some empty initialisation parameters
   311 	CExampleInterface::TExampleInterfaceInitParams initParams;
   312 	initParams.integer		= 0;
   313 	initParams.descriptor	= NULL;
   314 
   315 	//Creating implementation 1
   316 	CExampleInterface* impl1 = REINTERPRET_CAST(CExampleInterface*,
   317 							REComSession::CreateImplementationL(implUid1,dTorKey1,&initParams));
   318 	test(impl1->ImplId()==implUid1);
   319 
   320 	//Creating implementation 2
   321 	CExampleInterface* impl2 = REINTERPRET_CAST(CExampleInterface*,
   322 							REComSession::CreateImplementationL(implUid2,dTorKey2,&initParams));
   323 	test(impl2->ImplId()==implUid2);
   324 
   325 	//Destroy implementation 2
   326 	REComSession::DestroyedImplementation(dTorKey2);
   327 
   328 	delete impl2;
   329 	impl2=0;
   330 
   331 	//Now Destroy implementation 1
   332 	REComSession::DestroyedImplementation(dTorKey1);
   333 
   334 	delete impl1;
   335 	impl1=0;
   336 
   337 	REComSession::FinalClose();
   338 
   339 	__UHEAP_MARKEND;
   340 
   341 	}
   342 
   343 /**
   344 The test code for testing that REComSession::FinalClose() can be called many times
   345 without introducing any strange behaviour, memory leak and crash problem.
   346 
   347 @SYMTestCaseID          SYSLIB-ECOM-CT-0764
   348 @SYMTestCaseDesc	    Tests to show that FinalClose() can be called many times with no unknown consequence.
   349 @SYMTestPriority 	    High
   350 @SYMTestActions  	    Create the implementation with some empty initialisation parameters
   351 						Call up REComSession::FinalClose twice before destroying the implementation and once after the deletion
   352                         Check for any strange behaviour, memory leak and crash problem.
   353 @SYMTestExpectedResults The test must not fail.
   354 @SYMREQ                 REQ0000
   355 */
   356 void RFinalCloseTest::Create_Destroy3_With_FinalCloseL()
   357 	{
   358 	__UHEAP_MARK;
   359 	TUid implUid1={0x10009DC3};
   360 	TUid dTorKey1;
   361 	// Set up some empty initialisation parameters
   362 	CExampleInterface::TExampleInterfaceInitParams initParams;
   363 	initParams.integer		= 0;
   364 	initParams.descriptor	= NULL;
   365 
   366 	//Creating implementation 1
   367 	CExampleInterface* impl1 = REINTERPRET_CAST(CExampleInterface*,
   368 							REComSession::CreateImplementationL(implUid1,dTorKey1,&initParams));
   369 	test(impl1->ImplId()==implUid1);
   370 
   371 	//Called FinalClose() twice
   372 	REComSession::FinalClose();
   373 	REComSession::FinalClose();
   374 
   375 	REComSession::DestroyedImplementation(dTorKey1);
   376 	delete impl1;
   377 
   378 	REComSession::FinalClose();
   379 
   380 	__UHEAP_MARKEND;
   381 	}
   382 
   383 /**
   384 The test code for testing the functionality of REComSession::FinalClose()
   385 without introducing any strange behaviour,memory leak and crash problem
   386 
   387 @SYMTestCaseID          SYSLIB-ECOM-CT-0765
   388 @SYMTestCaseDesc	    Tests for the REComSession::FinalClose() function
   389 @SYMTestPriority 	    High
   390 @SYMTestActions  	    Open and close single connection to the the ECom server.
   391                         Call FinalClose, to check for any strange behaviour,memory leak and crash problem
   392 @SYMTestExpectedResults The test must not fail.
   393 @SYMREQ                 REQ0000
   394 */
   395 void RFinalCloseTest::Create_Destroy4_With_FinalCloseL()
   396 	{
   397 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0765 "));
   398 	__UHEAP_MARK;
   399 
   400 	REComSession& ecomsession = ecomsession.OpenL();
   401 
   402 	ecomsession.Close();
   403 
   404 	REComSession::FinalClose();
   405 
   406 	__UHEAP_MARKEND;
   407 	}
   408 /**
   409 The test code for testing the functionality of REComSession::FinalClose()
   410 without introducing any strange behaviour,memory leak and crash problem
   411 
   412 @SYMTestCaseID          SYSLIB-ECOM-CT-0766
   413 @SYMTestCaseDesc	    Tests for the REComSession::FinalClose() function
   414 @SYMTestPriority 	    High
   415 @SYMTestActions  	    Call FinalClose() function,to check for any memory leak and crash problem
   416 @SYMTestExpectedResults The test must not fail.
   417 @SYMREQ                 REQ0000
   418 */
   419 void RFinalCloseTest::FinalClose()
   420 	{
   421 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0766 "));
   422 	__UHEAP_MARK;
   423 
   424 	REComSession::FinalClose();
   425 
   426 	__UHEAP_MARKEND;
   427 	}
   428 
   429 LOCAL_C void NonConstructL_Create_Destroy_helper()
   430 	{
   431 	REComSession session;
   432 	}
   433 
   434 /**
   435 @SYMTestCaseID          SYSLIB-ECOM-CT-0767
   436 @SYMTestCaseDesc	    Tests for the REComSession::FinalClose() function
   437 @SYMTestPriority 	    High
   438 @SYMTestActions  	    Open and close connection to ECOM server
   439                         Check for any memory leak and crash problem
   440 @SYMTestExpectedResults The test must not fail.
   441 @SYMREQ                 REQ0000
   442 */
   443 void RFinalCloseTest::NonConstructL_Create_Destroy()
   444 	{
   445 	__UHEAP_MARK;
   446 
   447 	// Test 1
   448 	::NonConstructL_Create_Destroy_helper();
   449 
   450 	// Test 2
   451 	REComSession* ptr = new REComSession;
   452 	delete ptr;
   453 
   454 	__UHEAP_MARKEND;
   455 	}
   456 
   457 /**
   458 The test code is used for capturing the PANIC that occurs as a result of not
   459 calling REComSession::FinalClose() when using ECOM plugins.
   460 
   461 @SYMTestCaseID          SYSLIB-ECOM-CT-0768
   462 @SYMTestCaseDesc	    Tests for PANIC when REComSession::FinalClose() is called using ECOM plugins
   463 @SYMTestPriority 	    High
   464 @SYMTestActions  	    Check for memory leak panic
   465 @SYMTestExpectedResults The test must not fail.
   466 @SYMREQ                 REQ0000
   467 */
   468 void RFinalCloseTest::ThreadPanicTest(const TDesC& aName,TThreadFunction aFunction)
   469 	{
   470 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0768 "));
   471 	test.Next(aName);
   472 	TRequestStatus threadStatus;
   473 	RThread thread;
   474 	TBool jit;
   475 	jit=User::JustInTime();
   476 	User::SetJustInTime(EFalse);
   477 
   478 	TInt err=thread.Create(aName,aFunction,KDefaultStackSize*8,KMinHeapSize,0x100000,0);
   479 	test(err==KErrNone);
   480 	thread.Logon(threadStatus)	;
   481 	thread.Resume();
   482 
   483 	User::WaitForRequest(threadStatus);
   484 
   485 	//Now check why the thread Exit
   486 
   487 	test(thread.ExitType()==EExitPanic);
   488 	test(thread.ExitReason()==0);
   489 	//A memory leak will have the exit category of form ALLOC:xxxxxx
   490 	//test.Printf(_L("Exit xcat: %S"), thread.ExitCategory().Left(6));
   491 	test(thread.ExitCategory().Left(6).CompareF(_L("ALLOC:"))==0);
   492 	thread.Close();
   493 	User::SetJustInTime(jit);
   494 	}
   495 
   496 /**
   497 Copies the Plugins to specific folder for testing purpose
   498 */
   499 LOCAL_C void CopyPlugins()
   500     {
   501 	// Copy the dlls and .rsc files on to RAM
   502 	TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExDllOnZ, KEComExDllOnC));
   503 	test(err==KErrNone);
   504 
   505 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileOnC));
   506 	test(err==KErrNone);
   507 
   508 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExampleDllOnZ, KEComExampleDllOnC));
   509 	test(err==KErrNone);
   510 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample2DllOnZ, KEComExample2DllOnC));
   511 	test(err==KErrNone);
   512  	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample3DllOnZ, KEComExample3DllOnC));
   513 	test(err==KErrNone);
   514 
   515 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExampleRscOnZ, KEComExampleRscOnC));
   516 	test(err==KErrNone);
   517 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample2RscOnZ, KEComExample2RscOnC));
   518 	test(err==KErrNone);
   519 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample3RscOnZ, KEComExample3RscOnC));
   520 	test(err==KErrNone);
   521 	}
   522 
   523 // Deleting plugin from the RAM for cleanup purpose
   524 inline LOCAL_C void DeleteTestPlugin()
   525 	{
   526 	TRAPD(err, EComTestUtils::FileManDeleteFileL(KEComExDllOnC));
   527 	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileOnC));
   528  	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExampleDllOnC));
   529  	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample2DllOnC));
   530  	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample3DllOnC));
   531  	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExampleRscOnC));
   532  	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample2RscOnC));
   533  	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample3RscOnC));
   534 	}
   535 
   536 LOCAL_C void RunTestL()
   537 	{
   538 	__UHEAP_MARK;
   539 	//Basic ECOM test
   540 	test.Next(_L("FinalClose"));
   541 	RFinalCloseTest::FinalClose();
   542 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0759 Create_Destroy_With_FinalCloseL "));
   543 	RFinalCloseTest::Create_Destroy_With_FinalCloseL();
   544 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0761 ListImpl_With_FinalCloseL "));
   545 	RFinalCloseTest::ListImpl_With_FinalCloseL();
   546 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0763 Create_Destroy2_With_FinalCloseL "));
   547 	RFinalCloseTest::Create_Destroy2_With_FinalCloseL();
   548 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0764 Create_Destroy3_With_FinalCloseL "));
   549 	RFinalCloseTest::Create_Destroy3_With_FinalCloseL();
   550 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0767 NonConstructL_Create_Destroy "));
   551 	RFinalCloseTest::NonConstructL_Create_Destroy();
   552 
   553 	//ECOM FinalClose() Panic Test
   554 	#if defined(_DEBUG)
   555 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0760 "));
   556 	RFinalCloseTest::ThreadPanicTest(_L("Create Destroy Panic Testing"),RFinalCloseTest::Create_Destroy_Without_FinalClose);
   557 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0762 "));
   558 	RFinalCloseTest::ThreadPanicTest(_L("List Implementation Panic Testing"),RFinalCloseTest::ListImpl_Without_FinalClose);
   559 	#endif
   560 
   561 	__UHEAP_MARKEND;
   562 	}
   563 
   564 GLDEF_C TInt E32Main()
   565 	{
   566 	__UHEAP_MARK;
   567 
   568 	test.Title();
   569 	test.Start(_L("Final Close tests."));
   570 
   571 	CopyPlugins();
   572 
   573 	CTrapCleanup* cleanup = CTrapCleanup::New();
   574 	CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
   575 	CActiveScheduler::Install(scheduler);
   576 
   577 	TRAPD(err,RunTestL());
   578 	test(err==KErrNone);
   579 
   580 	// Cleanup files. If the cleanup fails that is no problem,
   581 	// as any subsequent tests will replace them. The only downside
   582 	// would be the disk not being tidied
   583 	DeleteTestPlugin();
   584 
   585 	delete scheduler;
   586 	delete cleanup;
   587 
   588 	test.End();
   589 	test.Close();
   590 
   591 	__UHEAP_MARKEND;
   592 	return(0);
   593 	}