os/ossrv/lowlevellibsandfws/pluginfw/Framework/PluginDiscoveryTests/t_plugindiscovery.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/PluginDiscoveryTests/t_plugindiscovery.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,506 @@
     1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Contains tests with invalid/missing plugin DLLs
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +
    1.22 +#include <ecom/ecom.h>
    1.23 +#include "EComUidCodes.h"
    1.24 +#include "Interface.h" // interface to Plugins
    1.25 +#include "../EcomTestUtils/EcomTestUtils.h"
    1.26 +
    1.27 +#include <e32test.h>
    1.28 +#include <f32file.h>
    1.29 +#include <bautils.h>
    1.30 +
    1.31 +LOCAL_D RTest test(_L("t_plugindiscovery.exe"));
    1.32 +
    1.33 +LOCAL_D CTrapCleanup* 	  TheTrapCleanup 	 = NULL;
    1.34 +
    1.35 +LOCAL_D CActiveScheduler* TheActiveScheduler = NULL;
    1.36 +
    1.37 +LOCAL_D RFs					TheFs;
    1.38 +
    1.39 +// Implementaion ID used for testing
    1.40 +const TUid KUidTestImplementation = {0x101F847C};
    1.41 +
    1.42 +
    1.43 +//It is used by some test methods which are called two times:
    1.44 +//from normal test and from OOM test.
    1.45 +static void LeaveIfErrNoMemory(TInt aError)
    1.46 +	{
    1.47 +	if(aError == KErrNoMemory)
    1.48 +		{
    1.49 +		REComSession::FinalClose();
    1.50 +		User::Leave(aError);
    1.51 +		}
    1.52 +	}
    1.53 +
    1.54 +
    1.55 +// Plugins used in tests.
    1.56 +_LIT(KEComInvalidDllOnZ, "z:\\RAMOnly\\InvalidSIDPlugin.dll");
    1.57 +_LIT(KEComInvalidRscOnZ, "z:\\RAMOnly\\InvalidSIDPlugin.rsc");
    1.58 +_LIT(KEComInvalidDllOnC, "c:\\sys\\bin\\InvalidSIDPlugin.dll");
    1.59 +_LIT(KEComInvalidRscOnC, "c:\\resource\\plugins\\InvalidSIDPlugin.rsc");
    1.60 +
    1.61 +_LIT(KEComExample5RscOnZ, "z:\\RAMOnly\\EComExample5.rsc");
    1.62 +_LIT(KEComExample5RscOnC, "c:\\resource\\plugins\\EComExample5.rsc");
    1.63 +_LIT(KEComRomRslvrExampleRscOnCRomLocation, "z:\\RAMOnly\\EComRomRslvrExampleOnC.RSC");
    1.64 +_LIT(KEComRomRslvrExampleRscOnCRamLocation, "c:\\resource\\plugins\\EComRomRslvrExampleOnZ.RSC");
    1.65 +
    1.66 +// Plugins used in plugins directory removing test
    1.67 +_LIT(KEComDefectPluginDLLOnZ,			"Z:\\RAMOnly\\DefectPlugin.dll");
    1.68 +_LIT(KEComDefectPluginRSCOnZ,			"Z:\\RAMOnly\\DefectPlugin.rsc");
    1.69 +_LIT(KEComDefectPluginDLLOnC,			"C:\\sys\\bin\\DefectPlugin.dll");
    1.70 +_LIT(KEComDefectPluginRSCOnC,			"C:\\Resource\\Plugins\\DefectPlugin.rsc");
    1.71 +_LIT(KEComResourcePluginDirNameOnC,		"C:\\Resource\\Plugins\\");
    1.72 +_LIT(KEComResourcePluginDirNameOffOnC,	"C:\\Resource\\PluginsNameOff\\");
    1.73 +
    1.74 +/**
    1.75 +@SYMTestCaseID SYSLIB-ECOM-CT-0030
    1.76 +@SYMTestCaseDesc Test that an orphaned resource file does not create a registry
    1.77 +				 entry.
    1.78 +@SYMTestPriority High
    1.79 +@SYMTestActions  EComExample5.rsc file copied to C: drive.
    1.80 +				 Check call to REComSession::CreateImplementationL() via test
    1.81 +				 CExampleInterface class fails to return the implementation.
    1.82 +@SYMTestExpectedResults The test must not fail.
    1.83 +@SYMREQ REQ3846
    1.84 +*/
    1.85 +LOCAL_C void TestOrphanedRscFileL()
    1.86 +	{
    1.87 +	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0030 "));
    1.88 +	__UHEAP_MARK;
    1.89 +
    1.90 +	// Copy plugin
    1.91 +	TRAPD(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample5RscOnC));
    1.92 +	ignoreErr = ignoreErr;
    1.93 +
    1.94 +	TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExample5RscOnZ, KEComExample5RscOnC));
    1.95 +	test(err == KErrNone);
    1.96 +
    1.97 +	// The reason for the folowing delay is:
    1.98 +	// ECOM server could be already started. It means that when we copy some
    1.99 +	// ECOM plugins from Z: to C: drive - ECOM server should look for and
   1.100 +	// find the new ECOM plugins. The ECOM server uses for that an active object,
   1.101 +	// which scans plugin directories. So the discovering service is asynchronous.
   1.102 +	// We have to wait some time until it finishes.
   1.103 +	// Otherwise CreateImplementationsL could fail to create requested implementations.
   1.104 +	WAIT_FOR3s;
   1.105 +
   1.106 +	CExampleInterface* interfaceimpl = NULL;
   1.107 +	TRAP(err, interfaceimpl = CExampleInterface::NewL2(KUidTestImplementation));
   1.108 +	::LeaveIfErrNoMemory(err);
   1.109 +	test(err == KErrNotFound);
   1.110 +	CleanupStack::PushL(interfaceimpl);
   1.111 +
   1.112 +	CleanupStack::PopAndDestroy(interfaceimpl);
   1.113 +	REComSession::FinalClose();
   1.114 +
   1.115 +	// Delete plugin
   1.116 +	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample5RscOnC));
   1.117 +	test(err == KErrNone);
   1.118 +	__UHEAP_MARK;
   1.119 +	}
   1.120 +
   1.121 +
   1.122 +/**
   1.123 +@SYMTestCaseID SYSLIB-ECOM-CT-1404
   1.124 +@SYMTestCaseDesc Test that an orphaned resource file does not create a registry entry.
   1.125 +			and that other valid implementations are discovered instead.
   1.126 +@SYMTestPriority High
   1.127 +@SYMTestActions  Copy EComRomRslvrExampleOnC to the plug-ins directory on the C drive, without the associated DLL
   1.128 +	Because the DLL is not there, Ecom should fall back to the implementations on the Z drive in EComRomRslvrExampleOnZ
   1.129 +@SYMTestExpectedResults ECom plugins with invalid DLLs fall back to the correct implementations.
   1.130 +@SYMPREQ	PREQ1192
   1.131 +*/
   1.132 +LOCAL_C void TestOrphanedRscFileFallBackL()
   1.133 +	{
   1.134 +	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1404 "));
   1.135 +	__UHEAP_MARK;
   1.136 +
   1.137 +	// Copy plugin resource file and NOT the associated DLL
   1.138 +	TRAPD(err, EComTestUtils::FileManCopyFileL(KEComRomRslvrExampleRscOnCRomLocation, KEComRomRslvrExampleRscOnCRamLocation));
   1.139 +	test(err == KErrNone);
   1.140 +
   1.141 +	// The reason for the folowing delay is:
   1.142 +	// ECOM server could be already started. It means that when we copy some
   1.143 +	// ECOM plugins from Z: to C: drive - ECOM server should look for and
   1.144 +	// find the new ECOM plugins. The ECOM server uses for that an active object,
   1.145 +	// which scans plugin directories. So the discovering service is asynchronous.
   1.146 +	// We have to wait some time until it finishes.
   1.147 +	// Otherwise ListImplementationsL could fail to find requested implementations.
   1.148 +	WAIT_FOR3s;
   1.149 +
   1.150 +	TUid romRslvrExampleInterfaceUid = {0x10009DC8};
   1.151 +	RImplInfoPtrArray ifArray;
   1.152 +	TRAP(err, REComSession::ListImplementationsL(romRslvrExampleInterfaceUid, ifArray));
   1.153 +	::LeaveIfErrNoMemory(err);
   1.154 +	test(err == KErrNone);
   1.155 +
   1.156 +	// Go through the implementations for the given interface, and find the ones that match up with
   1.157 +	// EComRomRslvrExampleRscOnZ (and not EComRomRslvrExampleRscOnC becuase it's DLL is missing)
   1.158 +	// EComRomRslvrExampleOnZ contains the implementation 0x10009DC7v2 and 0x10009DC6v1 (these should be found)
   1.159 +	// EComRomRslvrExampleOnC contains the implementation 0x10009DC7v1 and 0x10009DC6v2 (these should NOT be returned becuase of the missing DLL)
   1.160 +	TBool foundRightImplementation1 = EFalse;
   1.161 +	TBool foundRightImplementation2 = EFalse;
   1.162 +	for(TInt index = 0; index < ifArray.Count(); ++index)
   1.163 +		{
   1.164 +		TUid uid = ifArray[index]->ImplementationUid();
   1.165 +		TInt version = ifArray[index]->Version();
   1.166 +		TInt drive = ifArray[index]->Drive();
   1.167 +		if (uid.iUid == 0x10009DC6)
   1.168 +			{
   1.169 +			test(version == 1);
   1.170 +			test(drive==EDriveZ);
   1.171 +			foundRightImplementation1 = ETrue;
   1.172 +			}
   1.173 +		if (uid.iUid == 0x10009DC7)
   1.174 +			{
   1.175 +			test(version == 2);
   1.176 +			test(drive==EDriveZ);
   1.177 +			foundRightImplementation2 = ETrue;
   1.178 +			}
   1.179 +		}
   1.180 +	test(foundRightImplementation1 && foundRightImplementation2);
   1.181 +
   1.182 +	ifArray.ResetAndDestroy();
   1.183 +	REComSession::FinalClose();
   1.184 +
   1.185 +	// Delete plugin
   1.186 +	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRomRslvrExampleRscOnCRamLocation));
   1.187 +	test(err == KErrNone);
   1.188 +	__UHEAP_MARK;
   1.189 +	}
   1.190 +
   1.191 +
   1.192 +/**
   1.193 +@SYMTestCaseID SYSLIB-ECOM-CT-0031
   1.194 +@SYMTestCaseDesc Test that a plugin whose SID does not match the value in it's
   1.195 +				 resource file will not be installed in the registry.
   1.196 +@SYMTestPriority High
   1.197 +@SYMTestActions  InvalidSIDPlugin dll and rsc files copied to C: drive.
   1.198 +				 Verify plugin is not registered by checking
   1.199 +				 ListImplementationsL returns zero plugins for this interface.
   1.200 +@SYMTestExpectedResults The test must not fail.
   1.201 +@SYMREQ REQ3846
   1.202 +*/
   1.203 +LOCAL_C void TestInvalidSIDPluginL()
   1.204 +	{
   1.205 +	// InvalidSIDPlugin .dll and .rsc are copied from EComExample5.dll and
   1.206 +	// HeapTestImpl.rsc.
   1.207 +
   1.208 +	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0031 "));
   1.209 +	__UHEAP_MARK;
   1.210 +
   1.211 +	// Copy plugins
   1.212 +	TRAPD(err, EComTestUtils::FileManCopyFileL(KEComInvalidDllOnZ, KEComInvalidDllOnC));
   1.213 +	test(err == KErrNone);
   1.214 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComInvalidRscOnZ, KEComInvalidRscOnC));
   1.215 +	test(err == KErrNone);
   1.216 +
   1.217 +	// The reason for the folowing delay is:
   1.218 +	// ECOM server could be already started. It means that when we copy some
   1.219 +	// ECOM plugins from Z: to C: drive - ECOM server should look for and
   1.220 +	// find the new ECOM plugins. The ECOM server uses for that an active object,
   1.221 +	// which scans plugin directories. So the discovering service is asynchronous.
   1.222 +	// We have to wait some time until it finishes.
   1.223 +	// Otherwise ListImplementationsL could fail to find requested implementations.
   1.224 +	WAIT_FOR3s;
   1.225 +
   1.226 +	TUid ifUid = {0x101FE392};  // HeapTestImpl.rsc interface_uid
   1.227 +	RImplInfoPtrArray ifArray;
   1.228 +	REComSession::ListImplementationsL(ifUid, ifArray);
   1.229 +
   1.230 +	const TInt availCount = ifArray.Count();
   1.231 +	test.Printf(_L("Found %d implementations.\n"),availCount);
   1.232 +	test(availCount == 0);
   1.233 +
   1.234 +	ifArray.ResetAndDestroy();
   1.235 +	REComSession::FinalClose(); // Don't want leaks outside the test
   1.236 +
   1.237 +	// Cleanup plugins
   1.238 +	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComInvalidDllOnC));
   1.239 +	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComInvalidRscOnC));
   1.240 +
   1.241 +	__UHEAP_MARK;
   1.242 +	}
   1.243 +
   1.244 +/**
   1.245 +@SYMTestCaseID SYSLIB-ECOM-CT-1858
   1.246 +@SYMTestCaseDesc Test that rediscovery of removing and adding "\Resource\Plugins" directory
   1.247 +					works properly.
   1.248 +@SYMTestPriority High
   1.249 +@SYMTestActions  Removes "\Resource\Plugins" directory on C: drive, check that
   1.250 +					rediscovery	works properly by verifying plugin's registration.
   1.251 +				 Adds "\Resource\Plugins" directory on C: drive, check that rediscovery works
   1.252 +				 	fine by verifying plugin's registration.
   1.253 +@SYMTestExpectedResults The test must not fail.
   1.254 +@SYMDEF DEF088454
   1.255 +*/
   1.256 +LOCAL_C void TestPluginsDirectoryRemovingL()
   1.257 +	{
   1.258 +	test.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1858 "));
   1.259 +	__UHEAP_MARK;
   1.260 +
   1.261 +	/**
   1.262 +	Add The following plugin to C drive
   1.263 +
   1.264 +	Interface UID		DLL	UID		Imp. UID		Version		DllFile
   1.265 +	------------------------------------------------------------------------------------------------------------------------------------------
   1.266 +	0x102797A1			0x102797A0	0x102797A2		1			C:\\..\\DefectPlugin.dll
   1.267 +
   1.268 +	**/
   1.269 +	TRAPD(err, EComTestUtils::FileManCopyFileL(KEComDefectPluginDLLOnZ, KEComDefectPluginDLLOnC));
   1.270 +	test(err == KErrNone);
   1.271 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComDefectPluginRSCOnZ, KEComDefectPluginRSCOnC));
   1.272 +	test(err == KErrNone);
   1.273 +
   1.274 +	WAIT_FOR3s;
   1.275 +
   1.276 +	TUid interfaceUid={0x102797A1};
   1.277 +	RImplInfoPtrArray implArray;
   1.278 +
   1.279 +	// Now start ecom discovery and get implementations for IF UID 0x102797A1
   1.280 +	TRAP(err, REComSession::ListImplementationsL(interfaceUid, implArray));
   1.281 +	::LeaveIfErrNoMemory(err);
   1.282 +	test(err == KErrNone);
   1.283 +
   1.284 +	// Expected number of implementations returned
   1.285 +	test(implArray.Count()==1);
   1.286 +
   1.287 +	// Check that the implementation uid returned matched the specs above
   1.288 +	TUid implUid = implArray[0]->ImplementationUid();
   1.289 +	TInt version = implArray[0]->Version();
   1.290 +	TInt drive = implArray[0]->Drive();
   1.291 +	// imp. uid
   1.292 +	test(implUid.iUid == 0x102797A2);
   1.293 +	// version
   1.294 +	test(version == 1);
   1.295 +	// C drive
   1.296 +	test(drive == EDriveC);
   1.297 +
   1.298 +	implArray.ResetAndDestroy();
   1.299 +
   1.300 +	// Now remove plugins directory
   1.301 +	TRAP(err, EComTestUtils::FileManRenameL(KEComResourcePluginDirNameOnC, KEComResourcePluginDirNameOffOnC));
   1.302 +	test(err == KErrNone);
   1.303 +	TRAP(err, EComTestUtils::FileManDeleteDirL(KEComResourcePluginDirNameOnC));
   1.304 +	test(err == KErrNone);
   1.305 +
   1.306 +	TEntry entry;
   1.307 +	err = TheFs.Entry(KEComResourcePluginDirNameOnC, entry);
   1.308 +	// Test the plugins directory is now gone
   1.309 +	test(err == KErrNotFound);
   1.310 +
   1.311 +	// Wait EComServer performing rediscovery
   1.312 +	WAIT_FOR3s;
   1.313 +
   1.314 +	TRAP(err, REComSession::ListImplementationsL(interfaceUid, implArray));
   1.315 +	::LeaveIfErrNoMemory(err);
   1.316 +	test(err == KErrNone);
   1.317 +
   1.318 +	// Test the rediscovery and directory scanning has been performed on renaming off event
   1.319 +	test(implArray.Count()==0);
   1.320 +
   1.321 +	implArray.ResetAndDestroy();
   1.322 +
   1.323 +	// Now rename plugins directory back
   1.324 +	TRAP(err, EComTestUtils::FileManRenameL(KEComResourcePluginDirNameOffOnC, KEComResourcePluginDirNameOnC));
   1.325 +	test(err == KErrNone);
   1.326 +	TRAP(err, EComTestUtils::FileManDeleteDirL(KEComResourcePluginDirNameOffOnC));
   1.327 +	test(err == KErrNone);
   1.328 +
   1.329 +	// Test the plugins directory is added back
   1.330 +	err = TheFs.Entry(KEComResourcePluginDirNameOnC, entry);
   1.331 +	test(err == KErrNone);
   1.332 +
   1.333 +	// Wait EComServer performing rediscovery
   1.334 +	WAIT_FOR3s;
   1.335 +
   1.336 +	TRAP(err, REComSession::ListImplementationsL(interfaceUid, implArray));
   1.337 +	::LeaveIfErrNoMemory(err);
   1.338 +	test(err == KErrNone);
   1.339 +
   1.340 +	// Test the rediscovery and directory scanning has been performed on renaming off event
   1.341 +	test(implArray.Count()==1);
   1.342 +
   1.343 +	//Check that the implementation uid returned matched the specs above
   1.344 +	implUid = implArray[0]->ImplementationUid();
   1.345 +	version = implArray[0]->Version();
   1.346 +	drive = implArray[0]->Drive();
   1.347 +	test(implUid.iUid == 0x102797A2);
   1.348 +	test(version == 1);
   1.349 +	test(drive == EDriveC);
   1.350 +
   1.351 +	implArray.ResetAndDestroy();
   1.352 +
   1.353 +	REComSession::FinalClose(); // Don't want leaks outside the test
   1.354 +
   1.355 +	// Cleanup plugins
   1.356 +	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComDefectPluginDLLOnC));
   1.357 +	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComDefectPluginRSCOnC));
   1.358 +
   1.359 +	__UHEAP_MARK;
   1.360 +	}
   1.361 +
   1.362 +
   1.363 +
   1.364 +
   1.365 +typedef void (*ClassFuncPtrL) (void);
   1.366 +
   1.367 +/**
   1.368 +Wrapper function to call all test functions
   1.369 +
   1.370 +@param		testFuncL pointer to test function
   1.371 +@param		aTestDesc test function name
   1.372 +*/
   1.373 +LOCAL_C void DoBasicTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc)
   1.374 +	{
   1.375 +	test.Next(aTestDesc);
   1.376 +
   1.377 +	__UHEAP_MARK;
   1.378 +  	// find out the number of open handles
   1.379 +	TInt startProcessHandleCount;
   1.380 +	TInt startThreadHandleCount;
   1.381 +	RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
   1.382 +
   1.383 +	//Call the test function
   1.384 +	(*testFuncL)();
   1.385 +
   1.386 +	// check that no handles have leaked
   1.387 +	TInt endProcessHandleCount;
   1.388 +	TInt endThreadHandleCount;
   1.389 +	RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
   1.390 +
   1.391 +	test(startThreadHandleCount  == endThreadHandleCount);
   1.392 +
   1.393 +	__UHEAP_MARKEND;
   1.394 +	}
   1.395 +
   1.396 +/**
   1.397 +Wrapper function to call all OOM test functions
   1.398 +@param		testFuncL pointer to OOM test function
   1.399 +@param		aTestDesc test function name
   1.400 +*/
   1.401 +LOCAL_C void DoOOMTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc)
   1.402 +	{
   1.403 +	test.Next(aTestDesc);
   1.404 +
   1.405 +	TInt err;
   1.406 +	TInt tryCount = 0;
   1.407 +	do
   1.408 +		{
   1.409 +		__UHEAP_MARK;
   1.410 +  		// find out the number of open handles
   1.411 +		TInt startProcessHandleCount;
   1.412 +		TInt startThreadHandleCount;
   1.413 +		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
   1.414 +
   1.415 +		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
   1.416 +
   1.417 +		//Call the test function
   1.418 +		TRAP(err, ((*testFuncL)()));
   1.419 +
   1.420 +		__UHEAP_SETFAIL(RHeap::ENone, 0);
   1.421 +
   1.422 +		// release handles
   1.423 +		if(err == KErrNone)
   1.424 +			{
   1.425 +			REComSession::FinalClose();
   1.426 +			}
   1.427 +
   1.428 +		// check that no handles have leaked
   1.429 +		TInt endProcessHandleCount;
   1.430 +		TInt endThreadHandleCount;
   1.431 +		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
   1.432 +
   1.433 +		test(startProcessHandleCount == endProcessHandleCount);
   1.434 +		test(startThreadHandleCount  == endThreadHandleCount);
   1.435 +
   1.436 +		__UHEAP_MARKEND;
   1.437 +		} while(err == KErrNoMemory);
   1.438 +
   1.439 +	test(err == KErrNone);
   1.440 +	test.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
   1.441 +	}
   1.442 +
   1.443 +
   1.444 +
   1.445 +LOCAL_C void DoTestsL()
   1.446 +	{
   1.447 +	__UHEAP_MARK;
   1.448 +
   1.449 +	// Basic tests
   1.450 +	test.Next(_L("Basic Test Suite"));
   1.451 +	test.Start(_L("Basic Test Suite"));
   1.452 +	DoBasicTestL(&TestOrphanedRscFileL, _L("TestOrphanedRscFileL"));
   1.453 +	DoBasicTestL(&TestInvalidSIDPluginL, _L("TestInvalidSIDPluginL"));
   1.454 +	DoBasicTestL(&TestOrphanedRscFileFallBackL, _L("TestOrphanedRscFileFallBackL"));
   1.455 +	DoBasicTestL(&TestPluginsDirectoryRemovingL, _L("TestPluginsDirectoryRemovingL"));
   1.456 +	test.End();
   1.457 +
   1.458 +	// OOM tests
   1.459 +	test.Next(_L("Out-of-memory Repeat Tests"));
   1.460 +	test.Start(_L("Out-of-memory Repeat Tests"));
   1.461 +	DoOOMTestL(&TestOrphanedRscFileL, _L("TestOrphanedRscFileL"));
   1.462 +	DoOOMTestL(&TestInvalidSIDPluginL, _L("TestInvalidSIDPluginL"));
   1.463 +	DoOOMTestL(&TestOrphanedRscFileFallBackL, _L("TestOrphanedRscFileFallBackL"));
   1.464 +	DoOOMTestL(&TestPluginsDirectoryRemovingL, _L("TestPluginsDirectoryRemovingL"));
   1.465 +	test.End();
   1.466 +
   1.467 +	__UHEAP_MARKEND;
   1.468 +	}
   1.469 +
   1.470 +
   1.471 +//Initialise the Active Scheduler
   1.472 +//
   1.473 +LOCAL_C void SetupL()
   1.474 +	{
   1.475 +	// Construct and install the Active Scheduler. The Active Schedular is needed
   1.476 +	// by components used by this test as they are ActiveObjects.
   1.477 +	TheActiveScheduler = new(ELeave)CActiveScheduler;
   1.478 +	CActiveScheduler::Install(TheActiveScheduler);
   1.479 +	}
   1.480 +
   1.481 +GLDEF_C TInt E32Main()
   1.482 +	{
   1.483 +	__UHEAP_MARK;
   1.484 +
   1.485 +	test.Printf(_L("\n"));
   1.486 +	test.Title();
   1.487 +	test.Start(_L("Dual-Mode Discovery Tests"));
   1.488 +
   1.489 +	TheTrapCleanup = CTrapCleanup::New();
   1.490 +	TInt err = TheFs.Connect();
   1.491 +	test(err == KErrNone);
   1.492 +	TRAP(err, SetupL());
   1.493 +	test(err == KErrNone);
   1.494 +
   1.495 +
   1.496 +	// Perform tests.
   1.497 +	TRAP(err,DoTestsL());
   1.498 +	test(err==KErrNone);
   1.499 +
   1.500 +	delete TheActiveScheduler;
   1.501 +	TheFs.Close();
   1.502 +	delete TheTrapCleanup;
   1.503 +
   1.504 +	test.End();
   1.505 +	test.Close();
   1.506 +
   1.507 +	__UHEAP_MARKEND;
   1.508 +	return (KErrNone);
   1.509 +	}