os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistryDataTest/t_registrydata.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistryDataTest/t_registrydata.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,4396 @@
     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 +// This file contains test classes and their implementations
    1.18 +// to test production class CRegistryData. Where necessary stubs
    1.19 +// are implemented to help in writing test harness using RTest.
    1.20 +// Test can fail if the Registry Index files are corrupted or missing.
    1.21 +// To solve that problem we need to run some component test harness, which
    1.22 +// runs by linking against ECom.lib. like t_listimplementation or t_suicide.
    1.23 +// 
    1.24 +//
    1.25 +
    1.26 +#include <ecom/ecom.h>
    1.27 +#include "EComUidCodes.h"
    1.28 +#include "RegistrarObserver.h"
    1.29 +#include "RegistryData.h"
    1.30 +#include "Registrar.h"
    1.31 +#include "EComResolverParams.h"
    1.32 +#include "Discoverer.h"
    1.33 +#include "DiscovererObserver.h"
    1.34 +#include "DriveInfo.h"
    1.35 +#include "DowngradePath.h"
    1.36 +#include "../EcomTestUtils/EcomTestUtils.h"
    1.37 +#include "RegistryResolveTransaction.h"
    1.38 +#include "ParseImplementationData.h"
    1.39 +
    1.40 +#include <ecom/ecompanics.h>
    1.41 +#include <s32file.h>
    1.42 +#include <e32test.h>
    1.43 +#include <f32file.h>
    1.44 +#include <bautils.h>
    1.45 +#include <babackup.h>
    1.46 +#include <hal.h>
    1.47 +
    1.48 +#define UNUSED_VAR(a) a = a
    1.49 +
    1.50 +// Used within tests
    1.51 +const TUid KCExampleInterfaceUid = {0x10009DC0};
    1.52 +const TUid KCExampleInterfaceImp = {0x10009DC3};
    1.53 +const TUid KCDummyUid = {0x00000000};
    1.54 +const TUid KCInvalidUid = {0x10009999};
    1.55 +
    1.56 +const TInt KOneSecond = 1000000;
    1.57 +
    1.58 +// Used for suppressing warning in OOM tests
    1.59 +#define __UNUSED_VAR(var) var = var
    1.60 +
    1.61 +// Used for OOM test
    1.62 +#define TEST_OOM_ERR if(err == KErrNoMemory) User::Leave(err)
    1.63 +
    1.64 +// The implemented structure for the registry data
    1.65 +typedef CRegistryData::CImplementationData* CImplementationDataPtr;
    1.66 +typedef RArray<CImplementationDataPtr> RImplDataArray;
    1.67 +
    1.68 +// Test plugins and corresponding .rsc files that be copied to RAM for testing purpose
    1.69 +_LIT(KEComExDllOnZ,		"Z:\\RAMOnly\\EComExample5.dll");
    1.70 +
    1.71 +_LIT(KEComExDllOnC,		"C:\\sys\\bin\\EComExample5.dll");
    1.72 +_LIT(KEComRscFileOnC,	"C:\\resource\\plugins\\EComExample5.rsc");
    1.73 +_LIT(KEComRscFileOnZ,	"Z:\\RAMOnly\\EComExample5.rsc");
    1.74 +_LIT(KEComExampleDllOnC,		"C:\\sys\\bin\\EComExample.dll");
    1.75 +_LIT(KEComExampleDllOnZSysBin,	"Z:\\sys\\bin\\EComExample.dll");
    1.76 +_LIT(KEComExample2DllOnC,		"C:\\sys\\bin\\EComExample2.dll");
    1.77 +_LIT(KEComExample3DllOnC,		"C:\\sys\\bin\\EComExample3.dll");
    1.78 +
    1.79 +_LIT(KEComExampleRscOnC,		"C:\\resource\\plugins\\EComExample.rsc");
    1.80 +_LIT(KEComExample2RscOnC,		"C:\\resource\\plugins\\EComExample2.rsc");
    1.81 +_LIT(KEComExample3RscOnC,		"C:\\resource\\plugins\\EComExample3.rsc");
    1.82 +
    1.83 +_LIT(KEComExampleRscOnZ,		"Z:\\RAMOnly\\EComExample.rsc");
    1.84 +_LIT(KEComExample2RscOnZ,		"Z:\\RAMOnly\\EComExample2.rsc");
    1.85 +_LIT(KEComExample3RscOnZ,		"Z:\\RAMOnly\\EComExample3.rsc");
    1.86 +
    1.87 +_LIT(KEComExampleDllOnZ,			"Z:\\RAMOnly\\EComExample.dll");
    1.88 +_LIT(KEComExample2DllOnZ,		"Z:\\RAMOnly\\EComExample2.dll");
    1.89 +_LIT(KEComExample3DllOnZ,		"Z:\\RAMOnly\\EComExample3.dll");
    1.90 +
    1.91 +// These RSC files/DLLs are used to test an RSC file with a SID that does not
    1.92 +// match it's corresponding DLL. The implementations should not be listed/created.
    1.93 +_LIT(KEComInvalidDllOnZ, "z:\\RAMOnly\\InvalidSIDPlugin.dll");
    1.94 +_LIT(KEComInvalidRscOnZ, "z:\\RAMOnly\\InvalidSIDPlugin.rsc");
    1.95 +_LIT(KEComInvalidDllOnC, "c:\\sys\\bin\\InvalidSIDPlugin.dll");
    1.96 +_LIT(KEComInvalidRscOnC, "c:\\resource\\plugins\\InvalidSIDPlugin.rsc");
    1.97 +
    1.98 +// This DLL does not exist, and should fail a security check
    1.99 +_LIT(KEComMissingDll, "c:\\sys\\bin\\NonExistentDllName.dll");
   1.100 +
   1.101 +// These RSC files/DLLs are used to test an RSC file that points to a missing DLL
   1.102 +_LIT(KMissingDllRomRscFile, 		"z:\\RAMOnly\\EComRomRslvrExampleOnC.rsc");
   1.103 +_LIT(KMissingDllRamRscFile, 		"c:\\resource\\plugins\\EComRomRslvrExampleOnC.rsc");
   1.104 +// When the above RSC file's security check fails, the following implementations should be rolled back to
   1.105 +// (even though the filenames are EComRomRslvrExampleOnZ they will be copied to and exist on C Drive)
   1.106 +_LIT(KRollbackForMissingDllRomDllFile, 			"z:\\RAMOnly\\EComRomRslvrExampleOnZ.dll");
   1.107 +_LIT(KRollbackForMissingDllRamDllFile, 			"c:\\sys\\bin\\EComRomRslvrExampleOnZ.dll");
   1.108 +_LIT(KRollbackForMissingDllRomRscFile, 			"z:\\RAMOnly\\EComRomRslvrExampleOnZ.rsc");
   1.109 +_LIT(KRollbackForMissingDllRamRscFile, 			"c:\\resource\\plugins\\EComRomRslvrExampleOnZ.rsc");
   1.110 +
   1.111 +//PLUGIN1 DLL with interfaceID: 0x10009E36
   1.112 +_LIT(KEComExample14DllOnC,		"C:\\sys\\bin\\EComExample14.dll");
   1.113 +_LIT(KEComExample14DllOnZ,		"Z:\\RAMOnly\\EComExample14.dll");
   1.114 +_LIT(KEComExample14RscOnC,		"C:\\resource\\plugins\\EComExample14.rsc");
   1.115 +_LIT(KEComExample14RscOnZ,		"Z:\\RAMOnly\\EComExample14.rsc");
   1.116 +//PLUGIN3 DLL with interfaceID: 0x10009E36, implementation version 2
   1.117 +_LIT(KEComExample15DllOnC,		"C:\\sys\\bin\\EComExample15.dll");
   1.118 +_LIT(KEComExample15DllOnZ,		"Z:\\RAMOnly\\EComExample15.dll");
   1.119 +_LIT(KEComExample15RscOnC,		"C:\\resource\\plugins\\EComExample15.rsc");
   1.120 +_LIT(KEComExample15RscOnZ,		"Z:\\RAMOnly\\EComExample15.rsc");
   1.121 +//PLUGIN3 DLL with interfaceID: 0x10009E36
   1.122 +_LIT(KEComExample12DllOnC,		"C:\\sys\\bin\\EComExample12.dll");
   1.123 +_LIT(KEComExample12DllOnZ,		"Z:\\RAMOnly\\EComExample12.dll");
   1.124 +_LIT(KEComExample12RscOnC,		"C:\\resource\\plugins\\EComExample12.rsc");
   1.125 +_LIT(KEComExample12RscOnZ,		"Z:\\RAMOnly\\EComExample12.rsc");
   1.126 +
   1.127 +_LIT(KEComExample10DllOnC,		"C:\\sys\\bin\\EComExample10.dll");
   1.128 +//PLUGIN3 Upgraded
   1.129 +_LIT(KEcomExample12UpgradedOnC, "C:\\resource\\plugins\\EComExample12Upgraded.rsc");
   1.130 +_LIT(KEcomExample12UpgradedOnZ, "Z:\\RAMOnly\\EComExample12Upgraded.rsc");
   1.131 +_LIT(KEcomExample12UpgradedResourceNameOnly, "EComExample12Upgraded.rsc");
   1.132 +//PLUGIN1 Upgraded to PLUGIN3
   1.133 +_LIT(KEcomExample14UpgradedOnC, "C:\\resource\\plugins\\EComExample14Upgraded.rsc");
   1.134 +_LIT(KEcomExample14UpgradedOnZ, "Z:\\RAMOnly\\EComExample14Upgraded.rsc");
   1.135 +_LIT(KEcomExample14UpgradedResourceNameOnly, "EComExample14Upgraded.rsc");
   1.136 +//PLUGIN3 Downgraded to PLUGIN1
   1.137 +_LIT(KEcomExample12DowngradedOnC, "C:\\resource\\plugins\\EComExample12Downgraded.rsc");
   1.138 +_LIT(KEcomExample12DowngradedOnZ, "Z:\\RAMOnly\\EComExample12Downgraded.rsc");
   1.139 +_LIT(KEcomExample12DowngradedResourceNameOnly, "EComExample12Downgraded.rsc");
   1.140 +
   1.141 +_LIT(KDriveC, "C");
   1.142 +
   1.143 +#ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
   1.144 +    _LIT(KEnglishLocale, "elocl.01");
   1.145 +    _LIT(KEComSpanishLocale, "elocl.04");
   1.146 +#else
   1.147 +    // refer base/os/kernelhwsrv/kernel/eka/euser/locmapping.cpp
   1.148 +    // Language
   1.149 +    _LIT(KEComEnglishLang,"elocl_lan.001");
   1.150 +    //_LIT(KEComFrenchLang,"elocl_lan.002");
   1.151 +    //_LIT(KEComGermanLang,"elocl_lan.003");
   1.152 +    _LIT(KEComSpanishLang,"elocl_lan.004");
   1.153 +    // Region
   1.154 +    _LIT(KEComEnglishReg,"elocl_reg.826");
   1.155 +    //_LIT(KEComFrenchReg,"elocl_reg.250");
   1.156 +    //_LIT(KEComGermanReg,"elocl_reg.276");
   1.157 +    _LIT(KEComSpanishReg,"elocl_reg.724");
   1.158 +    // Collation
   1.159 +    _LIT(KEComEnglishColl,"elocl_col.001");
   1.160 +    //_LIT(KEComFrenchColl,"elocl_col.002");
   1.161 +    //_LIT(KEComGermanColl,"elocl_col.003");
   1.162 +    _LIT(KEComSpanishColl,"elocl_col.001");
   1.163 +#endif
   1.164 +
   1.165 +LOCAL_D CTrapCleanup*		TheTrapCleanup=NULL;
   1.166 +
   1.167 +LOCAL_D CActiveScheduler*	TheActiveScheduler=NULL;
   1.168 +
   1.169 +LOCAL_D RFs					TheFs;
   1.170 +
   1.171 +LOCAL_D RTest				TheTest(_L("t_registrydata.exe"));
   1.172 +
   1.173 +//TPtrC defined which will point to KEComSpiFilePathAndName or KEComSpiFilePathAndNameForNand
   1.174 +//according to the rom build type
   1.175 +LOCAL_D TPtrC				TheEComSpiFilePathAndNamePtrC;
   1.176 +
   1.177 +TCapabilitySet dummycaps;
   1.178 +
   1.179 +LOCAL_C void CopyPluginsL();
   1.180 +
   1.181 +inline LOCAL_C void DeleteTestPlugin()
   1.182 +	{
   1.183 +	TRAPD(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExDllOnC));
   1.184 +	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComRscFileOnC));
   1.185 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExampleDllOnC));
   1.186 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample2DllOnC));
   1.187 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample3DllOnC));
   1.188 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExampleRscOnC));
   1.189 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample2RscOnC));
   1.190 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample3RscOnC));
   1.191 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComInvalidDllOnC));
   1.192 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComInvalidRscOnC));
   1.193 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KMissingDllRamRscFile));
   1.194 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KRollbackForMissingDllRamDllFile));
   1.195 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KRollbackForMissingDllRamRscFile));
   1.196 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample12DllOnC));
   1.197 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample12RscOnC));
   1.198 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample14DllOnC));
   1.199 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample14RscOnC));
   1.200 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample15DllOnC));
   1.201 + 	TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample15RscOnC));
   1.202 +	}
   1.203 +
   1.204 +//
   1.205 +//
   1.206 +//Test macroses and functions
   1.207 +LOCAL_C void Check(TInt aValue, TInt aLine)
   1.208 +	{
   1.209 +	if(!aValue)
   1.210 +		{
   1.211 +		::DeleteTestPlugin();
   1.212 +		TheTest(EFalse, aLine);
   1.213 +		}
   1.214 +	}
   1.215 +LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
   1.216 +	{
   1.217 +	if(aValue != aExpected)
   1.218 +		{
   1.219 +		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
   1.220 +		::DeleteTestPlugin();
   1.221 +		TheTest(EFalse, aLine);
   1.222 +		}
   1.223 +	}
   1.224 +/**
   1.225 +Sets up the system-wide locale and language downgrade path.
   1.226 +*/
   1.227 +LOCAL_C void SetLanguageL(const TLanguage aLang[3])
   1.228 +	{
   1.229 +	TLocale locale;
   1.230 +	locale.SetLanguageDowngrade(0, aLang[0]);
   1.231 +	locale.SetLanguageDowngrade(1, aLang[1]);
   1.232 +	locale.SetLanguageDowngrade(2, aLang[2]);
   1.233 +	User::LeaveIfError(locale.Set());
   1.234 +	}
   1.235 +
   1.236 +#define TEST(arg) ::Check((arg), __LINE__)
   1.237 +#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
   1.238 +//
   1.239 +//
   1.240 +
   1.241 +/**
   1.242 +This class allows us to provide stub behavior to instantiate CRegistrar
   1.243 +*/
   1.244 +class TRegistrarObserverStub : public MRegistrarObserver
   1.245 +	{
   1.246 +public:
   1.247 +/**
   1.248 +The overloaded method from the MRegistrarObserver class Used for firing
   1.249 +notifications to the client sessions that the underlying registry data has changed.
   1.250 +@post		The CEComServer has notified all its client sessions
   1.251 +			registered for notifications that the data changed
   1.252 +*/
   1.253 +	void Notification(TInt aNotificationCode)
   1.254 +		{
   1.255 +		RDebug::Print(_L("TRegistrarObserverStub called with notification code %d.\n"), aNotificationCode);
   1.256 +		};
   1.257 +	};
   1.258 +
   1.259 +/**
   1.260 +This friend class allows us to access private and protected members of production
   1.261 +code class CDiscoverer.
   1.262 +*/
   1.263 +class TDiscoverer_StateAccessor
   1.264 +	{
   1.265 +public:
   1.266 +	TDiscoverer_StateAccessor() {};
   1.267 +	void ScanDirectoryL(CDiscoverer& aDiscoverer)
   1.268 +		{
   1.269 +		aDiscoverer.ProcessSSAEventL(EStartupStateNonCritical);
   1.270 +		}
   1.271 +	void ScanDriveL(CDiscoverer& aDiscoverer, TDriveUnit& aDrive)
   1.272 +		{
   1.273 +		TBool isRO = aDiscoverer.iCachedDriveInfo->DriveIsReadOnlyInternalL(aDrive);
   1.274 +		aDiscoverer.iDirScanner->ScanDriveL(aDrive, isRO);
   1.275 +		}
   1.276 +	};
   1.277 +
   1.278 +/**
   1.279 +This friend class allows us to access private and protected members of production
   1.280 +code class CRegistrar.
   1.281 +*/
   1.282 +class TRegistrar_StateAccessor
   1.283 +	{
   1.284 +public:
   1.285 +	TRegistrar_StateAccessor() {};
   1.286 +	void ScanDirectoryL(CRegistrar& aRegistrar)
   1.287 +		{
   1.288 +		TDiscoverer_StateAccessor discovererStateAccessor;
   1.289 +		discovererStateAccessor.ScanDirectoryL(*(aRegistrar.iDiscoverer));
   1.290 +		}
   1.291 +	void ScanDriveL(CRegistrar& aRegistrar, TDriveUnit& aDrive)
   1.292 +		{
   1.293 +		TDiscoverer_StateAccessor discovererStateAccessor;
   1.294 +		discovererStateAccessor.ScanDriveL(*(aRegistrar.iDiscoverer), aDrive);
   1.295 +		}
   1.296 +	void ParseL(CRegistrar& aRegistrar, CPluginBase*& aEntry,CRegistryData::CDllData& aDll);
   1.297 +	};
   1.298 +
   1.299 +void TRegistrar_StateAccessor::ParseL(CRegistrar& aRegistrar, CPluginBase*& aEntry,CRegistryData::CDllData& aDll)
   1.300 +		{
   1.301 +		aRegistrar.ParseL(aEntry,aDll);
   1.302 +		}
   1.303 +
   1.304 +
   1.305 +/**
   1.306 +This friend class allows us to access private and protected members of production
   1.307 +code class CRegistryData.
   1.308 +*/
   1.309 +class TRegistryData_StateAccessor
   1.310 +	{
   1.311 +public:
   1.312 +	TBool IsIndexValid(CRegistryData& aRegData);
   1.313 +
   1.314 +	TInt IndexedFind(CRegistryData& aRegData, const TUid& aImplementationUid);
   1.315 +
   1.316 +	TBool IsRegisteredDriveL(CRegistryData& aRegData, TDriveUnit aDriveUnit);
   1.317 +
   1.318 +	TInt RegistrationsCount(CRegistryData& aRegData);
   1.319 +
   1.320 +	TInt ImplementationsCount(CRegistryData& aRegData);
   1.321 +
   1.322 +	void SetRegistryChanged(CRegistryData& aRegData, TBool aChanged, TDriveUnit aDrive);
   1.323 +
   1.324 +	void ClearImplementationIndexList(CRegistryData& aRegData);
   1.325 +
   1.326 +	void ClearRegistrations(CRegistryData& aRegData);
   1.327 +
   1.328 +	void ResetAndDestroy(CRegistryData& aRegData);
   1.329 +
   1.330 +	void ConstructL(CRegistryData& aRegData);
   1.331 +
   1.332 +	TBool FindAnImplementation(CRegistryData& aRegData, TUid& aInterfaceUid, TDriveUnit& aDrive);
   1.333 +
   1.334 +	void GetImplementationInfoL(CRegistryData& aRegData, TUid& aInterfaceUid, RImplDataArray& aImplementationInfo);
   1.335 +
   1.336 +	void AppendDriveDataL(CRegistryData& aRegData, CRegistryData::CDriveData* aDriveData);
   1.337 +
   1.338 +	TInt FindImplementation(CRegistryData& aRegData, const TUid aImplUid, const TUid aInterfaceUid,
   1.339 +										CRegistryData::CImplementationData*& aImplData) const;
   1.340 +	static void ResetStaticDriveData();
   1.341 +	TInt GetDllListL(CRegistryData& aRegistryData, TDriveUnit aDriveUnit, TDll*& aDllList);
   1.342 +	TBool IsLanguageInitChanged(CRegistryData& aRegistryData);
   1.343 +	TInt DrivesRemoved(CRegistryData& aRegistryData);
   1.344 +	};
   1.345 +
   1.346 +/**
   1.347 +Constructs the registry
   1.348 +
   1.349 +*/
   1.350 +void TRegistryData_StateAccessor::ConstructL(CRegistryData& aRegData)
   1.351 +	{
   1.352 +	aRegData.ConstructL();
   1.353 +	}
   1.354 +
   1.355 +/**
   1.356 +Resets the registry
   1.357 +
   1.358 +*/
   1.359 +void TRegistryData_StateAccessor::ResetAndDestroy(CRegistryData& aRegData)
   1.360 +	{
   1.361 +	aRegData.iRegistrations->ResetAndDestroy();
   1.362 +	delete aRegData.iRegistrations;
   1.363 +	}
   1.364 +
   1.365 +/**
   1.366 +Clears the Implementations
   1.367 +@param		aRegData RegistryData object under test
   1.368 +*/
   1.369 +void TRegistryData_StateAccessor::ClearImplementationIndexList(CRegistryData& aRegData)
   1.370 +	{
   1.371 +	for(TInt index = 0; index < aRegData.iInterfaceImplIndex.Count(); ++index)
   1.372 +		{
   1.373 +		aRegData.iInterfaceImplIndex[index].Reset();
   1.374 +		}
   1.375 +	aRegData.iInterfaceImplIndex.Reset();
   1.376 +	aRegData.iImplIndex.Reset();
   1.377 +	}
   1.378 +
   1.379 +
   1.380 +/**
   1.381 +Clears the Registrations
   1.382 +@param		aRegData RegistryData object under test
   1.383 +*/
   1.384 +void TRegistryData_StateAccessor::ClearRegistrations(CRegistryData& aRegData)
   1.385 +	{
   1.386 +	if(aRegData.iRegistrations)
   1.387 +		{
   1.388 +		aRegData.iRegistrations->ResetAndDestroy();
   1.389 +		}
   1.390 +	}
   1.391 +
   1.392 +/**
   1.393 +Indicates whether the registry index is currently valid. The
   1.394 +index will not be valid if discoveries are currently taking place.
   1.395 +@param		aRegData RegistryData object under test
   1.396 +@return		ETrue if index is valid EFalse otherwise
   1.397 +*/
   1.398 +TBool TRegistryData_StateAccessor::IsIndexValid(CRegistryData& aRegData)
   1.399 +	{
   1.400 +	return aRegData.IndexValid();
   1.401 +	}
   1.402 +
   1.403 +/**
   1.404 +Tries to find the index entry of the passed implementation uid
   1.405 +@param		aRegData RegistryData object under test
   1.406 +@param		aImplementationUid the implementation Uid of the implementation to locate
   1.407 +@return		Index of the implementation, KErrNotFound otherwise
   1.408 +*/
   1.409 +TInt TRegistryData_StateAccessor::IndexedFind(CRegistryData& aRegData,
   1.410 +											  const TUid& aImplementationUid)
   1.411 +	{
   1.412 +	return aRegData.IndexedFind(aImplementationUid);
   1.413 +	}
   1.414 +
   1.415 +/**
   1.416 +Checks if the drive is already registered
   1.417 +@param		aRegData RegistryData object under test
   1.418 +@param		aDriveUnit the drive on which plugins are registered
   1.419 +@return		ETrue if drive is registered, EFalse otherwise
   1.420 +*/
   1.421 +TBool TRegistryData_StateAccessor::IsRegisteredDriveL(CRegistryData& aRegData,
   1.422 +													 TDriveUnit aDriveUnit)
   1.423 +	{
   1.424 +	TInt driveIndex = KErrNotFound;
   1.425 +	CRegistryData::CDriveData* aDriveData=NULL;
   1.426 +	driveIndex = aRegData.FindDriveL(aDriveUnit, aDriveData);
   1.427 +	// Return True if the driveindex has some valid value i.e. not KErrNotFound
   1.428 +	return (driveIndex != KErrNotFound);
   1.429 +	}
   1.430 +
   1.431 +/**
   1.432 +Obtains count of plugin registrations
   1.433 +@param		aRegData RegistryData object under test
   1.434 +@return		Number of registrations
   1.435 +*/
   1.436 +TInt TRegistryData_StateAccessor::RegistrationsCount(CRegistryData& aRegData)
   1.437 +	{
   1.438 +	return aRegData.iRegistrations->Count();
   1.439 +	}
   1.440 +
   1.441 +/**
   1.442 +Obtains count of plugin registrations
   1.443 +@param		aRegData RegistryData object under test
   1.444 +@return		Number of registrations
   1.445 +*/
   1.446 +TInt TRegistryData_StateAccessor::ImplementationsCount(CRegistryData& aRegData)
   1.447 +	{
   1.448 +	return aRegData.iInterfaceImplIndex.Count();
   1.449 +	}
   1.450 +
   1.451 +/**
   1.452 +Sets Registry Changed flag to the given value
   1.453 +@param		aRegData RegistryData object under test
   1.454 +@param		aChanged True if the registry is changed
   1.455 +@param		aDrive the drive under test
   1.456 +*/
   1.457 +void TRegistryData_StateAccessor::SetRegistryChanged(CRegistryData& aRegData, TBool aChanged, TDriveUnit aDrive)
   1.458 +	{
   1.459 +	for(TInt i = 0; i <aRegData.iRegistrations->Count(); i++)
   1.460 +		{
   1.461 +		if ((*aRegData.iRegistrations)[i]->iDrive == aDrive)
   1.462 +			{
   1.463 +			(*aRegData.iRegistrations)[i]->iRegistryChanged = aChanged;
   1.464 +			}
   1.465 +		}
   1.466 +	}
   1.467 +
   1.468 +/**
   1.469 +See if an implementation is discovered on the questioned drive
   1.470 +@param		aRegData RegistryData object under test
   1.471 +@param		aInterfaceUid Interface UID for the implementation
   1.472 +@param		aDrive Drive to search the implementation on
   1.473 +@return 	ETrue if an implementation exists
   1.474 +*/
   1.475 +TBool TRegistryData_StateAccessor::FindAnImplementation(CRegistryData& aRegData, TUid& aInterfaceUid, TDriveUnit& aDrive)
   1.476 +	{
   1.477 +	const TInt driveCount = aRegData.iRegistrations->Count();
   1.478 +	for(TInt driveIndex = 0; driveIndex < driveCount; ++driveIndex)
   1.479 +		{
   1.480 +		CRegistryData::CDriveData* driveData = (*aRegData.iRegistrations)[driveIndex];
   1.481 +		if(driveData->iDrive == aDrive)
   1.482 +			{
   1.483 +			TDll* dllList = (*aRegData.iRegistrations)[driveIndex]->iDllList;
   1.484 +			const TInt dllCount = dllList->Count();
   1.485 +			for(TInt dllIndex = 0; dllIndex < dllCount;++dllIndex)
   1.486 +				{
   1.487 +				// For each dll structure
   1.488 +				RInterfaceList* interfaceList = (*dllList)[dllIndex]->iIfList;
   1.489 +				const TInt ifCount = interfaceList->Count();
   1.490 +				for(TInt ifIndex = 0; ifIndex < ifCount; ++ifIndex)
   1.491 +					{
   1.492 +					CRegistryData::TInterfaceIndex index;
   1.493 +
   1.494 +					// For each interface structure
   1.495 +					TUid interfaceUid = (*interfaceList)[ifIndex]->iInterfaceUid;
   1.496 +					if(interfaceUid == aInterfaceUid)
   1.497 +						{
   1.498 +						return ETrue;
   1.499 +						}
   1.500 +					}
   1.501 +				}
   1.502 +			}
   1.503 +		}
   1.504 +
   1.505 +	return EFalse;
   1.506 +	}
   1.507 +
   1.508 +/**
   1.509 +Get implementation info from the index
   1.510 +@param		aRegData RegistryData object under test
   1.511 +@param		aInterfaceUid Interface UID for the implementation
   1.512 +@param  	aImplementationData Reference of array of Implementation Data
   1.513 +*/
   1.514 +void TRegistryData_StateAccessor::GetImplementationInfoL(CRegistryData& aRegData, TUid& aInterfaceUid, RImplDataArray& aImplementationData)
   1.515 +	{
   1.516 +	aRegData.ListImplementationsL(aInterfaceUid, aImplementationData);
   1.517 +	}
   1.518 +
   1.519 +/**
   1.520 +Append DriveSata to iRegistrations
   1.521 +@param		aRegData RegistryData object under test
   1.522 +@param		aInterfaceUid Interface UID for the implementation
   1.523 +@return 	Array of Implementations
   1.524 +*/
   1.525 +void TRegistryData_StateAccessor::AppendDriveDataL(CRegistryData& aRegData, CRegistryData::CDriveData* aDriveData)
   1.526 +	{
   1.527 +	aRegData.iRegistrations->AppendL(aDriveData);
   1.528 +	}
   1.529 +
   1.530 +/**
   1.531 +@param		aRegistryData The CRegistryData class object
   1.532 +@param		aImplUid The implementation to find.
   1.533 +@param		aInterfaceUid If greater than 0 the interface associated with the
   1.534 +			implementation to find.
   1.535 +@param		aImplData The found implementation data.
   1.536 +@return		KErrNone if found otherwise KErrNotFound
   1.537 +*/
   1.538 +TInt TRegistryData_StateAccessor::FindImplementation(CRegistryData& aRegistryData,
   1.539 +												const TUid aImplUid,
   1.540 +												const TUid aInterfaceUid,
   1.541 +												CRegistryData::CImplementationData*& aImplData) const
   1.542 +	{
   1.543 +	return aRegistryData.FindImplementation(aImplUid, aInterfaceUid, aImplData);
   1.544 +	}
   1.545 +
   1.546 +/**
   1.547 +@param		aRegistryData The CRegistryData class object
   1.548 +@param		aDriveUnit A drive unit
   1.549 +@param		aDllList The dll list returned on a specified drive.
   1.550 +@return		Index of the specified drive in registryData if found otherwise KErrNotFound
   1.551 +*/
   1.552 +TInt TRegistryData_StateAccessor::GetDllListL(CRegistryData& aRegistryData, TDriveUnit aDriveUnit, TDll*& aDllList)
   1.553 +{
   1.554 +	CRegistryData::CDriveData* drive =NULL;
   1.555 +
   1.556 +	// Get the drive data in the registry.
   1.557 +	TInt registryDriveIndex = aRegistryData.FindDriveL(aDriveUnit, drive);
   1.558 +	if(registryDriveIndex != KErrNotFound)
   1.559 +		{
   1.560 +		aDllList = (*aRegistryData.iRegistrations)[registryDriveIndex]->iDllList;
   1.561 +		}
   1.562 +	return registryDriveIndex;
   1.563 +}
   1.564 +
   1.565 +/**
   1.566 +Indicates whether the language downgrade path has been changed during start-up time.
   1.567 +@param		aRegData RegistryData object under test
   1.568 +@return		ETrue if index is valid EFalse otherwise
   1.569 +*/
   1.570 +TBool TRegistryData_StateAccessor::IsLanguageInitChanged(CRegistryData& aRegistryData)
   1.571 +{
   1.572 +	return aRegistryData.iLanguageChanged;
   1.573 +}
   1.574 +
   1.575 +TInt TRegistryData_StateAccessor::DrivesRemoved(CRegistryData& aRegistryData)
   1.576 +	{
   1.577 +		return aRegistryData.iRemovedDrives;
   1.578 +	}
   1.579 +
   1.580 +/** class to hold all the data required to create an instance of
   1.581 +CRegistryData::CImplementationData.
   1.582 +NB: the pointers in this struct are all owned by some other objects.
   1.583 +*/
   1.584 +_LIT8(KDefaultImplDataType, "Data Type");
   1.585 +_LIT8(KDefaultImplOpaqueData, "");
   1.586 +
   1.587 +struct TImplCreationStruct
   1.588 +	{
   1.589 +	TImplCreationStruct(TDriveNumber aDriveNumber,
   1.590 +						TUid  aInterfaceUid,
   1.591 +						TUid  aImplUid,
   1.592 +						const TDesC& aDllPathName,
   1.593 +						const TDesC& aImplDisplayName,
   1.594 +						const TDesC8& aImplDataType = KDefaultImplDataType,
   1.595 +						const TDesC8& aImplOpaqueData = KDefaultImplOpaqueData,
   1.596 +						TInt  aImplVersion = 1,
   1.597 +						TBool aRomBased = EFalse,
   1.598 +						TBool aRomOnly = EFalse);
   1.599 +
   1.600 +	TDriveUnit		iDriveUnit;
   1.601 +	TUid			iInterfaceUid;
   1.602 +	TUid			iImplUid;
   1.603 +	const TDesC&	iDllPathName;
   1.604 +	const TDesC&	iImplDisplayName;
   1.605 +	const TDesC8&	iImplDataType;
   1.606 +	const TDesC8&	iImplOpaqueData;
   1.607 +	TInt			iDriveIndex;
   1.608 +	CRegistryData::CDriveData*		iDriveData;
   1.609 +	CRegistryData::CDllData*		iDllData;
   1.610 +	CRegistryData::CInterfaceData*	iInterfaceData;
   1.611 +	CRegistryData::CImplementationData* iImplData;
   1.612 +	TInt			iImplVersion;
   1.613 +	TBool			iRomBased;
   1.614 +	TBool			iRomOnly;
   1.615 +	};
   1.616 +
   1.617 +// TImplCreationStruct Constructor
   1.618 +TImplCreationStruct::TImplCreationStruct(TDriveNumber aDriveNumber,
   1.619 +										TUid  aInterfaceUid,
   1.620 +										TUid  aImplUid,
   1.621 +										const TDesC& aDllPathName,
   1.622 +										const TDesC& aImplDisplayName,
   1.623 +										const TDesC8& aImplDataType,
   1.624 +										const TDesC8& aImplOpaqueData,
   1.625 +										TInt  aImplVersion,
   1.626 +										TBool aRomBased,
   1.627 +										TBool aRomOnly)
   1.628 +	: iDriveUnit(aDriveNumber), iInterfaceUid(aInterfaceUid),
   1.629 +	iImplUid(aImplUid), iDllPathName(aDllPathName),
   1.630 +	iImplDisplayName(aImplDisplayName), iImplDataType(aImplDataType),
   1.631 +	iImplOpaqueData(aImplOpaqueData), iDriveIndex(KErrNotFound),
   1.632 +	iDriveData(NULL), iDllData(NULL), iInterfaceData(NULL),
   1.633 +	iImplData(NULL), iImplVersion(aImplVersion), iRomBased(aRomBased),
   1.634 +	iRomOnly(aRomOnly)
   1.635 +	{
   1.636 +	}
   1.637 +
   1.638 +/**
   1.639 +Test class encloses necessary members that aid to test CRegistryData
   1.640 +*/
   1.641 +class CRegistryDataTest: public CBase
   1.642 +	{
   1.643 +public:
   1.644 +	static CRegistryDataTest* NewL(TBool aIsFullDiscovery);
   1.645 +
   1.646 +	virtual ~CRegistryDataTest();
   1.647 +
   1.648 +	void AddDllDataPlugIn3TestL();
   1.649 +	void AddDllDataTestL();
   1.650 +
   1.651 +	void IsRegisteredWithDateUpdateDllDataTestL();
   1.652 +	void CopyOrgPlugInL();
   1.653 +	void UpdateDllDataTest1L();
   1.654 +	void UpdateDllDataTest2L();
   1.655 +	void UpdateDllDataTest3L();
   1.656 +
   1.657 +	void SetEnabledStateTestL();
   1.658 +
   1.659 +	void FindImplementationTestL();
   1.660 +	//Test for ListImplementationsL() in CRegistryData
   1.661 +	void ListImplementationsL();
   1.662 +	//Test for ListImplementationsL() in CRegistryResolverTransaction
   1.663 +	void ListImplementationsTestT1L();
   1.664 +	void ListImplementationsTestT2L();
   1.665 +	void ListImplementationsTestT3L();
   1.666 +	void ListImplementationsTestT4L();
   1.667 +	void ListImplementationsTestT5L();
   1.668 +
   1.669 +	//Test for ListExtendedInterfacesL() in CRegistryData
   1.670 +	void ListExtendedInterfacesTestL();
   1.671 +
   1.672 +	void DoUndoTemporaryUninstallTestL();
   1.673 +
   1.674 +	void DiscoveriesBeginCompleteTestL();
   1.675 +
   1.676 +	void IndexedFindTestL();
   1.677 +
   1.678 +	void GetImplementationDllInfoForServerTest();
   1.679 +
   1.680 +	void GetImplementationDllInfoForClientTestL();
   1.681 +
   1.682 +	void GetImplementationDllInfoForServerPlugIn3Test();
   1.683 +
   1.684 +	void GetImplementationDllInfoForClientPlugIn3TestL();
   1.685 +
   1.686 +	void VerifySelectNewPluginTypeL();
   1.687 +
   1.688 +	void AllAtOnceDiscoveryStateTransitionTestL();
   1.689 +
   1.690 +	void StagedDiscoveryStateTransitionTestL();
   1.691 +
   1.692 +	void ImplementationDataTestL();
   1.693 +
   1.694 +	void InsertIntoIndexRemoveFromIndexTestL();
   1.695 +
   1.696 +	void RollbackTestL();
   1.697 +
   1.698 +	void ProcessSecurityCheckTestL();
   1.699 +
   1.700 +	void FailedSecurityCheckTestListImplementationsL();
   1.701 +
   1.702 +	void FailedSecurityCheckTestGetImplementationInfoL();
   1.703 +
   1.704 +	void IsAnyDllDiscoveredTestL();
   1.705 +	void IsAnyDllDiscoveredTestNoSpiL();
   1.706 +	void IsAnyDllDiscoveredTestWithSpiL();
   1.707 +
   1.708 +	void CheckDuplicatPluginsOnCL();
   1.709 +
   1.710 +	void CheckNoPluginsOnCL();
   1.711 +
   1.712 +	void DuplicateImplUidTestL();
   1.713 +	void TestDuplicatedImplPrecedenceL(const TImplCreationStruct& highprecedence,
   1.714 +									const TImplCreationStruct& lowprecedence);
   1.715 +
   1.716 +	static TBool SpiFileExists();
   1.717 +
   1.718 +	void LanguageChangedTestL();
   1.719 +
   1.720 +	void DrivesRemovedTestL();
   1.721 +private:
   1.722 +	CRegistryDataTest();
   1.723 +
   1.724 +	void ConstructL(TBool aIsFullDiscovery);
   1.725 +
   1.726 +	void CreateImplL(TImplCreationStruct& aCreationData);
   1.727 +public:
   1.728 +	/** The instance of the class under test */
   1.729 +	CRegistryData*						iRegistryData;
   1.730 +
   1.731 +	/** Registrar observer test class */
   1.732 +	TRegistrarObserverStub* iRegistrarObserver;
   1.733 +
   1.734 +	/** CRegistrar required for populating the CRegistryData */
   1.735 +	CRegistrar*							iRegistrar;
   1.736 +	/** CRegistrar state accessor */
   1.737 +	TRegistrar_StateAccessor* iRegistrarAccessor;
   1.738 +
   1.739 +	/** A list of returned UIDs from the list methods */
   1.740 +	RImplInfoArray*						iUidList;
   1.741 +
   1.742 +	/** A list of implementation data from the list methods */
   1.743 +	RImplDataArray						iImplDataList;
   1.744 +
   1.745 +	/** Friend class pointer used for accessing private members */
   1.746 +	TRegistryData_StateAccessor*		iStateAccessor;
   1.747 +
   1.748 +	/** The current drive unit identifier */
   1.749 +	TDriveUnit							iDriveUnit;
   1.750 +
   1.751 +	/** UID for an implementation of an interface */
   1.752 +	TUid								iImplementationUid;
   1.753 +
   1.754 +	/** UID to identify a particular interface */
   1.755 +	TUid								iInterfaceUid;
   1.756 +
   1.757 +	/** The directory entry data for a dll */
   1.758 +	TEntry								iDllEntry;
   1.759 +
   1.760 +	/** Flag to indicate if the registry entry requires an update */
   1.761 +	TBool								iUpdate;
   1.762 +
   1.763 +	/** The drive index returned by IsRegistered... so we know which drive to update on */
   1.764 +	TInt								iFoundDriveIndex;
   1.765 +
   1.766 +	};
   1.767 +
   1.768 +/**
   1.769 +Creates a new CRegistryDataTest object
   1.770 +@param		aIsFullDriveCDiscovery whether the constructor make full discovery on Drive C
   1.771 +@return		A pointer to the newly created class.
   1.772 +*/
   1.773 +CRegistryDataTest* CRegistryDataTest::NewL(TBool aIsFullDriveCDiscovery)
   1.774 +	{
   1.775 +	CRegistryDataTest* self = new (ELeave) CRegistryDataTest();
   1.776 +	CleanupStack::PushL(self);
   1.777 +	self->ConstructL(aIsFullDriveCDiscovery);
   1.778 +	CleanupStack::Pop();
   1.779 +	return self;
   1.780 +	}
   1.781 +
   1.782 +/**
   1.783 +Standardized default constructor
   1.784 +@post		CRegistryDataTest is fully constructed.
   1.785 +*/
   1.786 +CRegistryDataTest::CRegistryDataTest()
   1.787 +:	CBase()
   1.788 +	{
   1.789 +	iDriveUnit = EDriveC;
   1.790 +
   1.791 +	TUid thirdUid = {0x101F847B};
   1.792 +
   1.793 +	iDllEntry.iType = TUidType(KNullUid, KNullUid, thirdUid);
   1.794 +	iDllEntry.iName = KEComExDllOnC;
   1.795 +
   1.796 +	iInterfaceUid.iUid		= KCExampleInterfaceUid.iUid;
   1.797 +	iImplementationUid.iUid	= KCExampleInterfaceImp.iUid;
   1.798 +	}
   1.799 +
   1.800 +/**
   1.801 +Standardized 2nd(Initialization) phase of two phase construction.
   1.802 +Completes the safe construction of the CRegistryDataTest object
   1.803 +@param		aIsFullDriveCDiscovery whether the constructor make full discovery on Drive C
   1.804 +@post		CRegistryDataTest is fully constructed.
   1.805 +@leave		KErrNoMemory.
   1.806 +*/
   1.807 +void CRegistryDataTest::ConstructL(TBool aIsFullDriveCDiscovery)
   1.808 +	{
   1.809 +	iUidList = new(ELeave) RImplInfoArray;
   1.810 +	iStateAccessor= new(ELeave) TRegistryData_StateAccessor;
   1.811 +	iRegistryData = CRegistryData::NewL(TheFs);
   1.812 +	iRegistrarObserver=new (ELeave) TRegistrarObserverStub;
   1.813 +	iRegistrarAccessor=new (ELeave) TRegistrar_StateAccessor;
   1.814 +	iRegistrar=CRegistrar::NewL(*iRegistryData, *iRegistrarObserver, TheFs);
   1.815 +	if (aIsFullDriveCDiscovery)
   1.816 +		{
   1.817 +		TDriveUnit driveUnitC = EDriveC;
   1.818 +		iRegistrarAccessor->ScanDriveL(*iRegistrar,driveUnitC);
   1.819 +		}
   1.820 +	}
   1.821 +
   1.822 +/**
   1.823 +Standard destructor
   1.824 +*/
   1.825 +CRegistryDataTest::~CRegistryDataTest()
   1.826 +	{
   1.827 +	delete iUidList;
   1.828 +	delete iStateAccessor;
   1.829 +	delete iRegistrarAccessor;
   1.830 +	delete iRegistrar;
   1.831 +	delete iRegistrarObserver;
   1.832 +	delete iRegistryData;
   1.833 +	}
   1.834 +
   1.835 +/**
   1.836 + @return ETrue if the ECom.spi file exists on Z drive, EFalse if it does not
   1.837 +*/
   1.838 +TBool CRegistryDataTest::SpiFileExists()
   1.839 +	{
   1.840 +	TEntry entry;
   1.841 +	if (TheFs.Entry(TheEComSpiFilePathAndNamePtrC, entry) == KErrNone)
   1.842 +		{
   1.843 +		return ETrue;
   1.844 +		}
   1.845 +	return EFalse;
   1.846 +	}
   1.847 +
   1.848 +/**
   1.849 +@SYMTestCaseID          SYSLIB-ECOM-UT-3712
   1.850 +@SYMTestCaseDesc	    Tests for AddExtendedInterfaceL when adding duplicate extended interface Uid.
   1.851 +@SYMTestPriority 	    High
   1.852 +@SYMTestActions  	    Call CImplementationInformation::AddExtendedInterfaceL() with duplicate extended
   1.853 +						interface Uid.
   1.854 +						AddExtendedInterfacePanicL() and ThreadPanicTest() are used for this test case.
   1.855 +@SYMTestExpectedResults Ensure that the AddExtendedInterfaceL panics in debug mode, but duplicate extended
   1.856 +						interface is ignored in release mode.
   1.857 +@SYMDEF                 DEF111196
   1.858 +*/
   1.859 +LOCAL_C void AddExtendedInterfaceTestL()
   1.860 +	{
   1.861 +	
   1.862 +	// Test Starts...
   1.863 +	TUid testImplUid;
   1.864 +	testImplUid.iUid = KCExampleInterfaceUid.iUid;
   1.865 +	TInt testImplVersion = 2;
   1.866 +	_LIT(KTestImplName, "Implementation");
   1.867 +	_LIT8(KTestImplDataType, "Data Type");
   1.868 +	_LIT8(KTestImplOpaqueData, "Opaque Data");
   1.869 +	TUid testExtendedInterfaceUid1;
   1.870 +	TUid testExtendedInterfaceUid2;
   1.871 +	testExtendedInterfaceUid1.iUid = 0x10009E44;
   1.872 +	testExtendedInterfaceUid2.iUid = 0x10009E45;
   1.873 +
   1.874 +	TDriveUnit testImplDrive = EDriveC;
   1.875 +	TBool testImplRomOnly = ETrue;
   1.876 +	TBool testImplRomBased = EFalse;
   1.877 +
   1.878 +	CRegistryData* registryData = CRegistryData::NewL(TheFs);
   1.879 +	CleanupStack::PushL(registryData);
   1.880 +	CRegistryData::CDriveData* driveData = CRegistryData::CDriveData::NewLC(testImplDrive, registryData);
   1.881 +	CRegistryData::CDllData* dllData = CRegistryData::CDllData::NewLC(driveData);
   1.882 +	CRegistryData::CInterfaceData* interfaceData = CRegistryData::CInterfaceData::NewLC(dllData);
   1.883 +
   1.884 +	// NewL test
   1.885 +	HBufC* name = KTestImplName().AllocLC();
   1.886 +	HBufC8* dataType = KTestImplDataType().AllocLC();
   1.887 +	HBufC8* opaqueData = KTestImplOpaqueData().AllocLC();
   1.888 +
   1.889 +	RArray<TUid>* extendedInterfaces = new(ELeave) RArray<TUid>;
   1.890 +
   1.891 +	CleanupStack::PushL(TCleanupItem(CloseAndDeleteArray, extendedInterfaces));
   1.892 +
   1.893 +	CRegistryData::CImplementationData* implementationData;
   1.894 +	implementationData = CRegistryData::CImplementationData::NewL(interfaceData,
   1.895 +															testImplUid,
   1.896 +															testImplVersion,
   1.897 +															name,
   1.898 +															dataType,
   1.899 +															opaqueData,
   1.900 +															testImplDrive,
   1.901 +															testImplRomOnly,
   1.902 +															testImplRomBased,
   1.903 +															extendedInterfaces);
   1.904 +
   1.905 +	CleanupStack::Pop(extendedInterfaces);
   1.906 +	CleanupStack::Pop(opaqueData);
   1.907 +	CleanupStack::Pop(dataType);
   1.908 +	CleanupStack::Pop(name);
   1.909 +
   1.910 +	CleanupStack::PushL(implementationData);
   1.911 +	TEST(interfaceData == implementationData->iParent);
   1.912 +
   1.913 +	//Add extended interface
   1.914 +	implementationData->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid1);
   1.915 +	implementationData->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid2);
   1.916 +	const RArray<TUid>* extendedInterfacesList = implementationData->iImplInfo->GetExtendedInterfaceList();
   1.917 +	TEST(extendedInterfacesList->Count() == 2);
   1.918 +	RDebug::Printf("Number of extended interfaces = %d",extendedInterfacesList->Count());
   1.919 +	// Add duplicate extended interface, will panic in debug mode, but duplicate extended interface
   1.920 +	// is ignored in release mode
   1.921 +	implementationData->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid2);
   1.922 +
   1.923 +#ifdef NDEBUG
   1.924 +	const RArray<TUid>* extendedInterfacesList1 = implementationData->iImplInfo->GetExtendedInterfaceList();
   1.925 +	TEST(extendedInterfacesList1->Count() == 2);
   1.926 +	RDebug::Printf("Number of extended interfaces after adding duplicate extended interface = %d",extendedInterfacesList->Count());
   1.927 +#endif
   1.928 +	// Tidy up
   1.929 +	CleanupStack::PopAndDestroy(5, registryData);
   1.930 +
   1.931 +	// Test Ends...
   1.932 +	}
   1.933 +
   1.934 +LOCAL_C TInt AddExtendedInterfacePanicL(TAny*)
   1.935 +	{
   1.936 +	__UHEAP_MARK;
   1.937 +	CTrapCleanup* threadcleanup = CTrapCleanup::New();
   1.938 +	TRAPD(err,AddExtendedInterfaceTestL());
   1.939 +	TEST(err==KErrNone);
   1.940 +	delete threadcleanup;
   1.941 +	__UHEAP_MARKEND;
   1.942 +	return KErrNone;
   1.943 +	}
   1.944 +
   1.945 +/**
   1.946 +The test code is used for capturing the PANIC that occurs as a result of calling AddExtendedInterfaceL
   1.947 +with duplicate extended interface Uid .
   1.948 +*/
   1.949 +LOCAL_C void ThreadPanicTest(const TDesC& aName,TThreadFunction aFunction)
   1.950 +	{
   1.951 +	TRequestStatus threadStatus;
   1.952 +	RThread thread;
   1.953 +	TBool jit;
   1.954 +	jit=User::JustInTime();
   1.955 +	User::SetJustInTime(EFalse);
   1.956 +
   1.957 +	// Default stack size was doubled for X86, so reduce this multiplier to prevent panic
   1.958 +#ifdef __X86GCC__
   1.959 +	TInt err=thread.Create(aName,aFunction,KDefaultStackSize*4,KMinHeapSize,0x100000,0);
   1.960 +#else
   1.961 +	TInt err=thread.Create(aName,aFunction,KDefaultStackSize*8,KMinHeapSize,0x100000,0);
   1.962 +#endif	
   1.963 +	TEST(err==KErrNone);
   1.964 +	thread.Logon(threadStatus)	;
   1.965 +	thread.Resume();
   1.966 +
   1.967 +	User::WaitForRequest(threadStatus);
   1.968 +
   1.969 +	//Now check why the thread Exit
   1.970 +	// There is Assert_Debug check for the duplicate extended interface Uid for AddExtendedInterfaceL(),
   1.971 +	// Therefore, the panic reason would be KErrAlreadyExists for debug mode.
   1.972 +	// in release mode, the duplicate extended interface is ignored.
   1.973 +#ifdef _DEBUG
   1.974 +	RDebug::Printf("Thread status: %d", thread.ExitType());
   1.975 +	TEST(thread.ExitType()==EExitPanic);
   1.976 +	TEST(thread.ExitReason()==EEComPanic_CImlpementationInfromation_DuplicateExIf);
   1.977 +#else
   1.978 +	RDebug::Printf("Thread status: %d", thread.ExitType());
   1.979 +	TEST(thread.ExitType()==EExitKill);
   1.980 +#endif
   1.981 +	CLOSE_AND_WAIT(thread);
   1.982 +	User::SetJustInTime(jit);
   1.983 +	}
   1.984 +
   1.985 +
   1.986 +/**
   1.987 +Plugins to be used in this test
   1.988 +Interface UID	DLL	UID		Implementation UID	Version		DLL Type	Extended Interfaces
   1.989 +--------------------------------------------------------------------------------
   1.990 +0x10009E36		0x10009E3E	0x10009E39				1		PLUGIN3		{0x10009E44, 0x10009E45, 0x10009E46}
   1.991 +				0x10009E3E	0x10009E3C				1		PLUGIN3		{}
   1.992 +				0x10009E3E	0x10009E3D				1		PLUGIN3		{0x10009E44}
   1.993 +0x10009DC0		0x101F847B	0x101F847C				1		PLUGIN1		NULL
   1.994 +
   1.995 +@SYMTestCaseID          SYSLIB-ECOM-UT-3575
   1.996 +@SYMTestCaseDesc	    Tests for CImplementationInformation::GetExtendedInterfaceList() and
   1.997 +						CImplementationInformation::GetExtendedInterfaceListL() functions. Makes sure that
   1.998 +						results from both of the functions are identical.
   1.999 +@SYMTestPriority 	    High
  1.1000 +@SYMTestActions  	    List the extended interfaces for a valid implementation UID
  1.1001 +						List the extended interfaces for a non-existing implementation UID
  1.1002 +						List the extended interfaces for a valid PLUGIN1 implementation UID
  1.1003 +@SYMTestExpectedResults Expected extended interfaces are returned.
  1.1004 +@SYMEC                  EC43
  1.1005 +@SYMDEF					DEF111196
  1.1006 +*/
  1.1007 +void CRegistryDataTest::ListExtendedInterfacesTestL()
  1.1008 +	{
  1.1009 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3575 "));
  1.1010 +	TUid ImpUid = {0x10009E39};
  1.1011 +	TUid ImpUid1 = {0x10009E3C};
  1.1012 +	TUid ImpUidPLUGIN1 = {0x101F847C};
  1.1013 + 	TUid extendedInterfacesUid[] = {0x10009E44,0x10009E45,0x10009E46};
  1.1014 + 	TEntry dllinfo;
  1.1015 + 	TInt err;
  1.1016 + 	TClientRequest clntRq;
  1.1017 +
  1.1018 + 	//Gets the Implementation Information for a valid implementation UID with extended interfaces
  1.1019 + 	CImplementationInformation* implementationInfo=NULL;
  1.1020 + 	TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, KCDummyUid, dllinfo, implementationInfo, ETrue));
  1.1021 + 	TEST_OOM_ERR;
  1.1022 + 	TEST2(err, KErrNone);
  1.1023 + 	TEST(implementationInfo->ImplementationUid() == ImpUid);
  1.1024 +
  1.1025 + 	//Gets the list of extended Interfaces
  1.1026 + 	RArray<TUid>* extendedInterfaces = implementationInfo->GetExtendedInterfaceList();
  1.1027 +
  1.1028 + 	//Checks the extended interfaces list
  1.1029 + 	TEST(extendedInterfaces != NULL);
  1.1030 +	for (TInt i = 0; i < extendedInterfaces->Count(); i++)
  1.1031 +		{
  1.1032 +		TEST((*extendedInterfaces)[i] == extendedInterfacesUid[i]);
  1.1033 +		}
  1.1034 +
  1.1035 +	// Uses the GetExtendedInterfaceListL API to get the extended interface.
  1.1036 +	RArray<TUid> extendedInterfacesAPI;
  1.1037 +	CleanupClosePushL(extendedInterfacesAPI);
  1.1038 +	implementationInfo->GetExtendedInterfaceListL(extendedInterfacesAPI);
  1.1039 +	// Makes sure that the list return is the same as the one return from GetExtendedInterfaceList.
  1.1040 +	TEST(extendedInterfacesAPI.Count() == extendedInterfaces->Count());
  1.1041 +	for (TInt i = 0; i < extendedInterfaces->Count(); i++)
  1.1042 +		{
  1.1043 +		TEST((*extendedInterfaces)[i] == extendedInterfacesAPI[i]);
  1.1044 +		}
  1.1045 +	CleanupStack::PopAndDestroy(&extendedInterfacesAPI);
  1.1046 +
  1.1047 +	//Gets the Implementation Information for a valid implementation UID without extended interfaces
  1.1048 + 	TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid1, KCDummyUid, dllinfo, implementationInfo, ETrue));
  1.1049 + 	TEST_OOM_ERR;
  1.1050 + 	TEST2(err, KErrNone);
  1.1051 + 	TEST(implementationInfo->ImplementationUid() == ImpUid1);
  1.1052 +
  1.1053 + 	//Gets the list of extended Interfaces
  1.1054 +	extendedInterfaces = implementationInfo->GetExtendedInterfaceList();
  1.1055 + 	TEST(extendedInterfaces->Count() == 0);
  1.1056 +
  1.1057 +	// Uses the GetExtendedInterfaceListL API to get the extended interface.
  1.1058 +	RArray<TUid> extendedInterfacesAPI1;
  1.1059 +	CleanupClosePushL(extendedInterfacesAPI1);
  1.1060 +	implementationInfo->GetExtendedInterfaceListL(extendedInterfacesAPI1);
  1.1061 +	// Makes sure that the list return is the same as the one return from GetExtendedInterfaceList.
  1.1062 +	TEST(extendedInterfacesAPI1.Count() == extendedInterfaces->Count());
  1.1063 +	for (TInt i = 0; i < extendedInterfaces->Count(); i++)
  1.1064 +		{
  1.1065 +		TEST((*extendedInterfaces)[i] == extendedInterfacesAPI1[i]);
  1.1066 +		}
  1.1067 +	CleanupStack::PopAndDestroy(&extendedInterfacesAPI1);
  1.1068 +
  1.1069 +	//Gets the Implementation Information for a non-existing implementation UID
  1.1070 +	TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, KCInvalidUid, KCDummyUid, dllinfo, implementationInfo, ETrue));
  1.1071 +	TEST_OOM_ERR;
  1.1072 +	TEST2(err,KErrNone);
  1.1073 +	TEST(implementationInfo == NULL);
  1.1074 +
  1.1075 +	//Gets the Implementation Information for a valid PLUGIN1 implementation UID without extended interfaces
  1.1076 + 	TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUidPLUGIN1, KCDummyUid, dllinfo, implementationInfo, ETrue));
  1.1077 + 	TEST_OOM_ERR;
  1.1078 + 	TEST2(err, KErrNone);
  1.1079 + 	TEST(implementationInfo->ImplementationUid() == ImpUidPLUGIN1);
  1.1080 +
  1.1081 + 	//Gets the list of extended Interfaces
  1.1082 +	extendedInterfaces = implementationInfo->GetExtendedInterfaceList();
  1.1083 + 	TEST(extendedInterfaces == NULL);
  1.1084 +
  1.1085 +	// Uses the GetExtendedInterfaceListL API to get the extended interface.
  1.1086 +	RArray<TUid> extendedInterfacesAPI2;
  1.1087 +	CleanupClosePushL(extendedInterfacesAPI2);
  1.1088 +	implementationInfo->GetExtendedInterfaceListL(extendedInterfacesAPI2);
  1.1089 +	// Makes sure that the list return is the same as the one return from GetExtendedInterfaceList.
  1.1090 +	TEST(extendedInterfacesAPI2.Count() == 0);
  1.1091 +	CleanupStack::PopAndDestroy(&extendedInterfacesAPI2);
  1.1092 +	}
  1.1093 +
  1.1094 +
  1.1095 +/**
  1.1096 +The interface Uid 0x10009E36 has 5 implementations on different DLLs(EComExample12.dll,EComExample14.dll and EComExample15.dll).
  1.1097 +0x10009E3D is said to be ROM-Only, it will not be created. 0x10009E39 has higher version in EComExample15.
  1.1098 +Interface UID	DLL	UID		Implementation UID	Version		DLL Type	Extended Interfaces
  1.1099 +--------------------------------------------------------------------------------
  1.1100 +0x10009E36		0x10009E40	0x10009E48				1		PLUGIN1		None
  1.1101 +				0x10009E3E	0x10009E39				1		PLUGIN3		{0x10009E44, 0x10009E45, 0x10009E46}
  1.1102 +				0x10009E3E	0x10009E3C				1		PLUGIN3		{}
  1.1103 +				0x10009E3E	0x10009E3D				1		PLUGIN3		{0x10009E44}
  1.1104 +				0x10009E42	0x10009E39				2		PLUGIN3		{0x10009E44, 0x10009E45, 0x10009E46}
  1.1105 +
  1.1106 +@SYMTestCaseID          SYSLIB-ECOM-UT-3580
  1.1107 +@SYMTestCaseDesc	    Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
  1.1108 +						that fall into a PLUGIN1 Dll and PLUGIN3. The extended interface list will not be populated
  1.1109 +@SYMTestPriority 	    High
  1.1110 +@SYMTestActions  	    List the implementations for an interface UID and a set of extended interfaces.
  1.1111 +						Check the VID of every implementation matches the VID of the DLL which the implementation
  1.1112 +                        belongs to.
  1.1113 +@SYMTestExpectedResults Expected matches are returned from both PLUGIN1 and PLUGIN3.
  1.1114 +@SYMEC                  EC43
  1.1115 +*/
  1.1116 +void CRegistryDataTest::ListImplementationsTestT5L()
  1.1117 +	{
  1.1118 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3580 "));
  1.1119 +	const TUid KInterfaceUid = {0x10009E36};
  1.1120 +
  1.1121 +	TEST(iRegistryData->IndexValid());
  1.1122 +	// Set up client request and extended interfaces
  1.1123 +	TClientRequest clientReq;
  1.1124 +	RArray<TUid> extendedInterfaces;
  1.1125 +	CleanupClosePushL(extendedInterfaces);
  1.1126 +	TBool capability= ETrue;
  1.1127 +	CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
  1.1128 +	CleanupStack::PushL(registryResolveTransaction);
  1.1129 +	RImplInfoArray* iUidListPtr = NULL;
  1.1130 +	TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KInterfaceUid)));
  1.1131 +
  1.1132 +	TEST_OOM_ERR;
  1.1133 +	TEST2(err, KErrNone);
  1.1134 +
  1.1135 +	// Prints UIDs of implementations
  1.1136 +	_LIT(KUIDFormat,"Uid = 0x%08x\n");
  1.1137 +	_LIT(KLists,"There are %d Implementations \n");
  1.1138 +
  1.1139 +	TheTest.Printf(KLists, iUidListPtr->Count());
  1.1140 +	// Tests for expected number of implementations.
  1.1141 +	TEST(iUidListPtr->Count() == 3);
  1.1142 +
  1.1143 +	for(TInt index = 0; index < iUidListPtr->Count(); ++index)
  1.1144 +		{
  1.1145 +		// check VID of every implementation
  1.1146 +		TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
  1.1147 +		TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
  1.1148 +		TheTest.Printf(KUIDFormat, uid);
  1.1149 +		}
  1.1150 +	CleanupStack::PopAndDestroy(registryResolveTransaction);
  1.1151 +	CleanupStack::PopAndDestroy(&extendedInterfaces);
  1.1152 +	}
  1.1153 +/**
  1.1154 +The interface Uid 0x10009E36 has 5 implementations on different DLLs(EComExample12.dll,EComExample14.dll and EComExample15.dll).
  1.1155 +0x10009E3D is said to be ROM-Only, it will not be created. 0x10009E39 has higher version in EComExample15.
  1.1156 +Interface UID	DLL	UID		Implementation UID	Version	DLL Type	Extended Interfaces
  1.1157 +-------------------------------------------------------------------------------------------------------
  1.1158 +0x10009E36		0x10009E40	0x10009E48			1		PLUGIN1		None
  1.1159 +				0x10009E3E	0x10009E39			1		PLUGIN3		{0x10009E44, 0x10009E45, 0x10009E46}
  1.1160 +				0x10009E3E	0x10009E3C			1		PLUGIN3		{}
  1.1161 +				0x10009E3E	0x10009E3D			1		PLUGIN3		{0x10009E44}
  1.1162 +				0x10009E42	0x10009E39			2		PLUGIN3		{0x10009E44, 0x10009E45, 0x10009E46}
  1.1163 +
  1.1164 +@SYMTestCaseID          SYSLIB-ECOM-UT-3579
  1.1165 +@SYMTestCaseDesc	    Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
  1.1166 +						that fall into a PLUGIN1 Dll and PLUGIN3. The extended interface list will be populated
  1.1167 +@SYMTestPriority 	    High
  1.1168 +@SYMTestActions  	    List the implementations for an interface UID and a set of extended interfaces.
  1.1169 +						Check the VID of every implementation match the VID of the DLL which the implementation
  1.1170 +                        belongs to.
  1.1171 +@SYMTestExpectedResults No PLUGIN1 implementations should be returned.
  1.1172 +@SYMEC                  EC43
  1.1173 +*/
  1.1174 +void CRegistryDataTest::ListImplementationsTestT4L()
  1.1175 +	{
  1.1176 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3579 "));
  1.1177 +	const TUid KInterfaceUid = {0x10009E36};
  1.1178 +	const TUid KExtendedInterfaceUid = {0x10009E44};
  1.1179 +
  1.1180 +	TEST(iRegistryData->IndexValid());
  1.1181 +	//Set up client request and extended interfaces
  1.1182 +	TClientRequest clientReq;
  1.1183 +	RArray<TUid> extendedInterfaces;
  1.1184 +	CleanupClosePushL(extendedInterfaces);
  1.1185 +	extendedInterfaces.AppendL(KExtendedInterfaceUid);
  1.1186 +	TBool capability= ETrue;
  1.1187 +	CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
  1.1188 +	CleanupStack::PushL(registryResolveTransaction);
  1.1189 +	RImplInfoArray* iUidListPtr = NULL;
  1.1190 +	TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KInterfaceUid)));
  1.1191 +
  1.1192 +	TEST_OOM_ERR;
  1.1193 +	TEST2(err, KErrNone);
  1.1194 +
  1.1195 +	// Prints UIDs of implementations
  1.1196 +	_LIT(KUIDFormat,"Uid = 0x%08x\n");
  1.1197 +	_LIT(KLists,"There are %d Implementations \n");
  1.1198 +
  1.1199 +	TheTest.Printf(KLists, iUidListPtr->Count());
  1.1200 +	// Tests for expected number of implementations.
  1.1201 +	TEST(iUidListPtr->Count() == 1);
  1.1202 +
  1.1203 +	for(TInt index = 0; index < iUidListPtr->Count(); ++index)
  1.1204 +		{
  1.1205 +		// check VID of every implementation
  1.1206 +		TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
  1.1207 +		TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
  1.1208 +		TheTest.Printf(KUIDFormat, uid);
  1.1209 +		}
  1.1210 +	CleanupStack::PopAndDestroy(registryResolveTransaction);
  1.1211 +	CleanupStack::PopAndDestroy(&extendedInterfaces);
  1.1212 +	}
  1.1213 +
  1.1214 +/**
  1.1215 +@SYMTestCaseID          SYSLIB-ECOM-UT-3578
  1.1216 +@SYMTestCaseDesc	    Tests for CRegistryResolveTransaction::ListImplementationsL() function with invalid interface id.
  1.1217 +@SYMTestPriority 	    High
  1.1218 +@SYMTestActions  	    List the implementations for an invalid interface UID and valid extended interfaces.
  1.1219 +@SYMTestExpectedResults No implementation is returned.
  1.1220 +@SYMEC                  EC43
  1.1221 +*/
  1.1222 +void CRegistryDataTest::ListImplementationsTestT3L()
  1.1223 +	{
  1.1224 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3578 "));
  1.1225 +	const TUid KExtendedInterfaceUid = {0x10009E44};
  1.1226 +
  1.1227 +	TEST(iRegistryData->IndexValid());
  1.1228 +	//Set up client request and extended interfaces
  1.1229 +	TClientRequest clientReq;
  1.1230 +	RArray<TUid> extendedInterfaces;
  1.1231 +	CleanupClosePushL(extendedInterfaces);
  1.1232 +	extendedInterfaces.AppendL(KExtendedInterfaceUid);
  1.1233 +	TBool capability= ETrue;
  1.1234 +	CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
  1.1235 +	CleanupStack::PushL(registryResolveTransaction);
  1.1236 +	TRAPD(err, RImplInfoArray*	iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KCInvalidUid)));
  1.1237 +
  1.1238 +	TEST_OOM_ERR;
  1.1239 +	TEST2(err, KEComErrNoInterfaceIdentified);
  1.1240 +	TheTest.Printf(_L("No Implementation is found.\n"));
  1.1241 +	CleanupStack::PopAndDestroy(registryResolveTransaction);
  1.1242 +	CleanupStack::PopAndDestroy(&extendedInterfaces);
  1.1243 +	}
  1.1244 +
  1.1245 +/**
  1.1246 +The interface Uid 0x10009E36 has 5 implementations (EComExample12.dll,EComExample14.dll and EComExample15.dll), but only 1 will
  1.1247 +be picked up as 2 of them do not match the extended interfaces criteria (0x10009E3C and 0x10009E48),
  1.1248 +1 of them is said to be ROM only but it is on RAM(0x10009E3D), and 1 of them has older version(0x10009E39).
  1.1249 +
  1.1250 +Interface UID	DLL	UID		Implementation UID	Version		Type	Extended Interfaces
  1.1251 +--------------------------------------------------------------------------------------
  1.1252 +0x10009E36		0x10009E3E	0x10009E39			1			PlugIn3	{0x10009E44, 0x10009E45, 0x10009E46}
  1.1253 +				0x10009E3E	0x10009E3C			1			PlugIn3	{}
  1.1254 +				0x10009E3E	0x10009E3D			1			PlugIn3	{0x10009E44}
  1.1255 +				0x10009E40	0x10009E48			1			PLUGIN1	None
  1.1256 +				0x10009E42	0x10009E39			2			PlugIn3	{0x10009E44, 0x10009E45, 0x10009E46}
  1.1257 +
  1.1258 +@SYMTestCaseID          SYSLIB-ECOM-UT-3577
  1.1259 +@SYMTestCaseDesc	    Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
  1.1260 +						that fall into a PLUGIN3 Dll.
  1.1261 +@SYMTestPriority 	    High
  1.1262 +@SYMTestActions  	    List the implementations for an existing interface UID and a set of extended interfaces.
  1.1263 +                        Test for expected number of implementations. Check the VID of every implementation match
  1.1264 +                        the VID of the DLL which the implementation belongs to.
  1.1265 +@SYMTestExpectedResults Expected number of implementations are returned.
  1.1266 +@SYMEC                  EC43
  1.1267 +*/
  1.1268 +void CRegistryDataTest::ListImplementationsTestT2L()
  1.1269 +	{
  1.1270 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3577 "));
  1.1271 +	const TUid KInterfaceUid = {0x10009E36};
  1.1272 +	const TUid KExtendedInterfaceUid = {0x10009E44};
  1.1273 +
  1.1274 +	TEST(iRegistryData->IndexValid());
  1.1275 +	// Set up client request and extended interfaces
  1.1276 +	TClientRequest clientReq;
  1.1277 +	RArray<TUid> extendedInterfaces;
  1.1278 +	CleanupClosePushL(extendedInterfaces);
  1.1279 +	extendedInterfaces.AppendL(KExtendedInterfaceUid);
  1.1280 +	TBool capability= ETrue;
  1.1281 +	CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
  1.1282 +	CleanupStack::PushL(registryResolveTransaction);
  1.1283 +	RImplInfoArray* iUidListPtr = NULL;
  1.1284 +	TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KInterfaceUid)));
  1.1285 +
  1.1286 +	TEST_OOM_ERR;
  1.1287 +	TEST2(err, KErrNone);
  1.1288 +
  1.1289 +	// Prints UIDs of implementations
  1.1290 +	_LIT(KUIDFormat,"Uid = 0x%08x\n");
  1.1291 +	_LIT(KLists,"There are %d Implementations \n");
  1.1292 +
  1.1293 +	TheTest.Printf(KLists, iUidListPtr->Count());
  1.1294 +	// Tests for expected number of implementations.
  1.1295 +	TEST(iUidListPtr->Count() == 1);
  1.1296 +
  1.1297 +	for(TInt index = 0; index < iUidListPtr->Count(); ++index)
  1.1298 +		{
  1.1299 +		// checks VID of every implementation
  1.1300 +		TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
  1.1301 +		TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
  1.1302 +		TheTest.Printf(KUIDFormat, uid);
  1.1303 +		}
  1.1304 +	CleanupStack::PopAndDestroy(registryResolveTransaction);
  1.1305 +	CleanupStack::PopAndDestroy(&extendedInterfaces);
  1.1306 +	}
  1.1307 +
  1.1308 +
  1.1309 +/**
  1.1310 +The interface Uid 0x10009DC0 has 6 implementations on different DLLs but only 4 will
  1.1311 +be picked up as 2 of them are of older version(Impl ID 0x10009DC3 and 0x10009DC4 with version 1)
  1.1312 +
  1.1313 +Interface UID	DLL	UID		Implementation UID	Version
  1.1314 +-------------------------------------------------------
  1.1315 +0x10009DC0		0x10009DB1	0x10009DC3			1
  1.1316 +				0x10009DB1	0x10009DC4			1
  1.1317 +				0x10009DB3	0x10009DC3			2
  1.1318 +				0x10009DB3	0x10009DC4			2
  1.1319 +				0x101F8477	0x101F8478			1
  1.1320 +				0x101F847B	0x101F847C			1
  1.1321 +
  1.1322 +@SYMTestCaseID          SYSLIB-ECOM-UT-3576
  1.1323 +@SYMTestCaseDesc	    Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
  1.1324 +						that fall into a PLUGIN1 Dll.
  1.1325 +@SYMTestPriority 	    High
  1.1326 +@SYMTestActions  	    List the implementations for an existing interface UID and
  1.1327 +                        test for expected number of implementations.Check the VID of
  1.1328 +                        every implementation match the VID of the DLL which the implementation
  1.1329 +                        belongs to.
  1.1330 +@SYMTestExpectedResults Expected number of implementations are returned.
  1.1331 +@SYMEC                  EC43
  1.1332 +*/
  1.1333 +void CRegistryDataTest::ListImplementationsTestT1L()
  1.1334 +	{
  1.1335 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3576 "));
  1.1336 +	TEST(iRegistryData->IndexValid());
  1.1337 +	// Set up client request and extended interfaces
  1.1338 +	TClientRequest clientReq;
  1.1339 +	RArray<TUid> extendedInterfaces;
  1.1340 +	CleanupClosePushL(extendedInterfaces);
  1.1341 +	TBool capability= ETrue;
  1.1342 +	CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
  1.1343 +	CleanupStack::PushL(registryResolveTransaction);
  1.1344 +	RImplInfoArray* iUidListPtr = NULL;
  1.1345 +	TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(iInterfaceUid)));
  1.1346 +
  1.1347 +	TEST_OOM_ERR;
  1.1348 +	TEST2(err, KErrNone);
  1.1349 +	// Prints UIDs of implementations
  1.1350 +	_LIT(KUIDFormat,"Uid = 0x%08x\n");
  1.1351 +	_LIT(KLists,"There are %d Implementations \n");
  1.1352 +
  1.1353 +	TheTest.Printf(KLists, iUidListPtr->Count());
  1.1354 +	// Tests for expected number of implementations.
  1.1355 +	TEST(iUidListPtr->Count() == 4);
  1.1356 +
  1.1357 +	for(TInt index = 0; index < iUidListPtr->Count(); ++index)
  1.1358 +		{
  1.1359 +		// checks VID of every implementation
  1.1360 +		TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
  1.1361 +		TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
  1.1362 +		TheTest.Printf(KUIDFormat, uid);
  1.1363 +		}
  1.1364 +	CleanupStack::PopAndDestroy(registryResolveTransaction);
  1.1365 +	CleanupStack::PopAndDestroy(&extendedInterfaces);
  1.1366 +	}
  1.1367 +
  1.1368 +/** In order to create an instance of CImplementationData, the test
  1.1369 +has to create the chain of: drive data, dll data, and interface data.
  1.1370 +Use this method to safe the repetitive work.
  1.1371 +
  1.1372 +This method will not new the CImplementationData's parents if they
  1.1373 +have been set. Hence can be used to add an implementation to an
  1.1374 +existing interface data.
  1.1375 +*/
  1.1376 +void CRegistryDataTest::CreateImplL(TImplCreationStruct& aCreationData)
  1.1377 +	{
  1.1378 +	if (aCreationData.iImplData)
  1.1379 +	  {
  1.1380 +	  // Should not call this method. There is nothing to create.
  1.1381 +	  User::Leave(KErrGeneral);
  1.1382 +	  }
  1.1383 +
  1.1384 +	if (! aCreationData.iDriveData || (KErrNotFound == aCreationData.iDriveIndex))
  1.1385 +		{
  1.1386 +        aCreationData.iDriveIndex = iRegistryData->FindDriveL(
  1.1387 +            aCreationData.iDriveUnit, aCreationData.iDriveData);
  1.1388 +        if (KErrNotFound == aCreationData.iDriveIndex)
  1.1389 +            {
  1.1390 +            aCreationData.iDriveData = CRegistryData::CDriveData::NewLC(
  1.1391 +                aCreationData.iDriveUnit, iRegistryData);
  1.1392 +            iStateAccessor->AppendDriveDataL(*iRegistryData,
  1.1393 +                                             aCreationData.iDriveData);
  1.1394 +            CleanupStack::Pop(aCreationData.iDriveData);
  1.1395 +
  1.1396 +            aCreationData.iDriveIndex = iRegistryData->FindDriveL(
  1.1397 +            	aCreationData.iDriveUnit,aCreationData.iDriveData);
  1.1398 +            }
  1.1399 +		}
  1.1400 +
  1.1401 +	if (! aCreationData.iDllData)
  1.1402 +		{
  1.1403 +		if (aCreationData.iInterfaceData)
  1.1404 +			{
  1.1405 +			User::Leave(KErrGeneral); // can not have child without parent
  1.1406 +			}
  1.1407 +		TEntry e;
  1.1408 +		e.iName = aCreationData.iDllPathName;
  1.1409 +		TParse fileparse;
  1.1410 +		fileparse.Set(e.iName,NULL,NULL);
  1.1411 +		aCreationData.iDllData = CRegistryData::CDllData::NewLC(
  1.1412 +			fileparse.NameAndExt(),e.iModified,KNullUid,KNullUid, aCreationData.iDriveData);
  1.1413 +		aCreationData.iDllData->iSecurityChecked = ETrue;
  1.1414 +		aCreationData.iDriveData->AddL(aCreationData.iDllData);
  1.1415 +		CleanupStack::Pop(aCreationData.iDllData);
  1.1416 +		}
  1.1417 +
  1.1418 +	if (!aCreationData.iInterfaceData)
  1.1419 +		{
  1.1420 +		aCreationData.iInterfaceData = CRegistryData::CInterfaceData::NewLC(
  1.1421 +			aCreationData.iInterfaceUid, aCreationData.iDllData);
  1.1422 +		aCreationData.iDllData->AddL(aCreationData.iInterfaceData);
  1.1423 +		CleanupStack::Pop(aCreationData.iInterfaceData);
  1.1424 +		}
  1.1425 +
  1.1426 +	HBufC* name = aCreationData.iImplDisplayName.AllocLC();
  1.1427 +	HBufC8* dataType = aCreationData.iImplDataType.AllocLC();
  1.1428 +	HBufC8* opaqueData = aCreationData.iImplOpaqueData.AllocLC();
  1.1429 +
  1.1430 +	aCreationData.iImplData = CRegistryData::CImplementationData::NewL(
  1.1431 +		aCreationData.iInterfaceData,
  1.1432 +		aCreationData.iImplUid,
  1.1433 +		aCreationData.iImplVersion,
  1.1434 +		name,
  1.1435 +		dataType,
  1.1436 +		opaqueData,
  1.1437 +		aCreationData.iDriveUnit,
  1.1438 +		aCreationData.iRomOnly,
  1.1439 +		aCreationData.iRomBased);
  1.1440 +
  1.1441 +	CleanupStack::Pop(opaqueData);
  1.1442 +	CleanupStack::Pop(dataType);
  1.1443 +	CleanupStack::Pop(name);
  1.1444 +
  1.1445 +	CleanupStack::PushL(aCreationData.iImplData);
  1.1446 +	aCreationData.iInterfaceData->AddL(aCreationData.iImplData);
  1.1447 +	CleanupStack::Pop(aCreationData.iImplData);
  1.1448 +	}
  1.1449 +
  1.1450 +
  1.1451 +/**
  1.1452 +@SYMTestCaseID			SYSLIB-ECOM-CT-0290
  1.1453 +@SYMTestCaseDesc		Unit tests for CRegistryData::CImplementationData
  1.1454 +@SYMTestPriority			High
  1.1455 +@SYMTestActions			Create instances using NewLC and NewL. Check that the parent supplied is
  1.1456 +						correctly set.
  1.1457 +						Externalize instance created by NewL.
  1.1458 +						Internalize data set by previous step. Check implementation data is identical.
  1.1459 +						Check compare uid returns correct values.
  1.1460 +						Check for no crash and memory leaks.
  1.1461 +@SYMTestExpectedResults	The test must not fail.
  1.1462 +@SYMPREQ				PREQ277
  1.1463 +*/
  1.1464 +void  CRegistryDataTest::ImplementationDataTestL()
  1.1465 +	{
  1.1466 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0290 "));
  1.1467 +	// Set up for heap leak checking
  1.1468 +	__UHEAP_MARK;
  1.1469 +
  1.1470 +	// and leaking thread handles
  1.1471 +	TInt startProcessHandleCount;
  1.1472 +	TInt startThreadHandleCount;
  1.1473 +	TInt endProcessHandleCount;
  1.1474 +	TInt endThreadHandleCount;
  1.1475 +
  1.1476 +	// Test Starts...
  1.1477 +	RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
  1.1478 +
  1.1479 +	// Test Data
  1.1480 +	TUid testImplUid;
  1.1481 +	testImplUid.iUid = KCExampleInterfaceUid.iUid;
  1.1482 +	TInt testImplVersion = 2;
  1.1483 +	_LIT(KTestImplName, "Implementation");
  1.1484 +	_LIT8(KTestImplDataType, "Data Type");
  1.1485 +	_LIT8(KTestImplOpaqueData, "Opaque Data");
  1.1486 +	TUid testExtendedInterfaceUid1;
  1.1487 +	TUid testExtendedInterfaceUid2;
  1.1488 +	testExtendedInterfaceUid1.iUid = 0x10009E44;
  1.1489 +	testExtendedInterfaceUid2.iUid = 0x10009E45;
  1.1490 +
  1.1491 +	TDriveUnit testImplDrive = EDriveC;
  1.1492 +	TBool testImplRomOnly = ETrue;
  1.1493 +	TBool testImplRomBased = EFalse;
  1.1494 +
  1.1495 +	CRegistryData* registryData = CRegistryData::NewL(TheFs);
  1.1496 +	CleanupStack::PushL(registryData);
  1.1497 +	CRegistryData::CDriveData* driveData = CRegistryData::CDriveData::NewLC(testImplDrive, registryData);
  1.1498 +	CRegistryData::CDllData* dllData = CRegistryData::CDllData::NewLC(driveData);
  1.1499 +	CRegistryData::CInterfaceData* interfaceData = CRegistryData::CInterfaceData::NewLC(dllData);
  1.1500 +
  1.1501 +	// Start tests...
  1.1502 +	// NewLC test
  1.1503 +	CRegistryData::CImplementationData* implementation1;
  1.1504 +	implementation1 = CRegistryData::CImplementationData::NewLC(interfaceData);
  1.1505 +	TEST(interfaceData == implementation1->iParent);
  1.1506 +
  1.1507 +	// NewL test
  1.1508 +	HBufC* name = KTestImplName().AllocLC();
  1.1509 +	HBufC8* dataType = KTestImplDataType().AllocLC();
  1.1510 +	HBufC8* opaqueData = KTestImplOpaqueData().AllocLC();
  1.1511 +
  1.1512 +	RArray<TUid>* extendedInterfaces = new(ELeave) RArray<TUid>;
  1.1513 +
  1.1514 +	CleanupStack::PushL(TCleanupItem(CloseAndDeleteArray, extendedInterfaces));
  1.1515 +
  1.1516 +	CRegistryData::CImplementationData* implementation2;
  1.1517 +	implementation2 = CRegistryData::CImplementationData::NewL(interfaceData,
  1.1518 +															testImplUid,
  1.1519 +															testImplVersion,
  1.1520 +															name,
  1.1521 +															dataType,
  1.1522 +															opaqueData,
  1.1523 +															testImplDrive,
  1.1524 +															testImplRomOnly,
  1.1525 +															testImplRomBased,
  1.1526 +															extendedInterfaces);
  1.1527 +
  1.1528 +	CleanupStack::Pop(extendedInterfaces);
  1.1529 +	CleanupStack::Pop(opaqueData);
  1.1530 +	CleanupStack::Pop(dataType);
  1.1531 +	CleanupStack::Pop(name);
  1.1532 +
  1.1533 +	CleanupStack::PushL(implementation2);
  1.1534 +	TEST(interfaceData == implementation1->iParent);
  1.1535 +
  1.1536 +	//Add extended interface
  1.1537 +	implementation2->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid1);
  1.1538 +	implementation2->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid2);
  1.1539 +
  1.1540 +	// Externalize test
  1.1541 +	_LIT(KFileName,"c:\\ecomimpldata.dat");
  1.1542 +	RFile file;
  1.1543 +	TFileName fileName(KFileName);
  1.1544 +	TEST2(file.Replace(TheFs,fileName,EFileWrite|EFileRead), KErrNone);
  1.1545 +	RFileBuf buf;
  1.1546 +	CleanupClosePushL(buf);
  1.1547 +	buf.Attach(file);
  1.1548 +	RWriteStream stream(&buf);
  1.1549 +
  1.1550 +	implementation2->ExternalizeL(stream);
  1.1551 +	buf.SynchL();
  1.1552 +	CleanupStack::PopAndDestroy(&buf);
  1.1553 +
  1.1554 +	// Internalize test
  1.1555 +	TInt err = file.Open(TheFs,fileName,EFileRead);
  1.1556 +	TEST2(err, KErrNone);
  1.1557 +	RFileBuf buf2;
  1.1558 +	CleanupClosePushL(buf2);
  1.1559 +	buf2.Attach(file);
  1.1560 +	RReadStream stream2(&buf2);
  1.1561 +
  1.1562 +	implementation1->InternalizeL(stream2);
  1.1563 +
  1.1564 +	TEST(implementation1->iImplInfo->ImplementationUid().Uid == testImplUid.Uid);
  1.1565 +	TEST(implementation1->iImplInfo->Version() == testImplVersion);
  1.1566 +	TEST2(KErrNone, name->Compare(implementation1->iImplInfo->DisplayName()));
  1.1567 +	TEST2(KErrNone, dataType->Compare(implementation1->iImplInfo->DataType()));
  1.1568 +	TEST2(KErrNone, opaqueData->Compare(implementation1->iImplInfo->OpaqueData()));
  1.1569 +	TEST(implementation1->iImplInfo->Drive() == testImplDrive);
  1.1570 +	TEST(implementation1->iImplInfo->RomOnly() == testImplRomOnly);
  1.1571 +	TEST(implementation1->iImplInfo->RomBased() == testImplRomBased);
  1.1572 +	//Get extended interface and check
  1.1573 +	RArray<TUid>* extendedInterfaceList = implementation1->iImplInfo->GetExtendedInterfaceList();
  1.1574 +	TEST((*extendedInterfaceList)[0] == testExtendedInterfaceUid1);
  1.1575 +	TEST((*extendedInterfaceList)[1] == testExtendedInterfaceUid2);
  1.1576 +
  1.1577 +	CleanupStack::PopAndDestroy(&buf2);
  1.1578 +
  1.1579 +	// Setup data for Compare Implementation Uid
  1.1580 +	name = KTestImplName().AllocLC();
  1.1581 +	dataType = KTestImplDataType().AllocLC();
  1.1582 +	opaqueData = KTestImplOpaqueData().AllocLC();
  1.1583 +	TUid compareTestImplUid;
  1.1584 +	compareTestImplUid.iUid = 0x10009DC3;
  1.1585 +	CRegistryData::CImplementationData* implementation3;
  1.1586 +	implementation3 = CRegistryData::CImplementationData::NewL(interfaceData,
  1.1587 +															compareTestImplUid,
  1.1588 +															testImplVersion,
  1.1589 +															name,
  1.1590 +															dataType,
  1.1591 +															opaqueData,
  1.1592 +															testImplDrive,
  1.1593 +															testImplRomOnly,
  1.1594 +															testImplRomBased);
  1.1595 +	CleanupStack::Pop(opaqueData);
  1.1596 +	CleanupStack::Pop(dataType);
  1.1597 +	CleanupStack::Pop(name);
  1.1598 +
  1.1599 +	CleanupStack::PushL(implementation3);
  1.1600 +	TEST(interfaceData == implementation3->iParent);
  1.1601 +
  1.1602 +	// Compare Implementation Uid test
  1.1603 +	TEST(CRegistryData::CImplementationData::CompareImplUid(*implementation3, *implementation2) > 0);
  1.1604 +	TEST(CRegistryData::CImplementationData::CompareImplUid(*implementation1, *implementation3) < 0);
  1.1605 +	TEST(CRegistryData::CImplementationData::CompareImplUid(*implementation3, *implementation3) == 0);
  1.1606 +
  1.1607 +	// Tidy up
  1.1608 +	CleanupStack::PopAndDestroy(7, registryData);
  1.1609 +	TheFs.Delete(KFileName);
  1.1610 +
  1.1611 +// Check for open handles
  1.1612 +	RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
  1.1613 +	TEST(startThreadHandleCount == endThreadHandleCount);
  1.1614 +
  1.1615 +	// Test Ends...
  1.1616 +	__UHEAP_MARKEND;
  1.1617 +	}
  1.1618 +
  1.1619 +/**
  1.1620 +@SYMTestCaseID			SYSLIB-ECOM-CT-0291
  1.1621 +@SYMTestCaseDesc		Tests for CRegistryData::InsertIntoIndexRemoveFromIndexTestL
  1.1622 +						See CR65BCA3.
  1.1623 +@SYMTestPriority			High
  1.1624 +@SYMTestActions			Create 2 identical implementations, 1 for the Z drive and 1 for the C drive,
  1.1625 +						including parents and add to the registry.
  1.1626 +						Create a 3rd identical implementation, except for the name, for the C drive.
  1.1627 +						Check there are no implementations in the Implementation Index List.
  1.1628 +						Insert the Z implementations into the Implementation Index List and check.
  1.1629 +						Insert the 1st C implementation with security check on and check the upgrade
  1.1630 +						took place.
  1.1631 +						Remove the implementation. Check.
  1.1632 +						Add the Z drive implementation. Check.
  1.1633 +						Insert the 1st C implementation with security check off and check the upgrade
  1.1634 +						took place.
  1.1635 +						Remove the implementation. Check.
  1.1636 +						Add the Z drive implementation. Check.
  1.1637 +						Insert the 2nd C implementation with security check on and check the upgrade
  1.1638 +						did not take place.
  1.1639 +						Insert the 2nd C implementation with security check off and check the upgrade
  1.1640 +						did took place.
  1.1641 +						Remove the implementation. Check.
  1.1642 +						Check for no crash and memory leaks.
  1.1643 +@SYMTestExpectedResults	The test must not fail.
  1.1644 +@SYMPREQ				PREQ277
  1.1645 +*/
  1.1646 +void  CRegistryDataTest::InsertIntoIndexRemoveFromIndexTestL()
  1.1647 +	{
  1.1648 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0291 "));
  1.1649 +	_LIT(KTestImplName, "Implementation");
  1.1650 +	_LIT8(KTestImplDataType, "Data Type");
  1.1651 +	_LIT8(KTestImplOpaqueData, "Opaque Data");
  1.1652 +
  1.1653 +	// create Z drive data
  1.1654 +	TDriveUnit implDriveZ = EDriveZ;
  1.1655 +	CRegistryData::CDriveData* driveDataZ = CRegistryData::CDriveData::NewLC(implDriveZ,  iRegistryData);
  1.1656 +	iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataZ);
  1.1657 +	CleanupStack::Pop(driveDataZ);
  1.1658 +
  1.1659 +	// Create Implementation 1 on Z drive
  1.1660 +	_LIT(KEComUpgradeExample1OnZ,		"Z:\\sys\\bin\\EComUpgradeExampleOne.dll");
  1.1661 +	TEntry upgradeExample1OnZ;
  1.1662 +	upgradeExample1OnZ.iName = KEComUpgradeExample1OnZ;
  1.1663 +	TParse fileparse;
  1.1664 +	fileparse.Set(KEComUpgradeExample1OnZ,NULL,NULL);
  1.1665 +
  1.1666 +	CRegistryData::CDllData* dllDataZ = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),upgradeExample1OnZ.iModified,KNullUid, KNullUid, driveDataZ);
  1.1667 +	dllDataZ->iSecurityChecked = ETrue;
  1.1668 +	driveDataZ->AddL(dllDataZ);
  1.1669 +	CleanupStack::Pop(dllDataZ);
  1.1670 +	CRegistryData::CInterfaceData* interfaceDataZ = CRegistryData::CInterfaceData::NewLC(iInterfaceUid, dllDataZ);
  1.1671 +	dllDataZ->AddL(interfaceDataZ);
  1.1672 +	CleanupStack::Pop(interfaceDataZ);
  1.1673 +	HBufC* name = KTestImplName().AllocLC();
  1.1674 +	HBufC8* dataType = KTestImplDataType().AllocLC();
  1.1675 +	HBufC8* opaqueData = KTestImplOpaqueData().AllocLC();
  1.1676 +
  1.1677 +	CRegistryData::CImplementationData* implementation1;
  1.1678 +	implementation1 = CRegistryData::CImplementationData::NewL(interfaceDataZ,
  1.1679 +															iImplementationUid,
  1.1680 +															1,
  1.1681 +															name,
  1.1682 +															dataType,
  1.1683 +															opaqueData,
  1.1684 +															implDriveZ,
  1.1685 +															EFalse,
  1.1686 +															EFalse);
  1.1687 +	CleanupStack::Pop(opaqueData);
  1.1688 +	CleanupStack::Pop(dataType);
  1.1689 +	CleanupStack::Pop(name);
  1.1690 +	CleanupStack::PushL(implementation1);
  1.1691 +	interfaceDataZ->AddL(implementation1);
  1.1692 +	CleanupStack::Pop(implementation1);
  1.1693 +
  1.1694 +	// create C drive data
  1.1695 +	TDriveUnit implDriveC = EDriveC;
  1.1696 +	CRegistryData::CDriveData* driveDataC = CRegistryData::CDriveData::NewLC(implDriveC,  iRegistryData);
  1.1697 +	iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataC);
  1.1698 +	CleanupStack::Pop(driveDataC);
  1.1699 +
  1.1700 +	// Create Implementation 1 on C drive
  1.1701 +	_LIT(KEComUpgradeExample1OnC,		"C:\\sys\\bin\\EComUpgradeExampleOne.dll");
  1.1702 +	TEntry upgradeExample1OnC;
  1.1703 +	upgradeExample1OnC.iName = KEComUpgradeExample1OnC;
  1.1704 +	fileparse.Set(KEComUpgradeExample1OnC,NULL,NULL);
  1.1705 +
  1.1706 +	CRegistryData::CDllData* dllDataC1 = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),upgradeExample1OnC.iModified,KNullUid, KNullUid, driveDataC);
  1.1707 +	dllDataC1->iSecurityChecked = ETrue;
  1.1708 +	driveDataC->AddL(dllDataC1);
  1.1709 +	CleanupStack::Pop(dllDataC1);
  1.1710 +	CRegistryData::CInterfaceData* interfaceDataC1 = CRegistryData::CInterfaceData::NewLC(iInterfaceUid, dllDataC1);
  1.1711 +	dllDataC1->AddL(interfaceDataC1);
  1.1712 +	CleanupStack::Pop(interfaceDataC1);
  1.1713 +	name = KTestImplName().AllocLC();
  1.1714 +	dataType = KTestImplDataType().AllocLC();
  1.1715 +	opaqueData = KTestImplOpaqueData().AllocLC();
  1.1716 +
  1.1717 +	CRegistryData::CImplementationData* implementation2;
  1.1718 +	implementation2 = CRegistryData::CImplementationData::NewL(interfaceDataC1,
  1.1719 +															iImplementationUid,
  1.1720 +															2,
  1.1721 +															name,
  1.1722 +															dataType,
  1.1723 +															opaqueData,
  1.1724 +															implDriveC,
  1.1725 +															EFalse,
  1.1726 +															EFalse);
  1.1727 +	CleanupStack::Pop(opaqueData);
  1.1728 +	CleanupStack::Pop(dataType);
  1.1729 +	CleanupStack::Pop(name);
  1.1730 +	CleanupStack::PushL(implementation2);
  1.1731 +	interfaceDataC1->AddL(implementation2);
  1.1732 +	CleanupStack::Pop(implementation2);
  1.1733 +
  1.1734 +	// Create Implementation 2 on C drive
  1.1735 +	_LIT(KEComUpgradeExample2OnC,		"C:\\sys\\bin\\EComUpgradeExampleTwo.dll");
  1.1736 +	TEntry upgradeExample2OnC;
  1.1737 +	upgradeExample2OnC.iName = KEComUpgradeExample2OnC;
  1.1738 +	fileparse.Set(KEComUpgradeExample2OnC,NULL,NULL);
  1.1739 +
  1.1740 +	CRegistryData::CDllData* dllDataC2 = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),upgradeExample2OnC.iModified,KNullUid,KNullUid, driveDataC);
  1.1741 +	dllDataC2->iSecurityChecked = ETrue;
  1.1742 +	driveDataC->AddL(dllDataC2);
  1.1743 +	CleanupStack::Pop(dllDataC2);
  1.1744 +	CRegistryData::CInterfaceData* interfaceDataC2 = CRegistryData::CInterfaceData::NewLC(iInterfaceUid, dllDataC2);
  1.1745 +	dllDataC2->AddL(interfaceDataC2);
  1.1746 +	CleanupStack::Pop(interfaceDataC2);
  1.1747 +	name = KTestImplName().AllocLC();
  1.1748 +	dataType = KTestImplDataType().AllocLC();
  1.1749 +	opaqueData = KTestImplOpaqueData().AllocLC();
  1.1750 +
  1.1751 +	CRegistryData::CImplementationData* implementation3;
  1.1752 +	implementation3 = CRegistryData::CImplementationData::NewL(interfaceDataC2,
  1.1753 +															iImplementationUid,
  1.1754 +															2,
  1.1755 +															name,
  1.1756 +															dataType,
  1.1757 +															opaqueData,
  1.1758 +															implDriveC,
  1.1759 +															EFalse,
  1.1760 +															EFalse);
  1.1761 +	CleanupStack::Pop(opaqueData);
  1.1762 +	CleanupStack::Pop(dataType);
  1.1763 +	CleanupStack::Pop(name);
  1.1764 +	CleanupStack::PushL(implementation3);
  1.1765 +	interfaceDataC2->AddL(implementation3);
  1.1766 +	CleanupStack::Pop(implementation3);
  1.1767 +
  1.1768 +//===========================================================================
  1.1769 +
  1.1770 +	// Check index is empty
  1.1771 +	TEST(iStateAccessor->ImplementationsCount(*iRegistryData) == 0);
  1.1772 +
  1.1773 +//===========================================================================
  1.1774 +
  1.1775 +	// Add Implementation from Z drive to index
  1.1776 +	TBool result = iRegistryData->InsertIntoIndexL(implementation1, ETrue);
  1.1777 +	TEST2(result, ETrue);
  1.1778 +
  1.1779 +	RImplDataArray impls;
  1.1780 +	CleanupClosePushL(impls);
  1.1781 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1782 +	TEST(impls.Count() == 1);
  1.1783 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.1784 +
  1.1785 +//===========================================================================
  1.1786 +
  1.1787 +	// Add Implementation from C drive to index - this should upgrade existing implementation
  1.1788 +	result = iRegistryData->InsertIntoIndexL(implementation2, ETrue);
  1.1789 +	TEST2(result, ETrue);
  1.1790 +
  1.1791 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1792 +	TEST(impls.Count() == 1);
  1.1793 +	TEST(impls[0]->iImplInfo->Drive() == implDriveC);
  1.1794 +
  1.1795 +//===========================================================================
  1.1796 +
  1.1797 +	// remove existing implementation which causes rollback to Z drive impl
  1.1798 +	iRegistryData->RemoveFromIndexL(dllDataC1);
  1.1799 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1800 +	TEST(impls.Count() == 1);
  1.1801 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.1802 +
  1.1803 +//===========================================================================
  1.1804 +
  1.1805 +	// Add Implementation from C drive to index - this should upgrade existing implementation
  1.1806 +	result = iRegistryData->InsertIntoIndexL(implementation2, EFalse);
  1.1807 +	TEST2(result, ETrue);
  1.1808 +
  1.1809 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1810 +	TEST(impls.Count() == 1);
  1.1811 +	TEST(impls[0]->iImplInfo->Drive() == implDriveC);
  1.1812 +//===========================================================================
  1.1813 +
  1.1814 +	// remove existing implementation which causes rollback to Z drive impl
  1.1815 +	iRegistryData->RemoveFromIndexL(dllDataC1);
  1.1816 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1817 +	TEST(impls.Count() == 1);
  1.1818 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.1819 +//===========================================================================
  1.1820 +
  1.1821 +	// Add Implementation with different name from C drive to index
  1.1822 +	// this should NOT upgrade existing implementation
  1.1823 +	result = iRegistryData->InsertIntoIndexL(implementation3, ETrue);
  1.1824 +	TEST2(result, EFalse);
  1.1825 +
  1.1826 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1827 +	TEST(impls.Count() == 1);
  1.1828 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.1829 +//===========================================================================
  1.1830 +
  1.1831 +	// Add Implementation with different name from C drive to index
  1.1832 +	// this should upgrade existing implementation as security check is OFF
  1.1833 +	result = iRegistryData->InsertIntoIndexL(implementation3, EFalse);
  1.1834 +	TEST2(result, ETrue);
  1.1835 +
  1.1836 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1837 +	TEST(impls.Count() == 1);
  1.1838 +	TEST(impls[0]->iImplInfo->Drive() == implDriveC);
  1.1839 +//===========================================================================
  1.1840 +
  1.1841 +	// remove existing implementation which causes rollback to Z drive impl
  1.1842 +	iRegistryData->RemoveFromIndexL(dllDataC2);
  1.1843 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1844 +	TEST(impls.Count() == 1);
  1.1845 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.1846 +	CleanupStack::PopAndDestroy(&impls);
  1.1847 +	}
  1.1848 +
  1.1849 +/**
  1.1850 +Test case for Defect ECOM Index must rollback	to original Impl. if upgrade impl. is removed
  1.1851 +
  1.1852 +@SYMTestCaseID			SYSLIB-ECOM-CT-1373
  1.1853 +@SYMTestCaseDesc		Test case for defect number DEF065559 ECOM Index must rollback
  1.1854 +						to original Impl. if upgrade impl. is removed.
  1.1855 +@SYMTestPriority			High
  1.1856 +@SYMTestActions			Create 3 identical implementations, 1 for the Z drive, 1 for the C drive and
  1.1857 +						1 for the D drive, including parents and add to the registry.
  1.1858 +						Insert the Z implementation and check.
  1.1859 +						Insert the C implementation and check the upgrade took place.
  1.1860 +						Insert the D implementation and check the upgrade took place.
  1.1861 +						Remove the D implementation and check rollback to C occurred.
  1.1862 +						Remove the C implementation and check rollback to Z occurred.
  1.1863 +						Insert the C implementation and check the upgrade took place.
  1.1864 +						Insert the D implementation and check the upgrade took place.
  1.1865 +						Remove the C implementation and check no rollback occurred. i.e D impl available
  1.1866 +						Remove the D implementation and check rollback to Z occurred.
  1.1867 +						Insert the D implementation and check the upgrade took place.
  1.1868 +						Insert the C implementation and check no upgrade took place. i.e D impl available
  1.1869 +						Remove the D implementation and check rollback to C occurred.
  1.1870 +						Remove the C implementation and check rollback to Z occurred.
  1.1871 +						Check for no crash and memory leaks.
  1.1872 +@SYMTestExpectedResults	The test must not fail.
  1.1873 +@SYMDEF				DEF065559
  1.1874 +*/
  1.1875 +void  CRegistryDataTest::RollbackTestL()
  1.1876 +	{
  1.1877 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1373 "));
  1.1878 +	_LIT(KTestImplName, "Implementation");
  1.1879 +	_LIT8(KTestImplDataType, "Data Type");
  1.1880 +	_LIT8(KTestImplOpaqueData, "Opaque Data");
  1.1881 +
  1.1882 +	// Create Implementation 1 on Z drive
  1.1883 +	_LIT(KEComUpgradeExample1OnZ,		"Z:\\sys\\bin\\EComUpgradeExampleOne.dll");
  1.1884 +	TImplCreationStruct zDllData(EDriveZ,
  1.1885 +								iInterfaceUid,
  1.1886 +								iImplementationUid,
  1.1887 +								KEComUpgradeExample1OnZ,
  1.1888 +								KTestImplName,
  1.1889 +								KTestImplDataType,
  1.1890 +								KTestImplOpaqueData,
  1.1891 +								1,
  1.1892 +								ETrue,  // Z: is ROMBased
  1.1893 +								EFalse);
  1.1894 +	CreateImplL(zDllData);
  1.1895 +
  1.1896 +	// Create Implementation 1 on C drive
  1.1897 +	_LIT(KEComUpgradeExample1OnC,		"C:\\sys\\bin\\EComUpgradeExampleOne.dll");
  1.1898 +	TImplCreationStruct cDllData(EDriveC,
  1.1899 +								iInterfaceUid,
  1.1900 +								iImplementationUid,
  1.1901 +								KEComUpgradeExample1OnC,
  1.1902 +								KTestImplName,
  1.1903 +								KTestImplDataType,
  1.1904 +								KTestImplOpaqueData,
  1.1905 +								2);
  1.1906 +	CreateImplL(cDllData);
  1.1907 +
  1.1908 +	// create drive data on third drive.
  1.1909 +
  1.1910 +	// find a valid drive which is not Z and not C.
  1.1911 +	TEComCachedDriveInfoIterator iter(*iRegistryData->iCachedDriveInfo);
  1.1912 +	iter.Last(); // positioned at Z:
  1.1913 +	iter.Prev(); // the drive before Z:
  1.1914 +	for (; iter.InRange(); iter.Prev())
  1.1915 +		{
  1.1916 +		if (iter.DriveNumber() != EDriveC)
  1.1917 +			{
  1.1918 +			break;
  1.1919 +			}
  1.1920 +		}
  1.1921 +
  1.1922 +	TEST(iter.InRange() && iter.DriveNumber() != EDriveC);
  1.1923 +
  1.1924 +	TDriveName drvName = iter.DriveUnit().Name();
  1.1925 +
  1.1926 +	_LIT(KEComUpgradeExample1On3,		"_:\\sys\\bin\\EComUpgradeExampleOne.dll");
  1.1927 +	TBuf<36> dllName3(KEComUpgradeExample1On3);
  1.1928 +	dllName3[0] = drvName[0];
  1.1929 +	TImplCreationStruct thirdDllData(iter.DriveNumber(),
  1.1930 +									iInterfaceUid,
  1.1931 +									iImplementationUid,
  1.1932 +									dllName3,
  1.1933 +									KTestImplName,
  1.1934 +									KTestImplDataType,
  1.1935 +									KTestImplOpaqueData,
  1.1936 +									3);
  1.1937 +	CreateImplL(thirdDllData);
  1.1938 +//===========================================================================
  1.1939 +
  1.1940 +	// Check index is empty
  1.1941 +	TEST(iStateAccessor->ImplementationsCount(*iRegistryData) == 0);
  1.1942 +
  1.1943 +//===========================================================================
  1.1944 +	TDriveUnit implDriveZ = EDriveZ;
  1.1945 +	TDriveUnit implDriveC = EDriveC;
  1.1946 +
  1.1947 +	// Add Implementation from Z drive to index
  1.1948 +	TBool result = iRegistryData->InsertIntoIndexL(zDllData.iImplData, ETrue);
  1.1949 +	TEST2(result, ETrue);
  1.1950 +
  1.1951 +	RImplDataArray impls;
  1.1952 +	CleanupClosePushL(impls);
  1.1953 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1954 +	TEST(impls.Count() == 1);
  1.1955 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.1956 +
  1.1957 +//===========================================================================
  1.1958 +
  1.1959 +	// Add Implementation from C drive to index - this should upgrade existing implementation
  1.1960 +	result = iRegistryData->InsertIntoIndexL(cDllData.iImplData, ETrue);
  1.1961 +	TEST2(result, ETrue);
  1.1962 +
  1.1963 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1964 +	TEST(impls.Count() == 1);
  1.1965 +	TEST(impls[0]->iImplInfo->Drive() == implDriveC);
  1.1966 +
  1.1967 +//===========================================================================
  1.1968 +
  1.1969 +	// Add Implementation from third drive to index - this should upgrade existing implementation
  1.1970 +	result = iRegistryData->InsertIntoIndexL(thirdDllData.iImplData, ETrue);
  1.1971 +	TEST2(result, ETrue);
  1.1972 +
  1.1973 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1974 +	TEST(impls.Count() == 1);
  1.1975 +	TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
  1.1976 +
  1.1977 +//===========================================================================
  1.1978 +
  1.1979 +	// remove implementation from third drive which causes rollback to C drive impl
  1.1980 +	iRegistryData->RemoveFromIndexL(thirdDllData.iDllData);
  1.1981 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1982 +	TEST(impls.Count() == 1);
  1.1983 +	TEST(impls[0]->iImplInfo->Drive() == implDriveC);
  1.1984 +
  1.1985 +//===========================================================================
  1.1986 +
  1.1987 +	// remove implementation from C which causes rollback to Z drive impl
  1.1988 +	iRegistryData->RemoveFromIndexL(cDllData.iDllData);
  1.1989 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.1990 +	TEST(impls.Count() == 1);
  1.1991 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.1992 +
  1.1993 +//===========================================================================
  1.1994 +
  1.1995 +	// Add Implementation from C drive to index - this should upgrade existing implementation
  1.1996 +	result = iRegistryData->InsertIntoIndexL(cDllData.iImplData, ETrue);
  1.1997 +	TEST2(result, ETrue);
  1.1998 +
  1.1999 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2000 +	TEST(impls.Count() == 1);
  1.2001 +	TEST(impls[0]->iImplInfo->Drive() == implDriveC);
  1.2002 +
  1.2003 +//===========================================================================
  1.2004 +
  1.2005 +	// Add Implementation from third drive to index - this should upgrade existing implementation
  1.2006 +	result = iRegistryData->InsertIntoIndexL(thirdDllData.iImplData, ETrue);
  1.2007 +	TEST2(result, ETrue);
  1.2008 +
  1.2009 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2010 +	TEST(impls.Count() == 1);
  1.2011 +	TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
  1.2012 +
  1.2013 +//===========================================================================
  1.2014 +
  1.2015 +	// remove implementation from C which should cause no rollback
  1.2016 +	iRegistryData->RemoveFromIndexL(cDllData.iDllData);
  1.2017 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2018 +	TEST(impls.Count() == 1);
  1.2019 +	TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
  1.2020 +
  1.2021 +//===========================================================================
  1.2022 +
  1.2023 +	// remove implementation from third drive which causes rollback to Z drive impl
  1.2024 +	iRegistryData->RemoveFromIndexL(thirdDllData.iDllData);
  1.2025 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2026 +	TEST(impls.Count() == 1);
  1.2027 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.2028 +
  1.2029 +//===========================================================================
  1.2030 +
  1.2031 +	// Add Implementation from third drive to index - this should upgrade existing implementation
  1.2032 +	result = iRegistryData->InsertIntoIndexL(thirdDllData.iImplData, ETrue);
  1.2033 +	TEST2(result, ETrue);
  1.2034 +
  1.2035 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2036 +	TEST(impls.Count() == 1);
  1.2037 +	TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
  1.2038 +
  1.2039 +//===========================================================================
  1.2040 +
  1.2041 +	// Add Implementation from C drive to index - this should not upgrade existing implementation
  1.2042 +	result = iRegistryData->InsertIntoIndexL(cDllData.iImplData, ETrue);
  1.2043 +	TEST2(result, ETrue);
  1.2044 +
  1.2045 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2046 +	TEST(impls.Count() == 1);
  1.2047 +	TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
  1.2048 +
  1.2049 +//===========================================================================
  1.2050 +
  1.2051 +	// remove implementation from third drive which causes rollback to C drive impl
  1.2052 +	iRegistryData->RemoveFromIndexL(thirdDllData.iDllData);
  1.2053 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2054 +	TEST(impls.Count() == 1);
  1.2055 +	TEST(impls[0]->iImplInfo->Drive() == implDriveC);
  1.2056 +
  1.2057 +//===========================================================================
  1.2058 +
  1.2059 +	// remove implementation from C which causes rollback to Z drive impl
  1.2060 +	iRegistryData->RemoveFromIndexL(cDllData.iDllData);
  1.2061 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
  1.2062 +	TEST(impls.Count() == 1);
  1.2063 +	TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
  1.2064 +	CleanupStack::PopAndDestroy(&impls);
  1.2065 +	}
  1.2066 +
  1.2067 +/**
  1.2068 +@SYMTestCaseID          SYSLIB-ECOM-CT-0737
  1.2069 +@SYMTestCaseDesc	    Tests the creation and deletion of CRegistryData
  1.2070 +@SYMTestPriority 	    High
  1.2071 +@SYMTestActions  	    Create and delete CRegistryData object,checks for open handles
  1.2072 +@SYMTestExpectedResults The test must not fail.
  1.2073 +@SYMREQ                 REQ0000
  1.2074 +*/
  1.2075 +LOCAL_C void CreateDeleteTestL()
  1.2076 +	{
  1.2077 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0737 Create and Delete Test "));
  1.2078 +	// Set up for heap leak checking
  1.2079 +	__UHEAP_MARK;
  1.2080 +
  1.2081 +	// and leaking thread handles
  1.2082 +	TInt startProcessHandleCount;
  1.2083 +	TInt startThreadHandleCount;
  1.2084 +	TInt endProcessHandleCount;
  1.2085 +	TInt endThreadHandleCount;
  1.2086 +
  1.2087 +	// Test Starts...
  1.2088 +	RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
  1.2089 +
  1.2090 +	CRegistryDataTest* theTest = NULL;
  1.2091 +	// Create the object
  1.2092 +	TRAPD(err, theTest = CRegistryDataTest::NewL(EFalse));
  1.2093 +	TEST2(err, KErrNone);
  1.2094 +	// Delete the object
  1.2095 +	delete theTest;
  1.2096 +
  1.2097 +	// Check for open handles
  1.2098 +	RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
  1.2099 +	TEST(startThreadHandleCount == endThreadHandleCount);
  1.2100 +
  1.2101 +	// Test Ends...
  1.2102 +	__UHEAP_MARKEND;
  1.2103 +	}
  1.2104 +
  1.2105 +/**
  1.2106 +@SYMTestCaseID          SYSLIB-ECOM-UT-3572
  1.2107 +@SYMTestCaseDesc	    Tests for CRegistryData::UpdateDllDataL() function when an existing registered
  1.2108 +						PLUGIN3 is downgraded with an updated PLUGIN1 resource file.
  1.2109 +@SYMTestPriority 	    High
  1.2110 +@SYMTestActions  	    Update the data for a dll in the registry.
  1.2111 +                        Tests for OOM error.
  1.2112 +@SYMTestExpectedResults The data for the dll in the registry is updated.
  1.2113 +@SYMEC                  EC43
  1.2114 +*/
  1.2115 +void CRegistryDataTest::UpdateDllDataTest3L()
  1.2116 +	{
  1.2117 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3572 "));
  1.2118 +	// Checks if drive is registered
  1.2119 +	TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
  1.2120 +	CRegistryData::CDriveData* driveData = NULL;
  1.2121 +	// Fetches index of drive, in iFoundDriveIndex
  1.2122 +	iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
  1.2123 +
  1.2124 +	TEntry dllEntry;
  1.2125 +	TUid example12ThirdUid = {0x10009E3E};
  1.2126 +	dllEntry.iType = TUidType(KNullUid, KNullUid, example12ThirdUid);
  1.2127 +	dllEntry.iName = KEComExample12DllOnC;
  1.2128 +	dllEntry.iModified.HomeTime();
  1.2129 +
  1.2130 +	TBool registered = EFalse;
  1.2131 +
  1.2132 +	registered = iRegistryData->IsRegisteredWithDate(
  1.2133 +										 dllEntry[2],
  1.2134 +										 dllEntry.iModified,
  1.2135 +										 iUpdate,
  1.2136 +										 driveData);
  1.2137 +	TEST(registered);
  1.2138 +	// Log message if implementations need update
  1.2139 +	if (!iUpdate)
  1.2140 +		{
  1.2141 +		TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
  1.2142 +		}
  1.2143 +	//If the implementation needs an update, update it using UpdateDllDataL
  1.2144 +	else
  1.2145 +		{
  1.2146 +		TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
  1.2147 +		// Checks Implementation 0x10009E48 registered in the registry is version 1, display name is "Example 12 PlugIn3"
  1.2148 +		// A reference to the implementation entry in the registry
  1.2149 +		const TUid implementationUid = {0x10009E3C};
  1.2150 +		CRegistryData::CImplementationData*	implementationData = NULL;
  1.2151 +		TInt err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
  1.2152 +		TEST2(err,KErrNone);
  1.2153 +		CImplementationInformation* implementationInfo = implementationData->iImplInfo;
  1.2154 +		TEST(implementationInfo->Version() == 1);
  1.2155 +		TEST(implementationInfo->DisplayName().CompareF(_L("Example 12 PlugIn3"))==0);
  1.2156 +
  1.2157 +		// Dll Data object to be updated
  1.2158 +		CRegistryData::CDllData* updateDllData = NULL;
  1.2159 +		TParse fileparse;
  1.2160 +		fileparse.Set(dllEntry.iName,NULL,NULL);
  1.2161 +		updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
  1.2162 +
  1.2163 +		//Copies the downgraded resource file to C:
  1.2164 +		TRAP(err, EComTestUtils::FileManCopyFileL(KEcomExample12DowngradedOnZ, KEcomExample12DowngradedOnC));
  1.2165 +		TEST2(err, KErrNone);
  1.2166 +		//Creats the entry using downgraded resource file
  1.2167 +		TEntry rscBasedEntry;
  1.2168 +		rscBasedEntry.iName = KEcomExample12DowngradedResourceNameOnly;
  1.2169 +		TParse rscPath;
  1.2170 +		rscPath.Set(KEcomExample12DowngradedOnC,NULL,NULL);
  1.2171 +		CPluginBase* entryBase = NULL;
  1.2172 +		entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
  1.2173 +		CleanupStack::PushL(entryBase);
  1.2174 +		// Updates resource ext info
  1.2175 +		HBufC* resourceExt = entryBase->RscFileExt();
  1.2176 +		if(resourceExt)
  1.2177 +			{
  1.2178 +			updateDllData->SetResourceExtL(*resourceExt);
  1.2179 +			}
  1.2180 +		// parses the downgraded resource file
  1.2181 +		TInt error = KErrNone;
  1.2182 +		TRAP(error, iRegistrarAccessor->ParseL(*iRegistrar, entryBase, *updateDllData));
  1.2183 +		if (error == KErrNoMemory)
  1.2184 +			{
  1.2185 +			User::LeaveNoMemory();
  1.2186 +			}
  1.2187 +		CleanupStack::PopAndDestroy(entryBase);
  1.2188 +		TDriveUnit aDrive;
  1.2189 +		// Updates DLL data with a new dll data
  1.2190 +		TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
  1.2191 +		TEST_OOM_ERR;
  1.2192 +		TEST2(err, KErrNone);
  1.2193 +		CleanupStack::Pop(updateDllData);
  1.2194 +		// Checks registry data is updated with new data
  1.2195 +		// Implementation 0x10009E48 is downgraded from version 1 to version 0, display name is changed to "Example 12 PlugIn"
  1.2196 +		implementationData = NULL;
  1.2197 +		err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
  1.2198 +		TEST2(err,KErrNone);
  1.2199 +		implementationInfo = implementationData->iImplInfo;
  1.2200 +		TEST(implementationInfo->Version() == 0);
  1.2201 +		TEST(implementationInfo->DisplayName().CompareF(_L("Example 12 PlugIn")) == 0);
  1.2202 +		TheTest.Printf(_L("DLL data is updated \n"));
  1.2203 +		//deletes the downgraded resource file
  1.2204 +		TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12DowngradedOnC));
  1.2205 +		}
  1.2206 +	registered = iRegistryData->IsRegisteredWithDate(
  1.2207 +										 dllEntry[2],
  1.2208 +										 dllEntry.iModified,
  1.2209 +										 iUpdate,
  1.2210 +										 driveData);
  1.2211 +	TEST(registered);
  1.2212 +	TEST(!iUpdate);
  1.2213 +	}
  1.2214 +
  1.2215 +/**
  1.2216 +@SYMTestCaseID          SYSLIB-ECOM-UT-3571
  1.2217 +@SYMTestCaseDesc	    Tests for CRegistryData::UpdateDllDataL() function when an existing registered
  1.2218 +						PLUGIN1 is upgraded with an updated PLUGIN3 resource file.
  1.2219 +@SYMTestPriority 	    High
  1.2220 +@SYMTestActions  	    Update the data for a dll in the registry.
  1.2221 +                        Tests for OOM error.
  1.2222 +@SYMTestExpectedResults The data for the dll in the registry is updated.
  1.2223 +@SYMEC                  EC43
  1.2224 +*/
  1.2225 +void CRegistryDataTest::UpdateDllDataTest2L()
  1.2226 +	{
  1.2227 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3571 "));
  1.2228 +	// Checks if drive is registered
  1.2229 +	TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
  1.2230 +	CRegistryData::CDriveData* driveData = NULL;
  1.2231 +	// Fetches index of drive, in iFoundDriveIndex
  1.2232 +	iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
  1.2233 +
  1.2234 +	TEntry dllEntry;
  1.2235 +	TUid example14ThirdUid = {0x10009E40};
  1.2236 +	dllEntry.iType = TUidType(KNullUid, KNullUid, example14ThirdUid);
  1.2237 +	dllEntry.iName = KEComExample14DllOnC;
  1.2238 +	dllEntry.iModified.HomeTime();
  1.2239 +
  1.2240 +	TBool registered = EFalse;
  1.2241 +
  1.2242 +	registered = iRegistryData->IsRegisteredWithDate(
  1.2243 +										 dllEntry[2],
  1.2244 +										 dllEntry.iModified,
  1.2245 +										 iUpdate,
  1.2246 +										 driveData);
  1.2247 +	TEST(registered);
  1.2248 +	// Log message if implementations need update
  1.2249 +	if (!iUpdate)
  1.2250 +		{
  1.2251 +		TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
  1.2252 +		}
  1.2253 +	//If the implementation needs an update, update it using UpdateDllDataL
  1.2254 +	else
  1.2255 +		{
  1.2256 +		TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
  1.2257 +
  1.2258 +		// Checks Implementation 0x10009E48 registered in the registry is version 1, display name is "Example 14 PlugIn"
  1.2259 +		// A reference to the implementation entry in the registry
  1.2260 +		const TUid implementationUid = {0x10009E48};
  1.2261 +		CRegistryData::CImplementationData*	implementationData = NULL;
  1.2262 +		TInt err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
  1.2263 +		TEST2(err,KErrNone);
  1.2264 +		CImplementationInformation* implementationInfo = implementationData->iImplInfo;
  1.2265 +		TEST(implementationInfo->Version() == 1);
  1.2266 +		TEST(implementationInfo->DisplayName().CompareF(_L("Example 14 PlugIn"))==0);
  1.2267 +
  1.2268 +		// Dll Data object to be updated
  1.2269 +		CRegistryData::CDllData* updateDllData = NULL;
  1.2270 +		TParse fileparse;
  1.2271 +		fileparse.Set(dllEntry.iName,NULL,NULL);
  1.2272 +		updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
  1.2273 +
  1.2274 +		//copies the upgraded resource file to C:
  1.2275 +		TRAP(err, EComTestUtils::FileManCopyFileL(KEcomExample14UpgradedOnZ, KEcomExample14UpgradedOnC));
  1.2276 +		TEST2(err, KErrNone);
  1.2277 +		//Creats the entry using upgraded resource file
  1.2278 +		TEntry rscBasedEntry;
  1.2279 +		rscBasedEntry.iName = KEcomExample14UpgradedResourceNameOnly;
  1.2280 +		TParse rscPath;
  1.2281 +		rscPath.Set(KEcomExample14UpgradedOnC,NULL,NULL);
  1.2282 +		CPluginBase* entryBase = NULL;
  1.2283 +		entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
  1.2284 +		CleanupStack::PushL(entryBase);
  1.2285 +		// Updates resource ext info
  1.2286 +		HBufC* resourceExt = entryBase->RscFileExt();
  1.2287 +		if(resourceExt)
  1.2288 +			{
  1.2289 +			updateDllData->SetResourceExtL(*resourceExt);
  1.2290 +			}
  1.2291 +		// parses the upgraded resource file
  1.2292 +		TInt error = KErrNone;
  1.2293 +		TRAP(error, iRegistrarAccessor->ParseL(*iRegistrar, entryBase, *updateDllData));
  1.2294 +		if (error == KErrNoMemory)
  1.2295 +			{
  1.2296 +			User::LeaveNoMemory();
  1.2297 +			}
  1.2298 +		CleanupStack::PopAndDestroy(entryBase);
  1.2299 +
  1.2300 +		TDriveUnit aDrive;
  1.2301 +		// Updates DLL data with a new dll data
  1.2302 +		TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
  1.2303 +		TEST_OOM_ERR;
  1.2304 +		TEST2(err, KErrNone);
  1.2305 +		CleanupStack::Pop(updateDllData);
  1.2306 +		// Checks registry data is updated with new data
  1.2307 +		// Implementation 0x10009E48 is upgraded from version 1 to version 2, display name is changed to "Example 14 PlugIn3"
  1.2308 +		implementationData = NULL;
  1.2309 +		err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
  1.2310 +		TEST2(err,KErrNone);
  1.2311 +		implementationInfo = implementationData->iImplInfo;
  1.2312 +		TEST(implementationInfo->Version() == 2);
  1.2313 +		TEST(implementationInfo->DisplayName().CompareF(_L("Example 14 PlugIn3"))==0);
  1.2314 +		TheTest.Printf(_L("DLL data is updated \n"));
  1.2315 +		//deletes the upgraded resource file
  1.2316 +		TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample14UpgradedOnC));
  1.2317 +		}
  1.2318 +	registered = iRegistryData->IsRegisteredWithDate(
  1.2319 +										 dllEntry[2],
  1.2320 +										 dllEntry.iModified,
  1.2321 +										 iUpdate,
  1.2322 +										 driveData);
  1.2323 +	TEST(registered);
  1.2324 +	TEST(!iUpdate);
  1.2325 +	}
  1.2326 +
  1.2327 +/**
  1.2328 +@SYMTestCaseID          SYSLIB-ECOM-UT-3570
  1.2329 +@SYMTestCaseDesc	    Tests for CRegistryData::UpdateDllDataL() function when an existing registered
  1.2330 +						PLUGIN3 is upgraded with an updated PLUGIN3 resource file.
  1.2331 +@SYMTestPriority 	    High
  1.2332 +@SYMTestActions  	    Update the data for a dll in the registry.
  1.2333 +                        Tests for OOM error.
  1.2334 +@SYMTestExpectedResults The data for the dll in the registry is updated.
  1.2335 +@SYMEC                  EC43
  1.2336 +*/
  1.2337 +
  1.2338 +void CRegistryDataTest::UpdateDllDataTest1L()
  1.2339 +	{
  1.2340 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3570 "));
  1.2341 +	// Checks if drive is registered
  1.2342 +	TEST2(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit),ETrue);
  1.2343 +	CRegistryData::CDriveData* driveData = NULL;
  1.2344 +	// Fetches index of drive, in iFoundDriveIndex
  1.2345 +	iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
  1.2346 +
  1.2347 +	TEntry dllEntry;
  1.2348 +	TUid example12ThirdUid = {0x10009E3E};
  1.2349 +	dllEntry.iType = TUidType(KNullUid, KNullUid, example12ThirdUid);
  1.2350 +	dllEntry.iName = KEComExample12DllOnC;
  1.2351 +	dllEntry.iModified.HomeTime();
  1.2352 +
  1.2353 +	TBool registered = EFalse;
  1.2354 +	registered = iRegistryData->IsRegisteredWithDate(
  1.2355 +										 dllEntry[2],
  1.2356 +										 dllEntry.iModified,
  1.2357 +										 iUpdate,
  1.2358 +										 driveData);
  1.2359 +	TEST(registered);
  1.2360 +	// Log message if implementations need update
  1.2361 +	if (!iUpdate)
  1.2362 +		{
  1.2363 +		TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
  1.2364 +		}
  1.2365 +	//If the implementation needs an update, update it using UpdateDllDataL
  1.2366 +	else
  1.2367 +		{
  1.2368 +		TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
  1.2369 +
  1.2370 +		// Checks Implementation 0x10009E3C registered in the registry is version 1
  1.2371 +		// A reference to the implementation entry in the registry
  1.2372 +		const TUid implementationUid = {0x10009E3C};
  1.2373 +		CRegistryData::CImplementationData*	implementationData = NULL;
  1.2374 +		TInt err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
  1.2375 +		TEST2(err,KErrNone);
  1.2376 +		CImplementationInformation* implementationInfo = implementationData->iImplInfo;
  1.2377 +		TEST(implementationInfo->Version() == 1);
  1.2378 +		// Dll Data object to be updated
  1.2379 +		CRegistryData::CDllData* updateDllData = NULL;
  1.2380 +		TParse fileparse;
  1.2381 +		fileparse.Set(dllEntry.iName,NULL,NULL);
  1.2382 +		updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
  1.2383 +
  1.2384 +		//copies the upgraded resource file to C:
  1.2385 +		TRAP(err, EComTestUtils::FileManCopyFileL(KEcomExample12UpgradedOnZ, KEcomExample12UpgradedOnC));
  1.2386 +		TEST_OOM_ERR;
  1.2387 +		TEST2(err, KErrNone);
  1.2388 +		//Creats the entry using upgraded resource file
  1.2389 +		TEntry rscBasedEntry;
  1.2390 +		rscBasedEntry.iName = KEcomExample12UpgradedResourceNameOnly;
  1.2391 +		TParse rscPath;
  1.2392 +		rscPath.Set(KEcomExample12UpgradedOnC,NULL,NULL);
  1.2393 +		CPluginBase* entryBase = NULL;
  1.2394 +		entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
  1.2395 +		CleanupStack::PushL(entryBase);
  1.2396 +		// Updates resource ext info
  1.2397 +		HBufC* resourceExt = entryBase->RscFileExt();
  1.2398 +		if(resourceExt)
  1.2399 +			{
  1.2400 +			updateDllData->SetResourceExtL(*resourceExt);
  1.2401 +			}
  1.2402 +		// parses the upgraded resource file
  1.2403 +		TInt error = KErrNone;
  1.2404 +		TRAP(error, iRegistrarAccessor->ParseL(*iRegistrar, entryBase, *updateDllData));
  1.2405 +		if (error == KErrNoMemory)
  1.2406 +			{
  1.2407 +			User::LeaveNoMemory();
  1.2408 +			}
  1.2409 +		CleanupStack::PopAndDestroy(entryBase);
  1.2410 +		TDriveUnit aDrive;
  1.2411 +		// Updates DLL data with a new dll data
  1.2412 +		TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
  1.2413 +		TEST_OOM_ERR;
  1.2414 +		TEST2(err, KErrNone);
  1.2415 +		CleanupStack::Pop(updateDllData);
  1.2416 +		// Checks registry data is updated with new data
  1.2417 +		// Implementation 0x10009E3C is upgraded from version 1 to version 2
  1.2418 +		implementationData = NULL;
  1.2419 +		err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
  1.2420 +		TEST_OOM_ERR;
  1.2421 +		TEST2(err,KErrNone);
  1.2422 +		implementationInfo = implementationData->iImplInfo;
  1.2423 +		TEST(implementationInfo->Version() == 2);
  1.2424 +		TheTest.Printf(_L("DLL data is updated \n"));
  1.2425 +		//cleans the upgraded resource file
  1.2426 +		TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12UpgradedOnC));
  1.2427 +		}
  1.2428 +	registered = iRegistryData->IsRegisteredWithDate(
  1.2429 +										 dllEntry[2],
  1.2430 +										 dllEntry.iModified,
  1.2431 +										 iUpdate,
  1.2432 +										 driveData);
  1.2433 +	TEST(registered);
  1.2434 +	TEST(!iUpdate);
  1.2435 +	}
  1.2436 +
  1.2437 +
  1.2438 +
  1.2439 +/**
  1.2440 +@SYMTestCaseID          SYSLIB-ECOM-UT-3569
  1.2441 +@SYMTestCaseDesc	    Tests for CRegistryData::AddDllDataL() function using Dll type PLUGIN3
  1.2442 +@SYMTestPriority 	    High
  1.2443 +@SYMTestActions  	    Adds data on a specific dll to the registry.
  1.2444 +                        Tests for OOM error,checks if drive is registered.
  1.2445 +@SYMTestExpectedResults Dll data is added to the registry.
  1.2446 +@SYMEC                  EC43
  1.2447 +*/
  1.2448 +void CRegistryDataTest::AddDllDataPlugIn3TestL()
  1.2449 +	{
  1.2450 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3569 "));
  1.2451 +	// Checks if drive is registered
  1.2452 +	TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
  1.2453 +	CRegistryData::CDriveData* driveData = NULL;
  1.2454 +	// Fetches index of drive, in iFoundDriveIndex
  1.2455 +	iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
  1.2456 +
  1.2457 +	TEntry dllEntry;
  1.2458 +	TUid example10ThirdUid = {0x10009E37};
  1.2459 +	dllEntry.iType = TUidType(KNullUid, KNullUid, example10ThirdUid);
  1.2460 +	dllEntry.iName = KEComExample10DllOnC;
  1.2461 +	TBool registered = EFalse;
  1.2462 +	TRAPD(err, registered = iRegistryData->IsRegisteredWithDate(
  1.2463 +										 dllEntry[2],
  1.2464 +										 dllEntry.iModified,
  1.2465 +										 iUpdate,
  1.2466 +										 driveData));
  1.2467 +	TEST_OOM_ERR;
  1.2468 +	TEST2(err, KErrNone);
  1.2469 +	TEST(!registered);
  1.2470 +	// Dll Data object to be added
  1.2471 +	CRegistryData::CDllData* addDllData = NULL;
  1.2472 +	TParse fileparse;
  1.2473 +	fileparse.Set(dllEntry.iName,NULL,NULL);
  1.2474 +	addDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
  1.2475 +
  1.2476 +	// Adds DLL data of an existing DLL
  1.2477 +	TRAP(err, iRegistryData->AddDllDataL(iDriveUnit, iFoundDriveIndex, addDllData));
  1.2478 +
  1.2479 +	TEST_OOM_ERR;
  1.2480 +	CleanupStack::Pop(addDllData);
  1.2481 +	TEST2(err, KErrNone);
  1.2482 +
  1.2483 +
  1.2484 +	TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
  1.2485 +	TEST_OOM_ERR;
  1.2486 +	TEST2(err, KErrNone);
  1.2487 +	TRAP(err, registered = iRegistryData->IsRegisteredWithDate(
  1.2488 +										 dllEntry[2],
  1.2489 +										 dllEntry.iModified,
  1.2490 +										 iUpdate,
  1.2491 +										 driveData));
  1.2492 +
  1.2493 +	TEST_OOM_ERR;
  1.2494 +	TEST2(err, KErrNone);
  1.2495 +	TEST(registered);
  1.2496 +	// Do not delete addDllData as ownership is with the iRegistryData
  1.2497 +	}
  1.2498 +
  1.2499 +
  1.2500 +/**
  1.2501 +Adds the dll data on a perticular drive.
  1.2502 +
  1.2503 +@SYMTestCaseID          SYSLIB-ECOM-CT-0738
  1.2504 +@SYMTestCaseDesc	    Tests for CRegistryData::AddDllDataL() function
  1.2505 +@SYMTestPriority 	    High
  1.2506 +@SYMTestActions  	    Adds data on a specific dll to the registry.
  1.2507 +                        Tests for OOM error,checks if drive is registered.
  1.2508 +@SYMTestExpectedResults The test must not fail.
  1.2509 +@SYMREQ                 REQ0000
  1.2510 +*/
  1.2511 +void CRegistryDataTest::AddDllDataTestL()
  1.2512 +	{
  1.2513 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0738 "));
  1.2514 +	// Check if drive is registered
  1.2515 +	TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
  1.2516 +	CRegistryData::CDriveData* driveData = NULL;
  1.2517 +	// Fetch index of drive, in iFoundDriveIndex
  1.2518 +	iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
  1.2519 +
  1.2520 +	iRegistryData->IsRegisteredWithDate(
  1.2521 +										 iDllEntry[2],
  1.2522 +										 iDllEntry.iModified,
  1.2523 +										 iUpdate,
  1.2524 +
  1.2525 +										 driveData);
  1.2526 +	// Dll Data object to be added
  1.2527 +	CRegistryData::CDllData*			addDllData=NULL;
  1.2528 +	TParse fileparse;
  1.2529 +	fileparse.Set(iDllEntry.iName,NULL,NULL);
  1.2530 +	addDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),iDllEntry.iModified,iDllEntry[1], iDllEntry[2],driveData);
  1.2531 +
  1.2532 +	// Add DLL data of an existing DLL
  1.2533 +	TRAPD(err, iRegistryData->AddDllDataL(iDriveUnit, iFoundDriveIndex, addDllData));
  1.2534 +
  1.2535 +	TEST_OOM_ERR;
  1.2536 +	CleanupStack::Pop(addDllData);
  1.2537 +	TEST2(err, KErrNone);
  1.2538 +
  1.2539 +	TBool registered = EFalse;
  1.2540 +	TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
  1.2541 +	TEST_OOM_ERR;
  1.2542 +	TEST2(err, KErrNone);
  1.2543 +	TRAP(err, registered = iRegistryData->IsRegisteredWithDate(
  1.2544 +										 iDllEntry[2],
  1.2545 +										 iDllEntry.iModified,
  1.2546 +										 iUpdate,
  1.2547 +
  1.2548 +										 driveData));
  1.2549 +
  1.2550 +	TEST_OOM_ERR;
  1.2551 +	TEST2(err, KErrNone);
  1.2552 +	TEST(registered);
  1.2553 +	// Do not delete addDllData as ownership is with the iRegistryData
  1.2554 +	}
  1.2555 +
  1.2556 +/**
  1.2557 +Determines if the specified implementation is already registered and
  1.2558 +updates the data for the dll in the registry if it needs an update
  1.2559 +
  1.2560 +@SYMTestCaseID          SYSLIB-ECOM-CT-0739
  1.2561 +@SYMTestCaseDesc	    Tests for CRegistryData::UpdateDllDataL() function
  1.2562 +@SYMTestPriority 	    High
  1.2563 +@SYMTestActions  	    Update the data for a dll in the registry if it needs an update.
  1.2564 +                        Tests for OOM error.
  1.2565 +@SYMTestExpectedResults The test must not fail.
  1.2566 +@SYMREQ                 REQ0000
  1.2567 +*/
  1.2568 +void CRegistryDataTest::IsRegisteredWithDateUpdateDllDataTestL()
  1.2569 +	{
  1.2570 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0739 "));
  1.2571 +	TBool result=EFalse;
  1.2572 +	CRegistryData::CDriveData* driveData = NULL;
  1.2573 +	TInt err = KErrNone;
  1.2574 +	// Here we are doing positive testing. We are testing with valid entry.
  1.2575 +	// If that is not registered, register it using UpdateDllDataL
  1.2576 +	TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
  1.2577 +	TEST_OOM_ERR;
  1.2578 +	TEST2(err, KErrNone);
  1.2579 +
  1.2580 +	TRAP(err, result = iRegistryData->IsRegisteredWithDate(
  1.2581 +					  										 iDllEntry[2],
  1.2582 +															 iDllEntry.iModified,
  1.2583 +															 iUpdate,
  1.2584 +
  1.2585 +															 driveData));
  1.2586 +	TEST_OOM_ERR;
  1.2587 +	TEST2(err, KErrNone);
  1.2588 +	// Log message if implementations need update
  1.2589 +	if(result)
  1.2590 +		{
  1.2591 +		if(!iUpdate)
  1.2592 +			{
  1.2593 +			TEST(!iUpdate);
  1.2594 +			TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
  1.2595 +			}
  1.2596 +		else
  1.2597 +			{
  1.2598 +			TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
  1.2599 +
  1.2600 +			// Dll Data object to be updated
  1.2601 +			CRegistryData::CDllData*			updateDllData=NULL;
  1.2602 +			TParse fileparse;
  1.2603 +			fileparse.Set(iDllEntry.iName,NULL,NULL);
  1.2604 +			updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),iDllEntry.iModified,iDllEntry[1],iDllEntry[2],driveData);
  1.2605 +			TDriveUnit aDrive;
  1.2606 +
  1.2607 +			// Updates DLL data with a new dll data
  1.2608 +			TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
  1.2609 +			TEST_OOM_ERR;
  1.2610 +			CleanupStack::Pop(updateDllData);
  1.2611 +			TEST2(err, KErrNone);
  1.2612 +			// Print to that dll data is updated else we won't know we did.
  1.2613 +			TheTest.Printf(_L("DLL data is updated \n"));
  1.2614 +			}
  1.2615 +		}
  1.2616 +
  1.2617 +	TUid thirdUid = {0x101F8400};
  1.2618 +	iDllEntry.iType = TUidType(KNullUid, KNullUid, thirdUid);
  1.2619 +	// Here we are doing negative testing. We are testing with invalid entry.
  1.2620 +	// The result should be false
  1.2621 +	TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
  1.2622 +	TEST_OOM_ERR;
  1.2623 +	TEST2(err, KErrNone);
  1.2624 +	TRAP(err, result = iRegistryData->IsRegisteredWithDate(
  1.2625 +					  										iDllEntry[2],
  1.2626 +															iDllEntry.iModified,
  1.2627 +															iUpdate,
  1.2628 +
  1.2629 +															driveData));
  1.2630 +	TEST_OOM_ERR;
  1.2631 +	TEST2(err, KErrNone);
  1.2632 +	TEST(!result);
  1.2633 +	}
  1.2634 +
  1.2635 +/**
  1.2636 +Tests that an implementation is disabled and enabled by setting the state
  1.2637 +
  1.2638 +@SYMTestCaseID          SYSLIB-ECOM-CT-0740
  1.2639 +@SYMTestCaseDesc	    Tests for CRegistryData::SetEnabledState() function
  1.2640 +@SYMTestPriority 	    High
  1.2641 +@SYMTestActions  	    Tests for enable or disable the specified interface implementation
  1.2642 +						within the registry.
  1.2643 +@SYMTestExpectedResults The test must not fail.
  1.2644 +@SYMREQ                 REQ0000
  1.2645 +*/
  1.2646 +void CRegistryDataTest::SetEnabledStateTestL()
  1.2647 +	{
  1.2648 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0740 "));
  1.2649 +	// A reference to the implementation entry in the registry
  1.2650 +	CRegistryData::CImplementationData*	implementationData = NULL;
  1.2651 +
  1.2652 +	// Pass the state and enable or disable the implementaion
  1.2653 +	TInt err;
  1.2654 +	err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, KCDummyUid, implementationData);
  1.2655 +	TEST2(err, KErrNone);
  1.2656 +
  1.2657 +	const CImplementationInformation* implementationInfo = implementationData->iImplInfo;
  1.2658 +
  1.2659 +	// SetEnabledState() will disable the implementation if enablestate parameter is EFalse.
  1.2660 +	// If the  disablestate parameter is false the reverse will happen.
  1.2661 +	TBool result=EFalse;
  1.2662 +	TBool enableState=EFalse;
  1.2663 +	TRAP(err, result = iRegistryData->SetEnabledState(iImplementationUid, enableState));
  1.2664 +	TEST_OOM_ERR;
  1.2665 +	TEST2(err, KErrNone);
  1.2666 +	TEST(result == KErrNone);
  1.2667 +
  1.2668 +	//Implementation should be disabled
  1.2669 +	TEST(implementationInfo->Disabled()==(!enableState));
  1.2670 +
  1.2671 +	// enable it
  1.2672 +	enableState = ETrue;
  1.2673 +	TRAP(err, result = iRegistryData->SetEnabledState(iImplementationUid, enableState));
  1.2674 +	TEST_OOM_ERR;
  1.2675 +	TEST2(err, KErrNone);
  1.2676 +	TEST(result == KErrNone);
  1.2677 +
  1.2678 +	// Implementation should be enabled
  1.2679 +	TEST(implementationInfo->Disabled()==(!enableState));
  1.2680 +	}
  1.2681 +
  1.2682 +/**
  1.2683 +Obtains Implementation data and prints to log
  1.2684 +
  1.2685 +@SYMTestCaseID		SYSLIB-ECOM-CT-0741
  1.2686 +@SYMTestCaseDesc	Tests for CRegistryData::FindImplementation() functions
  1.2687 +@SYMTestPriority		High
  1.2688 +@SYMTestActions		Fetch the information on a particular implementation (UID)
  1.2689 +					Tests for the validation of the information fetched.
  1.2690 +					Fetch the information on a particular implementation (UID) and interface (UID)
  1.2691 +					Tests for the validation of the information fetched.
  1.2692 +@SYMTestExpectedResults The test must not fail.
  1.2693 +@SYMREQ                 REQ0000
  1.2694 +*/
  1.2695 +void CRegistryDataTest::FindImplementationTestL()
  1.2696 +	{
  1.2697 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0741 "));
  1.2698 +	// A reference to the implementation entry in the registry
  1.2699 +	CRegistryData::CImplementationData*	implementationData = NULL;
  1.2700 +
  1.2701 +	// find implementation with interface uid unknown
  1.2702 +	TInt err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, KCDummyUid, implementationData);
  1.2703 +	TEST_OOM_ERR;
  1.2704 +	TEST2(err, KErrNone);
  1.2705 +
  1.2706 +	const CImplementationInformation* implementationInfo = implementationData->iImplInfo;
  1.2707 +
  1.2708 +	TheTest.Printf((implementationInfo->DisplayName()));
  1.2709 +	_LIT(KUIDFormat,"Uid = 0x%08X\n");
  1.2710 +	TheTest.Printf(KUIDFormat, iImplementationUid);
  1.2711 +	TheTest.Printf(KUIDFormat, implementationInfo->ImplementationUid());
  1.2712 +	// Check for if its the same implementation
  1.2713 +	TEST(iImplementationUid == implementationInfo->ImplementationUid());
  1.2714 +
  1.2715 +	// find implementation with interface uid known
  1.2716 +	err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, iInterfaceUid, implementationData);
  1.2717 +	TEST_OOM_ERR;
  1.2718 +	TEST2(err, KErrNone);
  1.2719 +
  1.2720 +	implementationInfo = implementationData->iImplInfo;
  1.2721 +
  1.2722 +	TheTest.Printf((implementationInfo->DisplayName()));
  1.2723 +	TheTest.Printf(KUIDFormat, iImplementationUid);
  1.2724 +	TheTest.Printf(KUIDFormat, implementationInfo->ImplementationUid());
  1.2725 +	TheTest.Printf(KUIDFormat, iInterfaceUid);
  1.2726 +	TheTest.Printf(KUIDFormat, implementationData->iParent->iInterfaceUid);
  1.2727 +
  1.2728 +	// Check for if its the same implementation
  1.2729 +	TEST(iImplementationUid == implementationInfo->ImplementationUid());
  1.2730 +	// Check for if its the same interface
  1.2731 +	TEST(iInterfaceUid == implementationData->iParent->iInterfaceUid);
  1.2732 +
  1.2733 +	// attempt to find unknown implementation with dummy interface uid
  1.2734 +	err = iStateAccessor->FindImplementation(*iRegistryData, KCInvalidUid, KCDummyUid, implementationData);
  1.2735 +	TEST_OOM_ERR;
  1.2736 +	TEST2(err, KErrNotFound);
  1.2737 +
  1.2738 +	// attempt to find implementation for unknown interface uid
  1.2739 +	err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, KCInvalidUid, implementationData);
  1.2740 +	TEST_OOM_ERR;
  1.2741 +	TEST2(err, KErrNotFound);
  1.2742 +	}
  1.2743 +
  1.2744 +/**
  1.2745 +Tests functionality of ListImplementationsL for an interface id and listing all
  1.2746 +the implementations.
  1.2747 +The interface Uid 0x10009DC0 has 6 implementations on different DLLs but only 4 will
  1.2748 +be picked as as 2 of them are of older version(Impl ID 0x10009DC3 and 0x10009DC4 with version 1)
  1.2749 +
  1.2750 +Interface UID	DLL	UID		Implementation UID	Version
  1.2751 +-------------------------------------------------------
  1.2752 +0x10009DC0		0x10009DB1	0x10009DC3			1
  1.2753 +				0x10009DB1	0x10009DC4			1
  1.2754 +				0x10009DB3	0x10009DC3			2
  1.2755 +				0x10009DB3	0x10009DC4			2
  1.2756 +				0x101F8477	0x101F8478			1
  1.2757 +				0x101F847B	0x101F847C			1
  1.2758 +
  1.2759 +@SYMTestCaseID          SYSLIB-ECOM-CT-0742
  1.2760 +@SYMTestCaseDesc	    Tests for CRegistryData::ListImplementationsL() function
  1.2761 +@SYMTestPriority 	    High
  1.2762 +@SYMTestActions  	    List the implementations for an existing interface UID and
  1.2763 +                        test for expected number of implementations.Check the VID of
  1.2764 +                        every implementation match the VID of the DLL which the implementation
  1.2765 +                        belongs to.
  1.2766 +@SYMTestExpectedResults The test must not fail.
  1.2767 +@SYMREQ                 REQ0000, REQ6111
  1.2768 +*/
  1.2769 +void CRegistryDataTest::ListImplementationsL()
  1.2770 +	{
  1.2771 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0742 "));
  1.2772 +	// List the implementations for an existing interface UID
  1.2773 +	TEST(iRegistryData->IndexValid());
  1.2774 +
  1.2775 +	TRAPD(err, iRegistryData->ListImplementationsL(iInterfaceUid,iImplDataList));
  1.2776 +	CleanupClosePushL(iImplDataList);
  1.2777 +
  1.2778 +	TEST_OOM_ERR;
  1.2779 +	TEST2(err, KErrNone);
  1.2780 +
  1.2781 +	// Print UIDs of implementations
  1.2782 +	_LIT(KUIDFormat,"Uid = 0x%08x\n");
  1.2783 +	_LIT(KLists,"There are %d Implementations \n");
  1.2784 +
  1.2785 +	TheTest.Printf(KLists, iImplDataList.Count());
  1.2786 +	// Test for expected number of implementations
  1.2787 +	TEST(iImplDataList.Count() == 4);
  1.2788 +
  1.2789 +	for(TInt index = 0; index < iImplDataList.Count(); ++index)
  1.2790 +		{
  1.2791 +		CImplementationInformation* implInfo = iImplDataList[index]->iImplInfo;
  1.2792 +		TUid uid = implInfo->ImplementationUid();
  1.2793 +		TheTest.Printf(KUIDFormat, uid);
  1.2794 +		}
  1.2795 +	// Empty the array of implementation data
  1.2796 +	CleanupStack::PopAndDestroy(&iImplDataList);
  1.2797 +	}
  1.2798 +
  1.2799 +/**
  1.2800 +Tests functionality of TemporaryUninstallL and UndoTemporaryUninstallL
  1.2801 +Test does temporarily 1.install 2.uninstall and 3.install the specified drive
  1.2802 +
  1.2803 +@SYMTestCaseID          SYSLIB-ECOM-CT-0743
  1.2804 +@SYMTestCaseDesc	    Tests for CRegistryData::UndoTemporaryUninstallL(),TemporaryUninstallL() function
  1.2805 +@SYMTestPriority 	    High
  1.2806 +@SYMTestActions  	    Tests for temporarily install,uninstall,install the specified drive
  1.2807 +@SYMTestExpectedResults The test must not fail.
  1.2808 +@SYMREQ                 REQ0000
  1.2809 +*/
  1.2810 +void CRegistryDataTest::DoUndoTemporaryUninstallTestL()
  1.2811 +	{
  1.2812 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0743 "));
  1.2813 +	// We are testing with F drive.
  1.2814 +	iDriveUnit = EDriveF;
  1.2815 +	TBool driveregistered = iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit);
  1.2816 +	// Check that the drive is registered. If its not there add it by UndoTemporaryUninstallL
  1.2817 +	if (!driveregistered)
  1.2818 +		{
  1.2819 +		TRAPD(err, iRegistryData->UndoTemporaryUninstallL(iDriveUnit));
  1.2820 +		TEST_OOM_ERR;
  1.2821 +		TEST2(err, KErrNone);
  1.2822 +		}
  1.2823 +
  1.2824 +	// Test drive should be present
  1.2825 +	TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit));
  1.2826 +
  1.2827 +	// Uninstall the test drive
  1.2828 +	TRAPD(err, iRegistryData->TemporaryUninstallL(iDriveUnit));
  1.2829 +	TEST_OOM_ERR;
  1.2830 +	TEST2(err, KErrNone);
  1.2831 +	// Test drive should not be present
  1.2832 +	TEST(!(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)));
  1.2833 +
  1.2834 +	// Put the test drive back to work if it was registered before
  1.2835 +	if (driveregistered)
  1.2836 +		{
  1.2837 +		TRAP(err, iRegistryData->UndoTemporaryUninstallL(iDriveUnit));
  1.2838 +		TEST_OOM_ERR;
  1.2839 +		TEST2(err, KErrNone);
  1.2840 +		// Test drive should be present
  1.2841 +		TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit));
  1.2842 +		}
  1.2843 +	}
  1.2844 +
  1.2845 +/**
  1.2846 +Tests functionality of DiscoveriesBeginning and DiscoveriesCompleteL
  1.2847 +Tests registry data discovery process.
  1.2848 +
  1.2849 +@SYMTestCaseID          SYSLIB-ECOM-CT-0745
  1.2850 +@SYMTestCaseDesc	    Tests for CRegistryData::DiscoveriesBeginning(),CRegistryData::DiscoveriesCompleteL() functions
  1.2851 +@SYMTestPriority 	    High
  1.2852 +@SYMTestActions  	    Tests for registry data discovery process.
  1.2853 +@SYMTestExpectedResults The test must not fail.
  1.2854 +@SYMREQ                 REQ0000
  1.2855 +*/
  1.2856 +void CRegistryDataTest::DiscoveriesBeginCompleteTestL()
  1.2857 +	{
  1.2858 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0745 "));
  1.2859 +	// Issue discoveries begin and complete requests
  1.2860 +	// and confirm the same
  1.2861 +
  1.2862 +	// DiscoveriesBegin marks the registry indexes as invalid as
  1.2863 +	// the discovery process is in progress
  1.2864 +	TRAPD(err, iRegistryData->DiscoveriesBeginning());
  1.2865 +	TEST_OOM_ERR;
  1.2866 +	TEST2(err, KErrNone);
  1.2867 +	// Check Registry is invalid
  1.2868 +	TEST(!iStateAccessor->IsIndexValid(*(iRegistryData)));
  1.2869 +
  1.2870 +	// DiscoveriesCompleteL marks the registry indexes valid as
  1.2871 +	// the discovery process is complete
  1.2872 +	TBool regChanged = EFalse;
  1.2873 +	TRAP(err, iRegistryData->DiscoveriesCompleteL(EFalse, EPluginProcessingTypeAll,regChanged));
  1.2874 +	TEST_OOM_ERR;
  1.2875 +	TEST2(err, KErrNone);
  1.2876 +	// Check Registry is valid
  1.2877 +	TEST(iStateAccessor->IsIndexValid(*(iRegistryData)));
  1.2878 +	}
  1.2879 +
  1.2880 +/**
  1.2881 +Tests finding index for an entry for implementation Uid
  1.2882 +
  1.2883 +@SYMTestCaseID          SYSLIB-ECOM-CT-0747
  1.2884 +@SYMTestCaseDesc	    Tests for CRegistryData::IndexedFindTestL() function
  1.2885 +@SYMTestPriority 	    High
  1.2886 +@SYMTestActions  	    Tests to find the index entry for aImplementationUid and log it
  1.2887 +@SYMTestExpectedResults The test must not fail.
  1.2888 +@SYMREQ                 REQ0000
  1.2889 +*/
  1.2890 +void CRegistryDataTest::IndexedFindTestL()
  1.2891 +	{
  1.2892 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0747 "));
  1.2893 +	// Find the index entry for aImplementationUid and print it
  1.2894 +	TInt index=0;
  1.2895 +
  1.2896 +	TRAPD(err, index = iStateAccessor->IndexedFind(*(iRegistryData), iInterfaceUid));
  1.2897 +	TEST_OOM_ERR;
  1.2898 +	TEST2(err, KErrNone);
  1.2899 +	TheTest.Printf(_L("The index of interface 0x%08x is %d \n"), iInterfaceUid, index);
  1.2900 +	// Index should have some valid value
  1.2901 +	TEST(index >= 0);
  1.2902 +	}
  1.2903 +
  1.2904 +
  1.2905 +/**
  1.2906 +Plugins to be used in this test
  1.2907 +Interface UID	DLL	UID		Implementation UID	Version		DLL File
  1.2908 +--------------------------------------------------------------------------------
  1.2909 +0x10009E36		0x10009E3E	0x10009E39				1		C:\\..\\EComExample12.dll
  1.2910 +				0x10009E3E	0x10009E3C				1		C:\\..\\EComExample12.dll
  1.2911 +				0x10009E3E	0x10009E3D				1		C:\\..\\EComExample12.dll
  1.2912 +				0x10009E42	0x10009E39				2		C:\\..\\EComExample15.dll
  1.2913 +
  1.2914 +
  1.2915 +@SYMTestCaseID			SYSLIB-ECOM-UT-3573
  1.2916 +@SYMTestCaseDesc		Tests for CRegistryData::GetImplementationDllInfoForClientL() function for DLL type PLUGIN3.
  1.2917 +@SYMTestPriority		High
  1.2918 +@SYMTestActions			Get the plugin information of the implementation UID and validate the information.
  1.2919 +						Get the plugin information of the implementation UID and Interface UID and validate
  1.2920 +						the information.
  1.2921 +						Tests for that the implementation returned will have the highest version
  1.2922 +@SYMTestExpectedResults	Implementation information is returned correctly.
  1.2923 +@SYMEC					EC43
  1.2924 +*/
  1.2925 +void CRegistryDataTest::GetImplementationDllInfoForClientPlugIn3TestL()
  1.2926 + 	{
  1.2927 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3573 "));
  1.2928 +	TUid ImpUid15 = {0x10009E39};
  1.2929 + 	TUid ImpUid12 = {0x10009E3C};
  1.2930 + 	TUid InterfaceUid = {0x10009E36};
  1.2931 + 	TEntry dllinfo;
  1.2932 + 	TInt err;
  1.2933 + 	TClientRequest clntRq;
  1.2934 +
  1.2935 + 	//Tests the CImplementationInformation is correct
  1.2936 + 	//and the DllInfo contains correct implementation info
  1.2937 + 	//Implementation uid used=0x10009E3C
  1.2938 + 	CImplementationInformation* implementationInfo = NULL;
  1.2939 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid12, KCDummyUid, dllinfo, implementationInfo, ETrue);
  1.2940 + 	TEST2(err, KErrNone);
  1.2941 + 	TEST(implementationInfo->ImplementationUid() == ImpUid12);
  1.2942 + 	TEST(implementationInfo->Version() == 1);
  1.2943 + 	TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
  1.2944 +
  1.2945 + 	// ... again but with interface uid
  1.2946 +  	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid12, InterfaceUid, dllinfo, implementationInfo, ETrue);
  1.2947 + 	TEST2(err, KErrNone);
  1.2948 + 	TEST(implementationInfo->ImplementationUid() == ImpUid12);
  1.2949 + 	TEST(implementationInfo->Version() == 1);
  1.2950 + 	TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
  1.2951 +
  1.2952 + 	//Tests that the implementation returned will have the highest version
  1.2953 + 	//EComExample12.dll  contains Impl 0x10009E39 with version 1
  1.2954 + 	//EComExample15.dll contains Impl 0x10009E39 with version 2
  1.2955 + 	//Ensure that choose the implementation in EComExample15.dll
  1.2956 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid15, KCDummyUid, dllinfo, implementationInfo, ETrue);
  1.2957 + 	TEST2(err, KErrNone);
  1.2958 + 	TEST(implementationInfo->ImplementationUid() == ImpUid15);
  1.2959 + 	TEST(implementationInfo->Version() == 2);
  1.2960 + 	TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
  1.2961 +
  1.2962 + 	// ... again but with interface uid
  1.2963 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid15, InterfaceUid, dllinfo, implementationInfo, ETrue);
  1.2964 + 	TEST2(err, KErrNone);
  1.2965 + 	TEST(implementationInfo->ImplementationUid() == ImpUid15);
  1.2966 + 	TEST(implementationInfo->Version() == 2);
  1.2967 + 	TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
  1.2968 + 	}
  1.2969 +
  1.2970 +/**
  1.2971 +Plugins to be used in this test
  1.2972 +Interface UID	DLL	UID		Implementation UID	Version		DLL File
  1.2973 +--------------------------------------------------------------------------------
  1.2974 +0x10009E36		0x10009E3E	0x10009E39				1		C:\\..\\EComExample12.dll
  1.2975 +				0x10009E3E	0x10009E3C				1		C:\\..\\EComExample12.dll
  1.2976 +				0x10009E3E	0x10009E3D				1		C:\\..\\EComExample12.dll
  1.2977 +				0x10009E42	0x10009E39				2		C:\\..\\EComExample15.dll
  1.2978 +
  1.2979 +@SYMTestCaseID			SYSLIB-ECOM-UT-3574
  1.2980 +@SYMTestCaseDesc		Tests for CRegistryData::GetImplementationDllInfoForServer() function for DLL type PLUGIN3.
  1.2981 +@SYMTestPriority		High
  1.2982 +@SYMTestActions			Get the plugin information of the implementation UID and validate the information.
  1.2983 +						Get the plugin information of the implementation UID and Interface UID and validate
  1.2984 +						the information.
  1.2985 +						Tests for loading implementation from RAM
  1.2986 +						Tests for that the implementation returned will have the highest version
  1.2987 +@SYMTestExpectedResults	Implementation information is returned correctly.
  1.2988 +@SYMEC					EC43
  1.2989 +*/
  1.2990 +void CRegistryDataTest::GetImplementationDllInfoForServerPlugIn3Test()
  1.2991 + 	{
  1.2992 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3574 "));
  1.2993 +  	TUid ImpUid15={0x10009E39};
  1.2994 + 	TUid ImpUid12={0x10009E3C};
  1.2995 + 	TUid InterfaceUid={0x10009E36};
  1.2996 + 	TEntry dllinfo;
  1.2997 + 	TInt err;
  1.2998 +	TBool dummyBool;
  1.2999 +
  1.3000 + 	//Tests the CImplementationInformation is correct
  1.3001 + 	//and the DllInfo contains correct implementation info
  1.3002 + 	//Implementation uid used=0x10009E3C
  1.3003 + 	CImplementationInformation* implementationInfo=NULL;
  1.3004 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid12, KCDummyUid, dllinfo, implementationInfo, dummyBool);
  1.3005 + 	TEST2(err, KErrNone);
  1.3006 + 	TEST(implementationInfo->ImplementationUid() == ImpUid12);
  1.3007 + 	TEST(implementationInfo->Version() == 1);
  1.3008 + 	TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
  1.3009 +
  1.3010 + 	// ... again but with interface uid
  1.3011 +  	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid12, InterfaceUid, dllinfo, implementationInfo, dummyBool);
  1.3012 + 	TEST2(err, KErrNone);
  1.3013 + 	TEST(implementationInfo->ImplementationUid() == ImpUid12);
  1.3014 + 	TEST(implementationInfo->Version() == 1);
  1.3015 + 	TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
  1.3016 +
  1.3017 + 	//Tests that the implementation returned will have the highest version
  1.3018 + 	//EComExample12.dll  contains Impl 0x10009E39 with version 1
  1.3019 + 	//EComExample15.dll contains Impl 0x10009E39 with version 2
  1.3020 + 	//Ensure that choose the implementation in EComExample15.dll
  1.3021 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid15, KCDummyUid, dllinfo, implementationInfo, dummyBool);
  1.3022 + 	TEST2(err, KErrNone);
  1.3023 + 	TEST(implementationInfo->ImplementationUid() == ImpUid15);
  1.3024 + 	TEST(implementationInfo->Version() == 2);
  1.3025 + 	TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
  1.3026 +
  1.3027 + 	// ... again but with interface uid
  1.3028 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid15, InterfaceUid, dllinfo, implementationInfo, dummyBool);
  1.3029 + 	TEST2(err, KErrNone);
  1.3030 + 	TEST(implementationInfo->ImplementationUid() == ImpUid15);
  1.3031 + 	TEST(implementationInfo->Version() == 2);
  1.3032 + 	TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
  1.3033 + 	}
  1.3034 +
  1.3035 +/**
  1.3036 +Tests for the CRegistryData::GetImplementationDllInfoForClientTestL.
  1.3037 +Plugins to be used in this test
  1.3038 +Interface UID	DLL	UID		Implementation UID	Version		DllFile
  1.3039 +-------------------------------------------------------------------
  1.3040 +0x10009DC0		0x10009DB1	0x10009DC3			1		C:\\..\\EComExample.dll
  1.3041 +				0x10009DB1	0x10009DC4			1		C:\\..\\EComExample.dll
  1.3042 +				0x10009DB3	0x10009DC3			2		C:\\..\\EComExample2.dll
  1.3043 +				0x10009DB3	0x10009DC4			2		C:\\..\\EComExample2.dll
  1.3044 +				0x101F8477	0x101F8478			1		C:\\..\\EComExample3.dll
  1.3045 +				0x101F847B	0x101F847C			1		C:\\..\\EComExample5.dll
  1.3046 +
  1.3047 +
  1.3048 +@SYMTestCaseID			SYSLIB-ECOM-CT-1374
  1.3049 +@SYMTestCaseDesc		Tests for CRegistryData::GetImplementationDllInfoForClientL() function.
  1.3050 +@SYMTestPriority			High
  1.3051 +@SYMTestActions			Get the plugin information of the implementation UID and validate the information.
  1.3052 +						Get the plugin information of the implementation UID and Interface UID and validate
  1.3053 +						the information.
  1.3054 +						Tests for  the CImplementationInformation is correct
  1.3055 +						Tests for loading implementation from RAM
  1.3056 +						Tests for that the implementation returned will have the highest version
  1.3057 +						Tests for for invalid ImplementationUid
  1.3058 +@SYMTestExpectedResults	The test must not fail.
  1.3059 +@SYMREQ				DEF065552
  1.3060 +*/
  1.3061 +void CRegistryDataTest::GetImplementationDllInfoForClientTestL()
  1.3062 + 	{
  1.3063 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1374 "));
  1.3064 + 	_LIT(KEComExample2,"C:\\sys\\bin\\EComExample2.dll");
  1.3065 + 	_LIT(KEComExample3,"C:\\sys\\bin\\EComExample3.dll");
  1.3066 + 	_LIT(KEComExample5,"C:\\sys\\bin\\EComExample5.dll");
  1.3067 +
  1.3068 + 	TUid ImpUid={0x10009DC3};
  1.3069 + 	TUid ImpUid3={0x101F8478};
  1.3070 + 	TUid ImpUid5={0x101F847C};
  1.3071 + 	TEntry dllinfo;
  1.3072 + 	TInt err;
  1.3073 + 	TClientRequest clntRq;
  1.3074 +
  1.3075 + 	//Testing the CImplementationInformation is correct
  1.3076 + 	//and the DllInfo contains correct implementation info
  1.3077 + 	//Implementation uid used=0x101F8478
  1.3078 + 	CImplementationInformation* implementationInfo=NULL;
  1.3079 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid3, KCDummyUid, dllinfo, implementationInfo, ETrue);
  1.3080 + 	TEST2(err, KErrNone);
  1.3081 + 	TEST(implementationInfo->ImplementationUid()==ImpUid3);
  1.3082 + 	TEST(implementationInfo->Version()==1);
  1.3083 + 	TEST(dllinfo.iName.CompareF(KEComExample3)==0);
  1.3084 +
  1.3085 + 	// ... again but with interface uid
  1.3086 +  	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid3, iInterfaceUid, dllinfo, implementationInfo, ETrue);
  1.3087 + 	TEST2(err, KErrNone);
  1.3088 + 	TEST(implementationInfo->ImplementationUid()==ImpUid3);
  1.3089 + 	TEST(implementationInfo->Version()==1);
  1.3090 + 	TEST(dllinfo.iName.CompareF(KEComExample3)==0);
  1.3091 +
  1.3092 + 	//Testing loading implementation from RAM(EComExample5.dll)
  1.3093 + 	//Implementation uid used=0x101F847C
  1.3094 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid5, KCDummyUid, dllinfo, implementationInfo, ETrue);
  1.3095 + 	TEST2(err, KErrNone);
  1.3096 + 	TEST(implementationInfo->ImplementationUid()==ImpUid5);
  1.3097 + 	TEST(implementationInfo->Version()==1);
  1.3098 + 	TEST(dllinfo.iName.CompareF(KEComExample5)==0);
  1.3099 +
  1.3100 + 	// ... again but with interface uid
  1.3101 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid5, iInterfaceUid, dllinfo, implementationInfo, ETrue);
  1.3102 + 	TEST2(err, KErrNone);
  1.3103 + 	TEST(implementationInfo->ImplementationUid()==ImpUid5);
  1.3104 + 	TEST(implementationInfo->Version()==1);
  1.3105 + 	TEST(dllinfo.iName.CompareF(KEComExample5)==0);
  1.3106 +
  1.3107 + 	//Testing that the implementation returned will have the highest version
  1.3108 + 	//EComExample.dll  contains Impl 0x10009DC3 with version 1
  1.3109 + 	//EComExample2.dll contains Impl 0x10009DC3 with version 2
  1.3110 + 	//Ensure that choose the implementation in EComExample2.dll
  1.3111 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, KCDummyUid, dllinfo, implementationInfo, ETrue);
  1.3112 + 	TEST2(err, KErrNone);
  1.3113 + 	TEST(implementationInfo->ImplementationUid()==ImpUid);
  1.3114 + 	TEST(implementationInfo->Version()==2);
  1.3115 + 	TEST(dllinfo.iName.CompareF(KEComExample2)==0);
  1.3116 +
  1.3117 + 	// ... again but with interface uid
  1.3118 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, iInterfaceUid, dllinfo, implementationInfo, ETrue);
  1.3119 + 	TEST2(err, KErrNone);
  1.3120 + 	TEST(implementationInfo->ImplementationUid()==ImpUid);
  1.3121 + 	TEST(implementationInfo->Version()==2);
  1.3122 + 	TEST(dllinfo.iName.CompareF(KEComExample2)==0);
  1.3123 +
  1.3124 + 	//Testing for invalid ImplementationUid
  1.3125 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, KCInvalidUid, KCDummyUid, dllinfo, implementationInfo, ETrue);
  1.3126 + 	TEST2(err, KErrNotFound);
  1.3127 + 	TEST(implementationInfo==0);
  1.3128 +
  1.3129 + 	//Testing for invalid InterfaceUid
  1.3130 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, KCInvalidUid, dllinfo, implementationInfo, ETrue);
  1.3131 + 	TEST2(err, KErrNotFound);
  1.3132 + 	TEST(implementationInfo==0);
  1.3133 +
  1.3134 + 	//Testing for invalid ImplementationUid and invalid InterfaceUid
  1.3135 + 	err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, KCInvalidUid, KCInvalidUid, dllinfo, implementationInfo, ETrue);
  1.3136 + 	TEST2(err, KErrNotFound);
  1.3137 + 	TEST(implementationInfo==0);
  1.3138 + 	}
  1.3139 +
  1.3140 +/**
  1.3141 +Tests for the CRegistryData::GetImplementationDllInfoForServer.
  1.3142 +This new API is introduced in the Clientside loading of plugins(ECOM Platform security)
  1.3143 +where the server will return the plugin information(aEntry) of the implementation Uid
  1.3144 +requested by the client.
  1.3145 +Plugins to be used in this test
  1.3146 +Interface UID	DLL	UID		Implementation UID	Version		DllFile
  1.3147 +-------------------------------------------------------------------
  1.3148 +0x10009DC0		0x10009DB1	0x10009DC3			1		C:\\..\\EComExample.dll
  1.3149 +				0x10009DB1	0x10009DC4			1		C:\\..\\EComExample.dll
  1.3150 +				0x10009DB3	0x10009DC3			2		C:\\..\\EComExample2.dll
  1.3151 +				0x10009DB3	0x10009DC4			2		C:\\..\\EComExample2.dll
  1.3152 +				0x101F8477	0x101F8478			1		C:\\..\\EComExample3.dll
  1.3153 +				0x101F847B	0x101F847C			1		C:\\..\\EComExample5.dll
  1.3154 +
  1.3155 +
  1.3156 +@SYMTestCaseID			SYSLIB-ECOM-CT-0749
  1.3157 +@SYMTestCaseDesc		Tests for CRegistryData::GetImplementationDllInfoForServer() function.
  1.3158 +@SYMTestPriority			High
  1.3159 +@SYMTestActions			Get the plugin information of the implementation UID and validate the information.
  1.3160 +						Get the plugin information of the implementation UID and Interface UID and validate
  1.3161 +						the information.
  1.3162 +						Tests for  the CImplementationInformation is correct
  1.3163 +						Tests for loading implementation from RAM
  1.3164 +						Tests for that the implementation returned will have the highest version
  1.3165 +						Tests for for invalid ImplementationUid
  1.3166 +@SYMTestExpectedResults	The test must not fail.
  1.3167 +@SYMREQ				REQ0000
  1.3168 +*/
  1.3169 +void CRegistryDataTest::GetImplementationDllInfoForServerTest()
  1.3170 + 	{
  1.3171 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0749 "));
  1.3172 + 	_LIT(KEComExample2,"C:\\sys\\bin\\EComExample2.dll");
  1.3173 + 	_LIT(KEComExample3,"C:\\sys\\bin\\EComExample3.dll");
  1.3174 + 	_LIT(KEComExample5,"C:\\sys\\bin\\EComExample5.dll");
  1.3175 +
  1.3176 + 	TUid ImpUid={0x10009DC3};
  1.3177 + 	TUid ImpUid3={0x101F8478};
  1.3178 + 	TUid ImpUid5={0x101F847C};
  1.3179 + 	TEntry dllinfo;
  1.3180 + 	TInt err;
  1.3181 +	TBool dummyBool;
  1.3182 +
  1.3183 + 	//Testing the CImplementationInformation is correct
  1.3184 + 	//and the DllInfo contains correct implementation info
  1.3185 + 	//Implementation uid used=0x101F8478
  1.3186 + 	CImplementationInformation* implementationInfo=NULL;
  1.3187 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid3, KCDummyUid, dllinfo, implementationInfo, dummyBool);
  1.3188 + 	TEST2(err, KErrNone);
  1.3189 + 	TEST(implementationInfo->ImplementationUid()==ImpUid3);
  1.3190 + 	TEST(implementationInfo->Version()==1);
  1.3191 + 	TEST(dllinfo.iName.CompareF(KEComExample3)==0);
  1.3192 +
  1.3193 + 	// ... again but with interface uid
  1.3194 +  	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid3, iInterfaceUid, dllinfo, implementationInfo, dummyBool);
  1.3195 + 	TEST2(err, KErrNone);
  1.3196 + 	TEST(implementationInfo->ImplementationUid()==ImpUid3);
  1.3197 + 	TEST(implementationInfo->Version()==1);
  1.3198 + 	TEST(dllinfo.iName.CompareF(KEComExample3)==0);
  1.3199 +
  1.3200 + 	//Testing loading implementation from RAM(EComExample5.dll)
  1.3201 + 	//Implementation uid used=0x101F847C
  1.3202 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid5, KCDummyUid, dllinfo, implementationInfo, dummyBool);
  1.3203 + 	TEST2(err, KErrNone);
  1.3204 + 	TEST(implementationInfo->ImplementationUid()==ImpUid5);
  1.3205 + 	TEST(implementationInfo->Version()==1);
  1.3206 + 	TEST(dllinfo.iName.CompareF(KEComExample5)==0);
  1.3207 +
  1.3208 + 	// ... again but with interface uid
  1.3209 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid5, iInterfaceUid, dllinfo, implementationInfo, dummyBool);
  1.3210 + 	TEST2(err, KErrNone);
  1.3211 + 	TEST(implementationInfo->ImplementationUid()==ImpUid5);
  1.3212 + 	TEST(implementationInfo->Version()==1);
  1.3213 + 	TEST(dllinfo.iName.CompareF(KEComExample5)==0);
  1.3214 +
  1.3215 + 	//Testing that the implementation returned will have the highest version
  1.3216 + 	//EComExample.dll  contains Impl 0x10009DC3 with version 1
  1.3217 + 	//EComExample2.dll contains Impl 0x10009DC3 with version 2
  1.3218 + 	//Ensure that choose the implementation in EComExample2.dll
  1.3219 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid, KCDummyUid, dllinfo, implementationInfo, dummyBool);
  1.3220 + 	TEST2(err, KErrNone);
  1.3221 + 	TEST(implementationInfo->ImplementationUid()==ImpUid);
  1.3222 + 	TEST(implementationInfo->Version()==2);
  1.3223 + 	TEST(dllinfo.iName.CompareF(KEComExample2)==0);
  1.3224 +
  1.3225 + 	// ... again but with interface uid
  1.3226 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid, iInterfaceUid, dllinfo, implementationInfo, dummyBool);
  1.3227 + 	TEST2(err, KErrNone);
  1.3228 + 	TEST(implementationInfo->ImplementationUid()==ImpUid);
  1.3229 + 	TEST(implementationInfo->Version()==2);
  1.3230 + 	TEST(dllinfo.iName.CompareF(KEComExample2)==0);
  1.3231 +
  1.3232 + 	//Testing for invalid ImplementationUid
  1.3233 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, KCInvalidUid, KCDummyUid, dllinfo, implementationInfo, dummyBool);
  1.3234 + 	TEST2(err, KErrNotFound);
  1.3235 + 	TEST(implementationInfo==0);
  1.3236 +
  1.3237 + 	//Testing for invalid InterfaceUid
  1.3238 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid, KCInvalidUid, dllinfo, implementationInfo, dummyBool);
  1.3239 + 	TEST2(err, KErrNotFound);
  1.3240 + 	TEST(implementationInfo==0);
  1.3241 +
  1.3242 + 	//Testing for invalid ImplementationUid and invalid InterfaceUid
  1.3243 + 	err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, KCInvalidUid, KCInvalidUid, dllinfo, implementationInfo, dummyBool);
  1.3244 + 	TEST2(err, KErrNotFound);
  1.3245 + 	TEST(implementationInfo==0);
  1.3246 + 	}
  1.3247 +
  1.3248 +/**
  1.3249 +@SYMTestCaseID          SYSLIB-ECOM-CT-0750
  1.3250 +@SYMTestCaseDesc	    OOM test for the creation and deletion of CRegistryData
  1.3251 +@SYMTestPriority 	    High
  1.3252 +@SYMTestActions  	    Create and delete CRegistryData object,checks for handles leaked
  1.3253 +@SYMTestExpectedResults The test must not fail.
  1.3254 +@SYMREQ                 REQ0000
  1.3255 +*/
  1.3256 +LOCAL_C void OOMCreateDeleteTest()
  1.3257 +	{
  1.3258 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0750 OOM CreateDeleteTest "));
  1.3259 +	TInt err;
  1.3260 +	TInt failAt = 1;
  1.3261 +	__UNUSED_VAR(failAt);
  1.3262 +
  1.3263 +	CRegistryDataTest* theTest = NULL;
  1.3264 +
  1.3265 +	do
  1.3266 +		{
  1.3267 +		__UHEAP_MARK;
  1.3268 +  		// find out the number of open handles
  1.3269 +		TInt startProcessHandleCount;
  1.3270 +		TInt startThreadHandleCount;
  1.3271 +		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
  1.3272 +
  1.3273 +		__UHEAP_SETFAIL(RHeap::EDeterministic, failAt++);
  1.3274 +
  1.3275 +		TRAP(err, theTest = CRegistryDataTest::NewL(EFalse));
  1.3276 +
  1.3277 +		__UHEAP_SETFAIL(RHeap::ENone, 0);
  1.3278 +
  1.3279 +		delete theTest;
  1.3280 +		theTest = NULL;
  1.3281 +
  1.3282 +		// check that no handles have leaked
  1.3283 +		TInt endProcessHandleCount;
  1.3284 +		TInt endThreadHandleCount;
  1.3285 +		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
  1.3286 +
  1.3287 +		TEST(startProcessHandleCount == endProcessHandleCount);
  1.3288 +		TEST(startThreadHandleCount  == endThreadHandleCount);
  1.3289 +
  1.3290 +		__UHEAP_MARKEND;
  1.3291 +		}
  1.3292 +	while(err == KErrNoMemory);
  1.3293 +
  1.3294 +	TheTest.Printf(_L("- Succeeded at heap failure rate of %i\n"), failAt);
  1.3295 + 	TEST2(err, KErrNone);
  1.3296 +	}
  1.3297 +
  1.3298 +/**
  1.3299 +@SYMTestCaseID			SYSLIB-ECOM-UT-1408
  1.3300 +@SYMTestCaseDesc		Unit tests for CRegistryData::IsAnyDiscoveredL
  1.3301 +@SYMTestPriority		High
  1.3302 +@SYMTestActions			Calls each of the actions that should cause IsAnyDiscovered to be set. Because the behavior is different with and without SPI, the tests are separated into a test with SPI and a test without
  1.3303 +@SYMTestExpectedResults	IsAnyDiscovered should be false when CDriveData is created, and false when the drive is internalized with no dat file.
  1.3304 +						It should be true when the drive is internalized and there is a dat file.
  1.3305 +@SYMPREQ				PREQ1192
  1.3306 +*/
  1.3307 +void  CRegistryDataTest::IsAnyDllDiscoveredTestL()
  1.3308 +	{
  1.3309 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1408 "));
  1.3310 +	if (SpiFileExists())
  1.3311 +		{
  1.3312 +		IsAnyDllDiscoveredTestWithSpiL();
  1.3313 +		}
  1.3314 +	IsAnyDllDiscoveredTestNoSpiL();
  1.3315 +	}
  1.3316 +
  1.3317 +void  CRegistryDataTest::IsAnyDllDiscoveredTestWithSpiL()
  1.3318 +	{
  1.3319 +	//
  1.3320 +	// Test DatFileExists for dat files on ROM when there is a SPI file
  1.3321 +	//
  1.3322 +
  1.3323 +	iStateAccessor->ClearRegistrations(*iRegistryData);
  1.3324 +
  1.3325 +	// when a CDriveData is created DatFileExists should be false
  1.3326 +	CRegistryData::CDriveData* driveDataZ = CRegistryData::CDriveData::NewLC(EDriveZ, iRegistryData);
  1.3327 +	iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataZ);
  1.3328 +	CleanupStack::Pop(driveDataZ);
  1.3329 +	TEST(!iRegistryData->IsAnyDllRegisteredWithDriveL(EDriveZ));
  1.3330 +	}
  1.3331 +
  1.3332 +void  CRegistryDataTest::IsAnyDllDiscoveredTestNoSpiL()
  1.3333 +	{
  1.3334 +	//
  1.3335 +	// Test IsAnyDiscovered for dat files on ROM when there is no SPI file
  1.3336 +	//
  1.3337 +
  1.3338 +	iStateAccessor->ClearRegistrations(*iRegistryData);
  1.3339 +
  1.3340 +	// when a CDriveData is created there should be no DLL entries so IsAnyDiscoveredL should be false
  1.3341 +	CRegistryData::CDriveData* driveDataC = CRegistryData::CDriveData::NewLC(EDriveC, iRegistryData);
  1.3342 +	iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataC);
  1.3343 +	CleanupStack::Pop(driveDataC);
  1.3344 +	TEST(!iRegistryData->IsAnyDllRegisteredWithDriveL(EDriveC));
  1.3345 +	}
  1.3346 +
  1.3347 +/**
  1.3348 +Adds the dll data on a particular drive.
  1.3349 +
  1.3350 +@SYMTestCaseID          SYSLIB-ECOM-UT-1407
  1.3351 +@SYMTestCaseDesc	    Tests for CRegistryData::CDllData::ProcessSecurityCheckL() function
  1.3352 +@SYMTestPriority 	    High
  1.3353 +@SYMTestActions  	    Creates CDllData objects and calls ProcessSecurityCheckL on them
  1.3354 +                        The CDllData with a missing DLL should return EFalse, the CDllData with invalid
  1.3355 +                        SID should return EFalse, and a valid CDllData should return ETrue and ensure the VID
  1.3356 +                        match the VID of the valid DLL.
  1.3357 +@SYMTestExpectedResults ProcessSecurityCheckL returns false when a plugin's dll doesn't exist or has an invalid SID, true otherwise.
  1.3358 +@SYMREQ                 PREQ1192, REQ6111
  1.3359 +*/
  1.3360 +void CRegistryDataTest::ProcessSecurityCheckTestL()
  1.3361 +	{
  1.3362 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1407 "));
  1.3363 +	TParse fileparse;
  1.3364 +	TDriveUnit driveUnitC(EDriveC);
  1.3365 +	CRegistryData *registryData = CRegistryData::NewL(TheFs);
  1.3366 +	CleanupStack::PushL(registryData);
  1.3367 +	CRegistryData::CDriveData *driveCData = CRegistryData::CDriveData::NewLC(driveUnitC, registryData);
  1.3368 +
  1.3369 +	//
  1.3370 +	// Test that a missing DLL causes ProcessSecurityCheckL to return EFalse
  1.3371 +	//
  1.3372 +	TEntry missingDllEntry;
  1.3373 +	missingDllEntry.iName = KEComMissingDll;
  1.3374 +	fileparse.Set(KEComMissingDll,NULL,NULL);
  1.3375 +	CRegistryData::CDllData* missingDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),missingDllEntry.iModified,KNullUid,KNullUid, driveCData);
  1.3376 +	TEST(!missingDllData->ProcessSecurityCheckL());
  1.3377 +	CleanupStack::PopAndDestroy(missingDllData);
  1.3378 +
  1.3379 +	//
  1.3380 +	// Test that an invalid SID causes ProcessSecurityCheckL to return EFalse
  1.3381 +	//
  1.3382 +	TEntry mismatchedSidDllEntry;
  1.3383 +	// The actual secure Id for this DLL is 0x10009DB1, here the corresponding ID is set to 0x01010101
  1.3384 +	TUidType mismatchedSidUidType(KCInvalidUid, KCInvalidUid, KCInvalidUid);
  1.3385 +	mismatchedSidDllEntry.iName = KEComExampleDllOnZSysBin;
  1.3386 +	mismatchedSidDllEntry.iType = mismatchedSidUidType;
  1.3387 +	fileparse.Set(KEComExampleDllOnZSysBin,NULL,NULL);
  1.3388 +	CRegistryData::CDllData* mismatchedSidDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),mismatchedSidDllEntry.iModified,mismatchedSidUidType[1],mismatchedSidUidType[2], driveCData);
  1.3389 +	TEST(!mismatchedSidDllData->ProcessSecurityCheckL());
  1.3390 +	CleanupStack::PopAndDestroy(mismatchedSidDllData);
  1.3391 +
  1.3392 +	//
  1.3393 +	// Test that a valid entry causes ProcessSecurityCheckL to return ETrue
  1.3394 +	//
  1.3395 +	TUid KEcomExampleSecureId = {0x10009DB1};
  1.3396 +	TEntry validDllEntry;
  1.3397 +	TUidType validUidType(KCInvalidUid, KUidInterfaceImplementationCollection, KEcomExampleSecureId);
  1.3398 +	validDllEntry.iName = KEComExampleDllOnZSysBin;
  1.3399 +	validDllEntry.iType = validUidType;
  1.3400 +	fileparse.Set(KEComExampleDllOnZSysBin(),NULL,NULL);
  1.3401 +	CRegistryData::CDllData* validDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),validDllEntry.iModified,validUidType[1],validUidType[2], driveCData);
  1.3402 +	// Because ProcessSecurityCheckL is handled differently the first and second times it is called for a given DLL
  1.3403 +	// ProcessSecurityCheckL is called twice here to test both cases (the fist time the security check is performed, and the second time
  1.3404 +	// a cached value is used)
  1.3405 +	TEST(validDllData->ProcessSecurityCheckL());
  1.3406 +	TEST(validDllData->ProcessSecurityCheckL());
  1.3407 +	// check the VID of the DLL.
  1.3408 +	TEST((validDllData->iVid).iId == 0x70000001);
  1.3409 +	CleanupStack::PopAndDestroy(validDllData);
  1.3410 +
  1.3411 +
  1.3412 +	// Clean up
  1.3413 +	CleanupStack::PopAndDestroy(driveCData);
  1.3414 +	CleanupStack::PopAndDestroy(registryData);
  1.3415 +	}
  1.3416 +
  1.3417 +/**
  1.3418 +Tests functionality of ListImplementationsL for an interface ID where the security checks
  1.3419 +for DLLs implementing the given interface fail
  1.3420 +
  1.3421 +@SYMTestCaseID          SYSLIB-ECOM-UT-1405
  1.3422 +@SYMTestCaseDesc	    Tests for CRegistryData::ListImplementationsL() function
  1.3423 +@SYMTestPriority 	    High
  1.3424 +@SYMTestActions  		Makes sure the failed DLL security checks are handled properly
  1.3425 +						An RSC file with an incorrect SID is tested, followed by an RSC file with a missing DLL
  1.3426 +@SYMTestExpectedResults ECom plugin's with invalid DLLs are not returned.
  1.3427 +@SYMREQ                 PREQ1192
  1.3428 +*/
  1.3429 +void CRegistryDataTest::FailedSecurityCheckTestListImplementationsL()
  1.3430 +	{
  1.3431 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1405 "));
  1.3432 +	// Set up for heap leak checking
  1.3433 +	__UHEAP_MARK;
  1.3434 +
  1.3435 +	//
  1.3436 +	// Test that mismatching SIDs cause a plug-in to not be returned through ListImplementationsL
  1.3437 +	// InvalidSIDPlugin.rsc and InvalidSIDPlugin.dll are on the C drive, but their SIDs do not match
  1.3438 +	// This will cause the DLL security check to fail, and since there are no other implementations of this interface,
  1.3439 +	// no implementations should be returned
  1.3440 +	//
  1.3441 +	TUid ifUid1 = {0x101FE392};	// the interface UID for InvalidSIDPlugin
  1.3442 +
  1.3443 +	TRAPD(err, iRegistryData->ListImplementationsL(ifUid1,iImplDataList));
  1.3444 +
  1.3445 +	TEST_OOM_ERR;
  1.3446 +	// Since there are no other plug-ins implementing {0x101FE392}, there should be no implementations found
  1.3447 +	TEST2(err, KEComErrNoInterfaceIdentified);
  1.3448 +
  1.3449 +	//
  1.3450 +	// Test that a missing DLL causes a plug-in to not be returned through ListImplementationsL
  1.3451 +	// and that other valid implementations are rolled back to when this happens
  1.3452 +	//
  1.3453 +	// EComRomRslvrExampleOnC.rsc is on the C drive, and has an implementation that upgrades EComRomRslvrExampleOnZ.rsc
  1.3454 +	// The DLL corresponding to EComRomRslvrExampleOnC.rsc is missing, so will fail the security check
  1.3455 +	// This means Ecom should fall back to the implementations from EComRomRslvrExampleOnZ
  1.3456 +	//
  1.3457 +	TUid ifUid3 = {0x10009DC8};  // the interface UID for EComRomRslvrExampleDllOnZ and EComRomRslvrExampleDllOnC
  1.3458 +	TRAP(err, iRegistryData->ListImplementationsL(ifUid3,iImplDataList));
  1.3459 +
  1.3460 +	TEST_OOM_ERR;
  1.3461 +	TEST2(err, KErrNone);
  1.3462 +	CleanupClosePushL(iImplDataList);
  1.3463 +
  1.3464 +	// Print UIDs of implementations
  1.3465 +	_LIT(KUIDFormat,"Uid = 0x%08x\n");
  1.3466 +	_LIT(KLists,"There are %d Implementations \n");
  1.3467 +
  1.3468 +	TheTest.Printf(KLists, iImplDataList.Count());
  1.3469 +
  1.3470 +	// Go through each of the implementations returned, and find the ones that match up with EComRomRslvrExampleRscOnZ
  1.3471 +	// (not the ones from EComRomRslvrExampleRscOnC because it's DLL is missing)
  1.3472 +	// EComRomRslvrExampleOnZ contains the implementation 0x10009DC7v2 and 0x10009DC6v1 (these should be found)
  1.3473 +	// EComRomRslvrExampleOnC contains the implementation 0x10009DC7v1 and 0x10009DC6v2 (these should NOT be returned becuase of the missing DLL)
  1.3474 +	TBool foundRightImplementation1 = EFalse;
  1.3475 +	TBool foundRightImplementation2 = EFalse;
  1.3476 +	for(TInt index = 0; index < iImplDataList.Count(); ++index)
  1.3477 +		{
  1.3478 +		CImplementationInformation* implInfo = iImplDataList[index]->iImplInfo;
  1.3479 +		TUid uid = implInfo->ImplementationUid();
  1.3480 +		TInt version = implInfo->Version();
  1.3481 +		if (uid.iUid == 0x10009DC6)
  1.3482 +			{
  1.3483 +			TEST(version == 1);
  1.3484 +			// The implementation of 0x10009DC6 from EComRomRslvrExampleOnZ was found
  1.3485 +			foundRightImplementation1 = ETrue;
  1.3486 +			}
  1.3487 +		if (uid.iUid == 0x10009DC7)
  1.3488 +			{
  1.3489 +			TEST(version == 2);
  1.3490 +			// The implementation of 0x10009DC7 from EComRomRslvrExampleOnZ was found
  1.3491 +			foundRightImplementation2 = ETrue;
  1.3492 +			}
  1.3493 +		TheTest.Printf(KUIDFormat, uid);
  1.3494 +		}
  1.3495 +	// Test that both implementations were found
  1.3496 +	TEST(foundRightImplementation1 && foundRightImplementation2);
  1.3497 +
  1.3498 +
  1.3499 +	CleanupStack::PopAndDestroy(&iImplDataList);
  1.3500 +	__UHEAP_MARKEND;
  1.3501 +	}
  1.3502 +
  1.3503 +/**
  1.3504 +Tests functionality of ListImplementationsL for an interface id where the corresponding
  1.3505 +DLL fails the se
  1.3506 +
  1.3507 +@SYMTestCaseID          SYSLIB-ECOM-UT-1406
  1.3508 +@SYMTestCaseDesc	    Tests for CRegistryData::GetImplementationDllInfoForClientL() function
  1.3509 +@SYMTestPriority 	    High
  1.3510 +@SYMTestActions  		Makes sure the plug-ins that will fail a security check are not returned through GetImplementationDllInfoForClientL
  1.3511 +						InvalidSIDPlugin.rsc and InvalidSIDPlugin.dll are on the C drive, with non-matching SIDs, so will fail a security check
  1.3512 +						Because the security check fails, no implementation should be returned
  1.3513 +						EComRomRslvrExampleOnC is on the C drive, without its associated DLL so will fail a security check
  1.3514 +						Because the DLL is not there, Ecom should fall back to the implementations on the Z drive in EComRomRslvrExampleOnZ
  1.3515 +@SYMTestExpectedResults ECom plugin's with invalid DLLs are not returned.
  1.3516 +@SYMREQ                 PREQ1192
  1.3517 +*/
  1.3518 +void CRegistryDataTest::FailedSecurityCheckTestGetImplementationInfoL()
  1.3519 +	{
  1.3520 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1406 "));
  1.3521 +	// Set up for heap leak checking
  1.3522 +	__UHEAP_MARK;
  1.3523 +
  1.3524 +	//
  1.3525 +	// Test that mismatching SIDs cause a plug-in to not be returned through GetImplementationDllInfoForClientL
  1.3526 +	//
  1.3527 +	TUid implUid1 = {0x101FE393};  // the implementation UID for InvalidSIDPlugin
  1.3528 +	TUid ifUid1 = {0x101FE392};  // the interface UID for InvalidSIDPlugin
  1.3529 +	TClientRequest clientReq;
  1.3530 +	TEntry dllInfo;
  1.3531 +	CImplementationInformation *implementationInfo = NULL;
  1.3532 +	// Test for GetImplementatioDllInfoForClientL when security check is not done.
  1.3533 +	TInt err = iRegistryData->GetImplementationDllInfoForClientL(clientReq, implUid1, ifUid1, dllInfo, implementationInfo, EFalse);
  1.3534 +	TEST2(err, KErrNone);
  1.3535 +	TEST(dllInfo.iName.Compare(_L("C:\\sys\\bin\\InvalidSIDPlugin.dll")) == 0);
  1.3536 +	// Test for GetImplementatioDllInfoForClientL when security check is done.
  1.3537 +	err = iRegistryData->GetImplementationDllInfoForClientL(clientReq, implUid1, ifUid1, dllInfo, implementationInfo, ETrue);
  1.3538 +	// Because the security check failed for InvalidSIDPlugin and there are no other implementations of implementation UID 0x101FE393, KErrNotFound is returned
  1.3539 +	TEST2(err, KErrNotFound);
  1.3540 +	//
  1.3541 +	// Test that a missing DLL causes a plug-in to not be returned through GetImplementationDllInfoForClientL
  1.3542 +	// and that other valid implementations are rolled back to when this happens
  1.3543 +	//
  1.3544 +	TUid implUid3 = {0x10009DC7};  // EComRomRslvrExampleDllOnZ
  1.3545 +	TUid ifUid3 = {0x10009DC8};  // EComRomRslvrExampleDllOnZ
  1.3546 +	err = iRegistryData->GetImplementationDllInfoForClientL(clientReq, implUid3, ifUid3, dllInfo, implementationInfo, ETrue);
  1.3547 +	TEST2(err, KErrNone);
  1.3548 +	// Because the security check failed for EComRomRslvrExampleDllOnC the returned implementation should rollback to the implementation on the Z drive
  1.3549 +	TEST(dllInfo.iName.Compare(_L("C:\\sys\\bin\\EComRomRslvrExampleOnZ.dll")) == 0);
  1.3550 +
  1.3551 +	__UHEAP_MARKEND;
  1.3552 +	}
  1.3553 +
  1.3554 +/**
  1.3555 +Test case for Defect ECOM non-spi handling of multiple localised resource files with same name but different extension.
  1.3556 +Only one dll is created.
  1.3557 +
  1.3558 +@SYMTestCaseID		SYSLIB-ECOM-CT-1806
  1.3559 +@SYMTestCaseDesc 	This function is used to check no duplication DLL is created when
  1.3560 +					there are multiple resource files with same name but different extensions.
  1.3561 +@SYMTestPriority 	High
  1.3562 +@SYMTestActions  	Use CDiscoverer::CDirScanner::ScanDriveL to start discovery plugins on C:.
  1.3563 +					Check that the dll list only has one dll existing with specified dll and interface UID.
  1.3564 +@SYMTestExpectedResults The test must not fail.
  1.3565 +@SYMDEF	DEF87787
  1.3566 +*/
  1.3567 +void CRegistryDataTest::CheckDuplicatPluginsOnCL()
  1.3568 +	{
  1.3569 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1806 "));
  1.3570 +
  1.3571 +	//clean up all resource files in C:
  1.3572 +	DeleteTestPlugin();
  1.3573 +
  1.3574 +	TDriveUnit driveC = TDriveUnit(KDriveC);
  1.3575 +
  1.3576 +	TRegistrarObserverStub* registrarObsv = new(ELeave) TRegistrarObserverStub;
  1.3577 +	CleanupStack::PushL(registrarObsv);
  1.3578 +
  1.3579 +	CRegistryData* registryData = CRegistryData::NewL(TheFs);
  1.3580 +	CleanupStack::PushL(registryData);
  1.3581 +
  1.3582 +	CRegistrar* registrar = CRegistrar::NewL(*registryData, *registrarObsv, TheFs);
  1.3583 +	CleanupStack::PushL(registrar);
  1.3584 +
  1.3585 +	TRegistryData_StateAccessor* stateAccessor= new(ELeave) TRegistryData_StateAccessor;
  1.3586 +	CleanupStack::PushL(stateAccessor);
  1.3587 +
  1.3588 +	//After construction check that: registry is empty
  1.3589 +	TEST(stateAccessor->RegistrationsCount(*registryData) == 0);
  1.3590 +
  1.3591 +    //Copies multiple resource file with same name but different extensions on C:.
  1.3592 +    TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExDllOnZ, KEComExDllOnC));
  1.3593 + 	TEST2(err, KErrNone);
  1.3594 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileOnC));
  1.3595 + 	TEST2(err, KErrNone);
  1.3596 + 	_LIT(KEComRscFileA01OnC,	"C:\\resource\\plugins\\EComExample5.A01");
  1.3597 + 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA01OnC));
  1.3598 + 	TEST2(err, KErrNone);
  1.3599 + 	_LIT(KEComRscFileA02OnC,	"C:\\resource\\plugins\\EComExample5.A02");
  1.3600 + 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA02OnC));
  1.3601 + 	TEST2(err, KErrNone);
  1.3602 +
  1.3603 +	//Scan C: drive
  1.3604 +	TRegistrar_StateAccessor registrarStateAccessorStub;
  1.3605 +	registrarStateAccessorStub.ScanDriveL(*registrar, driveC);
  1.3606 +
  1.3607 +
  1.3608 +	TDll *DllList = NULL;
  1.3609 +	TInt indx = stateAccessor->GetDllListL(*registryData, driveC, DllList);
  1.3610 +	TEST(indx == 0);
  1.3611 +	TEST(DllList->Count() == 1);
  1.3612 +	CRegistryData::CDllData *dllData = (*DllList)[0];
  1.3613 +
  1.3614 +	//Testing loading implementation from RAM(EComExample5.dll) with specified Dll and interface UID.
  1.3615 + 	TUid thirdDllUid = {0x101F847B};
  1.3616 +	TEST(dllData->iDllEntry->GetThirdUid() == thirdDllUid);
  1.3617 + 	TUid InterfaceUid5={0x10009DC0};
  1.3618 +	TEST2(stateAccessor->FindAnImplementation(*registryData, InterfaceUid5, driveC), ETrue);
  1.3619 +
  1.3620 +	//Clean up
  1.3621 +	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExDllOnC));
  1.3622 + 	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileOnC));
  1.3623 + 	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA01OnC));
  1.3624 + 	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA02OnC));
  1.3625 +
  1.3626 + 	CleanupStack::PopAndDestroy(stateAccessor);
  1.3627 +    CleanupStack::PopAndDestroy(registrar);
  1.3628 +    CleanupStack::PopAndDestroy(registryData);
  1.3629 +    CleanupStack::PopAndDestroy(registrarObsv);
  1.3630 +
  1.3631 +    //back to orignal state before the test
  1.3632 +    CopyPluginsL();
  1.3633 + 	}
  1.3634 +
  1.3635 +/**
  1.3636 +Test case for Defect ECOM non-spi handling of multiple localised resource files but without
  1.3637 +a proper RSC file based on language downgrade path.
  1.3638 +
  1.3639 +@SYMTestCaseID		SYSLIB-ECOM-CT-1829
  1.3640 +@SYMTestCaseDesc 	This function is used to check no DLL is created when multiple resource files
  1.3641 +					exists but no proper RSC file based on language downgrade path.
  1.3642 +@SYMTestPriority 	High
  1.3643 +@SYMTestActions  	Use CDiscoverer::CDirScanner::ScanDriveL to start discovery plugins on C:.
  1.3644 +					Check that the dll list is empty after scanning.
  1.3645 +@SYMTestExpectedResults The test must not fail.
  1.3646 +@SYMDEF	DEF87787
  1.3647 +*/
  1.3648 +
  1.3649 +void CRegistryDataTest::CheckNoPluginsOnCL()
  1.3650 +	{
  1.3651 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1829 "));
  1.3652 +
  1.3653 +	//clean up all resource files in C:
  1.3654 +	DeleteTestPlugin();
  1.3655 +
  1.3656 +	TDriveUnit driveC = TDriveUnit(KDriveC);
  1.3657 +
  1.3658 +	TRegistrarObserverStub* registrarObsv = new(ELeave) TRegistrarObserverStub;
  1.3659 +	CleanupStack::PushL(registrarObsv);
  1.3660 +
  1.3661 +	CRegistryData* registryData = CRegistryData::NewL(TheFs);
  1.3662 +	CleanupStack::PushL(registryData);
  1.3663 +
  1.3664 +	CRegistrar* registrar = CRegistrar::NewL(*registryData, *registrarObsv, TheFs);
  1.3665 +	CleanupStack::PushL(registrar);
  1.3666 +
  1.3667 +	TRegistryData_StateAccessor* stateAccessor= new(ELeave) TRegistryData_StateAccessor;
  1.3668 +	CleanupStack::PushL(stateAccessor);
  1.3669 +
  1.3670 +	//After construction check that registry is empty
  1.3671 +	TEST(stateAccessor->RegistrationsCount(*registryData) == 0);
  1.3672 +
  1.3673 +    //Copies only EComExample5.A01 and EComExample5.A02 to C:, but no EComExample5.RSC
  1.3674 +	TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExDllOnZ, KEComExDllOnC));
  1.3675 + 	TEST2(err, KErrNone);
  1.3676 + 	_LIT(KEComRscFileA01OnC,	"C:\\resource\\plugins\\EComExample5.A01");
  1.3677 + 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA01OnC));
  1.3678 + 	TEST2(err, KErrNone);
  1.3679 + 	_LIT(KEComRscFileA02OnC,	"C:\\resource\\plugins\\EComExample5.A02");
  1.3680 + 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA02OnC));
  1.3681 + 	TEST2(err, KErrNone);
  1.3682 +
  1.3683 +	//Scan C: drive
  1.3684 +	TRegistrar_StateAccessor registrarStateAccessorStub;
  1.3685 +	registrarStateAccessorStub.ScanDriveL(*registrar, driveC);
  1.3686 +
  1.3687 +	//check dll list. No dll is created.
  1.3688 +	TDll *DllList = NULL;
  1.3689 +	TInt indx = stateAccessor->GetDllListL(*registryData, driveC, DllList);
  1.3690 +	TEST(indx == 0);
  1.3691 +	TEST(DllList->Count() == 0);
  1.3692 +
  1.3693 + 	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExDllOnC));
  1.3694 + 	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA01OnC));
  1.3695 + 	TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA02OnC));
  1.3696 +
  1.3697 + 	CleanupStack::PopAndDestroy(stateAccessor);
  1.3698 +    CleanupStack::PopAndDestroy(registrar);
  1.3699 +    CleanupStack::PopAndDestroy(registryData);
  1.3700 +    CleanupStack::PopAndDestroy(registrarObsv);
  1.3701 +
  1.3702 +    //back to orignal state before the test
  1.3703 +    CopyPluginsL();
  1.3704 +
  1.3705 +	}
  1.3706 +
  1.3707 +/**
  1.3708 +Test case for implementations with same implementation UID but different
  1.3709 +interface UIDs. Implementation UIDs should be globally unique. So this
  1.3710 +is an error condition. But to maintain backward compatibility,
  1.3711 +ECom will allow it. List operation and most of the time, create
  1.3712 +should work. Problem arises if client uses the create request which
  1.3713 +does not supply the interface UID. In that case ECom applies a set of
  1.3714 +rules to determine which of the duplicate to pick. The returned
  1.3715 +impl. may not be the one the client is expecting. The rules from high
  1.3716 +precedence to low are:
  1.3717 +1. ROM based > non-ROM based,
  1.3718 +2. High drive letter > low drive letter
  1.3719 +3. Low I/F UID > High I/F UID.
  1.3720 +Rule number 1 is tested in SYSLIB-ECOM-CIT-3161.
  1.3721 +This testcase tests rule number 2 and number 3.
  1.3722 +
  1.3723 +@SYMTestCaseID		SYSLIB-ECOM-CT-3157
  1.3724 +@SYMTestCaseDesc 	This function verifies that ECom handles duplicated
  1.3725 +					implementation UID as expected:
  1.3726 +					- List operations always return the correct implementations.
  1.3727 +					- Create request which does not specify the I/F UID would get
  1.3728 +					  the implementation with the lowest I/F UID.
  1.3729 +					- Create request specifying both I/F UID and impl UID would
  1.3730 +					  get the correct implementation.
  1.3731 +@SYMTestPriority 	High
  1.3732 +@SYMTestActions  	1. Add two plugins with duplicated impl. UID but different I/F UID.
  1.3733 +					2. Perform list operation on each interface. Check that the
  1.3734 +					correct implementation is returned in each case.
  1.3735 +					3. Do a search by implementation UID only (I/F UID is zero).
  1.3736 +					Check that ECom returns the implementation with the lower
  1.3737 +					I/F UID.
  1.3738 +					4. Do another search specifying both I/F UID and impl. UID.
  1.3739 +					Check that ECom returns the correct implementation.
  1.3740 +					5. Remove the implementation with lower I/F UID from the
  1.3741 +					indexes. Do search by impl UID only. ECom should return the high
  1.3742 +					implementation.
  1.3743 +@SYMTestExpectedResults The test must not fail.
  1.3744 +@SYMDEF				INC080992
  1.3745 +*/
  1.3746 +void CRegistryDataTest::DuplicateImplUidTestL()
  1.3747 +	{
  1.3748 +	// Do not run this test in OOM mode. Main part of this test is
  1.3749 +	// inserting implementation in iInterfaceImplIndex and iImplIndex.
  1.3750 +	// This operation does not cleanup properly if OOM because it
  1.3751 +	// relies on server exit.
  1.3752 +
  1.3753 +	// This test uses 2 interfaces: KCExampleInterfaceUid (10009DC0) and
  1.3754 +	//                              KCInvalidUid (10009999).
  1.3755 +	// They have a common implementationUID KCExampleInterfaceImp.
  1.3756 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3157 "));
  1.3757 +
  1.3758 +	_LIT(KHighDllPath, "C:\\resource\\plugins\\interfacehigh.dll");
  1.3759 +	_LIT(KLowDllPath, "C:\\resource\\plugins\\interfacelow.dll");
  1.3760 +
  1.3761 +	_LIT(KHighDisplayName, "dupl impl. of 10009DC0");
  1.3762 +	_LIT(KLowDisplayName, "dupl impl. of 10009999");
  1.3763 +
  1.3764 +	// Create implementation with high interface UID
  1.3765 +	TImplCreationStruct highIfUid(EDriveC,
  1.3766 +							 KCExampleInterfaceUid,
  1.3767 +							 KCExampleInterfaceImp,
  1.3768 +							 KHighDllPath,
  1.3769 +							 KHighDisplayName);
  1.3770 +	CreateImplL(highIfUid);
  1.3771 +
  1.3772 +	// Create implementation with low interface UID
  1.3773 +	TImplCreationStruct lowIfUid(EDriveC,
  1.3774 +							KCInvalidUid,
  1.3775 +							KCExampleInterfaceImp,
  1.3776 +							KLowDllPath,
  1.3777 +							KLowDisplayName);
  1.3778 +	CreateImplL(lowIfUid);
  1.3779 +
  1.3780 +	TheTest.Printf(_L("Testing low I/F UID overrides high I/F UID on same drive\n"));
  1.3781 +	TestDuplicatedImplPrecedenceL(lowIfUid, highIfUid);
  1.3782 +
  1.3783 +	_LIT(KHighDriveDllPath, "K:\\resource\\plugins\\highdriveletter.dll");
  1.3784 +	_LIT(KHighDriveDisplayName, "K: impl. of i/f 10009DC0");
  1.3785 +	TImplCreationStruct highDriveLetter(EDriveK,
  1.3786 +							 KCExampleInterfaceUid,
  1.3787 +							 KCExampleInterfaceImp,
  1.3788 +							 KHighDriveDllPath,
  1.3789 +							 KHighDriveDisplayName);
  1.3790 +	CreateImplL(highDriveLetter);
  1.3791 +
  1.3792 +	// I/f UID of the dll in K: is same as highIfUid above.
  1.3793 +	// But K: take precedence over C: by virtue of higher drive number.
  1.3794 +	TheTest.Printf(_L("Testing high drive letter overrides low drive letter"));
  1.3795 +	TestDuplicatedImplPrecedenceL(highDriveLetter, lowIfUid);
  1.3796 +	}
  1.3797 +
  1.3798 +/** Helper of DuplicateImplUidTestL. This function does the real
  1.3799 +work while DuplicateImplUidTestL just setup the test parameters.
  1.3800 +
  1.3801 +@param highprecedence - data of the implementation of higher precedence.
  1.3802 +@param lowprecedence - the other implementation of lower precedence.
  1.3803 +*/
  1.3804 +void CRegistryDataTest::TestDuplicatedImplPrecedenceL(
  1.3805 +	const TImplCreationStruct& highprecedence,
  1.3806 +	const TImplCreationStruct& lowprecedence)
  1.3807 +	{
  1.3808 +	TUid commonImplUid = highprecedence.iImplUid;
  1.3809 +	TEST2(lowprecedence.iImplUid.iUid, highprecedence.iImplUid.iUid);
  1.3810 +
  1.3811 +	//=============================================================
  1.3812 +	// Check index is empty
  1.3813 +	TEST2(iStateAccessor->ImplementationsCount(*iRegistryData), 0);
  1.3814 +
  1.3815 +	//=============================================================
  1.3816 +	// Add implementation of lowprecedence to indexes
  1.3817 +	TBool result = iRegistryData->InsertIntoIndexL(lowprecedence.iImplData,
  1.3818 +												   ETrue);
  1.3819 +	TEST2(result, ETrue);
  1.3820 +
  1.3821 +	//=============================================================
  1.3822 +	// Add implementation of highprecedence to indexes
  1.3823 +	result = iRegistryData->InsertIntoIndexL(highprecedence.iImplData,
  1.3824 +											 ETrue);
  1.3825 +	TEST2(result, ETrue);
  1.3826 +
  1.3827 +	//=============================================================
  1.3828 +	// Check the two plugins are inserted in the indexes and list
  1.3829 +	// operation works OK
  1.3830 +	TUid tempUid = lowprecedence.iInterfaceUid;
  1.3831 +	RImplDataArray impls;
  1.3832 +	CleanupClosePushL(impls);
  1.3833 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, tempUid, impls);
  1.3834 +	TEST2(impls.Count(), 1);
  1.3835 +	TEST(impls[0]->iImplInfo->DisplayName() == lowprecedence.iImplDisplayName);
  1.3836 +
  1.3837 +	// Next do a list on the other I/F.
  1.3838 +	tempUid = highprecedence.iInterfaceUid;
  1.3839 +	iStateAccessor->GetImplementationInfoL(*iRegistryData, tempUid, impls);
  1.3840 +	TEST2(impls.Count(), 1);
  1.3841 +	TEST(impls[0]->iImplInfo->DisplayName() == highprecedence.iImplDisplayName);
  1.3842 +
  1.3843 +	//=============================================================
  1.3844 +	// If not specify interface UID, FindImplementation should return
  1.3845 +	// the implementation of high precedence
  1.3846 +	CRegistryData::CImplementationData*	searchResult = NULL;
  1.3847 +	TInt err = iStateAccessor->FindImplementation(*iRegistryData,
  1.3848 +											 commonImplUid,
  1.3849 +											 KNullUid,
  1.3850 +											 searchResult);
  1.3851 +	TEST2(err, KErrNone);
  1.3852 +	TEST(searchResult == highprecedence.iImplData);
  1.3853 +
  1.3854 +	//=============================================================
  1.3855 +	// FindImplementation should return the correct implementation
  1.3856 +	// if the interface UID is specified.
  1.3857 +	err = iStateAccessor->FindImplementation(*iRegistryData,
  1.3858 +											 commonImplUid,
  1.3859 +											 lowprecedence.iInterfaceUid,
  1.3860 +											 searchResult);
  1.3861 +	TEST2(err, KErrNone);
  1.3862 +	TEST(searchResult == lowprecedence.iImplData);
  1.3863 +
  1.3864 +	// Repeat FindImplementation test on the highprecedence interface UID
  1.3865 +	err = iStateAccessor->FindImplementation(*iRegistryData,
  1.3866 +											 commonImplUid,
  1.3867 +											 highprecedence.iInterfaceUid,
  1.3868 +											 searchResult);
  1.3869 +	TEST2(err, KErrNone);
  1.3870 +	TEST(searchResult == highprecedence.iImplData);
  1.3871 +
  1.3872 +	//=============================================================
  1.3873 +	// Remove the implementation of higher precedence.
  1.3874 +	TRAP(err, iRegistryData->RemoveFromIndexL(highprecedence.iDllData));
  1.3875 +	TEST2(err, KErrNone);
  1.3876 +
  1.3877 +	//=============================================================
  1.3878 +	// Now only the implementation with low precedence is in the indexes
  1.3879 +	err = iStateAccessor->FindImplementation(*iRegistryData,
  1.3880 +											 commonImplUid,
  1.3881 +											 KNullUid,
  1.3882 +											 searchResult);
  1.3883 +	TEST2(err, KErrNone);
  1.3884 +	TEST(searchResult == lowprecedence.iImplData);
  1.3885 +
  1.3886 +	// Before exit, make sure the indexes are empty.
  1.3887 +	TRAP(err, iRegistryData->RemoveFromIndexL(lowprecedence.iDllData));
  1.3888 +	TEST2(err, KErrNone);
  1.3889 +
  1.3890 +	// Check index is empty
  1.3891 +	TEST2(iStateAccessor->ImplementationsCount(*iRegistryData), 0);
  1.3892 +	CleanupStack::PopAndDestroy(&impls);
  1.3893 +	}
  1.3894 +/**
  1.3895 +Test case for making sure the flag for indication of language switch set properly when
  1.3896 +language downgrade change happens during the running time.
  1.3897 +
  1.3898 +@SYMTestCaseID		SYSLIB-ECOM-UT-3171
  1.3899 +@SYMTestCaseDesc 	This function verifies that ECom set the flag for indicating
  1.3900 +					language change properly:
  1.3901 +					- False when there is no language switch activity.
  1.3902 +					- True when language downgrade path is changed from non-localise to localise.
  1.3903 +					- True when first language changed only as opposed to  complete language downgrade path
  1.3904 +					- False when there is language switch activity, however, the language downgrade
  1.3905 +					  path has no change.
  1.3906 +@SYMTestPriority 	High
  1.3907 +@SYMTestActions  	1. construct language downgrade path
  1.3908 +					2. Sets up the system-wide locale and language downgrade path.
  1.3909 +					3. Check flag whether set properly.
  1.3910 +@SYMTestExpectedResults The test must not fail.
  1.3911 +@SYMDEF				CR0902
  1.3912 +*/
  1.3913 +void CRegistryDataTest::LanguageChangedTestL()
  1.3914 +	{
  1.3915 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3171 "));
  1.3916 +	//exclude those changes for language downgrade path during start-up time
  1.3917 +	if(!iStateAccessor->IsLanguageInitChanged(*iRegistryData))
  1.3918 +		{
  1.3919 +		// Language files used for locale settings
  1.3920 +		_LIT(KEComEnglishLocale, "elocl.01");
  1.3921 +		_LIT(KEComSpanishLocale, "elocl.04");
  1.3922 +
  1.3923 +		TLanguage downgradePathSetup[3];
  1.3924 +		TLocale locale;
  1.3925 +		TExtendedLocale extendedLocale;
  1.3926 +
  1.3927 +		TBool isLanguageChange = EFalse;
  1.3928 +		//There is no language switch activity, expect EFalse
  1.3929 +		TRAPD(err, iRegistryData->LanguageChangedL(isLanguageChange));
  1.3930 +		TEST_OOM_ERR;
  1.3931 +		TEST2(err, KErrNone);
  1.3932 +		TEST2(isLanguageChange, EFalse);
  1.3933 +
  1.3934 +		//change language downgrade path from non localise to localise.
  1.3935 +		extendedLocale.LoadSystemSettings();
  1.3936 +        #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
  1.3937 +            extendedLocale.LoadLocale(KEComEnglishLocale);
  1.3938 +        #else
  1.3939 +            extendedLocale.LoadLocale(KEComEnglishLang,KEComEnglishReg,KEComEnglishColl);
  1.3940 +        #endif  
  1.3941 + 		extendedLocale.SaveSystemSettings();
  1.3942 +
  1.3943 +		downgradePathSetup[0] = ELangEnglish;
  1.3944 +		downgradePathSetup[1] = ELangFrench;
  1.3945 +		downgradePathSetup[2] = ELangGerman;
  1.3946 +		SetLanguageL(downgradePathSetup);
  1.3947 +
  1.3948 +		TRAP(err, iRegistryData->LanguageChangedL(isLanguageChange));
  1.3949 +		TEST_OOM_ERR;
  1.3950 +		TEST2(err, KErrNone);
  1.3951 +		TEST2(isLanguageChange, ETrue);
  1.3952 +		//Change first language from English to Spanish..
  1.3953 +		extendedLocale.LoadSystemSettings();
  1.3954 +        #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
  1.3955 +            extendedLocale.LoadLocale(KEComSpanishLocale);
  1.3956 +        #else
  1.3957 +            extendedLocale.LoadLocale(KEComSpanishLang,KEComSpanishReg,KEComSpanishColl);
  1.3958 +        #endif  
  1.3959 +		extendedLocale.SaveSystemSettings();
  1.3960 +		downgradePathSetup[0] =ELangSpanish;
  1.3961 +		SetLanguageL(downgradePathSetup);
  1.3962 +		TRAP(err, iRegistryData->LanguageChangedL(isLanguageChange));
  1.3963 +		TEST_OOM_ERR;
  1.3964 +		TEST2(err, KErrNone);
  1.3965 +		TEST2(isLanguageChange, ETrue);
  1.3966 +
  1.3967 +		//use same language downgrade path setting.
  1.3968 +		SetLanguageL(downgradePathSetup);
  1.3969 +		TRAP(err, iRegistryData->LanguageChangedL(isLanguageChange));
  1.3970 +		TEST_OOM_ERR;
  1.3971 +		TEST2(err, KErrNone);
  1.3972 +		TEST2(isLanguageChange, EFalse);
  1.3973 +		}
  1.3974 +	}
  1.3975 +
  1.3976 +/**
  1.3977 +@SYMTestCaseID		SYSLIB-ECOM-UT-3670
  1.3978 +@SYMTestCaseDesc 	This test verifies that ECom sets the iDrivesRemoved correctly when drives
  1.3979 +					are added and removed
  1.3980 +@SYMTestPriority 	High
  1.3981 +@SYMTestActions  	Call UndoTemporaryUninstallL to install some drives
  1.3982 +					Remove selected drives by calling TemporaryUninstallL
  1.3983 +					Use the state accessor to verify that the iDrivesRemoved flag
  1.3984 +					correctly stores the removed drives
  1.3985 +@SYMTestExpectedResults The iDrivesRemoved flag should match the removed drives
  1.3986 +@SYMDEF				INC110470
  1.3987 +*/
  1.3988 +void CRegistryDataTest::DrivesRemovedTestL()
  1.3989 +	{
  1.3990 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3670 "));
  1.3991 +
  1.3992 +	//Ensure that the following drives are all installed
  1.3993 +	iRegistryData->UndoTemporaryUninstallL(EDriveA);
  1.3994 +	iRegistryData->UndoTemporaryUninstallL(EDriveO);
  1.3995 +	iRegistryData->UndoTemporaryUninstallL(EDriveF);
  1.3996 +	iRegistryData->UndoTemporaryUninstallL(EDriveZ);
  1.3997 +
  1.3998 +	//Test that there are no drives removed
  1.3999 +	TEST2(iStateAccessor->DrivesRemoved(*iRegistryData), 0);
  1.4000 +
  1.4001 +	//Remove a drive and check that the state indicates the correct drive
  1.4002 +	//has been removed
  1.4003 +	iRegistryData->TemporaryUninstallL(EDriveZ);
  1.4004 +	TInt drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
  1.4005 +	TEST2(drivesRemoved, 0x2000000);
  1.4006 +
  1.4007 +	//remove another drive then re-add the first and make sure the
  1.4008 +	//correct drive is removed
  1.4009 +	iRegistryData->TemporaryUninstallL(EDriveA);
  1.4010 +	iRegistryData->UndoTemporaryUninstallL(EDriveZ);
  1.4011 +	drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
  1.4012 +	TEST2(drivesRemoved, 0x1);
  1.4013 +
  1.4014 +	//Remove all existing drives  plus that hasnt been mounted
  1.4015 +	//and check the result
  1.4016 +	iRegistryData->TemporaryUninstallL(EDriveA);
  1.4017 +	iRegistryData->TemporaryUninstallL(EDriveO);
  1.4018 +	iRegistryData->TemporaryUninstallL(EDriveF);
  1.4019 +	iRegistryData->TemporaryUninstallL(EDriveZ);
  1.4020 +	iRegistryData->TemporaryUninstallL(EDriveX);
  1.4021 +
  1.4022 +	drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
  1.4023 +	TEST2(drivesRemoved, 0x2004021);
  1.4024 +
  1.4025 +	//Add some existing and some new drives check the result
  1.4026 +	iRegistryData->UndoTemporaryUninstallL(EDriveF);
  1.4027 +	iRegistryData->UndoTemporaryUninstallL(EDriveZ);
  1.4028 +	iRegistryData->UndoTemporaryUninstallL(EDriveB);
  1.4029 +	iRegistryData->UndoTemporaryUninstallL(EDriveR);
  1.4030 +
  1.4031 +	drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
  1.4032 +	TEST2(drivesRemoved, 0x0004001);
  1.4033 +
  1.4034 +	}
  1.4035 +
  1.4036 +// Type definition for pointer to member function.
  1.4037 +// Used in calling the CRegistryDataTest member function for testing.
  1.4038 +typedef void (CRegistryDataTest::*ClassFuncPtrL) (void);
  1.4039 +
  1.4040 +/**
  1.4041 +@SYMTestCaseID          SYSLIB-ECOM-CT-0751
  1.4042 +@SYMTestCaseDesc	    Function to call all test functions
  1.4043 +@SYMTestPriority 	    High
  1.4044 +@SYMTestActions  	    Calls up all test functions related to CRegistryData
  1.4045 +@SYMTestExpectedResults The test must not fail.
  1.4046 +@SYMREQ                 REQ0000
  1.4047 +*/
  1.4048 +/**
  1.4049 +Wrapper function to call all test functions
  1.4050 +@param		testFunc pointer to test function
  1.4051 +@param		aTestDesc test function name
  1.4052 +@param		aIsFullDriveCDiscovery whether the constructor make full discovery on drive C
  1.4053 +*/
  1.4054 +LOCAL_C void DoBasicTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDriveCDiscovery)
  1.4055 +	{
  1.4056 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0751 "));
  1.4057 +	TheTest.Next(aTestDesc);
  1.4058 +
  1.4059 +	__UHEAP_MARK;
  1.4060 +  	// find out the number of open handles
  1.4061 +	TInt startProcessHandleCount;
  1.4062 +	TInt startThreadHandleCount;
  1.4063 +	RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
  1.4064 +
  1.4065 +	CRegistryDataTest* theTest = CRegistryDataTest::NewL(aIsFullDriveCDiscovery);
  1.4066 +	CleanupStack::PushL(theTest);
  1.4067 +
  1.4068 +	(theTest->*testFuncL)();
  1.4069 +
  1.4070 +	CleanupStack::PopAndDestroy(theTest);
  1.4071 +
  1.4072 +	// check that no handles have leaked
  1.4073 +	TInt endProcessHandleCount;
  1.4074 +	TInt endThreadHandleCount;
  1.4075 +	RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
  1.4076 +
  1.4077 +	TEST(startProcessHandleCount == endProcessHandleCount);
  1.4078 +	TEST(startThreadHandleCount  == endThreadHandleCount);
  1.4079 +
  1.4080 +	__UHEAP_MARKEND;
  1.4081 +	}
  1.4082 +
  1.4083 +/**
  1.4084 +@SYMTestCaseID          SYSLIB-ECOM-CT-0752
  1.4085 +@SYMTestCaseDesc	    Function to call all OOM test functions
  1.4086 +@SYMTestPriority 	    High
  1.4087 +@SYMTestActions  	    Calls up all OOM test functions related to CRegistryData
  1.4088 +@SYMTestExpectedResults The test must not fail.
  1.4089 +@SYMREQ                 REQ0000
  1.4090 +*/
  1.4091 +/**
  1.4092 +Wrapper function to call all OOM test functions
  1.4093 +@param		testFuncL pointer to OOM test function
  1.4094 +@param		aTestDesc test function name
  1.4095 +@param		aIsFullDriveCDiscovery whether the constructor make full discovery on drive C
  1.4096 +*/
  1.4097 +LOCAL_C void DoOOMTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDriveCDiscovery)
  1.4098 +	{
  1.4099 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0752 "));
  1.4100 +	TheTest.Next(aTestDesc);
  1.4101 +
  1.4102 +	TInt err;
  1.4103 +	TInt tryCount = 0;
  1.4104 +	do
  1.4105 +		{
  1.4106 +		__UHEAP_MARK;
  1.4107 +  		// find out the number of open handles
  1.4108 +		TInt startProcessHandleCount;
  1.4109 +		TInt startThreadHandleCount;
  1.4110 +		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
  1.4111 +
  1.4112 +		CRegistryDataTest* theTest = CRegistryDataTest::NewL(aIsFullDriveCDiscovery);
  1.4113 +		CleanupStack::PushL(theTest);
  1.4114 +
  1.4115 +		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
  1.4116 +
  1.4117 +		TRAP(err, (theTest->*testFuncL)());
  1.4118 +
  1.4119 +		__UHEAP_SETFAIL(RHeap::ENone, 0);
  1.4120 +
  1.4121 +		CleanupStack::PopAndDestroy(theTest);
  1.4122 +		theTest = NULL;
  1.4123 +		// check that no handles have leaked
  1.4124 +		TInt endProcessHandleCount;
  1.4125 +		TInt endThreadHandleCount;
  1.4126 +		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
  1.4127 +
  1.4128 +		TEST(startProcessHandleCount == endProcessHandleCount);
  1.4129 +		TEST(startThreadHandleCount  == endThreadHandleCount);
  1.4130 +
  1.4131 +		__UHEAP_MARKEND;
  1.4132 +		} while(err == KErrNoMemory);
  1.4133 +
  1.4134 + 	TEST2(err, KErrNone);
  1.4135 +	TheTest.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
  1.4136 +	}
  1.4137 +
  1.4138 +/**
  1.4139 +Wrapper function for OOM test of function UpdateDllDataTest1L,UpdateDllDataTest2L,UpdateDllDataTest3L
  1.4140 +@param		testFuncL pointer to OOM test function
  1.4141 +@param		aTestDesc test function name
  1.4142 +@param		aIsFullDriveCDiscovery whether the constructor makes full discovery on drive C
  1.4143 +@param		aTestNumber The number identifies the test case of update dll data.
  1.4144 +*/
  1.4145 +LOCAL_C void DoOOMTestUpdateDllDataL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDriveCDiscovery,TInt aTestNumber)
  1.4146 +	{
  1.4147 +	TheTest.Next(aTestDesc);
  1.4148 +
  1.4149 +	TInt err;
  1.4150 +	TInt tryCount = 0;
  1.4151 +	do
  1.4152 +		{
  1.4153 +		__UHEAP_MARK;
  1.4154 +		switch (aTestNumber)
  1.4155 +			{
  1.4156 +				case 1:
  1.4157 +					{
  1.4158 +					TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12UpgradedOnC));
  1.4159 +					}
  1.4160 +				case 2:
  1.4161 +					{
  1.4162 +					TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample14UpgradedOnC));
  1.4163 +					}
  1.4164 +				case 3:
  1.4165 +					{
  1.4166 +					TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12DowngradedOnC));
  1.4167 +					}
  1.4168 +			}
  1.4169 +  		// find out the number of open handles
  1.4170 +		TInt startProcessHandleCount;
  1.4171 +		TInt startThreadHandleCount;
  1.4172 +		RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
  1.4173 +
  1.4174 +		CRegistryDataTest* theTest = CRegistryDataTest::NewL(aIsFullDriveCDiscovery);
  1.4175 +		CleanupStack::PushL(theTest);
  1.4176 +
  1.4177 +		__UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
  1.4178 +
  1.4179 +		TRAP(err, (theTest->*testFuncL)());
  1.4180 +
  1.4181 +		__UHEAP_SETFAIL(RHeap::ENone, 0);
  1.4182 +
  1.4183 +		CleanupStack::PopAndDestroy(theTest);
  1.4184 +		theTest = NULL;
  1.4185 +		// check that no handles have leaked
  1.4186 +		TInt endProcessHandleCount;
  1.4187 +		TInt endThreadHandleCount;
  1.4188 +		RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
  1.4189 +
  1.4190 +		TEST(startProcessHandleCount == endProcessHandleCount);
  1.4191 +		TEST(startThreadHandleCount  == endThreadHandleCount);
  1.4192 +
  1.4193 +		__UHEAP_MARKEND;
  1.4194 +		} while(err == KErrNoMemory);
  1.4195 +
  1.4196 + 	TEST2(err, KErrNone);
  1.4197 +	TheTest.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
  1.4198 +	}
  1.4199 +
  1.4200 +
  1.4201 +LOCAL_C void DoTestsL()
  1.4202 +	{
  1.4203 +	__UHEAP_MARK;
  1.4204 +	// Create backup server session here. When deleted it deletes safely.
  1.4205 +	// Registrar object creates BackUpNotifier object which
  1.4206 +	// internally creates CBaBackupSessionWrapper, an interface to BackUpSErver session opens 3 handles.
  1.4207 +	// but when Registrar object is deleted it deletes one handle and two are left open.
  1.4208 +
  1.4209 +	CBaBackupSessionWrapper *BackupSession = CBaBackupSessionWrapper::NewL();
  1.4210 +
  1.4211 +	// Basic tests
  1.4212 +	CreateDeleteTestL();
  1.4213 +	DoBasicTestL(&CRegistryDataTest::FailedSecurityCheckTestListImplementationsL,_L("FailedSecurityCheckTestListImplementations Test"), ETrue);
  1.4214 +	DoBasicTestL(&CRegistryDataTest::FailedSecurityCheckTestGetImplementationInfoL,_L("FailedSecurityCheckTestGetImplementationInfo Test"), ETrue);
  1.4215 +	DoBasicTestL(&CRegistryDataTest::ProcessSecurityCheckTestL, _L("ProcessSecurityCheckTest Test"), ETrue);
  1.4216 +	DoBasicTestL(&CRegistryDataTest::IsAnyDllDiscoveredTestL,_L("IsAnyDllDiscoveredTest Test"), ETrue);
  1.4217 +	DoBasicTestL(&CRegistryDataTest::ImplementationDataTestL,_L("ImplementationData Test"), EFalse);
  1.4218 +	DoBasicTestL(&CRegistryDataTest::InsertIntoIndexRemoveFromIndexTestL,_L("InsertIntoIndexRemoveFromIndex Test"), EFalse);
  1.4219 +	DoBasicTestL(&CRegistryDataTest::RollbackTestL,_L("Rollback Test"), EFalse);
  1.4220 +	DoBasicTestL(&CRegistryDataTest::AddDllDataTestL, _L("AddDllData Test"), ETrue);
  1.4221 +	DoBasicTestL(&CRegistryDataTest::AddDllDataPlugIn3TestL, _L("AddDllData PlugIn3 Test"), ETrue);
  1.4222 +	DoBasicTestL(&CRegistryDataTest::UpdateDllDataTest1L, _L("UpdateDllData Test 1"), ETrue);
  1.4223 +	DoBasicTestL(&CRegistryDataTest::UpdateDllDataTest2L, _L("UpdateDllData Test 2"), ETrue);
  1.4224 +	DoBasicTestL(&CRegistryDataTest::UpdateDllDataTest3L, _L("UpdateDllData Test 3"), ETrue);
  1.4225 +	DoBasicTestL(&CRegistryDataTest::IsRegisteredWithDateUpdateDllDataTestL, _L("IsRegisteredWithDate and UpdateDllData Test"), ETrue);
  1.4226 +	DoBasicTestL(&CRegistryDataTest::SetEnabledStateTestL, _L("SetEnabledState Test"), ETrue);
  1.4227 +	DoBasicTestL(&CRegistryDataTest::FindImplementationTestL, _L("FindImplementation Test"), ETrue);
  1.4228 +	DoBasicTestL(&CRegistryDataTest::ListImplementationsL, _L("ListImplementations Test for CRegistryData"), ETrue);
  1.4229 +	DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT1L, _L("ListImplementations Test for CRegistryResolveTransaction 1"), ETrue);
  1.4230 +	DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT2L, _L("ListImplementations Test for CRegistryResolveTransaction 2"), ETrue);
  1.4231 +	DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT3L, _L("ListImplementations Test for CRegistryResolveTransaction 3"), ETrue);
  1.4232 +	DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT4L, _L("ListImplementations Test for CRegistryResolveTransaction 4"), ETrue);
  1.4233 +	DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT5L, _L("ListImplementations Test for CRegistryResolveTransaction 5"), ETrue);
  1.4234 +	DoBasicTestL(&CRegistryDataTest::ListExtendedInterfacesTestL, _L("ListExtendedInterfaces Test"), ETrue);
  1.4235 +
  1.4236 +	DoBasicTestL(&CRegistryDataTest::DoUndoTemporaryUninstallTestL, _L("TemporaryUninstall and UndoTemporaryUninstall Test"), ETrue);
  1.4237 +	DoBasicTestL(&CRegistryDataTest::DiscoveriesBeginCompleteTestL, _L("DiscoveriesBegin and DiscoveriesComplete Test"), ETrue);
  1.4238 +
  1.4239 +	DoBasicTestL(&CRegistryDataTest::IndexedFindTestL, _L("IndexedFind Test"), ETrue);
  1.4240 +	DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForClientTestL,_L("GetImplementationDllInfoForClientL Test"), ETrue);
  1.4241 +	DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForServerTest,_L("GetImplementationDllInfoForServer Test"), ETrue);
  1.4242 +	DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForClientPlugIn3TestL,_L("GetImplementationDllInfoForClientPlugIn3L Test"), ETrue);
  1.4243 +	DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForServerPlugIn3Test,_L("GetImplementationDllInfoForServerPlugIn3 Test"), ETrue);
  1.4244 +	DoBasicTestL(&CRegistryDataTest::CheckDuplicatPluginsOnCL,_L("CheckDuplicatPluginsOnCL Test"), EFalse);
  1.4245 +	DoBasicTestL(&CRegistryDataTest::CheckNoPluginsOnCL,_L("CheckNoPluginsOnCL Test"), EFalse);
  1.4246 +	DoBasicTestL(&CRegistryDataTest::DuplicateImplUidTestL,_L("DuplicateImplUidTestL Test"), EFalse);
  1.4247 +	DoBasicTestL(&CRegistryDataTest::LanguageChangedTestL,_L("LanguageChangedTestL Test"), EFalse);
  1.4248 +	DoBasicTestL(&CRegistryDataTest::DrivesRemovedTestL,_L("DrivesRemovedTestL Test"), EFalse);
  1.4249 +
  1.4250 +	//OOM tests
  1.4251 +
  1.4252 +	OOMCreateDeleteTest();
  1.4253 +	DoOOMTestL(&CRegistryDataTest::FailedSecurityCheckTestListImplementationsL,_L("OOM FailedSecurityCheckTestListImplementations Test"), ETrue);
  1.4254 +	DoOOMTestL(&CRegistryDataTest::FailedSecurityCheckTestGetImplementationInfoL,_L("OOM FailedSecurityCheckTestGetImplementationInfo Test"), ETrue);
  1.4255 +	DoOOMTestL(&CRegistryDataTest::ProcessSecurityCheckTestL, _L("OOM ProcessSecurityCheckTest Test"), ETrue);
  1.4256 +	DoOOMTestL(&CRegistryDataTest::IsAnyDllDiscoveredTestL, _L("OOM IsAnyDllDiscoveredTestL Test"), ETrue);
  1.4257 +	DoOOMTestL(&CRegistryDataTest::ImplementationDataTestL, _L("OOM ImplementationData Test"), EFalse);
  1.4258 +	DoOOMTestL(&CRegistryDataTest::InsertIntoIndexRemoveFromIndexTestL, _L("OOM InsertIntoIndexRemoveFromIndex Test"), EFalse);
  1.4259 +	DoOOMTestL(&CRegistryDataTest::RollbackTestL, _L("OOM Rollback Test"), EFalse);
  1.4260 +	DoOOMTestL(&CRegistryDataTest::AddDllDataTestL, _L("OOM AddDllData Test"), ETrue);
  1.4261 +	DoOOMTestL(&CRegistryDataTest::AddDllDataPlugIn3TestL, _L("OOM AddDllData PlugIn3 Test"), ETrue);
  1.4262 +	DoOOMTestUpdateDllDataL(&CRegistryDataTest::UpdateDllDataTest1L, _L("OOM UpdateDllData Test 1"), ETrue, 1);
  1.4263 +	DoOOMTestUpdateDllDataL(&CRegistryDataTest::UpdateDllDataTest2L, _L("OOM UpdateDllData Test 2"), ETrue, 2);
  1.4264 +	DoOOMTestUpdateDllDataL(&CRegistryDataTest::UpdateDllDataTest3L, _L("OOM UpdateDllData Test 3"), ETrue, 3);
  1.4265 +	DoOOMTestL(&CRegistryDataTest::IsRegisteredWithDateUpdateDllDataTestL, _L("IsRegisteredWithDate and UpdateDllData Test"), ETrue);
  1.4266 +	DoOOMTestL(&CRegistryDataTest::SetEnabledStateTestL, _L("OOM SetEnabledState Test"), ETrue);
  1.4267 +	DoOOMTestL(&CRegistryDataTest::FindImplementationTestL, _L("OOM FindImplementation Test"), ETrue);
  1.4268 +	DoOOMTestL(&CRegistryDataTest::ListImplementationsL, _L("OOM ListImplementations Test for CRegistryData"), ETrue);
  1.4269 +	DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT1L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 1"), ETrue);
  1.4270 +	DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT2L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 2"), ETrue);
  1.4271 +	DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT3L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 3"), ETrue);
  1.4272 +	DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT4L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 4"), ETrue);
  1.4273 +	DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT5L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 5"), ETrue);
  1.4274 +    DoOOMTestL(&CRegistryDataTest::ListExtendedInterfacesTestL, _L("OOM ListExtendedInterfaces Test"), ETrue);
  1.4275 +	DoOOMTestL(&CRegistryDataTest::DoUndoTemporaryUninstallTestL, _L("OOM Test for TemporaryUninstall and UndoTemporaryUninstall"), ETrue);
  1.4276 +	DoOOMTestL(&CRegistryDataTest::DiscoveriesBeginCompleteTestL, _L("OOM Test for DiscoveriesBegin and DiscoveriesComplete"), ETrue);
  1.4277 +	DoOOMTestL(&CRegistryDataTest::IndexedFindTestL, _L("OOM IndexedFind Test"), ETrue);
  1.4278 +	DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForClientTestL,_L("OOM Test for GetImplementationDllInfoForClientL Test"), ETrue);
  1.4279 +	DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForServerTest,_L("OOM Test for GetImplementationDllInfoForServer Test"), ETrue);
  1.4280 +	DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForClientTestL,_L("OOM Test for GetImplementationDllInfoForClientPlugIn3L Test"), ETrue);
  1.4281 +	DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForServerTest,_L("OOM Test for GetImplementationDllInfoForServerPlugIn3L Test"), ETrue);
  1.4282 +	DoOOMTestL(&CRegistryDataTest::LanguageChangedTestL,_L("OOM Test for LanguageChangedTestL Test"), ETrue);
  1.4283 +	DoOOMTestL(&CRegistryDataTest::DrivesRemovedTestL,_L("OOM Test for DrivesRemovedTestL Test"), ETrue);
  1.4284 +
  1.4285 +	// OOM test can not be performed on API StoreL nad RestoreL, since registry index file gets corrupted when its
  1.4286 +	// data is not completely written, causing to fail in next call.
  1.4287 +	delete BackupSession;
  1.4288 +
  1.4289 +	// Panic Test
  1.4290 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3712 "));
  1.4291 +	ThreadPanicTest(_L("AddExtendedInterface Panic Testing"),AddExtendedInterfacePanicL);
  1.4292 +
  1.4293 +	__UHEAP_MARKEND;
  1.4294 +	}
  1.4295 +
  1.4296 +/**
  1.4297 +Copies the Plugins to specific folder for testing purpose
  1.4298 +*/
  1.4299 +LOCAL_C void CopyPluginsL()
  1.4300 +    {
  1.4301 +	// Copy the dlls and .rsc files on to RAM
  1.4302 +	TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExDllOnZ, KEComExDllOnC));
  1.4303 + 	TEST2(err, KErrNone);
  1.4304 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileOnC));
  1.4305 + 	TEST2(err, KErrNone);
  1.4306 +
  1.4307 +  	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExampleDllOnZ, KEComExampleDllOnC));
  1.4308 +	TEST2(err, KErrNone);
  1.4309 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample2DllOnZ, KEComExample2DllOnC));
  1.4310 +	TEST2(err, KErrNone);
  1.4311 + 	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample3DllOnZ, KEComExample3DllOnC));
  1.4312 +	TEST2(err, KErrNone);
  1.4313 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12DllOnZ, KEComExample12DllOnC));
  1.4314 +	TEST2(err, KErrNone);
  1.4315 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample14DllOnZ, KEComExample14DllOnC));
  1.4316 +	TEST2(err, KErrNone);
  1.4317 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample15DllOnZ, KEComExample15DllOnC));
  1.4318 +	TEST2(err, KErrNone);
  1.4319 +
  1.4320 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExampleRscOnZ, KEComExampleRscOnC));
  1.4321 +	TEST2(err, KErrNone);
  1.4322 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample2RscOnZ, KEComExample2RscOnC));
  1.4323 +	TEST2(err, KErrNone);
  1.4324 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample3RscOnZ, KEComExample3RscOnC));
  1.4325 +	TEST2(err, KErrNone);
  1.4326 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12RscOnZ, KEComExample12RscOnC));
  1.4327 +	TEST2(err, KErrNone);
  1.4328 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample14RscOnZ, KEComExample14RscOnC));
  1.4329 +	TEST2(err, KErrNone);
  1.4330 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample15RscOnZ, KEComExample15RscOnC));
  1.4331 +	TEST2(err, KErrNone);
  1.4332 +
  1.4333 +	// Test plug-in resource file SID that doesn't match the DLL
  1.4334 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComInvalidDllOnZ, KEComInvalidDllOnC));
  1.4335 +	TEST2(err, KErrNone);
  1.4336 +	TRAP(err, EComTestUtils::FileManCopyFileL(KEComInvalidRscOnZ, KEComInvalidRscOnC));
  1.4337 +	TEST2(err, KErrNone);
  1.4338 +
  1.4339 +	TRAP(err, EComTestUtils::FileManCopyFileL(KMissingDllRomRscFile, KMissingDllRamRscFile));
  1.4340 +	TEST2(err, KErrNone);
  1.4341 +	TRAP(err, EComTestUtils::FileManCopyFileL(KRollbackForMissingDllRomDllFile, KRollbackForMissingDllRamDllFile));
  1.4342 +	TEST2(err, KErrNone);
  1.4343 +	TRAP(err, EComTestUtils::FileManCopyFileL(KRollbackForMissingDllRomRscFile, KRollbackForMissingDllRamRscFile));
  1.4344 +	TEST2(err, KErrNone);
  1.4345 +
  1.4346 +	// Wait, so that ECom server looks for plugins copied from Z: to C drive
  1.4347 +	// ECOM server could be already started. It means that when we copy some
  1.4348 +	// ECOM plugins from Z: to C: drive - ECOM server should look for and
  1.4349 +	// find the new ECOM plugins. The ECOM server uses for that CDiscoverer::CIdleScanningTimer
  1.4350 +	// which is an active object. So the discovering service is asynchronous. We have to
  1.4351 +	// wait some time until it finishes. Otherwise ListImplementationsL could fail to find
  1.4352 +	// requested implementations.
  1.4353 +	User::After(KOneSecond * 3);
  1.4354 +	}
  1.4355 +
  1.4356 +//Initialise the Active Scheduler
  1.4357 +LOCAL_C void SetupL()
  1.4358 +    {
  1.4359 +	// Construct and install the Active Scheduler. The Active Schedular is needed
  1.4360 +	// by components used by this test as they are ActiveObjects.
  1.4361 +	TheActiveScheduler = new(ELeave)CActiveScheduler;
  1.4362 +	CActiveScheduler::Install(TheActiveScheduler);
  1.4363 +	ECOMTU_KILL_SERVER_L(TheTest);
  1.4364 +	}
  1.4365 +
  1.4366 +GLDEF_C TInt E32Main()
  1.4367 +	{
  1.4368 +	__UHEAP_MARK;
  1.4369 +
  1.4370 +	TheTest.Printf(_L("\n"));
  1.4371 +	TheTest.Title();
  1.4372 +	TheTest.Start(_L("Registry Data Tests"));
  1.4373 +
  1.4374 +	TheTrapCleanup = CTrapCleanup::New();
  1.4375 +
  1.4376 +	User::LeaveIfError(TheFs.Connect());
  1.4377 +
  1.4378 +	TRAPD(err, SetupL());
  1.4379 +	TEST2(err, KErrNone);
  1.4380 +
  1.4381 +	CopyPluginsL();
  1.4382 +
  1.4383 +	TRAP(err, DoTestsL());
  1.4384 +	TEST2(err, KErrNone);
  1.4385 +
  1.4386 +	// Cleanup files. If the cleanup fails that is no problem,
  1.4387 +	// as any subsequent tests will replace them. The only downside
  1.4388 +	// would be the disk not being tidied
  1.4389 +	DeleteTestPlugin();
  1.4390 +	TheFs.Close();
  1.4391 +
  1.4392 +	delete TheTrapCleanup;
  1.4393 +	delete TheActiveScheduler;
  1.4394 +	TheTest.End();
  1.4395 +	TheTest.Close();
  1.4396 +
  1.4397 +	__UHEAP_MARKEND;
  1.4398 +	return(KErrNone);
  1.4399 +	}