lowlevellibsandfws/pluginfw/Framework/SimpleTests/t_capcheck.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 
       
    21 #include <ecom/ecom.h>
       
    22 #include "EComUidCodes.h"
       
    23 #include "Interface.h"
       
    24 #include "T_PlatSecInterface.h"
       
    25 #include "../EcomTestUtils/EcomTestUtils.h"
       
    26 #include "LoadManager.h"
       
    27 
       
    28 /**----------------------------Client CAP-----------------------------------------
       
    29              Client Capability Set="ReadUserData" "WriteUserData"
       
    30 */
       
    31 /** ---------------------------Plugins used in this test case----------------------
       
    32 - T_PlatSecECom1.dll in DRIVE Z:
       
    33   Details:-Resource file=102026AB.rss
       
    34 		  -Capability Set="ReadUserData" "WriteUserData"
       
    35 		  -ImplementationUid=0x102026AA based on InterfaceUid=0x102026A8
       
    36 
       
    37 - T_PlatSecECom2.dll in DRIVE Z:
       
    38   Details:-Resource file=102026AD.rss
       
    39   		  -Capability Set="ReadUserData"
       
    40   		  -ImplementationUid=0x102026AC based on InterfaceUid=0x102026A9
       
    41 
       
    42 - T_PlatSecECom3.dll in DRIVE Z:
       
    43   Details:-Resource file=102026AF.rss
       
    44           -Capability Set="ReaderUserData" "WriteUserData" "AllFiles"
       
    45           -ImplementationUid=0x102026AE based on InterfaceUid=0x102026A9
       
    46 
       
    47 - T_PlatSecECom4.dll in DRIVE C:
       
    48   Details:-Resource file=10202666.rss
       
    49   		  -Capability Set="ReadUserData" "WriteUserData" "ProtServ"
       
    50   		  -ImplementationUid=0x102026B1 based on InterfaceUid=0x102026A8
       
    51 
       
    52 - T_PlatSecResolver.dll in DRIVE Z:
       
    53   Details:-Resource file=10202777.rss
       
    54   		  -Capability Set="ReadUserData"
       
    55   		  -ImplementationUid=0x10202747 based on InterfaceUid=0x102027E7
       
    56 
       
    57 - EComExample.dll in Drive Z:
       
    58   Details:-Contain two implementation and one Resolver, only interested in the resolver
       
    59   		  -Resource file=10009DB1.RSS
       
    60   		  -Capability Set="All -Tcb"
       
    61   		  -ImplementationUid=0x10009DD0 based on InterfaceUid=0x10009D90
       
    62 -------------------------------------------------------------------------------------
       
    63 */
       
    64 
       
    65 /** Test cases covered in this test code:
       
    66 1.	Testing Client API capability filtering in ListImplementation(TUid aInterfaceUid) in Z,C;
       
    67 2.	Testing Client API capability filtering in CreateImplementation(TUid aImplementationUid) in Z,C;
       
    68 3.	Testing Client API capability checking in Loading a non-default resolver in the server side
       
    69 */
       
    70 
       
    71 class RCapCheckTest
       
    72 	{
       
    73 public:
       
    74 	static TBool IsPlatSecEnforcementOn();
       
    75 	//Test case 1
       
    76 	static void ListImpl_InterfaceL();
       
    77 	//Test case 2
       
    78 	static void CreateImpl_Implementation();
       
    79 	//Test case 3
       
    80 	static void ListImpl_NonDefaultResolverL();
       
    81 	//Test case 4
       
    82 	static void ListImpl_InterfaceWithoutCapCheckL();
       
    83 	};
       
    84 
       
    85 
       
    86 /**--------------------Utility Functions--------------------------------------------*/
       
    87 // Plugins files that need to be copied from Z: to C:
       
    88 _LIT(KResourceFileNameC,	 "C:\\resource\\plugins\\T_PlatSecECom4.rsc");
       
    89 _LIT(KExampleDllFileNameC,	 "C:\\sys\\bin\\T_PlatSecECom4.dll");
       
    90 _LIT(KResourceFileNameZ,	 "Z:\\RAMONLY\\T_PlatSecECom4.rsc");
       
    91 
       
    92 _LIT(KExampleDllFileNameZ,	 "Z:\\RAMONLY\\T_PlatSecECom4.dll");
       
    93 
       
    94 const TInt KOneSecond = 1000000;
       
    95 
       
    96 LOCAL_D RFs	TheFs;
       
    97 
       
    98 LOCAL_D RTest test(_L("Capability Checking Test"));
       
    99 
       
   100 // Copy the Plugins to specific folder for testing purpose
       
   101 LOCAL_C void CopyPluginsL()
       
   102 	{
       
   103 	// Copy the dlls and .rsc files on to RAM
       
   104 	TRAPD(err, EComTestUtils::FileManCopyFileL(KResourceFileNameZ,KResourceFileNameC));
       
   105 	test(err == KErrNone);
       
   106 	TRAP(err, EComTestUtils::FileManCopyFileL(KExampleDllFileNameZ,KExampleDllFileNameC));
       
   107 	test(err == KErrNone);
       
   108 	// Wait, so that ECom server looks for plugins copied from Z: to C drive
       
   109 	// ECOM server could be already started. It means that when we copy some
       
   110 	// ECOM plugins from Z: to C: drive - ECOM server should look for and
       
   111 	// find the new ECOM plugins. The ECOM server uses for that CDiscoverer::CIdleScanningTimer
       
   112 	// which is an active object. So the discovering service is asynchronous. We have to
       
   113 	// wait some time until it finishes. Otherwise ListImplementationsL could fail to find
       
   114 	// requested implementations.
       
   115 	User::After(KOneSecond * 3);
       
   116 	}
       
   117 
       
   118 // Deleting plugin from the RAM for cleanup purpose
       
   119 inline LOCAL_C void DeleteTestPlugin()
       
   120 	{
       
   121 	TRAPD(err, EComTestUtils::FileManDeleteFileL(KResourceFileNameC));
       
   122 	test(err == KErrNone);
       
   123 
       
   124 	TRAP(err, EComTestUtils::FileManDeleteFileL(KExampleDllFileNameC));
       
   125 #if defined(__WINS__) || defined (__WINSCW__)
       
   126     if (err != KErrNone)
       
   127    	    {
       
   128         TESTC(test, err, KErrAccessDenied); // DLL File locked under Windows emulator due to it being demand paged
       
   129         }
       
   130     else
       
   131        	TESTC(test, err, KErrNone); // DLL File not locked on Windows
       
   132 #elif defined(__EPOC32__)
       
   133    	TESTC(test, err, KErrNone); // DLL File not locked on target hardware
       
   134 #endif
       
   135     // Do no test at all as its an unexpected platform.
       
   136 }
       
   137 
       
   138 TBool RCapCheckTest::IsPlatSecEnforcementOn()
       
   139 	{
       
   140 	return PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement);
       
   141 	}
       
   142 /**
       
   143 --------------------------Test case 1---------------------------------------------
       
   144 Testing Client API capability filtering in ListImplementation(TUid aInterfaceUid);
       
   145 -Client CapSet listing implemenation with InterfaceUid=0x102026A9
       
   146  *Two existing Impl based on that Interface T_PlatSecECom2.dll & T_PlatSecEcom3.dll
       
   147   one with lower capability set than the client
       
   148  *Expected array count=1 as it wont be able to load T_PlatSecECom2.dll
       
   149   when PlatSec is enforced, count=2 otherwise.
       
   150 -Client Capset listing implementation with InterfaceUid=0x102026A8
       
   151  *Test to ensure it pick up plugins in other drive else than Z
       
   152 
       
   153 
       
   154 @SYMTestCaseID          SYSLIB-ECOM-CT-0771
       
   155 @SYMTestCaseDesc	    Testing Client API capability filtering in ListImplementation(TUid aInterfaceUid)
       
   156 @SYMTestPriority 	    High
       
   157 @SYMTestActions  	    Ensure it picks up plugins in other drive else than Z
       
   158                         List of all available implementations which
       
   159 	                    satisfy this given interface and check for the validity.
       
   160 @SYMTestExpectedResults The test must not fail.
       
   161 @SYMREQ                 REQ0000
       
   162 */
       
   163 void RCapCheckTest::ListImpl_InterfaceL()
       
   164 	{
       
   165 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0771 List Implementation Capability checking\n "));
       
   166 	// Input parameter
       
   167 	const TUid interfaceUid = {0x102026A9};
       
   168 	// Output parameters
       
   169 	TInt err = KErrNone;
       
   170 	RImplInfoPtrArray* implementationArray=new (ELeave) RImplInfoPtrArray;
       
   171 
       
   172 	//Listing implementation from interface=0x102026A9
       
   173 	TRAP(err, REComSession::ListImplementationsL(interfaceUid, *implementationArray));
       
   174 	test(KErrNone == err);
       
   175 	if (RCapCheckTest::IsPlatSecEnforcementOn())
       
   176 		{
       
   177 		//Only will return one implementation in T_PlatSecECom3.dll
       
   178 		test(1 == implementationArray->Count());
       
   179 		const TUid expectedImplUid = {0x102026AE};
       
   180 		test(expectedImplUid == (*implementationArray)[0]->ImplementationUid());
       
   181 		}
       
   182 	else
       
   183 		{
       
   184 		//Return two implementations from T_PlatSecECom2.dll and T_PlatSecECom3.dll
       
   185 		test(2 == implementationArray->Count());
       
   186 		}
       
   187 	implementationArray->ResetAndDestroy();
       
   188 
       
   189 	//Listing implementation from interface=0x102026A8
       
   190 	const TUid interfaceUid2 = {0x102026A8};
       
   191 	TRAP(err, REComSession::ListImplementationsL(interfaceUid2, *implementationArray));
       
   192 	test(KErrNone == err);
       
   193 	test(2 == implementationArray->Count());
       
   194 	implementationArray->ResetAndDestroy();
       
   195 
       
   196 	delete implementationArray;
       
   197 	}
       
   198 
       
   199 /**
       
   200 --------------------------Test case 2----------------------------------------------------
       
   201 Testing Client API capability filtering in CreateImplementation(TUid aImplementationUid);
       
   202 - Client try to create Implementation with different capset
       
   203 - If Client.CAPS > Plugin.CAPS Expected Result=FAIL
       
   204 - If Client.CAPS < Plugin.CAPS Expected Result=OK
       
   205 - If Client.CAPS = Plugin.CAPS Expected Result=OK
       
   206 
       
   207 @SYMTestCaseID          SYSLIB-ECOM-CT-0772
       
   208 @SYMTestCaseDesc	    Testing Client API capability filtering in CreateImplementation(TUid aImplementationUid)
       
   209 @SYMTestPriority 	    High
       
   210 @SYMTestActions  	    Create Implementation with different capsets
       
   211 @SYMTestExpectedResults The test must not fail.
       
   212 @SYMREQ                 REQ0000
       
   213 */
       
   214 void RCapCheckTest::CreateImpl_Implementation()
       
   215 	{
       
   216 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0772 Create Implementation Capability filtering\n "));
       
   217 	// Output parameters
       
   218 	TInt ret=KErrNone;
       
   219 	TUid returnedimplUid;
       
   220 	TAny* ImplCreation=NULL;
       
   221 
       
   222 	//Creating Implementation with CAPS="ReadUserData"
       
   223 	const TUid ImplUid2 = {0x102026AC};
       
   224 	TRAP(ret,ImplCreation=REComSession::CreateImplementationL(ImplUid2,returnedimplUid));
       
   225 	if (RCapCheckTest::IsPlatSecEnforcementOn())
       
   226 		{
       
   227 		test(KErrPermissionDenied == ret);
       
   228 		test(NULL == ImplCreation);
       
   229 		}
       
   230 	else
       
   231 		{
       
   232 		test(KErrNone == ret);
       
   233 		test(NULL != ImplCreation);
       
   234 		test(ImplUid2 == returnedimplUid);
       
   235 		//Cast to CPlatSecInterface2
       
   236 		CPlatSecInterface2* impl2=reinterpret_cast <CPlatSecInterface2*> (ImplCreation);
       
   237 		test(ImplUid2 == impl2->ImplId());
       
   238 		REComSession::DestroyedImplementation(returnedimplUid);
       
   239 
       
   240 		delete ImplCreation;
       
   241 		ImplCreation = NULL;
       
   242 		}
       
   243 
       
   244 	//Creating Implementation with CAPS="ReadUserData WriteUserData AllFiles"
       
   245 	const TUid ImplUid3 = {0x102026AE};
       
   246 	TUid instanceKey;
       
   247 	TRAP(ret,ImplCreation=REComSession::CreateImplementationL(ImplUid3,instanceKey));
       
   248 	CInstanceInfoSimple* instanceInfo = reinterpret_cast <CInstanceInfoSimple*> (instanceKey.iUid);
       
   249 	returnedimplUid = instanceInfo->ImplementationUid();
       
   250 
       
   251 	test(KErrNone == ret);
       
   252 	test(NULL != ImplCreation);
       
   253 
       
   254 	test(ImplUid3 == returnedimplUid);
       
   255 	//Cast to CPlatSecInterface3
       
   256 	CPlatSecInterface3* impl3=reinterpret_cast <CPlatSecInterface3*> (ImplCreation);
       
   257 	test(ImplUid3 == impl3->ImplId());
       
   258 	REComSession::DestroyedImplementation(instanceKey);
       
   259 
       
   260 	delete ImplCreation;
       
   261 	ImplCreation = NULL;
       
   262 
       
   263 	//Creating Implementation with CAPS="ReadUserData WriteUserData"
       
   264 	const TUid ImplUid1 = {0x102026AA};
       
   265 	TRAP(ret,ImplCreation=REComSession::CreateImplementationL(ImplUid1,instanceKey));
       
   266 	instanceInfo = reinterpret_cast <CInstanceInfoSimple*> (instanceKey.iUid);
       
   267 	returnedimplUid = instanceInfo->ImplementationUid();
       
   268 	test(KErrNone == ret);
       
   269 	test(NULL != ImplCreation);
       
   270 	test(ImplUid1 == returnedimplUid);
       
   271 	//Cast to CPlatSecInterface1
       
   272 	CPlatSecInterface1* impl1=reinterpret_cast <CPlatSecInterface1*> (ImplCreation);
       
   273 	test(ImplUid1 == impl1->ImplId());
       
   274 	REComSession::DestroyedImplementation(instanceKey);
       
   275 
       
   276 	delete ImplCreation;
       
   277 	ImplCreation = NULL;
       
   278 
       
   279 	//Creating Implementation in C:\ with CAPS="ReadUserData WriteUserData ProtServ"
       
   280 	const TUid ImplUid4 = {0x102026B1};
       
   281 	TRAP(ret,ImplCreation=REComSession::CreateImplementationL(ImplUid4,instanceKey));
       
   282 	instanceInfo = reinterpret_cast <CInstanceInfoSimple*> (instanceKey.iUid);
       
   283 	returnedimplUid = instanceInfo->ImplementationUid();
       
   284 	test(KErrNone == ret);
       
   285 	test(NULL != ImplCreation);
       
   286 	test(ImplUid4 == returnedimplUid);
       
   287 	REComSession::DestroyedImplementation(instanceKey);
       
   288 
       
   289 	delete ImplCreation;
       
   290 	ImplCreation = NULL;
       
   291 	}
       
   292 
       
   293 /**
       
   294 --------------------------Test case 3----------------------------------------------------
       
   295 Testing Client API capability filtering in ListImplementation by specifying a non-default
       
   296 resolver Uid.  The resolver is loaded in the server side.
       
   297 If PlatSecEnforcement is ON, the non-default resolver should have at least the "ProtServ"
       
   298 capability in order to be successfully loaded.
       
   299 - Testing using a non-default resolver T_PlatSecResolver.dll with CAPS=ReadUserData
       
   300 - Testing using a non-default resolver EComExample.dll with CAPS=All-Tcb
       
   301 
       
   302 @SYMTestCaseID          SYSLIB-ECOM-CT-0773
       
   303 @SYMTestCaseDesc	    Testing Client API capability filtering in CreateImplementation(TUid aImplementationUid)
       
   304 @SYMTestPriority 	    High
       
   305 @SYMTestActions  	    Tests for listing all available implementations using a non-default resolver  with CAPS=ReadUserData
       
   306                         Tests for listing all available implementations using a non-default resolver with CAPS=All-Tcb
       
   307 @SYMTestExpectedResults The test must not fail.
       
   308 @SYMREQ                 REQ0000
       
   309 */
       
   310 void RCapCheckTest::ListImpl_NonDefaultResolverL()
       
   311 	{
       
   312 	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0773 Capability checking in loading non-default resolver in server side\n "));
       
   313 	// Input parameters
       
   314 	const TUid interfaceUid = {0x102026A9};
       
   315 	const TUid resolverUid	= {0x10202747};
       
   316 	TEComResolverParams resolverparams;
       
   317 	_LIT8(KDummyData,"dummy");
       
   318 	//Set any resolver data type as it will never reach the resolving part
       
   319 	resolverparams.SetDataType(KDummyData());
       
   320 	// Output parameters
       
   321 	TInt err=KErrNone;
       
   322 	RImplInfoPtrArray* implementationArray=new (ELeave) RImplInfoPtrArray;
       
   323 
       
   324 	//Listing implementation from interface=0x102026A9 using T_PlatSecResolver.dll
       
   325 	TRAP(err,REComSession::ListImplementationsL(interfaceUid,resolverparams,resolverUid,*implementationArray));
       
   326 	if (RCapCheckTest::IsPlatSecEnforcementOn())
       
   327 		{
       
   328 		//ensure that no resolver returned here because of lacking the capability ProtServ
       
   329 		test(KErrPermissionDenied == err);
       
   330 		}
       
   331 	else
       
   332 		{
       
   333 		//No resolver should be found based on the dummy resolver data
       
   334 		test(KEComErrNoResolver == err);
       
   335 		}
       
   336 	test(0 == implementationArray->Count());
       
   337 
       
   338 	//Listing implementation from interface=0x10009DD0 using EComExample.dll
       
   339 	const TUid resolverUid2 = {0x10009DD0};
       
   340 	TRAP(err,REComSession::ListImplementationsL(interfaceUid,resolverparams,resolverUid2,*implementationArray));
       
   341 	//ensure that no problem here as the resolver has the capability ProtServ
       
   342 	test(KErrNone == err);
       
   343 	if (RCapCheckTest::IsPlatSecEnforcementOn())
       
   344 		{
       
   345 		//Only will return one implementation in T_PlatSecECom3.dll
       
   346 		test(1 == implementationArray->Count());
       
   347 		const TUid expectedImplUid = {0x102026AE};
       
   348 		test(expectedImplUid == (*implementationArray)[0]->ImplementationUid());
       
   349 		}
       
   350 	else
       
   351 		{
       
   352 		//Return two implementations from T_PlatSecECom2.dll and T_PlatSecECom3.dll
       
   353 		test(2 == implementationArray->Count());
       
   354 		}
       
   355 	implementationArray->ResetAndDestroy();
       
   356 
       
   357 	delete implementationArray;
       
   358 	implementationArray = NULL;
       
   359 	}
       
   360 
       
   361 /**
       
   362 --------------------------Test case 4---------------------------------------------
       
   363 Testing Client API without capability filtering in ListImplementation(TUid aInterfaceUid);
       
   364 -Client CapSet listing implemenation with InterfaceUid=0x102026A9
       
   365  *Two existing Impl based on that Interface T_PlatSecECom2.dll & T_PlatSecEcom3.dll
       
   366   one with lower capability set than the client
       
   367  *Expected array count=2 as it will be able to load T_PlatSecECom2.dll
       
   368   when PlatSec is enforced, count=2 otherwise.
       
   369 -Client Capset listing implementation with InterfaceUid=0x102026A8
       
   370  *Test to ensure it pick up plugins in other drive else than Z
       
   371 
       
   372 
       
   373 @SYMTestCaseID          BASESRVCS-ECOM-T-4026
       
   374 @SYMTestCaseDesc	    Testing Client API without capability filtering in ListImplementation(TUid aInterfaceUid)
       
   375 @SYMTestPriority 	    High
       
   376 @SYMTestActions  	    Ensure it picks up plugins in other drive else than Z
       
   377                         List of all available implementations which
       
   378 	                    satisfy this given interface and check for the validity.
       
   379 @SYMTestExpectedResults The test must not fail.
       
   380 @SYMREQ                 CR1573,REQ11641 and REQ11793
       
   381 */
       
   382 void RCapCheckTest::ListImpl_InterfaceWithoutCapCheckL()
       
   383 	{
       
   384 	test.Next(_L(" @SYMTestCaseID:BASESRVCS-ECOM-T-4026 List Implementation Without Capability checking and trying to Create Implementation\n "));
       
   385 	// Input parameter
       
   386 	const TUid interfaceUid = {0x102026A9};
       
   387 	// Output parameters
       
   388 	TInt err = KErrNone;
       
   389 	RImplInfoPtrArray* implementationArray=new (ELeave) RImplInfoPtrArray;
       
   390 	TBool capability = EFalse;
       
   391 
       
   392 	//Listing implementation from interface=0x102026A9
       
   393 	TRAP(err, REComSession::ListImplementationsL(interfaceUid, *implementationArray,capability));
       
   394 	test(KErrNone == err);
       
   395 	if (RCapCheckTest::IsPlatSecEnforcementOn())
       
   396 		{
       
   397 		TInt count=implementationArray->Count();
       
   398 		test(2 == implementationArray->Count());
       
   399 		}
       
   400 	
       
   401 	TUid returnedimplUid;
       
   402 	TAny* ImplCreation=NULL;
       
   403 	//Creating Implementation with CAPS="ReadUserData"
       
   404 	const TUid ImplUid2 = {0x102026AC};
       
   405 	TRAP(err,ImplCreation=REComSession::CreateImplementationL(ImplUid2,returnedimplUid));
       
   406 	if (RCapCheckTest::IsPlatSecEnforcementOn())
       
   407 		{
       
   408 		test(KErrPermissionDenied == err);
       
   409 		test(NULL == ImplCreation);
       
   410 		}	
       
   411 	implementationArray->ResetAndDestroy();
       
   412 
       
   413 	//Listing implementation from interface=0x102026A8
       
   414 	const TUid interfaceUid2 = {0x102026A8};
       
   415 	TRAP(err, REComSession::ListImplementationsL(interfaceUid2, *implementationArray));
       
   416 	test(KErrNone == err);
       
   417 	test(2 == implementationArray->Count());
       
   418 	implementationArray->ResetAndDestroy();
       
   419 
       
   420 	delete implementationArray;
       
   421 	}
       
   422 
       
   423 
       
   424 LOCAL_C void RunTestL()
       
   425 	{
       
   426 	__UHEAP_MARK;
       
   427 
       
   428 	//Test case 1
       
   429 	RCapCheckTest::ListImpl_InterfaceL();
       
   430 
       
   431 	//Test case 2
       
   432 	RCapCheckTest::CreateImpl_Implementation();
       
   433 
       
   434 	//Test case 3
       
   435 	RCapCheckTest::ListImpl_NonDefaultResolverL();
       
   436 	
       
   437 	//Test case 4
       
   438 	RCapCheckTest::ListImpl_InterfaceWithoutCapCheckL();
       
   439 
       
   440 	//We do not want any memory leak here
       
   441 	REComSession::FinalClose();
       
   442 
       
   443 	__UHEAP_MARKEND;
       
   444 	}
       
   445 
       
   446 GLDEF_C TInt E32Main()
       
   447 	{
       
   448 	TInt err=KErrNone;
       
   449 	__UHEAP_MARK;
       
   450 
       
   451 	test.Title();
       
   452 	test.Start(_L("Capability Checking tests."));
       
   453 
       
   454 	// This test is only applicable for secure ECom.
       
   455 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   456 	CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
       
   457 	CActiveScheduler::Install(scheduler);
       
   458 
       
   459 	TRAP(err, CopyPluginsL());
       
   460 	test(err==KErrNone);
       
   461 
       
   462 	TRAP(err,RunTestL());
       
   463 	test(err==KErrNone);
       
   464 
       
   465 	// Cleanup files. If the cleanup fails that is no problem,
       
   466 	// as any subsequent tests will replace them. The only downside
       
   467 	// would be the disk not being tidied
       
   468 	DeleteTestPlugin();
       
   469 
       
   470 	delete scheduler;
       
   471 	delete cleanup;
       
   472 
       
   473 	test.End();
       
   474 	test.Close();
       
   475 
       
   476 	__UHEAP_MARKEND;
       
   477 	return(0);
       
   478 	}