os/ossrv/lowlevellibsandfws/pluginfw/Framework/RegistryDataTest/t_registrydata.cpp
Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This file contains test classes and their implementations
15 // to test production class CRegistryData. Where necessary stubs
16 // are implemented to help in writing test harness using RTest.
17 // Test can fail if the Registry Index files are corrupted or missing.
18 // To solve that problem we need to run some component test harness, which
19 // runs by linking against ECom.lib. like t_listimplementation or t_suicide.
23 #include <ecom/ecom.h>
24 #include "EComUidCodes.h"
25 #include "RegistrarObserver.h"
26 #include "RegistryData.h"
27 #include "Registrar.h"
28 #include "EComResolverParams.h"
29 #include "Discoverer.h"
30 #include "DiscovererObserver.h"
31 #include "DriveInfo.h"
32 #include "DowngradePath.h"
33 #include "../EcomTestUtils/EcomTestUtils.h"
34 #include "RegistryResolveTransaction.h"
35 #include "ParseImplementationData.h"
37 #include <ecom/ecompanics.h>
45 #define UNUSED_VAR(a) a = a
48 const TUid KCExampleInterfaceUid = {0x10009DC0};
49 const TUid KCExampleInterfaceImp = {0x10009DC3};
50 const TUid KCDummyUid = {0x00000000};
51 const TUid KCInvalidUid = {0x10009999};
53 const TInt KOneSecond = 1000000;
55 // Used for suppressing warning in OOM tests
56 #define __UNUSED_VAR(var) var = var
59 #define TEST_OOM_ERR if(err == KErrNoMemory) User::Leave(err)
61 // The implemented structure for the registry data
62 typedef CRegistryData::CImplementationData* CImplementationDataPtr;
63 typedef RArray<CImplementationDataPtr> RImplDataArray;
65 // Test plugins and corresponding .rsc files that be copied to RAM for testing purpose
66 _LIT(KEComExDllOnZ, "Z:\\RAMOnly\\EComExample5.dll");
68 _LIT(KEComExDllOnC, "C:\\sys\\bin\\EComExample5.dll");
69 _LIT(KEComRscFileOnC, "C:\\resource\\plugins\\EComExample5.rsc");
70 _LIT(KEComRscFileOnZ, "Z:\\RAMOnly\\EComExample5.rsc");
71 _LIT(KEComExampleDllOnC, "C:\\sys\\bin\\EComExample.dll");
72 _LIT(KEComExampleDllOnZSysBin, "Z:\\sys\\bin\\EComExample.dll");
73 _LIT(KEComExample2DllOnC, "C:\\sys\\bin\\EComExample2.dll");
74 _LIT(KEComExample3DllOnC, "C:\\sys\\bin\\EComExample3.dll");
76 _LIT(KEComExampleRscOnC, "C:\\resource\\plugins\\EComExample.rsc");
77 _LIT(KEComExample2RscOnC, "C:\\resource\\plugins\\EComExample2.rsc");
78 _LIT(KEComExample3RscOnC, "C:\\resource\\plugins\\EComExample3.rsc");
80 _LIT(KEComExampleRscOnZ, "Z:\\RAMOnly\\EComExample.rsc");
81 _LIT(KEComExample2RscOnZ, "Z:\\RAMOnly\\EComExample2.rsc");
82 _LIT(KEComExample3RscOnZ, "Z:\\RAMOnly\\EComExample3.rsc");
84 _LIT(KEComExampleDllOnZ, "Z:\\RAMOnly\\EComExample.dll");
85 _LIT(KEComExample2DllOnZ, "Z:\\RAMOnly\\EComExample2.dll");
86 _LIT(KEComExample3DllOnZ, "Z:\\RAMOnly\\EComExample3.dll");
88 // These RSC files/DLLs are used to test an RSC file with a SID that does not
89 // match it's corresponding DLL. The implementations should not be listed/created.
90 _LIT(KEComInvalidDllOnZ, "z:\\RAMOnly\\InvalidSIDPlugin.dll");
91 _LIT(KEComInvalidRscOnZ, "z:\\RAMOnly\\InvalidSIDPlugin.rsc");
92 _LIT(KEComInvalidDllOnC, "c:\\sys\\bin\\InvalidSIDPlugin.dll");
93 _LIT(KEComInvalidRscOnC, "c:\\resource\\plugins\\InvalidSIDPlugin.rsc");
95 // This DLL does not exist, and should fail a security check
96 _LIT(KEComMissingDll, "c:\\sys\\bin\\NonExistentDllName.dll");
98 // These RSC files/DLLs are used to test an RSC file that points to a missing DLL
99 _LIT(KMissingDllRomRscFile, "z:\\RAMOnly\\EComRomRslvrExampleOnC.rsc");
100 _LIT(KMissingDllRamRscFile, "c:\\resource\\plugins\\EComRomRslvrExampleOnC.rsc");
101 // When the above RSC file's security check fails, the following implementations should be rolled back to
102 // (even though the filenames are EComRomRslvrExampleOnZ they will be copied to and exist on C Drive)
103 _LIT(KRollbackForMissingDllRomDllFile, "z:\\RAMOnly\\EComRomRslvrExampleOnZ.dll");
104 _LIT(KRollbackForMissingDllRamDllFile, "c:\\sys\\bin\\EComRomRslvrExampleOnZ.dll");
105 _LIT(KRollbackForMissingDllRomRscFile, "z:\\RAMOnly\\EComRomRslvrExampleOnZ.rsc");
106 _LIT(KRollbackForMissingDllRamRscFile, "c:\\resource\\plugins\\EComRomRslvrExampleOnZ.rsc");
108 //PLUGIN1 DLL with interfaceID: 0x10009E36
109 _LIT(KEComExample14DllOnC, "C:\\sys\\bin\\EComExample14.dll");
110 _LIT(KEComExample14DllOnZ, "Z:\\RAMOnly\\EComExample14.dll");
111 _LIT(KEComExample14RscOnC, "C:\\resource\\plugins\\EComExample14.rsc");
112 _LIT(KEComExample14RscOnZ, "Z:\\RAMOnly\\EComExample14.rsc");
113 //PLUGIN3 DLL with interfaceID: 0x10009E36, implementation version 2
114 _LIT(KEComExample15DllOnC, "C:\\sys\\bin\\EComExample15.dll");
115 _LIT(KEComExample15DllOnZ, "Z:\\RAMOnly\\EComExample15.dll");
116 _LIT(KEComExample15RscOnC, "C:\\resource\\plugins\\EComExample15.rsc");
117 _LIT(KEComExample15RscOnZ, "Z:\\RAMOnly\\EComExample15.rsc");
118 //PLUGIN3 DLL with interfaceID: 0x10009E36
119 _LIT(KEComExample12DllOnC, "C:\\sys\\bin\\EComExample12.dll");
120 _LIT(KEComExample12DllOnZ, "Z:\\RAMOnly\\EComExample12.dll");
121 _LIT(KEComExample12RscOnC, "C:\\resource\\plugins\\EComExample12.rsc");
122 _LIT(KEComExample12RscOnZ, "Z:\\RAMOnly\\EComExample12.rsc");
124 _LIT(KEComExample10DllOnC, "C:\\sys\\bin\\EComExample10.dll");
126 _LIT(KEcomExample12UpgradedOnC, "C:\\resource\\plugins\\EComExample12Upgraded.rsc");
127 _LIT(KEcomExample12UpgradedOnZ, "Z:\\RAMOnly\\EComExample12Upgraded.rsc");
128 _LIT(KEcomExample12UpgradedResourceNameOnly, "EComExample12Upgraded.rsc");
129 //PLUGIN1 Upgraded to PLUGIN3
130 _LIT(KEcomExample14UpgradedOnC, "C:\\resource\\plugins\\EComExample14Upgraded.rsc");
131 _LIT(KEcomExample14UpgradedOnZ, "Z:\\RAMOnly\\EComExample14Upgraded.rsc");
132 _LIT(KEcomExample14UpgradedResourceNameOnly, "EComExample14Upgraded.rsc");
133 //PLUGIN3 Downgraded to PLUGIN1
134 _LIT(KEcomExample12DowngradedOnC, "C:\\resource\\plugins\\EComExample12Downgraded.rsc");
135 _LIT(KEcomExample12DowngradedOnZ, "Z:\\RAMOnly\\EComExample12Downgraded.rsc");
136 _LIT(KEcomExample12DowngradedResourceNameOnly, "EComExample12Downgraded.rsc");
140 #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
141 _LIT(KEnglishLocale, "elocl.01");
142 _LIT(KEComSpanishLocale, "elocl.04");
144 // refer base/os/kernelhwsrv/kernel/eka/euser/locmapping.cpp
146 _LIT(KEComEnglishLang,"elocl_lan.001");
147 //_LIT(KEComFrenchLang,"elocl_lan.002");
148 //_LIT(KEComGermanLang,"elocl_lan.003");
149 _LIT(KEComSpanishLang,"elocl_lan.004");
151 _LIT(KEComEnglishReg,"elocl_reg.826");
152 //_LIT(KEComFrenchReg,"elocl_reg.250");
153 //_LIT(KEComGermanReg,"elocl_reg.276");
154 _LIT(KEComSpanishReg,"elocl_reg.724");
156 _LIT(KEComEnglishColl,"elocl_col.001");
157 //_LIT(KEComFrenchColl,"elocl_col.002");
158 //_LIT(KEComGermanColl,"elocl_col.003");
159 _LIT(KEComSpanishColl,"elocl_col.001");
162 LOCAL_D CTrapCleanup* TheTrapCleanup=NULL;
164 LOCAL_D CActiveScheduler* TheActiveScheduler=NULL;
168 LOCAL_D RTest TheTest(_L("t_registrydata.exe"));
170 //TPtrC defined which will point to KEComSpiFilePathAndName or KEComSpiFilePathAndNameForNand
171 //according to the rom build type
172 LOCAL_D TPtrC TheEComSpiFilePathAndNamePtrC;
174 TCapabilitySet dummycaps;
176 LOCAL_C void CopyPluginsL();
178 inline LOCAL_C void DeleteTestPlugin()
180 TRAPD(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExDllOnC));
181 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComRscFileOnC));
182 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExampleDllOnC));
183 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample2DllOnC));
184 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample3DllOnC));
185 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExampleRscOnC));
186 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample2RscOnC));
187 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample3RscOnC));
188 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComInvalidDllOnC));
189 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComInvalidRscOnC));
190 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KMissingDllRamRscFile));
191 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KRollbackForMissingDllRamDllFile));
192 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KRollbackForMissingDllRamRscFile));
193 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample12DllOnC));
194 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample12RscOnC));
195 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample14DllOnC));
196 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample14RscOnC));
197 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample15DllOnC));
198 TRAP(ignoreErr, EComTestUtils::FileManDeleteFileL(KEComExample15RscOnC));
203 //Test macroses and functions
204 LOCAL_C void Check(TInt aValue, TInt aLine)
208 ::DeleteTestPlugin();
209 TheTest(EFalse, aLine);
212 LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
214 if(aValue != aExpected)
216 RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
217 ::DeleteTestPlugin();
218 TheTest(EFalse, aLine);
222 Sets up the system-wide locale and language downgrade path.
224 LOCAL_C void SetLanguageL(const TLanguage aLang[3])
227 locale.SetLanguageDowngrade(0, aLang[0]);
228 locale.SetLanguageDowngrade(1, aLang[1]);
229 locale.SetLanguageDowngrade(2, aLang[2]);
230 User::LeaveIfError(locale.Set());
233 #define TEST(arg) ::Check((arg), __LINE__)
234 #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
239 This class allows us to provide stub behavior to instantiate CRegistrar
241 class TRegistrarObserverStub : public MRegistrarObserver
245 The overloaded method from the MRegistrarObserver class Used for firing
246 notifications to the client sessions that the underlying registry data has changed.
247 @post The CEComServer has notified all its client sessions
248 registered for notifications that the data changed
250 void Notification(TInt aNotificationCode)
252 RDebug::Print(_L("TRegistrarObserverStub called with notification code %d.\n"), aNotificationCode);
257 This friend class allows us to access private and protected members of production
258 code class CDiscoverer.
260 class TDiscoverer_StateAccessor
263 TDiscoverer_StateAccessor() {};
264 void ScanDirectoryL(CDiscoverer& aDiscoverer)
266 aDiscoverer.ProcessSSAEventL(EStartupStateNonCritical);
268 void ScanDriveL(CDiscoverer& aDiscoverer, TDriveUnit& aDrive)
270 TBool isRO = aDiscoverer.iCachedDriveInfo->DriveIsReadOnlyInternalL(aDrive);
271 aDiscoverer.iDirScanner->ScanDriveL(aDrive, isRO);
276 This friend class allows us to access private and protected members of production
277 code class CRegistrar.
279 class TRegistrar_StateAccessor
282 TRegistrar_StateAccessor() {};
283 void ScanDirectoryL(CRegistrar& aRegistrar)
285 TDiscoverer_StateAccessor discovererStateAccessor;
286 discovererStateAccessor.ScanDirectoryL(*(aRegistrar.iDiscoverer));
288 void ScanDriveL(CRegistrar& aRegistrar, TDriveUnit& aDrive)
290 TDiscoverer_StateAccessor discovererStateAccessor;
291 discovererStateAccessor.ScanDriveL(*(aRegistrar.iDiscoverer), aDrive);
293 void ParseL(CRegistrar& aRegistrar, CPluginBase*& aEntry,CRegistryData::CDllData& aDll);
296 void TRegistrar_StateAccessor::ParseL(CRegistrar& aRegistrar, CPluginBase*& aEntry,CRegistryData::CDllData& aDll)
298 aRegistrar.ParseL(aEntry,aDll);
303 This friend class allows us to access private and protected members of production
304 code class CRegistryData.
306 class TRegistryData_StateAccessor
309 TBool IsIndexValid(CRegistryData& aRegData);
311 TInt IndexedFind(CRegistryData& aRegData, const TUid& aImplementationUid);
313 TBool IsRegisteredDriveL(CRegistryData& aRegData, TDriveUnit aDriveUnit);
315 TInt RegistrationsCount(CRegistryData& aRegData);
317 TInt ImplementationsCount(CRegistryData& aRegData);
319 void SetRegistryChanged(CRegistryData& aRegData, TBool aChanged, TDriveUnit aDrive);
321 void ClearImplementationIndexList(CRegistryData& aRegData);
323 void ClearRegistrations(CRegistryData& aRegData);
325 void ResetAndDestroy(CRegistryData& aRegData);
327 void ConstructL(CRegistryData& aRegData);
329 TBool FindAnImplementation(CRegistryData& aRegData, TUid& aInterfaceUid, TDriveUnit& aDrive);
331 void GetImplementationInfoL(CRegistryData& aRegData, TUid& aInterfaceUid, RImplDataArray& aImplementationInfo);
333 void AppendDriveDataL(CRegistryData& aRegData, CRegistryData::CDriveData* aDriveData);
335 TInt FindImplementation(CRegistryData& aRegData, const TUid aImplUid, const TUid aInterfaceUid,
336 CRegistryData::CImplementationData*& aImplData) const;
337 static void ResetStaticDriveData();
338 TInt GetDllListL(CRegistryData& aRegistryData, TDriveUnit aDriveUnit, TDll*& aDllList);
339 TBool IsLanguageInitChanged(CRegistryData& aRegistryData);
340 TInt DrivesRemoved(CRegistryData& aRegistryData);
344 Constructs the registry
347 void TRegistryData_StateAccessor::ConstructL(CRegistryData& aRegData)
349 aRegData.ConstructL();
356 void TRegistryData_StateAccessor::ResetAndDestroy(CRegistryData& aRegData)
358 aRegData.iRegistrations->ResetAndDestroy();
359 delete aRegData.iRegistrations;
363 Clears the Implementations
364 @param aRegData RegistryData object under test
366 void TRegistryData_StateAccessor::ClearImplementationIndexList(CRegistryData& aRegData)
368 for(TInt index = 0; index < aRegData.iInterfaceImplIndex.Count(); ++index)
370 aRegData.iInterfaceImplIndex[index].Reset();
372 aRegData.iInterfaceImplIndex.Reset();
373 aRegData.iImplIndex.Reset();
378 Clears the Registrations
379 @param aRegData RegistryData object under test
381 void TRegistryData_StateAccessor::ClearRegistrations(CRegistryData& aRegData)
383 if(aRegData.iRegistrations)
385 aRegData.iRegistrations->ResetAndDestroy();
390 Indicates whether the registry index is currently valid. The
391 index will not be valid if discoveries are currently taking place.
392 @param aRegData RegistryData object under test
393 @return ETrue if index is valid EFalse otherwise
395 TBool TRegistryData_StateAccessor::IsIndexValid(CRegistryData& aRegData)
397 return aRegData.IndexValid();
401 Tries to find the index entry of the passed implementation uid
402 @param aRegData RegistryData object under test
403 @param aImplementationUid the implementation Uid of the implementation to locate
404 @return Index of the implementation, KErrNotFound otherwise
406 TInt TRegistryData_StateAccessor::IndexedFind(CRegistryData& aRegData,
407 const TUid& aImplementationUid)
409 return aRegData.IndexedFind(aImplementationUid);
413 Checks if the drive is already registered
414 @param aRegData RegistryData object under test
415 @param aDriveUnit the drive on which plugins are registered
416 @return ETrue if drive is registered, EFalse otherwise
418 TBool TRegistryData_StateAccessor::IsRegisteredDriveL(CRegistryData& aRegData,
419 TDriveUnit aDriveUnit)
421 TInt driveIndex = KErrNotFound;
422 CRegistryData::CDriveData* aDriveData=NULL;
423 driveIndex = aRegData.FindDriveL(aDriveUnit, aDriveData);
424 // Return True if the driveindex has some valid value i.e. not KErrNotFound
425 return (driveIndex != KErrNotFound);
429 Obtains count of plugin registrations
430 @param aRegData RegistryData object under test
431 @return Number of registrations
433 TInt TRegistryData_StateAccessor::RegistrationsCount(CRegistryData& aRegData)
435 return aRegData.iRegistrations->Count();
439 Obtains count of plugin registrations
440 @param aRegData RegistryData object under test
441 @return Number of registrations
443 TInt TRegistryData_StateAccessor::ImplementationsCount(CRegistryData& aRegData)
445 return aRegData.iInterfaceImplIndex.Count();
449 Sets Registry Changed flag to the given value
450 @param aRegData RegistryData object under test
451 @param aChanged True if the registry is changed
452 @param aDrive the drive under test
454 void TRegistryData_StateAccessor::SetRegistryChanged(CRegistryData& aRegData, TBool aChanged, TDriveUnit aDrive)
456 for(TInt i = 0; i <aRegData.iRegistrations->Count(); i++)
458 if ((*aRegData.iRegistrations)[i]->iDrive == aDrive)
460 (*aRegData.iRegistrations)[i]->iRegistryChanged = aChanged;
466 See if an implementation is discovered on the questioned drive
467 @param aRegData RegistryData object under test
468 @param aInterfaceUid Interface UID for the implementation
469 @param aDrive Drive to search the implementation on
470 @return ETrue if an implementation exists
472 TBool TRegistryData_StateAccessor::FindAnImplementation(CRegistryData& aRegData, TUid& aInterfaceUid, TDriveUnit& aDrive)
474 const TInt driveCount = aRegData.iRegistrations->Count();
475 for(TInt driveIndex = 0; driveIndex < driveCount; ++driveIndex)
477 CRegistryData::CDriveData* driveData = (*aRegData.iRegistrations)[driveIndex];
478 if(driveData->iDrive == aDrive)
480 TDll* dllList = (*aRegData.iRegistrations)[driveIndex]->iDllList;
481 const TInt dllCount = dllList->Count();
482 for(TInt dllIndex = 0; dllIndex < dllCount;++dllIndex)
484 // For each dll structure
485 RInterfaceList* interfaceList = (*dllList)[dllIndex]->iIfList;
486 const TInt ifCount = interfaceList->Count();
487 for(TInt ifIndex = 0; ifIndex < ifCount; ++ifIndex)
489 CRegistryData::TInterfaceIndex index;
491 // For each interface structure
492 TUid interfaceUid = (*interfaceList)[ifIndex]->iInterfaceUid;
493 if(interfaceUid == aInterfaceUid)
506 Get implementation info from the index
507 @param aRegData RegistryData object under test
508 @param aInterfaceUid Interface UID for the implementation
509 @param aImplementationData Reference of array of Implementation Data
511 void TRegistryData_StateAccessor::GetImplementationInfoL(CRegistryData& aRegData, TUid& aInterfaceUid, RImplDataArray& aImplementationData)
513 aRegData.ListImplementationsL(aInterfaceUid, aImplementationData);
517 Append DriveSata to iRegistrations
518 @param aRegData RegistryData object under test
519 @param aInterfaceUid Interface UID for the implementation
520 @return Array of Implementations
522 void TRegistryData_StateAccessor::AppendDriveDataL(CRegistryData& aRegData, CRegistryData::CDriveData* aDriveData)
524 aRegData.iRegistrations->AppendL(aDriveData);
528 @param aRegistryData The CRegistryData class object
529 @param aImplUid The implementation to find.
530 @param aInterfaceUid If greater than 0 the interface associated with the
531 implementation to find.
532 @param aImplData The found implementation data.
533 @return KErrNone if found otherwise KErrNotFound
535 TInt TRegistryData_StateAccessor::FindImplementation(CRegistryData& aRegistryData,
537 const TUid aInterfaceUid,
538 CRegistryData::CImplementationData*& aImplData) const
540 return aRegistryData.FindImplementation(aImplUid, aInterfaceUid, aImplData);
544 @param aRegistryData The CRegistryData class object
545 @param aDriveUnit A drive unit
546 @param aDllList The dll list returned on a specified drive.
547 @return Index of the specified drive in registryData if found otherwise KErrNotFound
549 TInt TRegistryData_StateAccessor::GetDllListL(CRegistryData& aRegistryData, TDriveUnit aDriveUnit, TDll*& aDllList)
551 CRegistryData::CDriveData* drive =NULL;
553 // Get the drive data in the registry.
554 TInt registryDriveIndex = aRegistryData.FindDriveL(aDriveUnit, drive);
555 if(registryDriveIndex != KErrNotFound)
557 aDllList = (*aRegistryData.iRegistrations)[registryDriveIndex]->iDllList;
559 return registryDriveIndex;
563 Indicates whether the language downgrade path has been changed during start-up time.
564 @param aRegData RegistryData object under test
565 @return ETrue if index is valid EFalse otherwise
567 TBool TRegistryData_StateAccessor::IsLanguageInitChanged(CRegistryData& aRegistryData)
569 return aRegistryData.iLanguageChanged;
572 TInt TRegistryData_StateAccessor::DrivesRemoved(CRegistryData& aRegistryData)
574 return aRegistryData.iRemovedDrives;
577 /** class to hold all the data required to create an instance of
578 CRegistryData::CImplementationData.
579 NB: the pointers in this struct are all owned by some other objects.
581 _LIT8(KDefaultImplDataType, "Data Type");
582 _LIT8(KDefaultImplOpaqueData, "");
584 struct TImplCreationStruct
586 TImplCreationStruct(TDriveNumber aDriveNumber,
589 const TDesC& aDllPathName,
590 const TDesC& aImplDisplayName,
591 const TDesC8& aImplDataType = KDefaultImplDataType,
592 const TDesC8& aImplOpaqueData = KDefaultImplOpaqueData,
593 TInt aImplVersion = 1,
594 TBool aRomBased = EFalse,
595 TBool aRomOnly = EFalse);
597 TDriveUnit iDriveUnit;
600 const TDesC& iDllPathName;
601 const TDesC& iImplDisplayName;
602 const TDesC8& iImplDataType;
603 const TDesC8& iImplOpaqueData;
605 CRegistryData::CDriveData* iDriveData;
606 CRegistryData::CDllData* iDllData;
607 CRegistryData::CInterfaceData* iInterfaceData;
608 CRegistryData::CImplementationData* iImplData;
614 // TImplCreationStruct Constructor
615 TImplCreationStruct::TImplCreationStruct(TDriveNumber aDriveNumber,
618 const TDesC& aDllPathName,
619 const TDesC& aImplDisplayName,
620 const TDesC8& aImplDataType,
621 const TDesC8& aImplOpaqueData,
625 : iDriveUnit(aDriveNumber), iInterfaceUid(aInterfaceUid),
626 iImplUid(aImplUid), iDllPathName(aDllPathName),
627 iImplDisplayName(aImplDisplayName), iImplDataType(aImplDataType),
628 iImplOpaqueData(aImplOpaqueData), iDriveIndex(KErrNotFound),
629 iDriveData(NULL), iDllData(NULL), iInterfaceData(NULL),
630 iImplData(NULL), iImplVersion(aImplVersion), iRomBased(aRomBased),
636 Test class encloses necessary members that aid to test CRegistryData
638 class CRegistryDataTest: public CBase
641 static CRegistryDataTest* NewL(TBool aIsFullDiscovery);
643 virtual ~CRegistryDataTest();
645 void AddDllDataPlugIn3TestL();
646 void AddDllDataTestL();
648 void IsRegisteredWithDateUpdateDllDataTestL();
649 void CopyOrgPlugInL();
650 void UpdateDllDataTest1L();
651 void UpdateDllDataTest2L();
652 void UpdateDllDataTest3L();
654 void SetEnabledStateTestL();
656 void FindImplementationTestL();
657 //Test for ListImplementationsL() in CRegistryData
658 void ListImplementationsL();
659 //Test for ListImplementationsL() in CRegistryResolverTransaction
660 void ListImplementationsTestT1L();
661 void ListImplementationsTestT2L();
662 void ListImplementationsTestT3L();
663 void ListImplementationsTestT4L();
664 void ListImplementationsTestT5L();
666 //Test for ListExtendedInterfacesL() in CRegistryData
667 void ListExtendedInterfacesTestL();
669 void DoUndoTemporaryUninstallTestL();
671 void DiscoveriesBeginCompleteTestL();
673 void IndexedFindTestL();
675 void GetImplementationDllInfoForServerTest();
677 void GetImplementationDllInfoForClientTestL();
679 void GetImplementationDllInfoForServerPlugIn3Test();
681 void GetImplementationDllInfoForClientPlugIn3TestL();
683 void VerifySelectNewPluginTypeL();
685 void AllAtOnceDiscoveryStateTransitionTestL();
687 void StagedDiscoveryStateTransitionTestL();
689 void ImplementationDataTestL();
691 void InsertIntoIndexRemoveFromIndexTestL();
693 void RollbackTestL();
695 void ProcessSecurityCheckTestL();
697 void FailedSecurityCheckTestListImplementationsL();
699 void FailedSecurityCheckTestGetImplementationInfoL();
701 void IsAnyDllDiscoveredTestL();
702 void IsAnyDllDiscoveredTestNoSpiL();
703 void IsAnyDllDiscoveredTestWithSpiL();
705 void CheckDuplicatPluginsOnCL();
707 void CheckNoPluginsOnCL();
709 void DuplicateImplUidTestL();
710 void TestDuplicatedImplPrecedenceL(const TImplCreationStruct& highprecedence,
711 const TImplCreationStruct& lowprecedence);
713 static TBool SpiFileExists();
715 void LanguageChangedTestL();
717 void DrivesRemovedTestL();
721 void ConstructL(TBool aIsFullDiscovery);
723 void CreateImplL(TImplCreationStruct& aCreationData);
725 /** The instance of the class under test */
726 CRegistryData* iRegistryData;
728 /** Registrar observer test class */
729 TRegistrarObserverStub* iRegistrarObserver;
731 /** CRegistrar required for populating the CRegistryData */
732 CRegistrar* iRegistrar;
733 /** CRegistrar state accessor */
734 TRegistrar_StateAccessor* iRegistrarAccessor;
736 /** A list of returned UIDs from the list methods */
737 RImplInfoArray* iUidList;
739 /** A list of implementation data from the list methods */
740 RImplDataArray iImplDataList;
742 /** Friend class pointer used for accessing private members */
743 TRegistryData_StateAccessor* iStateAccessor;
745 /** The current drive unit identifier */
746 TDriveUnit iDriveUnit;
748 /** UID for an implementation of an interface */
749 TUid iImplementationUid;
751 /** UID to identify a particular interface */
754 /** The directory entry data for a dll */
757 /** Flag to indicate if the registry entry requires an update */
760 /** The drive index returned by IsRegistered... so we know which drive to update on */
761 TInt iFoundDriveIndex;
766 Creates a new CRegistryDataTest object
767 @param aIsFullDriveCDiscovery whether the constructor make full discovery on Drive C
768 @return A pointer to the newly created class.
770 CRegistryDataTest* CRegistryDataTest::NewL(TBool aIsFullDriveCDiscovery)
772 CRegistryDataTest* self = new (ELeave) CRegistryDataTest();
773 CleanupStack::PushL(self);
774 self->ConstructL(aIsFullDriveCDiscovery);
780 Standardized default constructor
781 @post CRegistryDataTest is fully constructed.
783 CRegistryDataTest::CRegistryDataTest()
786 iDriveUnit = EDriveC;
788 TUid thirdUid = {0x101F847B};
790 iDllEntry.iType = TUidType(KNullUid, KNullUid, thirdUid);
791 iDllEntry.iName = KEComExDllOnC;
793 iInterfaceUid.iUid = KCExampleInterfaceUid.iUid;
794 iImplementationUid.iUid = KCExampleInterfaceImp.iUid;
798 Standardized 2nd(Initialization) phase of two phase construction.
799 Completes the safe construction of the CRegistryDataTest object
800 @param aIsFullDriveCDiscovery whether the constructor make full discovery on Drive C
801 @post CRegistryDataTest is fully constructed.
804 void CRegistryDataTest::ConstructL(TBool aIsFullDriveCDiscovery)
806 iUidList = new(ELeave) RImplInfoArray;
807 iStateAccessor= new(ELeave) TRegistryData_StateAccessor;
808 iRegistryData = CRegistryData::NewL(TheFs);
809 iRegistrarObserver=new (ELeave) TRegistrarObserverStub;
810 iRegistrarAccessor=new (ELeave) TRegistrar_StateAccessor;
811 iRegistrar=CRegistrar::NewL(*iRegistryData, *iRegistrarObserver, TheFs);
812 if (aIsFullDriveCDiscovery)
814 TDriveUnit driveUnitC = EDriveC;
815 iRegistrarAccessor->ScanDriveL(*iRegistrar,driveUnitC);
822 CRegistryDataTest::~CRegistryDataTest()
825 delete iStateAccessor;
826 delete iRegistrarAccessor;
828 delete iRegistrarObserver;
829 delete iRegistryData;
833 @return ETrue if the ECom.spi file exists on Z drive, EFalse if it does not
835 TBool CRegistryDataTest::SpiFileExists()
838 if (TheFs.Entry(TheEComSpiFilePathAndNamePtrC, entry) == KErrNone)
846 @SYMTestCaseID SYSLIB-ECOM-UT-3712
847 @SYMTestCaseDesc Tests for AddExtendedInterfaceL when adding duplicate extended interface Uid.
848 @SYMTestPriority High
849 @SYMTestActions Call CImplementationInformation::AddExtendedInterfaceL() with duplicate extended
851 AddExtendedInterfacePanicL() and ThreadPanicTest() are used for this test case.
852 @SYMTestExpectedResults Ensure that the AddExtendedInterfaceL panics in debug mode, but duplicate extended
853 interface is ignored in release mode.
856 LOCAL_C void AddExtendedInterfaceTestL()
861 testImplUid.iUid = KCExampleInterfaceUid.iUid;
862 TInt testImplVersion = 2;
863 _LIT(KTestImplName, "Implementation");
864 _LIT8(KTestImplDataType, "Data Type");
865 _LIT8(KTestImplOpaqueData, "Opaque Data");
866 TUid testExtendedInterfaceUid1;
867 TUid testExtendedInterfaceUid2;
868 testExtendedInterfaceUid1.iUid = 0x10009E44;
869 testExtendedInterfaceUid2.iUid = 0x10009E45;
871 TDriveUnit testImplDrive = EDriveC;
872 TBool testImplRomOnly = ETrue;
873 TBool testImplRomBased = EFalse;
875 CRegistryData* registryData = CRegistryData::NewL(TheFs);
876 CleanupStack::PushL(registryData);
877 CRegistryData::CDriveData* driveData = CRegistryData::CDriveData::NewLC(testImplDrive, registryData);
878 CRegistryData::CDllData* dllData = CRegistryData::CDllData::NewLC(driveData);
879 CRegistryData::CInterfaceData* interfaceData = CRegistryData::CInterfaceData::NewLC(dllData);
882 HBufC* name = KTestImplName().AllocLC();
883 HBufC8* dataType = KTestImplDataType().AllocLC();
884 HBufC8* opaqueData = KTestImplOpaqueData().AllocLC();
886 RArray<TUid>* extendedInterfaces = new(ELeave) RArray<TUid>;
888 CleanupStack::PushL(TCleanupItem(CloseAndDeleteArray, extendedInterfaces));
890 CRegistryData::CImplementationData* implementationData;
891 implementationData = CRegistryData::CImplementationData::NewL(interfaceData,
902 CleanupStack::Pop(extendedInterfaces);
903 CleanupStack::Pop(opaqueData);
904 CleanupStack::Pop(dataType);
905 CleanupStack::Pop(name);
907 CleanupStack::PushL(implementationData);
908 TEST(interfaceData == implementationData->iParent);
910 //Add extended interface
911 implementationData->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid1);
912 implementationData->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid2);
913 const RArray<TUid>* extendedInterfacesList = implementationData->iImplInfo->GetExtendedInterfaceList();
914 TEST(extendedInterfacesList->Count() == 2);
915 RDebug::Printf("Number of extended interfaces = %d",extendedInterfacesList->Count());
916 // Add duplicate extended interface, will panic in debug mode, but duplicate extended interface
917 // is ignored in release mode
918 implementationData->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid2);
921 const RArray<TUid>* extendedInterfacesList1 = implementationData->iImplInfo->GetExtendedInterfaceList();
922 TEST(extendedInterfacesList1->Count() == 2);
923 RDebug::Printf("Number of extended interfaces after adding duplicate extended interface = %d",extendedInterfacesList->Count());
926 CleanupStack::PopAndDestroy(5, registryData);
931 LOCAL_C TInt AddExtendedInterfacePanicL(TAny*)
934 CTrapCleanup* threadcleanup = CTrapCleanup::New();
935 TRAPD(err,AddExtendedInterfaceTestL());
937 delete threadcleanup;
943 The test code is used for capturing the PANIC that occurs as a result of calling AddExtendedInterfaceL
944 with duplicate extended interface Uid .
946 LOCAL_C void ThreadPanicTest(const TDesC& aName,TThreadFunction aFunction)
948 TRequestStatus threadStatus;
951 jit=User::JustInTime();
952 User::SetJustInTime(EFalse);
954 // Default stack size was doubled for X86, so reduce this multiplier to prevent panic
956 TInt err=thread.Create(aName,aFunction,KDefaultStackSize*4,KMinHeapSize,0x100000,0);
958 TInt err=thread.Create(aName,aFunction,KDefaultStackSize*8,KMinHeapSize,0x100000,0);
961 thread.Logon(threadStatus) ;
964 User::WaitForRequest(threadStatus);
966 //Now check why the thread Exit
967 // There is Assert_Debug check for the duplicate extended interface Uid for AddExtendedInterfaceL(),
968 // Therefore, the panic reason would be KErrAlreadyExists for debug mode.
969 // in release mode, the duplicate extended interface is ignored.
971 RDebug::Printf("Thread status: %d", thread.ExitType());
972 TEST(thread.ExitType()==EExitPanic);
973 TEST(thread.ExitReason()==EEComPanic_CImlpementationInfromation_DuplicateExIf);
975 RDebug::Printf("Thread status: %d", thread.ExitType());
976 TEST(thread.ExitType()==EExitKill);
978 CLOSE_AND_WAIT(thread);
979 User::SetJustInTime(jit);
984 Plugins to be used in this test
985 Interface UID DLL UID Implementation UID Version DLL Type Extended Interfaces
986 --------------------------------------------------------------------------------
987 0x10009E36 0x10009E3E 0x10009E39 1 PLUGIN3 {0x10009E44, 0x10009E45, 0x10009E46}
988 0x10009E3E 0x10009E3C 1 PLUGIN3 {}
989 0x10009E3E 0x10009E3D 1 PLUGIN3 {0x10009E44}
990 0x10009DC0 0x101F847B 0x101F847C 1 PLUGIN1 NULL
992 @SYMTestCaseID SYSLIB-ECOM-UT-3575
993 @SYMTestCaseDesc Tests for CImplementationInformation::GetExtendedInterfaceList() and
994 CImplementationInformation::GetExtendedInterfaceListL() functions. Makes sure that
995 results from both of the functions are identical.
996 @SYMTestPriority High
997 @SYMTestActions List the extended interfaces for a valid implementation UID
998 List the extended interfaces for a non-existing implementation UID
999 List the extended interfaces for a valid PLUGIN1 implementation UID
1000 @SYMTestExpectedResults Expected extended interfaces are returned.
1004 void CRegistryDataTest::ListExtendedInterfacesTestL()
1006 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3575 "));
1007 TUid ImpUid = {0x10009E39};
1008 TUid ImpUid1 = {0x10009E3C};
1009 TUid ImpUidPLUGIN1 = {0x101F847C};
1010 TUid extendedInterfacesUid[] = {0x10009E44,0x10009E45,0x10009E46};
1013 TClientRequest clntRq;
1015 //Gets the Implementation Information for a valid implementation UID with extended interfaces
1016 CImplementationInformation* implementationInfo=NULL;
1017 TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, KCDummyUid, dllinfo, implementationInfo, ETrue));
1019 TEST2(err, KErrNone);
1020 TEST(implementationInfo->ImplementationUid() == ImpUid);
1022 //Gets the list of extended Interfaces
1023 RArray<TUid>* extendedInterfaces = implementationInfo->GetExtendedInterfaceList();
1025 //Checks the extended interfaces list
1026 TEST(extendedInterfaces != NULL);
1027 for (TInt i = 0; i < extendedInterfaces->Count(); i++)
1029 TEST((*extendedInterfaces)[i] == extendedInterfacesUid[i]);
1032 // Uses the GetExtendedInterfaceListL API to get the extended interface.
1033 RArray<TUid> extendedInterfacesAPI;
1034 CleanupClosePushL(extendedInterfacesAPI);
1035 implementationInfo->GetExtendedInterfaceListL(extendedInterfacesAPI);
1036 // Makes sure that the list return is the same as the one return from GetExtendedInterfaceList.
1037 TEST(extendedInterfacesAPI.Count() == extendedInterfaces->Count());
1038 for (TInt i = 0; i < extendedInterfaces->Count(); i++)
1040 TEST((*extendedInterfaces)[i] == extendedInterfacesAPI[i]);
1042 CleanupStack::PopAndDestroy(&extendedInterfacesAPI);
1044 //Gets the Implementation Information for a valid implementation UID without extended interfaces
1045 TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid1, KCDummyUid, dllinfo, implementationInfo, ETrue));
1047 TEST2(err, KErrNone);
1048 TEST(implementationInfo->ImplementationUid() == ImpUid1);
1050 //Gets the list of extended Interfaces
1051 extendedInterfaces = implementationInfo->GetExtendedInterfaceList();
1052 TEST(extendedInterfaces->Count() == 0);
1054 // Uses the GetExtendedInterfaceListL API to get the extended interface.
1055 RArray<TUid> extendedInterfacesAPI1;
1056 CleanupClosePushL(extendedInterfacesAPI1);
1057 implementationInfo->GetExtendedInterfaceListL(extendedInterfacesAPI1);
1058 // Makes sure that the list return is the same as the one return from GetExtendedInterfaceList.
1059 TEST(extendedInterfacesAPI1.Count() == extendedInterfaces->Count());
1060 for (TInt i = 0; i < extendedInterfaces->Count(); i++)
1062 TEST((*extendedInterfaces)[i] == extendedInterfacesAPI1[i]);
1064 CleanupStack::PopAndDestroy(&extendedInterfacesAPI1);
1066 //Gets the Implementation Information for a non-existing implementation UID
1067 TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, KCInvalidUid, KCDummyUid, dllinfo, implementationInfo, ETrue));
1069 TEST2(err,KErrNone);
1070 TEST(implementationInfo == NULL);
1072 //Gets the Implementation Information for a valid PLUGIN1 implementation UID without extended interfaces
1073 TRAP(err,iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUidPLUGIN1, KCDummyUid, dllinfo, implementationInfo, ETrue));
1075 TEST2(err, KErrNone);
1076 TEST(implementationInfo->ImplementationUid() == ImpUidPLUGIN1);
1078 //Gets the list of extended Interfaces
1079 extendedInterfaces = implementationInfo->GetExtendedInterfaceList();
1080 TEST(extendedInterfaces == NULL);
1082 // Uses the GetExtendedInterfaceListL API to get the extended interface.
1083 RArray<TUid> extendedInterfacesAPI2;
1084 CleanupClosePushL(extendedInterfacesAPI2);
1085 implementationInfo->GetExtendedInterfaceListL(extendedInterfacesAPI2);
1086 // Makes sure that the list return is the same as the one return from GetExtendedInterfaceList.
1087 TEST(extendedInterfacesAPI2.Count() == 0);
1088 CleanupStack::PopAndDestroy(&extendedInterfacesAPI2);
1093 The interface Uid 0x10009E36 has 5 implementations on different DLLs(EComExample12.dll,EComExample14.dll and EComExample15.dll).
1094 0x10009E3D is said to be ROM-Only, it will not be created. 0x10009E39 has higher version in EComExample15.
1095 Interface UID DLL UID Implementation UID Version DLL Type Extended Interfaces
1096 --------------------------------------------------------------------------------
1097 0x10009E36 0x10009E40 0x10009E48 1 PLUGIN1 None
1098 0x10009E3E 0x10009E39 1 PLUGIN3 {0x10009E44, 0x10009E45, 0x10009E46}
1099 0x10009E3E 0x10009E3C 1 PLUGIN3 {}
1100 0x10009E3E 0x10009E3D 1 PLUGIN3 {0x10009E44}
1101 0x10009E42 0x10009E39 2 PLUGIN3 {0x10009E44, 0x10009E45, 0x10009E46}
1103 @SYMTestCaseID SYSLIB-ECOM-UT-3580
1104 @SYMTestCaseDesc Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
1105 that fall into a PLUGIN1 Dll and PLUGIN3. The extended interface list will not be populated
1106 @SYMTestPriority High
1107 @SYMTestActions List the implementations for an interface UID and a set of extended interfaces.
1108 Check the VID of every implementation matches the VID of the DLL which the implementation
1110 @SYMTestExpectedResults Expected matches are returned from both PLUGIN1 and PLUGIN3.
1113 void CRegistryDataTest::ListImplementationsTestT5L()
1115 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3580 "));
1116 const TUid KInterfaceUid = {0x10009E36};
1118 TEST(iRegistryData->IndexValid());
1119 // Set up client request and extended interfaces
1120 TClientRequest clientReq;
1121 RArray<TUid> extendedInterfaces;
1122 CleanupClosePushL(extendedInterfaces);
1123 TBool capability= ETrue;
1124 CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
1125 CleanupStack::PushL(registryResolveTransaction);
1126 RImplInfoArray* iUidListPtr = NULL;
1127 TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KInterfaceUid)));
1130 TEST2(err, KErrNone);
1132 // Prints UIDs of implementations
1133 _LIT(KUIDFormat,"Uid = 0x%08x\n");
1134 _LIT(KLists,"There are %d Implementations \n");
1136 TheTest.Printf(KLists, iUidListPtr->Count());
1137 // Tests for expected number of implementations.
1138 TEST(iUidListPtr->Count() == 3);
1140 for(TInt index = 0; index < iUidListPtr->Count(); ++index)
1142 // check VID of every implementation
1143 TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
1144 TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
1145 TheTest.Printf(KUIDFormat, uid);
1147 CleanupStack::PopAndDestroy(registryResolveTransaction);
1148 CleanupStack::PopAndDestroy(&extendedInterfaces);
1151 The interface Uid 0x10009E36 has 5 implementations on different DLLs(EComExample12.dll,EComExample14.dll and EComExample15.dll).
1152 0x10009E3D is said to be ROM-Only, it will not be created. 0x10009E39 has higher version in EComExample15.
1153 Interface UID DLL UID Implementation UID Version DLL Type Extended Interfaces
1154 -------------------------------------------------------------------------------------------------------
1155 0x10009E36 0x10009E40 0x10009E48 1 PLUGIN1 None
1156 0x10009E3E 0x10009E39 1 PLUGIN3 {0x10009E44, 0x10009E45, 0x10009E46}
1157 0x10009E3E 0x10009E3C 1 PLUGIN3 {}
1158 0x10009E3E 0x10009E3D 1 PLUGIN3 {0x10009E44}
1159 0x10009E42 0x10009E39 2 PLUGIN3 {0x10009E44, 0x10009E45, 0x10009E46}
1161 @SYMTestCaseID SYSLIB-ECOM-UT-3579
1162 @SYMTestCaseDesc Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
1163 that fall into a PLUGIN1 Dll and PLUGIN3. The extended interface list will be populated
1164 @SYMTestPriority High
1165 @SYMTestActions List the implementations for an interface UID and a set of extended interfaces.
1166 Check the VID of every implementation match the VID of the DLL which the implementation
1168 @SYMTestExpectedResults No PLUGIN1 implementations should be returned.
1171 void CRegistryDataTest::ListImplementationsTestT4L()
1173 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3579 "));
1174 const TUid KInterfaceUid = {0x10009E36};
1175 const TUid KExtendedInterfaceUid = {0x10009E44};
1177 TEST(iRegistryData->IndexValid());
1178 //Set up client request and extended interfaces
1179 TClientRequest clientReq;
1180 RArray<TUid> extendedInterfaces;
1181 CleanupClosePushL(extendedInterfaces);
1182 extendedInterfaces.AppendL(KExtendedInterfaceUid);
1183 TBool capability= ETrue;
1184 CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
1185 CleanupStack::PushL(registryResolveTransaction);
1186 RImplInfoArray* iUidListPtr = NULL;
1187 TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KInterfaceUid)));
1190 TEST2(err, KErrNone);
1192 // Prints UIDs of implementations
1193 _LIT(KUIDFormat,"Uid = 0x%08x\n");
1194 _LIT(KLists,"There are %d Implementations \n");
1196 TheTest.Printf(KLists, iUidListPtr->Count());
1197 // Tests for expected number of implementations.
1198 TEST(iUidListPtr->Count() == 1);
1200 for(TInt index = 0; index < iUidListPtr->Count(); ++index)
1202 // check VID of every implementation
1203 TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
1204 TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
1205 TheTest.Printf(KUIDFormat, uid);
1207 CleanupStack::PopAndDestroy(registryResolveTransaction);
1208 CleanupStack::PopAndDestroy(&extendedInterfaces);
1212 @SYMTestCaseID SYSLIB-ECOM-UT-3578
1213 @SYMTestCaseDesc Tests for CRegistryResolveTransaction::ListImplementationsL() function with invalid interface id.
1214 @SYMTestPriority High
1215 @SYMTestActions List the implementations for an invalid interface UID and valid extended interfaces.
1216 @SYMTestExpectedResults No implementation is returned.
1219 void CRegistryDataTest::ListImplementationsTestT3L()
1221 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3578 "));
1222 const TUid KExtendedInterfaceUid = {0x10009E44};
1224 TEST(iRegistryData->IndexValid());
1225 //Set up client request and extended interfaces
1226 TClientRequest clientReq;
1227 RArray<TUid> extendedInterfaces;
1228 CleanupClosePushL(extendedInterfaces);
1229 extendedInterfaces.AppendL(KExtendedInterfaceUid);
1230 TBool capability= ETrue;
1231 CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
1232 CleanupStack::PushL(registryResolveTransaction);
1233 TRAPD(err, RImplInfoArray* iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KCInvalidUid)));
1236 TEST2(err, KEComErrNoInterfaceIdentified);
1237 TheTest.Printf(_L("No Implementation is found.\n"));
1238 CleanupStack::PopAndDestroy(registryResolveTransaction);
1239 CleanupStack::PopAndDestroy(&extendedInterfaces);
1243 The interface Uid 0x10009E36 has 5 implementations (EComExample12.dll,EComExample14.dll and EComExample15.dll), but only 1 will
1244 be picked up as 2 of them do not match the extended interfaces criteria (0x10009E3C and 0x10009E48),
1245 1 of them is said to be ROM only but it is on RAM(0x10009E3D), and 1 of them has older version(0x10009E39).
1247 Interface UID DLL UID Implementation UID Version Type Extended Interfaces
1248 --------------------------------------------------------------------------------------
1249 0x10009E36 0x10009E3E 0x10009E39 1 PlugIn3 {0x10009E44, 0x10009E45, 0x10009E46}
1250 0x10009E3E 0x10009E3C 1 PlugIn3 {}
1251 0x10009E3E 0x10009E3D 1 PlugIn3 {0x10009E44}
1252 0x10009E40 0x10009E48 1 PLUGIN1 None
1253 0x10009E42 0x10009E39 2 PlugIn3 {0x10009E44, 0x10009E45, 0x10009E46}
1255 @SYMTestCaseID SYSLIB-ECOM-UT-3577
1256 @SYMTestCaseDesc Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
1257 that fall into a PLUGIN3 Dll.
1258 @SYMTestPriority High
1259 @SYMTestActions List the implementations for an existing interface UID and a set of extended interfaces.
1260 Test for expected number of implementations. Check the VID of every implementation match
1261 the VID of the DLL which the implementation belongs to.
1262 @SYMTestExpectedResults Expected number of implementations are returned.
1265 void CRegistryDataTest::ListImplementationsTestT2L()
1267 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3577 "));
1268 const TUid KInterfaceUid = {0x10009E36};
1269 const TUid KExtendedInterfaceUid = {0x10009E44};
1271 TEST(iRegistryData->IndexValid());
1272 // Set up client request and extended interfaces
1273 TClientRequest clientReq;
1274 RArray<TUid> extendedInterfaces;
1275 CleanupClosePushL(extendedInterfaces);
1276 extendedInterfaces.AppendL(KExtendedInterfaceUid);
1277 TBool capability= ETrue;
1278 CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
1279 CleanupStack::PushL(registryResolveTransaction);
1280 RImplInfoArray* iUidListPtr = NULL;
1281 TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(KInterfaceUid)));
1284 TEST2(err, KErrNone);
1286 // Prints UIDs of implementations
1287 _LIT(KUIDFormat,"Uid = 0x%08x\n");
1288 _LIT(KLists,"There are %d Implementations \n");
1290 TheTest.Printf(KLists, iUidListPtr->Count());
1291 // Tests for expected number of implementations.
1292 TEST(iUidListPtr->Count() == 1);
1294 for(TInt index = 0; index < iUidListPtr->Count(); ++index)
1296 // checks VID of every implementation
1297 TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
1298 TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
1299 TheTest.Printf(KUIDFormat, uid);
1301 CleanupStack::PopAndDestroy(registryResolveTransaction);
1302 CleanupStack::PopAndDestroy(&extendedInterfaces);
1307 The interface Uid 0x10009DC0 has 6 implementations on different DLLs but only 4 will
1308 be picked up as 2 of them are of older version(Impl ID 0x10009DC3 and 0x10009DC4 with version 1)
1310 Interface UID DLL UID Implementation UID Version
1311 -------------------------------------------------------
1312 0x10009DC0 0x10009DB1 0x10009DC3 1
1313 0x10009DB1 0x10009DC4 1
1314 0x10009DB3 0x10009DC3 2
1315 0x10009DB3 0x10009DC4 2
1316 0x101F8477 0x101F8478 1
1317 0x101F847B 0x101F847C 1
1319 @SYMTestCaseID SYSLIB-ECOM-UT-3576
1320 @SYMTestCaseDesc Tests for CRegistryResolveTransaction::ListImplementationsL() function with matches
1321 that fall into a PLUGIN1 Dll.
1322 @SYMTestPriority High
1323 @SYMTestActions List the implementations for an existing interface UID and
1324 test for expected number of implementations.Check the VID of
1325 every implementation match the VID of the DLL which the implementation
1327 @SYMTestExpectedResults Expected number of implementations are returned.
1330 void CRegistryDataTest::ListImplementationsTestT1L()
1332 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3576 "));
1333 TEST(iRegistryData->IndexValid());
1334 // Set up client request and extended interfaces
1335 TClientRequest clientReq;
1336 RArray<TUid> extendedInterfaces;
1337 CleanupClosePushL(extendedInterfaces);
1338 TBool capability= ETrue;
1339 CRegistryResolveTransaction* registryResolveTransaction = CRegistryResolveTransaction::NewL(*iRegistryData,extendedInterfaces,clientReq,capability);
1340 CleanupStack::PushL(registryResolveTransaction);
1341 RImplInfoArray* iUidListPtr = NULL;
1342 TRAPD(err, iUidListPtr = &(registryResolveTransaction->ListImplementationsL(iInterfaceUid)));
1345 TEST2(err, KErrNone);
1346 // Prints UIDs of implementations
1347 _LIT(KUIDFormat,"Uid = 0x%08x\n");
1348 _LIT(KLists,"There are %d Implementations \n");
1350 TheTest.Printf(KLists, iUidListPtr->Count());
1351 // Tests for expected number of implementations.
1352 TEST(iUidListPtr->Count() == 4);
1354 for(TInt index = 0; index < iUidListPtr->Count(); ++index)
1356 // checks VID of every implementation
1357 TEST(((*(iUidListPtr))[index]->VendorId()).iId == 0x70000001);
1358 TUid uid = (*(iUidListPtr))[index]->ImplementationUid();
1359 TheTest.Printf(KUIDFormat, uid);
1361 CleanupStack::PopAndDestroy(registryResolveTransaction);
1362 CleanupStack::PopAndDestroy(&extendedInterfaces);
1365 /** In order to create an instance of CImplementationData, the test
1366 has to create the chain of: drive data, dll data, and interface data.
1367 Use this method to safe the repetitive work.
1369 This method will not new the CImplementationData's parents if they
1370 have been set. Hence can be used to add an implementation to an
1371 existing interface data.
1373 void CRegistryDataTest::CreateImplL(TImplCreationStruct& aCreationData)
1375 if (aCreationData.iImplData)
1377 // Should not call this method. There is nothing to create.
1378 User::Leave(KErrGeneral);
1381 if (! aCreationData.iDriveData || (KErrNotFound == aCreationData.iDriveIndex))
1383 aCreationData.iDriveIndex = iRegistryData->FindDriveL(
1384 aCreationData.iDriveUnit, aCreationData.iDriveData);
1385 if (KErrNotFound == aCreationData.iDriveIndex)
1387 aCreationData.iDriveData = CRegistryData::CDriveData::NewLC(
1388 aCreationData.iDriveUnit, iRegistryData);
1389 iStateAccessor->AppendDriveDataL(*iRegistryData,
1390 aCreationData.iDriveData);
1391 CleanupStack::Pop(aCreationData.iDriveData);
1393 aCreationData.iDriveIndex = iRegistryData->FindDriveL(
1394 aCreationData.iDriveUnit,aCreationData.iDriveData);
1398 if (! aCreationData.iDllData)
1400 if (aCreationData.iInterfaceData)
1402 User::Leave(KErrGeneral); // can not have child without parent
1405 e.iName = aCreationData.iDllPathName;
1407 fileparse.Set(e.iName,NULL,NULL);
1408 aCreationData.iDllData = CRegistryData::CDllData::NewLC(
1409 fileparse.NameAndExt(),e.iModified,KNullUid,KNullUid, aCreationData.iDriveData);
1410 aCreationData.iDllData->iSecurityChecked = ETrue;
1411 aCreationData.iDriveData->AddL(aCreationData.iDllData);
1412 CleanupStack::Pop(aCreationData.iDllData);
1415 if (!aCreationData.iInterfaceData)
1417 aCreationData.iInterfaceData = CRegistryData::CInterfaceData::NewLC(
1418 aCreationData.iInterfaceUid, aCreationData.iDllData);
1419 aCreationData.iDllData->AddL(aCreationData.iInterfaceData);
1420 CleanupStack::Pop(aCreationData.iInterfaceData);
1423 HBufC* name = aCreationData.iImplDisplayName.AllocLC();
1424 HBufC8* dataType = aCreationData.iImplDataType.AllocLC();
1425 HBufC8* opaqueData = aCreationData.iImplOpaqueData.AllocLC();
1427 aCreationData.iImplData = CRegistryData::CImplementationData::NewL(
1428 aCreationData.iInterfaceData,
1429 aCreationData.iImplUid,
1430 aCreationData.iImplVersion,
1434 aCreationData.iDriveUnit,
1435 aCreationData.iRomOnly,
1436 aCreationData.iRomBased);
1438 CleanupStack::Pop(opaqueData);
1439 CleanupStack::Pop(dataType);
1440 CleanupStack::Pop(name);
1442 CleanupStack::PushL(aCreationData.iImplData);
1443 aCreationData.iInterfaceData->AddL(aCreationData.iImplData);
1444 CleanupStack::Pop(aCreationData.iImplData);
1449 @SYMTestCaseID SYSLIB-ECOM-CT-0290
1450 @SYMTestCaseDesc Unit tests for CRegistryData::CImplementationData
1451 @SYMTestPriority High
1452 @SYMTestActions Create instances using NewLC and NewL. Check that the parent supplied is
1454 Externalize instance created by NewL.
1455 Internalize data set by previous step. Check implementation data is identical.
1456 Check compare uid returns correct values.
1457 Check for no crash and memory leaks.
1458 @SYMTestExpectedResults The test must not fail.
1461 void CRegistryDataTest::ImplementationDataTestL()
1463 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0290 "));
1464 // Set up for heap leak checking
1467 // and leaking thread handles
1468 TInt startProcessHandleCount;
1469 TInt startThreadHandleCount;
1470 TInt endProcessHandleCount;
1471 TInt endThreadHandleCount;
1474 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
1478 testImplUid.iUid = KCExampleInterfaceUid.iUid;
1479 TInt testImplVersion = 2;
1480 _LIT(KTestImplName, "Implementation");
1481 _LIT8(KTestImplDataType, "Data Type");
1482 _LIT8(KTestImplOpaqueData, "Opaque Data");
1483 TUid testExtendedInterfaceUid1;
1484 TUid testExtendedInterfaceUid2;
1485 testExtendedInterfaceUid1.iUid = 0x10009E44;
1486 testExtendedInterfaceUid2.iUid = 0x10009E45;
1488 TDriveUnit testImplDrive = EDriveC;
1489 TBool testImplRomOnly = ETrue;
1490 TBool testImplRomBased = EFalse;
1492 CRegistryData* registryData = CRegistryData::NewL(TheFs);
1493 CleanupStack::PushL(registryData);
1494 CRegistryData::CDriveData* driveData = CRegistryData::CDriveData::NewLC(testImplDrive, registryData);
1495 CRegistryData::CDllData* dllData = CRegistryData::CDllData::NewLC(driveData);
1496 CRegistryData::CInterfaceData* interfaceData = CRegistryData::CInterfaceData::NewLC(dllData);
1500 CRegistryData::CImplementationData* implementation1;
1501 implementation1 = CRegistryData::CImplementationData::NewLC(interfaceData);
1502 TEST(interfaceData == implementation1->iParent);
1505 HBufC* name = KTestImplName().AllocLC();
1506 HBufC8* dataType = KTestImplDataType().AllocLC();
1507 HBufC8* opaqueData = KTestImplOpaqueData().AllocLC();
1509 RArray<TUid>* extendedInterfaces = new(ELeave) RArray<TUid>;
1511 CleanupStack::PushL(TCleanupItem(CloseAndDeleteArray, extendedInterfaces));
1513 CRegistryData::CImplementationData* implementation2;
1514 implementation2 = CRegistryData::CImplementationData::NewL(interfaceData,
1523 extendedInterfaces);
1525 CleanupStack::Pop(extendedInterfaces);
1526 CleanupStack::Pop(opaqueData);
1527 CleanupStack::Pop(dataType);
1528 CleanupStack::Pop(name);
1530 CleanupStack::PushL(implementation2);
1531 TEST(interfaceData == implementation1->iParent);
1533 //Add extended interface
1534 implementation2->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid1);
1535 implementation2->iImplInfo->AddExtendedInterfaceL(testExtendedInterfaceUid2);
1538 _LIT(KFileName,"c:\\ecomimpldata.dat");
1540 TFileName fileName(KFileName);
1541 TEST2(file.Replace(TheFs,fileName,EFileWrite|EFileRead), KErrNone);
1543 CleanupClosePushL(buf);
1545 RWriteStream stream(&buf);
1547 implementation2->ExternalizeL(stream);
1549 CleanupStack::PopAndDestroy(&buf);
1552 TInt err = file.Open(TheFs,fileName,EFileRead);
1553 TEST2(err, KErrNone);
1555 CleanupClosePushL(buf2);
1557 RReadStream stream2(&buf2);
1559 implementation1->InternalizeL(stream2);
1561 TEST(implementation1->iImplInfo->ImplementationUid().Uid == testImplUid.Uid);
1562 TEST(implementation1->iImplInfo->Version() == testImplVersion);
1563 TEST2(KErrNone, name->Compare(implementation1->iImplInfo->DisplayName()));
1564 TEST2(KErrNone, dataType->Compare(implementation1->iImplInfo->DataType()));
1565 TEST2(KErrNone, opaqueData->Compare(implementation1->iImplInfo->OpaqueData()));
1566 TEST(implementation1->iImplInfo->Drive() == testImplDrive);
1567 TEST(implementation1->iImplInfo->RomOnly() == testImplRomOnly);
1568 TEST(implementation1->iImplInfo->RomBased() == testImplRomBased);
1569 //Get extended interface and check
1570 RArray<TUid>* extendedInterfaceList = implementation1->iImplInfo->GetExtendedInterfaceList();
1571 TEST((*extendedInterfaceList)[0] == testExtendedInterfaceUid1);
1572 TEST((*extendedInterfaceList)[1] == testExtendedInterfaceUid2);
1574 CleanupStack::PopAndDestroy(&buf2);
1576 // Setup data for Compare Implementation Uid
1577 name = KTestImplName().AllocLC();
1578 dataType = KTestImplDataType().AllocLC();
1579 opaqueData = KTestImplOpaqueData().AllocLC();
1580 TUid compareTestImplUid;
1581 compareTestImplUid.iUid = 0x10009DC3;
1582 CRegistryData::CImplementationData* implementation3;
1583 implementation3 = CRegistryData::CImplementationData::NewL(interfaceData,
1592 CleanupStack::Pop(opaqueData);
1593 CleanupStack::Pop(dataType);
1594 CleanupStack::Pop(name);
1596 CleanupStack::PushL(implementation3);
1597 TEST(interfaceData == implementation3->iParent);
1599 // Compare Implementation Uid test
1600 TEST(CRegistryData::CImplementationData::CompareImplUid(*implementation3, *implementation2) > 0);
1601 TEST(CRegistryData::CImplementationData::CompareImplUid(*implementation1, *implementation3) < 0);
1602 TEST(CRegistryData::CImplementationData::CompareImplUid(*implementation3, *implementation3) == 0);
1605 CleanupStack::PopAndDestroy(7, registryData);
1606 TheFs.Delete(KFileName);
1608 // Check for open handles
1609 RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
1610 TEST(startThreadHandleCount == endThreadHandleCount);
1617 @SYMTestCaseID SYSLIB-ECOM-CT-0291
1618 @SYMTestCaseDesc Tests for CRegistryData::InsertIntoIndexRemoveFromIndexTestL
1620 @SYMTestPriority High
1621 @SYMTestActions Create 2 identical implementations, 1 for the Z drive and 1 for the C drive,
1622 including parents and add to the registry.
1623 Create a 3rd identical implementation, except for the name, for the C drive.
1624 Check there are no implementations in the Implementation Index List.
1625 Insert the Z implementations into the Implementation Index List and check.
1626 Insert the 1st C implementation with security check on and check the upgrade
1628 Remove the implementation. Check.
1629 Add the Z drive implementation. Check.
1630 Insert the 1st C implementation with security check off and check the upgrade
1632 Remove the implementation. Check.
1633 Add the Z drive implementation. Check.
1634 Insert the 2nd C implementation with security check on and check the upgrade
1636 Insert the 2nd C implementation with security check off and check the upgrade
1638 Remove the implementation. Check.
1639 Check for no crash and memory leaks.
1640 @SYMTestExpectedResults The test must not fail.
1643 void CRegistryDataTest::InsertIntoIndexRemoveFromIndexTestL()
1645 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0291 "));
1646 _LIT(KTestImplName, "Implementation");
1647 _LIT8(KTestImplDataType, "Data Type");
1648 _LIT8(KTestImplOpaqueData, "Opaque Data");
1650 // create Z drive data
1651 TDriveUnit implDriveZ = EDriveZ;
1652 CRegistryData::CDriveData* driveDataZ = CRegistryData::CDriveData::NewLC(implDriveZ, iRegistryData);
1653 iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataZ);
1654 CleanupStack::Pop(driveDataZ);
1656 // Create Implementation 1 on Z drive
1657 _LIT(KEComUpgradeExample1OnZ, "Z:\\sys\\bin\\EComUpgradeExampleOne.dll");
1658 TEntry upgradeExample1OnZ;
1659 upgradeExample1OnZ.iName = KEComUpgradeExample1OnZ;
1661 fileparse.Set(KEComUpgradeExample1OnZ,NULL,NULL);
1663 CRegistryData::CDllData* dllDataZ = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),upgradeExample1OnZ.iModified,KNullUid, KNullUid, driveDataZ);
1664 dllDataZ->iSecurityChecked = ETrue;
1665 driveDataZ->AddL(dllDataZ);
1666 CleanupStack::Pop(dllDataZ);
1667 CRegistryData::CInterfaceData* interfaceDataZ = CRegistryData::CInterfaceData::NewLC(iInterfaceUid, dllDataZ);
1668 dllDataZ->AddL(interfaceDataZ);
1669 CleanupStack::Pop(interfaceDataZ);
1670 HBufC* name = KTestImplName().AllocLC();
1671 HBufC8* dataType = KTestImplDataType().AllocLC();
1672 HBufC8* opaqueData = KTestImplOpaqueData().AllocLC();
1674 CRegistryData::CImplementationData* implementation1;
1675 implementation1 = CRegistryData::CImplementationData::NewL(interfaceDataZ,
1684 CleanupStack::Pop(opaqueData);
1685 CleanupStack::Pop(dataType);
1686 CleanupStack::Pop(name);
1687 CleanupStack::PushL(implementation1);
1688 interfaceDataZ->AddL(implementation1);
1689 CleanupStack::Pop(implementation1);
1691 // create C drive data
1692 TDriveUnit implDriveC = EDriveC;
1693 CRegistryData::CDriveData* driveDataC = CRegistryData::CDriveData::NewLC(implDriveC, iRegistryData);
1694 iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataC);
1695 CleanupStack::Pop(driveDataC);
1697 // Create Implementation 1 on C drive
1698 _LIT(KEComUpgradeExample1OnC, "C:\\sys\\bin\\EComUpgradeExampleOne.dll");
1699 TEntry upgradeExample1OnC;
1700 upgradeExample1OnC.iName = KEComUpgradeExample1OnC;
1701 fileparse.Set(KEComUpgradeExample1OnC,NULL,NULL);
1703 CRegistryData::CDllData* dllDataC1 = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),upgradeExample1OnC.iModified,KNullUid, KNullUid, driveDataC);
1704 dllDataC1->iSecurityChecked = ETrue;
1705 driveDataC->AddL(dllDataC1);
1706 CleanupStack::Pop(dllDataC1);
1707 CRegistryData::CInterfaceData* interfaceDataC1 = CRegistryData::CInterfaceData::NewLC(iInterfaceUid, dllDataC1);
1708 dllDataC1->AddL(interfaceDataC1);
1709 CleanupStack::Pop(interfaceDataC1);
1710 name = KTestImplName().AllocLC();
1711 dataType = KTestImplDataType().AllocLC();
1712 opaqueData = KTestImplOpaqueData().AllocLC();
1714 CRegistryData::CImplementationData* implementation2;
1715 implementation2 = CRegistryData::CImplementationData::NewL(interfaceDataC1,
1724 CleanupStack::Pop(opaqueData);
1725 CleanupStack::Pop(dataType);
1726 CleanupStack::Pop(name);
1727 CleanupStack::PushL(implementation2);
1728 interfaceDataC1->AddL(implementation2);
1729 CleanupStack::Pop(implementation2);
1731 // Create Implementation 2 on C drive
1732 _LIT(KEComUpgradeExample2OnC, "C:\\sys\\bin\\EComUpgradeExampleTwo.dll");
1733 TEntry upgradeExample2OnC;
1734 upgradeExample2OnC.iName = KEComUpgradeExample2OnC;
1735 fileparse.Set(KEComUpgradeExample2OnC,NULL,NULL);
1737 CRegistryData::CDllData* dllDataC2 = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),upgradeExample2OnC.iModified,KNullUid,KNullUid, driveDataC);
1738 dllDataC2->iSecurityChecked = ETrue;
1739 driveDataC->AddL(dllDataC2);
1740 CleanupStack::Pop(dllDataC2);
1741 CRegistryData::CInterfaceData* interfaceDataC2 = CRegistryData::CInterfaceData::NewLC(iInterfaceUid, dllDataC2);
1742 dllDataC2->AddL(interfaceDataC2);
1743 CleanupStack::Pop(interfaceDataC2);
1744 name = KTestImplName().AllocLC();
1745 dataType = KTestImplDataType().AllocLC();
1746 opaqueData = KTestImplOpaqueData().AllocLC();
1748 CRegistryData::CImplementationData* implementation3;
1749 implementation3 = CRegistryData::CImplementationData::NewL(interfaceDataC2,
1758 CleanupStack::Pop(opaqueData);
1759 CleanupStack::Pop(dataType);
1760 CleanupStack::Pop(name);
1761 CleanupStack::PushL(implementation3);
1762 interfaceDataC2->AddL(implementation3);
1763 CleanupStack::Pop(implementation3);
1765 //===========================================================================
1767 // Check index is empty
1768 TEST(iStateAccessor->ImplementationsCount(*iRegistryData) == 0);
1770 //===========================================================================
1772 // Add Implementation from Z drive to index
1773 TBool result = iRegistryData->InsertIntoIndexL(implementation1, ETrue);
1774 TEST2(result, ETrue);
1776 RImplDataArray impls;
1777 CleanupClosePushL(impls);
1778 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1779 TEST(impls.Count() == 1);
1780 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
1782 //===========================================================================
1784 // Add Implementation from C drive to index - this should upgrade existing implementation
1785 result = iRegistryData->InsertIntoIndexL(implementation2, ETrue);
1786 TEST2(result, ETrue);
1788 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1789 TEST(impls.Count() == 1);
1790 TEST(impls[0]->iImplInfo->Drive() == implDriveC);
1792 //===========================================================================
1794 // remove existing implementation which causes rollback to Z drive impl
1795 iRegistryData->RemoveFromIndexL(dllDataC1);
1796 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1797 TEST(impls.Count() == 1);
1798 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
1800 //===========================================================================
1802 // Add Implementation from C drive to index - this should upgrade existing implementation
1803 result = iRegistryData->InsertIntoIndexL(implementation2, EFalse);
1804 TEST2(result, ETrue);
1806 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1807 TEST(impls.Count() == 1);
1808 TEST(impls[0]->iImplInfo->Drive() == implDriveC);
1809 //===========================================================================
1811 // remove existing implementation which causes rollback to Z drive impl
1812 iRegistryData->RemoveFromIndexL(dllDataC1);
1813 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1814 TEST(impls.Count() == 1);
1815 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
1816 //===========================================================================
1818 // Add Implementation with different name from C drive to index
1819 // this should NOT upgrade existing implementation
1820 result = iRegistryData->InsertIntoIndexL(implementation3, ETrue);
1821 TEST2(result, EFalse);
1823 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1824 TEST(impls.Count() == 1);
1825 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
1826 //===========================================================================
1828 // Add Implementation with different name from C drive to index
1829 // this should upgrade existing implementation as security check is OFF
1830 result = iRegistryData->InsertIntoIndexL(implementation3, EFalse);
1831 TEST2(result, ETrue);
1833 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1834 TEST(impls.Count() == 1);
1835 TEST(impls[0]->iImplInfo->Drive() == implDriveC);
1836 //===========================================================================
1838 // remove existing implementation which causes rollback to Z drive impl
1839 iRegistryData->RemoveFromIndexL(dllDataC2);
1840 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1841 TEST(impls.Count() == 1);
1842 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
1843 CleanupStack::PopAndDestroy(&impls);
1847 Test case for Defect ECOM Index must rollback to original Impl. if upgrade impl. is removed
1849 @SYMTestCaseID SYSLIB-ECOM-CT-1373
1850 @SYMTestCaseDesc Test case for defect number DEF065559 ECOM Index must rollback
1851 to original Impl. if upgrade impl. is removed.
1852 @SYMTestPriority High
1853 @SYMTestActions Create 3 identical implementations, 1 for the Z drive, 1 for the C drive and
1854 1 for the D drive, including parents and add to the registry.
1855 Insert the Z implementation and check.
1856 Insert the C implementation and check the upgrade took place.
1857 Insert the D implementation and check the upgrade took place.
1858 Remove the D implementation and check rollback to C occurred.
1859 Remove the C implementation and check rollback to Z occurred.
1860 Insert the C implementation and check the upgrade took place.
1861 Insert the D implementation and check the upgrade took place.
1862 Remove the C implementation and check no rollback occurred. i.e D impl available
1863 Remove the D implementation and check rollback to Z occurred.
1864 Insert the D implementation and check the upgrade took place.
1865 Insert the C implementation and check no upgrade took place. i.e D impl available
1866 Remove the D implementation and check rollback to C occurred.
1867 Remove the C implementation and check rollback to Z occurred.
1868 Check for no crash and memory leaks.
1869 @SYMTestExpectedResults The test must not fail.
1872 void CRegistryDataTest::RollbackTestL()
1874 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1373 "));
1875 _LIT(KTestImplName, "Implementation");
1876 _LIT8(KTestImplDataType, "Data Type");
1877 _LIT8(KTestImplOpaqueData, "Opaque Data");
1879 // Create Implementation 1 on Z drive
1880 _LIT(KEComUpgradeExample1OnZ, "Z:\\sys\\bin\\EComUpgradeExampleOne.dll");
1881 TImplCreationStruct zDllData(EDriveZ,
1884 KEComUpgradeExample1OnZ,
1887 KTestImplOpaqueData,
1889 ETrue, // Z: is ROMBased
1891 CreateImplL(zDllData);
1893 // Create Implementation 1 on C drive
1894 _LIT(KEComUpgradeExample1OnC, "C:\\sys\\bin\\EComUpgradeExampleOne.dll");
1895 TImplCreationStruct cDllData(EDriveC,
1898 KEComUpgradeExample1OnC,
1901 KTestImplOpaqueData,
1903 CreateImplL(cDllData);
1905 // create drive data on third drive.
1907 // find a valid drive which is not Z and not C.
1908 TEComCachedDriveInfoIterator iter(*iRegistryData->iCachedDriveInfo);
1909 iter.Last(); // positioned at Z:
1910 iter.Prev(); // the drive before Z:
1911 for (; iter.InRange(); iter.Prev())
1913 if (iter.DriveNumber() != EDriveC)
1919 TEST(iter.InRange() && iter.DriveNumber() != EDriveC);
1921 TDriveName drvName = iter.DriveUnit().Name();
1923 _LIT(KEComUpgradeExample1On3, "_:\\sys\\bin\\EComUpgradeExampleOne.dll");
1924 TBuf<36> dllName3(KEComUpgradeExample1On3);
1925 dllName3[0] = drvName[0];
1926 TImplCreationStruct thirdDllData(iter.DriveNumber(),
1932 KTestImplOpaqueData,
1934 CreateImplL(thirdDllData);
1935 //===========================================================================
1937 // Check index is empty
1938 TEST(iStateAccessor->ImplementationsCount(*iRegistryData) == 0);
1940 //===========================================================================
1941 TDriveUnit implDriveZ = EDriveZ;
1942 TDriveUnit implDriveC = EDriveC;
1944 // Add Implementation from Z drive to index
1945 TBool result = iRegistryData->InsertIntoIndexL(zDllData.iImplData, ETrue);
1946 TEST2(result, ETrue);
1948 RImplDataArray impls;
1949 CleanupClosePushL(impls);
1950 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1951 TEST(impls.Count() == 1);
1952 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
1954 //===========================================================================
1956 // Add Implementation from C drive to index - this should upgrade existing implementation
1957 result = iRegistryData->InsertIntoIndexL(cDllData.iImplData, ETrue);
1958 TEST2(result, ETrue);
1960 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1961 TEST(impls.Count() == 1);
1962 TEST(impls[0]->iImplInfo->Drive() == implDriveC);
1964 //===========================================================================
1966 // Add Implementation from third drive to index - this should upgrade existing implementation
1967 result = iRegistryData->InsertIntoIndexL(thirdDllData.iImplData, ETrue);
1968 TEST2(result, ETrue);
1970 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1971 TEST(impls.Count() == 1);
1972 TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
1974 //===========================================================================
1976 // remove implementation from third drive which causes rollback to C drive impl
1977 iRegistryData->RemoveFromIndexL(thirdDllData.iDllData);
1978 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1979 TEST(impls.Count() == 1);
1980 TEST(impls[0]->iImplInfo->Drive() == implDriveC);
1982 //===========================================================================
1984 // remove implementation from C which causes rollback to Z drive impl
1985 iRegistryData->RemoveFromIndexL(cDllData.iDllData);
1986 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1987 TEST(impls.Count() == 1);
1988 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
1990 //===========================================================================
1992 // Add Implementation from C drive to index - this should upgrade existing implementation
1993 result = iRegistryData->InsertIntoIndexL(cDllData.iImplData, ETrue);
1994 TEST2(result, ETrue);
1996 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
1997 TEST(impls.Count() == 1);
1998 TEST(impls[0]->iImplInfo->Drive() == implDriveC);
2000 //===========================================================================
2002 // Add Implementation from third drive to index - this should upgrade existing implementation
2003 result = iRegistryData->InsertIntoIndexL(thirdDllData.iImplData, ETrue);
2004 TEST2(result, ETrue);
2006 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
2007 TEST(impls.Count() == 1);
2008 TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
2010 //===========================================================================
2012 // remove implementation from C which should cause no rollback
2013 iRegistryData->RemoveFromIndexL(cDllData.iDllData);
2014 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
2015 TEST(impls.Count() == 1);
2016 TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
2018 //===========================================================================
2020 // remove implementation from third drive which causes rollback to Z drive impl
2021 iRegistryData->RemoveFromIndexL(thirdDllData.iDllData);
2022 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
2023 TEST(impls.Count() == 1);
2024 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
2026 //===========================================================================
2028 // Add Implementation from third drive to index - this should upgrade existing implementation
2029 result = iRegistryData->InsertIntoIndexL(thirdDllData.iImplData, ETrue);
2030 TEST2(result, ETrue);
2032 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
2033 TEST(impls.Count() == 1);
2034 TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
2036 //===========================================================================
2038 // Add Implementation from C drive to index - this should not upgrade existing implementation
2039 result = iRegistryData->InsertIntoIndexL(cDllData.iImplData, ETrue);
2040 TEST2(result, ETrue);
2042 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
2043 TEST(impls.Count() == 1);
2044 TEST(impls[0]->iImplInfo->Drive() == iter.DriveUnit());
2046 //===========================================================================
2048 // remove implementation from third drive which causes rollback to C drive impl
2049 iRegistryData->RemoveFromIndexL(thirdDllData.iDllData);
2050 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
2051 TEST(impls.Count() == 1);
2052 TEST(impls[0]->iImplInfo->Drive() == implDriveC);
2054 //===========================================================================
2056 // remove implementation from C which causes rollback to Z drive impl
2057 iRegistryData->RemoveFromIndexL(cDllData.iDllData);
2058 iStateAccessor->GetImplementationInfoL(*iRegistryData, iInterfaceUid, impls);
2059 TEST(impls.Count() == 1);
2060 TEST(impls[0]->iImplInfo->Drive() == implDriveZ);
2061 CleanupStack::PopAndDestroy(&impls);
2065 @SYMTestCaseID SYSLIB-ECOM-CT-0737
2066 @SYMTestCaseDesc Tests the creation and deletion of CRegistryData
2067 @SYMTestPriority High
2068 @SYMTestActions Create and delete CRegistryData object,checks for open handles
2069 @SYMTestExpectedResults The test must not fail.
2072 LOCAL_C void CreateDeleteTestL()
2074 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0737 Create and Delete Test "));
2075 // Set up for heap leak checking
2078 // and leaking thread handles
2079 TInt startProcessHandleCount;
2080 TInt startThreadHandleCount;
2081 TInt endProcessHandleCount;
2082 TInt endThreadHandleCount;
2085 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
2087 CRegistryDataTest* theTest = NULL;
2088 // Create the object
2089 TRAPD(err, theTest = CRegistryDataTest::NewL(EFalse));
2090 TEST2(err, KErrNone);
2091 // Delete the object
2094 // Check for open handles
2095 RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
2096 TEST(startThreadHandleCount == endThreadHandleCount);
2103 @SYMTestCaseID SYSLIB-ECOM-UT-3572
2104 @SYMTestCaseDesc Tests for CRegistryData::UpdateDllDataL() function when an existing registered
2105 PLUGIN3 is downgraded with an updated PLUGIN1 resource file.
2106 @SYMTestPriority High
2107 @SYMTestActions Update the data for a dll in the registry.
2108 Tests for OOM error.
2109 @SYMTestExpectedResults The data for the dll in the registry is updated.
2112 void CRegistryDataTest::UpdateDllDataTest3L()
2114 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3572 "));
2115 // Checks if drive is registered
2116 TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
2117 CRegistryData::CDriveData* driveData = NULL;
2118 // Fetches index of drive, in iFoundDriveIndex
2119 iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
2122 TUid example12ThirdUid = {0x10009E3E};
2123 dllEntry.iType = TUidType(KNullUid, KNullUid, example12ThirdUid);
2124 dllEntry.iName = KEComExample12DllOnC;
2125 dllEntry.iModified.HomeTime();
2127 TBool registered = EFalse;
2129 registered = iRegistryData->IsRegisteredWithDate(
2135 // Log message if implementations need update
2138 TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
2140 //If the implementation needs an update, update it using UpdateDllDataL
2143 TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
2144 // Checks Implementation 0x10009E48 registered in the registry is version 1, display name is "Example 12 PlugIn3"
2145 // A reference to the implementation entry in the registry
2146 const TUid implementationUid = {0x10009E3C};
2147 CRegistryData::CImplementationData* implementationData = NULL;
2148 TInt err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
2149 TEST2(err,KErrNone);
2150 CImplementationInformation* implementationInfo = implementationData->iImplInfo;
2151 TEST(implementationInfo->Version() == 1);
2152 TEST(implementationInfo->DisplayName().CompareF(_L("Example 12 PlugIn3"))==0);
2154 // Dll Data object to be updated
2155 CRegistryData::CDllData* updateDllData = NULL;
2157 fileparse.Set(dllEntry.iName,NULL,NULL);
2158 updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
2160 //Copies the downgraded resource file to C:
2161 TRAP(err, EComTestUtils::FileManCopyFileL(KEcomExample12DowngradedOnZ, KEcomExample12DowngradedOnC));
2162 TEST2(err, KErrNone);
2163 //Creats the entry using downgraded resource file
2164 TEntry rscBasedEntry;
2165 rscBasedEntry.iName = KEcomExample12DowngradedResourceNameOnly;
2167 rscPath.Set(KEcomExample12DowngradedOnC,NULL,NULL);
2168 CPluginBase* entryBase = NULL;
2169 entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
2170 CleanupStack::PushL(entryBase);
2171 // Updates resource ext info
2172 HBufC* resourceExt = entryBase->RscFileExt();
2175 updateDllData->SetResourceExtL(*resourceExt);
2177 // parses the downgraded resource file
2178 TInt error = KErrNone;
2179 TRAP(error, iRegistrarAccessor->ParseL(*iRegistrar, entryBase, *updateDllData));
2180 if (error == KErrNoMemory)
2182 User::LeaveNoMemory();
2184 CleanupStack::PopAndDestroy(entryBase);
2186 // Updates DLL data with a new dll data
2187 TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
2189 TEST2(err, KErrNone);
2190 CleanupStack::Pop(updateDllData);
2191 // Checks registry data is updated with new data
2192 // Implementation 0x10009E48 is downgraded from version 1 to version 0, display name is changed to "Example 12 PlugIn"
2193 implementationData = NULL;
2194 err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
2195 TEST2(err,KErrNone);
2196 implementationInfo = implementationData->iImplInfo;
2197 TEST(implementationInfo->Version() == 0);
2198 TEST(implementationInfo->DisplayName().CompareF(_L("Example 12 PlugIn")) == 0);
2199 TheTest.Printf(_L("DLL data is updated \n"));
2200 //deletes the downgraded resource file
2201 TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12DowngradedOnC));
2203 registered = iRegistryData->IsRegisteredWithDate(
2213 @SYMTestCaseID SYSLIB-ECOM-UT-3571
2214 @SYMTestCaseDesc Tests for CRegistryData::UpdateDllDataL() function when an existing registered
2215 PLUGIN1 is upgraded with an updated PLUGIN3 resource file.
2216 @SYMTestPriority High
2217 @SYMTestActions Update the data for a dll in the registry.
2218 Tests for OOM error.
2219 @SYMTestExpectedResults The data for the dll in the registry is updated.
2222 void CRegistryDataTest::UpdateDllDataTest2L()
2224 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3571 "));
2225 // Checks if drive is registered
2226 TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
2227 CRegistryData::CDriveData* driveData = NULL;
2228 // Fetches index of drive, in iFoundDriveIndex
2229 iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
2232 TUid example14ThirdUid = {0x10009E40};
2233 dllEntry.iType = TUidType(KNullUid, KNullUid, example14ThirdUid);
2234 dllEntry.iName = KEComExample14DllOnC;
2235 dllEntry.iModified.HomeTime();
2237 TBool registered = EFalse;
2239 registered = iRegistryData->IsRegisteredWithDate(
2245 // Log message if implementations need update
2248 TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
2250 //If the implementation needs an update, update it using UpdateDllDataL
2253 TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
2255 // Checks Implementation 0x10009E48 registered in the registry is version 1, display name is "Example 14 PlugIn"
2256 // A reference to the implementation entry in the registry
2257 const TUid implementationUid = {0x10009E48};
2258 CRegistryData::CImplementationData* implementationData = NULL;
2259 TInt err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
2260 TEST2(err,KErrNone);
2261 CImplementationInformation* implementationInfo = implementationData->iImplInfo;
2262 TEST(implementationInfo->Version() == 1);
2263 TEST(implementationInfo->DisplayName().CompareF(_L("Example 14 PlugIn"))==0);
2265 // Dll Data object to be updated
2266 CRegistryData::CDllData* updateDllData = NULL;
2268 fileparse.Set(dllEntry.iName,NULL,NULL);
2269 updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
2271 //copies the upgraded resource file to C:
2272 TRAP(err, EComTestUtils::FileManCopyFileL(KEcomExample14UpgradedOnZ, KEcomExample14UpgradedOnC));
2273 TEST2(err, KErrNone);
2274 //Creats the entry using upgraded resource file
2275 TEntry rscBasedEntry;
2276 rscBasedEntry.iName = KEcomExample14UpgradedResourceNameOnly;
2278 rscPath.Set(KEcomExample14UpgradedOnC,NULL,NULL);
2279 CPluginBase* entryBase = NULL;
2280 entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
2281 CleanupStack::PushL(entryBase);
2282 // Updates resource ext info
2283 HBufC* resourceExt = entryBase->RscFileExt();
2286 updateDllData->SetResourceExtL(*resourceExt);
2288 // parses the upgraded resource file
2289 TInt error = KErrNone;
2290 TRAP(error, iRegistrarAccessor->ParseL(*iRegistrar, entryBase, *updateDllData));
2291 if (error == KErrNoMemory)
2293 User::LeaveNoMemory();
2295 CleanupStack::PopAndDestroy(entryBase);
2298 // Updates DLL data with a new dll data
2299 TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
2301 TEST2(err, KErrNone);
2302 CleanupStack::Pop(updateDllData);
2303 // Checks registry data is updated with new data
2304 // Implementation 0x10009E48 is upgraded from version 1 to version 2, display name is changed to "Example 14 PlugIn3"
2305 implementationData = NULL;
2306 err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
2307 TEST2(err,KErrNone);
2308 implementationInfo = implementationData->iImplInfo;
2309 TEST(implementationInfo->Version() == 2);
2310 TEST(implementationInfo->DisplayName().CompareF(_L("Example 14 PlugIn3"))==0);
2311 TheTest.Printf(_L("DLL data is updated \n"));
2312 //deletes the upgraded resource file
2313 TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample14UpgradedOnC));
2315 registered = iRegistryData->IsRegisteredWithDate(
2325 @SYMTestCaseID SYSLIB-ECOM-UT-3570
2326 @SYMTestCaseDesc Tests for CRegistryData::UpdateDllDataL() function when an existing registered
2327 PLUGIN3 is upgraded with an updated PLUGIN3 resource file.
2328 @SYMTestPriority High
2329 @SYMTestActions Update the data for a dll in the registry.
2330 Tests for OOM error.
2331 @SYMTestExpectedResults The data for the dll in the registry is updated.
2335 void CRegistryDataTest::UpdateDllDataTest1L()
2337 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3570 "));
2338 // Checks if drive is registered
2339 TEST2(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit),ETrue);
2340 CRegistryData::CDriveData* driveData = NULL;
2341 // Fetches index of drive, in iFoundDriveIndex
2342 iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
2345 TUid example12ThirdUid = {0x10009E3E};
2346 dllEntry.iType = TUidType(KNullUid, KNullUid, example12ThirdUid);
2347 dllEntry.iName = KEComExample12DllOnC;
2348 dllEntry.iModified.HomeTime();
2350 TBool registered = EFalse;
2351 registered = iRegistryData->IsRegisteredWithDate(
2357 // Log message if implementations need update
2360 TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
2362 //If the implementation needs an update, update it using UpdateDllDataL
2365 TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
2367 // Checks Implementation 0x10009E3C registered in the registry is version 1
2368 // A reference to the implementation entry in the registry
2369 const TUid implementationUid = {0x10009E3C};
2370 CRegistryData::CImplementationData* implementationData = NULL;
2371 TInt err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
2372 TEST2(err,KErrNone);
2373 CImplementationInformation* implementationInfo = implementationData->iImplInfo;
2374 TEST(implementationInfo->Version() == 1);
2375 // Dll Data object to be updated
2376 CRegistryData::CDllData* updateDllData = NULL;
2378 fileparse.Set(dllEntry.iName,NULL,NULL);
2379 updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
2381 //copies the upgraded resource file to C:
2382 TRAP(err, EComTestUtils::FileManCopyFileL(KEcomExample12UpgradedOnZ, KEcomExample12UpgradedOnC));
2384 TEST2(err, KErrNone);
2385 //Creats the entry using upgraded resource file
2386 TEntry rscBasedEntry;
2387 rscBasedEntry.iName = KEcomExample12UpgradedResourceNameOnly;
2389 rscPath.Set(KEcomExample12UpgradedOnC,NULL,NULL);
2390 CPluginBase* entryBase = NULL;
2391 entryBase=CSecurePlugin::NewL(TheFs,rscBasedEntry,rscPath.Drive(), EFalse);
2392 CleanupStack::PushL(entryBase);
2393 // Updates resource ext info
2394 HBufC* resourceExt = entryBase->RscFileExt();
2397 updateDllData->SetResourceExtL(*resourceExt);
2399 // parses the upgraded resource file
2400 TInt error = KErrNone;
2401 TRAP(error, iRegistrarAccessor->ParseL(*iRegistrar, entryBase, *updateDllData));
2402 if (error == KErrNoMemory)
2404 User::LeaveNoMemory();
2406 CleanupStack::PopAndDestroy(entryBase);
2408 // Updates DLL data with a new dll data
2409 TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
2411 TEST2(err, KErrNone);
2412 CleanupStack::Pop(updateDllData);
2413 // Checks registry data is updated with new data
2414 // Implementation 0x10009E3C is upgraded from version 1 to version 2
2415 implementationData = NULL;
2416 err = iStateAccessor->FindImplementation(*iRegistryData, implementationUid, KCDummyUid, implementationData);
2418 TEST2(err,KErrNone);
2419 implementationInfo = implementationData->iImplInfo;
2420 TEST(implementationInfo->Version() == 2);
2421 TheTest.Printf(_L("DLL data is updated \n"));
2422 //cleans the upgraded resource file
2423 TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12UpgradedOnC));
2425 registered = iRegistryData->IsRegisteredWithDate(
2437 @SYMTestCaseID SYSLIB-ECOM-UT-3569
2438 @SYMTestCaseDesc Tests for CRegistryData::AddDllDataL() function using Dll type PLUGIN3
2439 @SYMTestPriority High
2440 @SYMTestActions Adds data on a specific dll to the registry.
2441 Tests for OOM error,checks if drive is registered.
2442 @SYMTestExpectedResults Dll data is added to the registry.
2445 void CRegistryDataTest::AddDllDataPlugIn3TestL()
2447 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3569 "));
2448 // Checks if drive is registered
2449 TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
2450 CRegistryData::CDriveData* driveData = NULL;
2451 // Fetches index of drive, in iFoundDriveIndex
2452 iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
2455 TUid example10ThirdUid = {0x10009E37};
2456 dllEntry.iType = TUidType(KNullUid, KNullUid, example10ThirdUid);
2457 dllEntry.iName = KEComExample10DllOnC;
2458 TBool registered = EFalse;
2459 TRAPD(err, registered = iRegistryData->IsRegisteredWithDate(
2465 TEST2(err, KErrNone);
2467 // Dll Data object to be added
2468 CRegistryData::CDllData* addDllData = NULL;
2470 fileparse.Set(dllEntry.iName,NULL,NULL);
2471 addDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),dllEntry.iModified,dllEntry[1], dllEntry[2],driveData);
2473 // Adds DLL data of an existing DLL
2474 TRAP(err, iRegistryData->AddDllDataL(iDriveUnit, iFoundDriveIndex, addDllData));
2477 CleanupStack::Pop(addDllData);
2478 TEST2(err, KErrNone);
2481 TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
2483 TEST2(err, KErrNone);
2484 TRAP(err, registered = iRegistryData->IsRegisteredWithDate(
2491 TEST2(err, KErrNone);
2493 // Do not delete addDllData as ownership is with the iRegistryData
2498 Adds the dll data on a perticular drive.
2500 @SYMTestCaseID SYSLIB-ECOM-CT-0738
2501 @SYMTestCaseDesc Tests for CRegistryData::AddDllDataL() function
2502 @SYMTestPriority High
2503 @SYMTestActions Adds data on a specific dll to the registry.
2504 Tests for OOM error,checks if drive is registered.
2505 @SYMTestExpectedResults The test must not fail.
2508 void CRegistryDataTest::AddDllDataTestL()
2510 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0738 "));
2511 // Check if drive is registered
2512 TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)!= KErrNotFound);
2513 CRegistryData::CDriveData* driveData = NULL;
2514 // Fetch index of drive, in iFoundDriveIndex
2515 iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData);
2517 iRegistryData->IsRegisteredWithDate(
2519 iDllEntry.iModified,
2523 // Dll Data object to be added
2524 CRegistryData::CDllData* addDllData=NULL;
2526 fileparse.Set(iDllEntry.iName,NULL,NULL);
2527 addDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),iDllEntry.iModified,iDllEntry[1], iDllEntry[2],driveData);
2529 // Add DLL data of an existing DLL
2530 TRAPD(err, iRegistryData->AddDllDataL(iDriveUnit, iFoundDriveIndex, addDllData));
2533 CleanupStack::Pop(addDllData);
2534 TEST2(err, KErrNone);
2536 TBool registered = EFalse;
2537 TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
2539 TEST2(err, KErrNone);
2540 TRAP(err, registered = iRegistryData->IsRegisteredWithDate(
2542 iDllEntry.iModified,
2548 TEST2(err, KErrNone);
2550 // Do not delete addDllData as ownership is with the iRegistryData
2554 Determines if the specified implementation is already registered and
2555 updates the data for the dll in the registry if it needs an update
2557 @SYMTestCaseID SYSLIB-ECOM-CT-0739
2558 @SYMTestCaseDesc Tests for CRegistryData::UpdateDllDataL() function
2559 @SYMTestPriority High
2560 @SYMTestActions Update the data for a dll in the registry if it needs an update.
2561 Tests for OOM error.
2562 @SYMTestExpectedResults The test must not fail.
2565 void CRegistryDataTest::IsRegisteredWithDateUpdateDllDataTestL()
2567 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0739 "));
2568 TBool result=EFalse;
2569 CRegistryData::CDriveData* driveData = NULL;
2570 TInt err = KErrNone;
2571 // Here we are doing positive testing. We are testing with valid entry.
2572 // If that is not registered, register it using UpdateDllDataL
2573 TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
2575 TEST2(err, KErrNone);
2577 TRAP(err, result = iRegistryData->IsRegisteredWithDate(
2579 iDllEntry.iModified,
2584 TEST2(err, KErrNone);
2585 // Log message if implementations need update
2591 TheTest.Printf(_L("Specified implementation group is already registered and does not need an update\n"));
2595 TheTest.Printf(_L("Specified implementation group is not registered with date and needs an update\n"));
2597 // Dll Data object to be updated
2598 CRegistryData::CDllData* updateDllData=NULL;
2600 fileparse.Set(iDllEntry.iName,NULL,NULL);
2601 updateDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),iDllEntry.iModified,iDllEntry[1],iDllEntry[2],driveData);
2604 // Updates DLL data with a new dll data
2605 TRAP(err, iRegistryData->UpdateDllDataL(aDrive, iFoundDriveIndex, updateDllData));
2607 CleanupStack::Pop(updateDllData);
2608 TEST2(err, KErrNone);
2609 // Print to that dll data is updated else we won't know we did.
2610 TheTest.Printf(_L("DLL data is updated \n"));
2614 TUid thirdUid = {0x101F8400};
2615 iDllEntry.iType = TUidType(KNullUid, KNullUid, thirdUid);
2616 // Here we are doing negative testing. We are testing with invalid entry.
2617 // The result should be false
2618 TRAP(err, iFoundDriveIndex = iRegistryData->FindDriveL(iDriveUnit,driveData));
2620 TEST2(err, KErrNone);
2621 TRAP(err, result = iRegistryData->IsRegisteredWithDate(
2623 iDllEntry.iModified,
2628 TEST2(err, KErrNone);
2633 Tests that an implementation is disabled and enabled by setting the state
2635 @SYMTestCaseID SYSLIB-ECOM-CT-0740
2636 @SYMTestCaseDesc Tests for CRegistryData::SetEnabledState() function
2637 @SYMTestPriority High
2638 @SYMTestActions Tests for enable or disable the specified interface implementation
2639 within the registry.
2640 @SYMTestExpectedResults The test must not fail.
2643 void CRegistryDataTest::SetEnabledStateTestL()
2645 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0740 "));
2646 // A reference to the implementation entry in the registry
2647 CRegistryData::CImplementationData* implementationData = NULL;
2649 // Pass the state and enable or disable the implementaion
2651 err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, KCDummyUid, implementationData);
2652 TEST2(err, KErrNone);
2654 const CImplementationInformation* implementationInfo = implementationData->iImplInfo;
2656 // SetEnabledState() will disable the implementation if enablestate parameter is EFalse.
2657 // If the disablestate parameter is false the reverse will happen.
2658 TBool result=EFalse;
2659 TBool enableState=EFalse;
2660 TRAP(err, result = iRegistryData->SetEnabledState(iImplementationUid, enableState));
2662 TEST2(err, KErrNone);
2663 TEST(result == KErrNone);
2665 //Implementation should be disabled
2666 TEST(implementationInfo->Disabled()==(!enableState));
2669 enableState = ETrue;
2670 TRAP(err, result = iRegistryData->SetEnabledState(iImplementationUid, enableState));
2672 TEST2(err, KErrNone);
2673 TEST(result == KErrNone);
2675 // Implementation should be enabled
2676 TEST(implementationInfo->Disabled()==(!enableState));
2680 Obtains Implementation data and prints to log
2682 @SYMTestCaseID SYSLIB-ECOM-CT-0741
2683 @SYMTestCaseDesc Tests for CRegistryData::FindImplementation() functions
2684 @SYMTestPriority High
2685 @SYMTestActions Fetch the information on a particular implementation (UID)
2686 Tests for the validation of the information fetched.
2687 Fetch the information on a particular implementation (UID) and interface (UID)
2688 Tests for the validation of the information fetched.
2689 @SYMTestExpectedResults The test must not fail.
2692 void CRegistryDataTest::FindImplementationTestL()
2694 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0741 "));
2695 // A reference to the implementation entry in the registry
2696 CRegistryData::CImplementationData* implementationData = NULL;
2698 // find implementation with interface uid unknown
2699 TInt err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, KCDummyUid, implementationData);
2701 TEST2(err, KErrNone);
2703 const CImplementationInformation* implementationInfo = implementationData->iImplInfo;
2705 TheTest.Printf((implementationInfo->DisplayName()));
2706 _LIT(KUIDFormat,"Uid = 0x%08X\n");
2707 TheTest.Printf(KUIDFormat, iImplementationUid);
2708 TheTest.Printf(KUIDFormat, implementationInfo->ImplementationUid());
2709 // Check for if its the same implementation
2710 TEST(iImplementationUid == implementationInfo->ImplementationUid());
2712 // find implementation with interface uid known
2713 err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, iInterfaceUid, implementationData);
2715 TEST2(err, KErrNone);
2717 implementationInfo = implementationData->iImplInfo;
2719 TheTest.Printf((implementationInfo->DisplayName()));
2720 TheTest.Printf(KUIDFormat, iImplementationUid);
2721 TheTest.Printf(KUIDFormat, implementationInfo->ImplementationUid());
2722 TheTest.Printf(KUIDFormat, iInterfaceUid);
2723 TheTest.Printf(KUIDFormat, implementationData->iParent->iInterfaceUid);
2725 // Check for if its the same implementation
2726 TEST(iImplementationUid == implementationInfo->ImplementationUid());
2727 // Check for if its the same interface
2728 TEST(iInterfaceUid == implementationData->iParent->iInterfaceUid);
2730 // attempt to find unknown implementation with dummy interface uid
2731 err = iStateAccessor->FindImplementation(*iRegistryData, KCInvalidUid, KCDummyUid, implementationData);
2733 TEST2(err, KErrNotFound);
2735 // attempt to find implementation for unknown interface uid
2736 err = iStateAccessor->FindImplementation(*iRegistryData, iImplementationUid, KCInvalidUid, implementationData);
2738 TEST2(err, KErrNotFound);
2742 Tests functionality of ListImplementationsL for an interface id and listing all
2743 the implementations.
2744 The interface Uid 0x10009DC0 has 6 implementations on different DLLs but only 4 will
2745 be picked as as 2 of them are of older version(Impl ID 0x10009DC3 and 0x10009DC4 with version 1)
2747 Interface UID DLL UID Implementation UID Version
2748 -------------------------------------------------------
2749 0x10009DC0 0x10009DB1 0x10009DC3 1
2750 0x10009DB1 0x10009DC4 1
2751 0x10009DB3 0x10009DC3 2
2752 0x10009DB3 0x10009DC4 2
2753 0x101F8477 0x101F8478 1
2754 0x101F847B 0x101F847C 1
2756 @SYMTestCaseID SYSLIB-ECOM-CT-0742
2757 @SYMTestCaseDesc Tests for CRegistryData::ListImplementationsL() function
2758 @SYMTestPriority High
2759 @SYMTestActions List the implementations for an existing interface UID and
2760 test for expected number of implementations.Check the VID of
2761 every implementation match the VID of the DLL which the implementation
2763 @SYMTestExpectedResults The test must not fail.
2764 @SYMREQ REQ0000, REQ6111
2766 void CRegistryDataTest::ListImplementationsL()
2768 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0742 "));
2769 // List the implementations for an existing interface UID
2770 TEST(iRegistryData->IndexValid());
2772 TRAPD(err, iRegistryData->ListImplementationsL(iInterfaceUid,iImplDataList));
2773 CleanupClosePushL(iImplDataList);
2776 TEST2(err, KErrNone);
2778 // Print UIDs of implementations
2779 _LIT(KUIDFormat,"Uid = 0x%08x\n");
2780 _LIT(KLists,"There are %d Implementations \n");
2782 TheTest.Printf(KLists, iImplDataList.Count());
2783 // Test for expected number of implementations
2784 TEST(iImplDataList.Count() == 4);
2786 for(TInt index = 0; index < iImplDataList.Count(); ++index)
2788 CImplementationInformation* implInfo = iImplDataList[index]->iImplInfo;
2789 TUid uid = implInfo->ImplementationUid();
2790 TheTest.Printf(KUIDFormat, uid);
2792 // Empty the array of implementation data
2793 CleanupStack::PopAndDestroy(&iImplDataList);
2797 Tests functionality of TemporaryUninstallL and UndoTemporaryUninstallL
2798 Test does temporarily 1.install 2.uninstall and 3.install the specified drive
2800 @SYMTestCaseID SYSLIB-ECOM-CT-0743
2801 @SYMTestCaseDesc Tests for CRegistryData::UndoTemporaryUninstallL(),TemporaryUninstallL() function
2802 @SYMTestPriority High
2803 @SYMTestActions Tests for temporarily install,uninstall,install the specified drive
2804 @SYMTestExpectedResults The test must not fail.
2807 void CRegistryDataTest::DoUndoTemporaryUninstallTestL()
2809 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0743 "));
2810 // We are testing with F drive.
2811 iDriveUnit = EDriveF;
2812 TBool driveregistered = iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit);
2813 // Check that the drive is registered. If its not there add it by UndoTemporaryUninstallL
2814 if (!driveregistered)
2816 TRAPD(err, iRegistryData->UndoTemporaryUninstallL(iDriveUnit));
2818 TEST2(err, KErrNone);
2821 // Test drive should be present
2822 TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit));
2824 // Uninstall the test drive
2825 TRAPD(err, iRegistryData->TemporaryUninstallL(iDriveUnit));
2827 TEST2(err, KErrNone);
2828 // Test drive should not be present
2829 TEST(!(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit)));
2831 // Put the test drive back to work if it was registered before
2832 if (driveregistered)
2834 TRAP(err, iRegistryData->UndoTemporaryUninstallL(iDriveUnit));
2836 TEST2(err, KErrNone);
2837 // Test drive should be present
2838 TEST(iStateAccessor->IsRegisteredDriveL(*iRegistryData, iDriveUnit));
2843 Tests functionality of DiscoveriesBeginning and DiscoveriesCompleteL
2844 Tests registry data discovery process.
2846 @SYMTestCaseID SYSLIB-ECOM-CT-0745
2847 @SYMTestCaseDesc Tests for CRegistryData::DiscoveriesBeginning(),CRegistryData::DiscoveriesCompleteL() functions
2848 @SYMTestPriority High
2849 @SYMTestActions Tests for registry data discovery process.
2850 @SYMTestExpectedResults The test must not fail.
2853 void CRegistryDataTest::DiscoveriesBeginCompleteTestL()
2855 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0745 "));
2856 // Issue discoveries begin and complete requests
2857 // and confirm the same
2859 // DiscoveriesBegin marks the registry indexes as invalid as
2860 // the discovery process is in progress
2861 TRAPD(err, iRegistryData->DiscoveriesBeginning());
2863 TEST2(err, KErrNone);
2864 // Check Registry is invalid
2865 TEST(!iStateAccessor->IsIndexValid(*(iRegistryData)));
2867 // DiscoveriesCompleteL marks the registry indexes valid as
2868 // the discovery process is complete
2869 TBool regChanged = EFalse;
2870 TRAP(err, iRegistryData->DiscoveriesCompleteL(EFalse, EPluginProcessingTypeAll,regChanged));
2872 TEST2(err, KErrNone);
2873 // Check Registry is valid
2874 TEST(iStateAccessor->IsIndexValid(*(iRegistryData)));
2878 Tests finding index for an entry for implementation Uid
2880 @SYMTestCaseID SYSLIB-ECOM-CT-0747
2881 @SYMTestCaseDesc Tests for CRegistryData::IndexedFindTestL() function
2882 @SYMTestPriority High
2883 @SYMTestActions Tests to find the index entry for aImplementationUid and log it
2884 @SYMTestExpectedResults The test must not fail.
2887 void CRegistryDataTest::IndexedFindTestL()
2889 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0747 "));
2890 // Find the index entry for aImplementationUid and print it
2893 TRAPD(err, index = iStateAccessor->IndexedFind(*(iRegistryData), iInterfaceUid));
2895 TEST2(err, KErrNone);
2896 TheTest.Printf(_L("The index of interface 0x%08x is %d \n"), iInterfaceUid, index);
2897 // Index should have some valid value
2903 Plugins to be used in this test
2904 Interface UID DLL UID Implementation UID Version DLL File
2905 --------------------------------------------------------------------------------
2906 0x10009E36 0x10009E3E 0x10009E39 1 C:\\..\\EComExample12.dll
2907 0x10009E3E 0x10009E3C 1 C:\\..\\EComExample12.dll
2908 0x10009E3E 0x10009E3D 1 C:\\..\\EComExample12.dll
2909 0x10009E42 0x10009E39 2 C:\\..\\EComExample15.dll
2912 @SYMTestCaseID SYSLIB-ECOM-UT-3573
2913 @SYMTestCaseDesc Tests for CRegistryData::GetImplementationDllInfoForClientL() function for DLL type PLUGIN3.
2914 @SYMTestPriority High
2915 @SYMTestActions Get the plugin information of the implementation UID and validate the information.
2916 Get the plugin information of the implementation UID and Interface UID and validate
2918 Tests for that the implementation returned will have the highest version
2919 @SYMTestExpectedResults Implementation information is returned correctly.
2922 void CRegistryDataTest::GetImplementationDllInfoForClientPlugIn3TestL()
2924 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3573 "));
2925 TUid ImpUid15 = {0x10009E39};
2926 TUid ImpUid12 = {0x10009E3C};
2927 TUid InterfaceUid = {0x10009E36};
2930 TClientRequest clntRq;
2932 //Tests the CImplementationInformation is correct
2933 //and the DllInfo contains correct implementation info
2934 //Implementation uid used=0x10009E3C
2935 CImplementationInformation* implementationInfo = NULL;
2936 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid12, KCDummyUid, dllinfo, implementationInfo, ETrue);
2937 TEST2(err, KErrNone);
2938 TEST(implementationInfo->ImplementationUid() == ImpUid12);
2939 TEST(implementationInfo->Version() == 1);
2940 TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
2942 // ... again but with interface uid
2943 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid12, InterfaceUid, dllinfo, implementationInfo, ETrue);
2944 TEST2(err, KErrNone);
2945 TEST(implementationInfo->ImplementationUid() == ImpUid12);
2946 TEST(implementationInfo->Version() == 1);
2947 TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
2949 //Tests that the implementation returned will have the highest version
2950 //EComExample12.dll contains Impl 0x10009E39 with version 1
2951 //EComExample15.dll contains Impl 0x10009E39 with version 2
2952 //Ensure that choose the implementation in EComExample15.dll
2953 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid15, KCDummyUid, dllinfo, implementationInfo, ETrue);
2954 TEST2(err, KErrNone);
2955 TEST(implementationInfo->ImplementationUid() == ImpUid15);
2956 TEST(implementationInfo->Version() == 2);
2957 TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
2959 // ... again but with interface uid
2960 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid15, InterfaceUid, dllinfo, implementationInfo, ETrue);
2961 TEST2(err, KErrNone);
2962 TEST(implementationInfo->ImplementationUid() == ImpUid15);
2963 TEST(implementationInfo->Version() == 2);
2964 TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
2968 Plugins to be used in this test
2969 Interface UID DLL UID Implementation UID Version DLL File
2970 --------------------------------------------------------------------------------
2971 0x10009E36 0x10009E3E 0x10009E39 1 C:\\..\\EComExample12.dll
2972 0x10009E3E 0x10009E3C 1 C:\\..\\EComExample12.dll
2973 0x10009E3E 0x10009E3D 1 C:\\..\\EComExample12.dll
2974 0x10009E42 0x10009E39 2 C:\\..\\EComExample15.dll
2976 @SYMTestCaseID SYSLIB-ECOM-UT-3574
2977 @SYMTestCaseDesc Tests for CRegistryData::GetImplementationDllInfoForServer() function for DLL type PLUGIN3.
2978 @SYMTestPriority High
2979 @SYMTestActions Get the plugin information of the implementation UID and validate the information.
2980 Get the plugin information of the implementation UID and Interface UID and validate
2982 Tests for loading implementation from RAM
2983 Tests for that the implementation returned will have the highest version
2984 @SYMTestExpectedResults Implementation information is returned correctly.
2987 void CRegistryDataTest::GetImplementationDllInfoForServerPlugIn3Test()
2989 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3574 "));
2990 TUid ImpUid15={0x10009E39};
2991 TUid ImpUid12={0x10009E3C};
2992 TUid InterfaceUid={0x10009E36};
2997 //Tests the CImplementationInformation is correct
2998 //and the DllInfo contains correct implementation info
2999 //Implementation uid used=0x10009E3C
3000 CImplementationInformation* implementationInfo=NULL;
3001 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid12, KCDummyUid, dllinfo, implementationInfo, dummyBool);
3002 TEST2(err, KErrNone);
3003 TEST(implementationInfo->ImplementationUid() == ImpUid12);
3004 TEST(implementationInfo->Version() == 1);
3005 TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
3007 // ... again but with interface uid
3008 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid12, InterfaceUid, dllinfo, implementationInfo, dummyBool);
3009 TEST2(err, KErrNone);
3010 TEST(implementationInfo->ImplementationUid() == ImpUid12);
3011 TEST(implementationInfo->Version() == 1);
3012 TEST(dllinfo.iName.CompareF(KEComExample12DllOnC) == 0);
3014 //Tests that the implementation returned will have the highest version
3015 //EComExample12.dll contains Impl 0x10009E39 with version 1
3016 //EComExample15.dll contains Impl 0x10009E39 with version 2
3017 //Ensure that choose the implementation in EComExample15.dll
3018 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid15, KCDummyUid, dllinfo, implementationInfo, dummyBool);
3019 TEST2(err, KErrNone);
3020 TEST(implementationInfo->ImplementationUid() == ImpUid15);
3021 TEST(implementationInfo->Version() == 2);
3022 TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
3024 // ... again but with interface uid
3025 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid15, InterfaceUid, dllinfo, implementationInfo, dummyBool);
3026 TEST2(err, KErrNone);
3027 TEST(implementationInfo->ImplementationUid() == ImpUid15);
3028 TEST(implementationInfo->Version() == 2);
3029 TEST(dllinfo.iName.CompareF(KEComExample15DllOnC) == 0);
3033 Tests for the CRegistryData::GetImplementationDllInfoForClientTestL.
3034 Plugins to be used in this test
3035 Interface UID DLL UID Implementation UID Version DllFile
3036 -------------------------------------------------------------------
3037 0x10009DC0 0x10009DB1 0x10009DC3 1 C:\\..\\EComExample.dll
3038 0x10009DB1 0x10009DC4 1 C:\\..\\EComExample.dll
3039 0x10009DB3 0x10009DC3 2 C:\\..\\EComExample2.dll
3040 0x10009DB3 0x10009DC4 2 C:\\..\\EComExample2.dll
3041 0x101F8477 0x101F8478 1 C:\\..\\EComExample3.dll
3042 0x101F847B 0x101F847C 1 C:\\..\\EComExample5.dll
3045 @SYMTestCaseID SYSLIB-ECOM-CT-1374
3046 @SYMTestCaseDesc Tests for CRegistryData::GetImplementationDllInfoForClientL() function.
3047 @SYMTestPriority High
3048 @SYMTestActions Get the plugin information of the implementation UID and validate the information.
3049 Get the plugin information of the implementation UID and Interface UID and validate
3051 Tests for the CImplementationInformation is correct
3052 Tests for loading implementation from RAM
3053 Tests for that the implementation returned will have the highest version
3054 Tests for for invalid ImplementationUid
3055 @SYMTestExpectedResults The test must not fail.
3058 void CRegistryDataTest::GetImplementationDllInfoForClientTestL()
3060 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1374 "));
3061 _LIT(KEComExample2,"C:\\sys\\bin\\EComExample2.dll");
3062 _LIT(KEComExample3,"C:\\sys\\bin\\EComExample3.dll");
3063 _LIT(KEComExample5,"C:\\sys\\bin\\EComExample5.dll");
3065 TUid ImpUid={0x10009DC3};
3066 TUid ImpUid3={0x101F8478};
3067 TUid ImpUid5={0x101F847C};
3070 TClientRequest clntRq;
3072 //Testing the CImplementationInformation is correct
3073 //and the DllInfo contains correct implementation info
3074 //Implementation uid used=0x101F8478
3075 CImplementationInformation* implementationInfo=NULL;
3076 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid3, KCDummyUid, dllinfo, implementationInfo, ETrue);
3077 TEST2(err, KErrNone);
3078 TEST(implementationInfo->ImplementationUid()==ImpUid3);
3079 TEST(implementationInfo->Version()==1);
3080 TEST(dllinfo.iName.CompareF(KEComExample3)==0);
3082 // ... again but with interface uid
3083 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid3, iInterfaceUid, dllinfo, implementationInfo, ETrue);
3084 TEST2(err, KErrNone);
3085 TEST(implementationInfo->ImplementationUid()==ImpUid3);
3086 TEST(implementationInfo->Version()==1);
3087 TEST(dllinfo.iName.CompareF(KEComExample3)==0);
3089 //Testing loading implementation from RAM(EComExample5.dll)
3090 //Implementation uid used=0x101F847C
3091 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid5, KCDummyUid, dllinfo, implementationInfo, ETrue);
3092 TEST2(err, KErrNone);
3093 TEST(implementationInfo->ImplementationUid()==ImpUid5);
3094 TEST(implementationInfo->Version()==1);
3095 TEST(dllinfo.iName.CompareF(KEComExample5)==0);
3097 // ... again but with interface uid
3098 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid5, iInterfaceUid, dllinfo, implementationInfo, ETrue);
3099 TEST2(err, KErrNone);
3100 TEST(implementationInfo->ImplementationUid()==ImpUid5);
3101 TEST(implementationInfo->Version()==1);
3102 TEST(dllinfo.iName.CompareF(KEComExample5)==0);
3104 //Testing that the implementation returned will have the highest version
3105 //EComExample.dll contains Impl 0x10009DC3 with version 1
3106 //EComExample2.dll contains Impl 0x10009DC3 with version 2
3107 //Ensure that choose the implementation in EComExample2.dll
3108 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, KCDummyUid, dllinfo, implementationInfo, ETrue);
3109 TEST2(err, KErrNone);
3110 TEST(implementationInfo->ImplementationUid()==ImpUid);
3111 TEST(implementationInfo->Version()==2);
3112 TEST(dllinfo.iName.CompareF(KEComExample2)==0);
3114 // ... again but with interface uid
3115 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, iInterfaceUid, dllinfo, implementationInfo, ETrue);
3116 TEST2(err, KErrNone);
3117 TEST(implementationInfo->ImplementationUid()==ImpUid);
3118 TEST(implementationInfo->Version()==2);
3119 TEST(dllinfo.iName.CompareF(KEComExample2)==0);
3121 //Testing for invalid ImplementationUid
3122 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, KCInvalidUid, KCDummyUid, dllinfo, implementationInfo, ETrue);
3123 TEST2(err, KErrNotFound);
3124 TEST(implementationInfo==0);
3126 //Testing for invalid InterfaceUid
3127 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, ImpUid, KCInvalidUid, dllinfo, implementationInfo, ETrue);
3128 TEST2(err, KErrNotFound);
3129 TEST(implementationInfo==0);
3131 //Testing for invalid ImplementationUid and invalid InterfaceUid
3132 err = iRegistryData->GetImplementationDllInfoForClientL(clntRq, KCInvalidUid, KCInvalidUid, dllinfo, implementationInfo, ETrue);
3133 TEST2(err, KErrNotFound);
3134 TEST(implementationInfo==0);
3138 Tests for the CRegistryData::GetImplementationDllInfoForServer.
3139 This new API is introduced in the Clientside loading of plugins(ECOM Platform security)
3140 where the server will return the plugin information(aEntry) of the implementation Uid
3141 requested by the client.
3142 Plugins to be used in this test
3143 Interface UID DLL UID Implementation UID Version DllFile
3144 -------------------------------------------------------------------
3145 0x10009DC0 0x10009DB1 0x10009DC3 1 C:\\..\\EComExample.dll
3146 0x10009DB1 0x10009DC4 1 C:\\..\\EComExample.dll
3147 0x10009DB3 0x10009DC3 2 C:\\..\\EComExample2.dll
3148 0x10009DB3 0x10009DC4 2 C:\\..\\EComExample2.dll
3149 0x101F8477 0x101F8478 1 C:\\..\\EComExample3.dll
3150 0x101F847B 0x101F847C 1 C:\\..\\EComExample5.dll
3153 @SYMTestCaseID SYSLIB-ECOM-CT-0749
3154 @SYMTestCaseDesc Tests for CRegistryData::GetImplementationDllInfoForServer() function.
3155 @SYMTestPriority High
3156 @SYMTestActions Get the plugin information of the implementation UID and validate the information.
3157 Get the plugin information of the implementation UID and Interface UID and validate
3159 Tests for the CImplementationInformation is correct
3160 Tests for loading implementation from RAM
3161 Tests for that the implementation returned will have the highest version
3162 Tests for for invalid ImplementationUid
3163 @SYMTestExpectedResults The test must not fail.
3166 void CRegistryDataTest::GetImplementationDllInfoForServerTest()
3168 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0749 "));
3169 _LIT(KEComExample2,"C:\\sys\\bin\\EComExample2.dll");
3170 _LIT(KEComExample3,"C:\\sys\\bin\\EComExample3.dll");
3171 _LIT(KEComExample5,"C:\\sys\\bin\\EComExample5.dll");
3173 TUid ImpUid={0x10009DC3};
3174 TUid ImpUid3={0x101F8478};
3175 TUid ImpUid5={0x101F847C};
3180 //Testing the CImplementationInformation is correct
3181 //and the DllInfo contains correct implementation info
3182 //Implementation uid used=0x101F8478
3183 CImplementationInformation* implementationInfo=NULL;
3184 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid3, KCDummyUid, dllinfo, implementationInfo, dummyBool);
3185 TEST2(err, KErrNone);
3186 TEST(implementationInfo->ImplementationUid()==ImpUid3);
3187 TEST(implementationInfo->Version()==1);
3188 TEST(dllinfo.iName.CompareF(KEComExample3)==0);
3190 // ... again but with interface uid
3191 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid3, iInterfaceUid, dllinfo, implementationInfo, dummyBool);
3192 TEST2(err, KErrNone);
3193 TEST(implementationInfo->ImplementationUid()==ImpUid3);
3194 TEST(implementationInfo->Version()==1);
3195 TEST(dllinfo.iName.CompareF(KEComExample3)==0);
3197 //Testing loading implementation from RAM(EComExample5.dll)
3198 //Implementation uid used=0x101F847C
3199 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid5, KCDummyUid, dllinfo, implementationInfo, dummyBool);
3200 TEST2(err, KErrNone);
3201 TEST(implementationInfo->ImplementationUid()==ImpUid5);
3202 TEST(implementationInfo->Version()==1);
3203 TEST(dllinfo.iName.CompareF(KEComExample5)==0);
3205 // ... again but with interface uid
3206 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid5, iInterfaceUid, dllinfo, implementationInfo, dummyBool);
3207 TEST2(err, KErrNone);
3208 TEST(implementationInfo->ImplementationUid()==ImpUid5);
3209 TEST(implementationInfo->Version()==1);
3210 TEST(dllinfo.iName.CompareF(KEComExample5)==0);
3212 //Testing that the implementation returned will have the highest version
3213 //EComExample.dll contains Impl 0x10009DC3 with version 1
3214 //EComExample2.dll contains Impl 0x10009DC3 with version 2
3215 //Ensure that choose the implementation in EComExample2.dll
3216 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid, KCDummyUid, dllinfo, implementationInfo, dummyBool);
3217 TEST2(err, KErrNone);
3218 TEST(implementationInfo->ImplementationUid()==ImpUid);
3219 TEST(implementationInfo->Version()==2);
3220 TEST(dllinfo.iName.CompareF(KEComExample2)==0);
3222 // ... again but with interface uid
3223 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid, iInterfaceUid, dllinfo, implementationInfo, dummyBool);
3224 TEST2(err, KErrNone);
3225 TEST(implementationInfo->ImplementationUid()==ImpUid);
3226 TEST(implementationInfo->Version()==2);
3227 TEST(dllinfo.iName.CompareF(KEComExample2)==0);
3229 //Testing for invalid ImplementationUid
3230 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, KCInvalidUid, KCDummyUid, dllinfo, implementationInfo, dummyBool);
3231 TEST2(err, KErrNotFound);
3232 TEST(implementationInfo==0);
3234 //Testing for invalid InterfaceUid
3235 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, ImpUid, KCInvalidUid, dllinfo, implementationInfo, dummyBool);
3236 TEST2(err, KErrNotFound);
3237 TEST(implementationInfo==0);
3239 //Testing for invalid ImplementationUid and invalid InterfaceUid
3240 err = iRegistryData->GetImplementationDllInfoForServer(dummycaps, KCInvalidUid, KCInvalidUid, dllinfo, implementationInfo, dummyBool);
3241 TEST2(err, KErrNotFound);
3242 TEST(implementationInfo==0);
3246 @SYMTestCaseID SYSLIB-ECOM-CT-0750
3247 @SYMTestCaseDesc OOM test for the creation and deletion of CRegistryData
3248 @SYMTestPriority High
3249 @SYMTestActions Create and delete CRegistryData object,checks for handles leaked
3250 @SYMTestExpectedResults The test must not fail.
3253 LOCAL_C void OOMCreateDeleteTest()
3255 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0750 OOM CreateDeleteTest "));
3258 __UNUSED_VAR(failAt);
3260 CRegistryDataTest* theTest = NULL;
3265 // find out the number of open handles
3266 TInt startProcessHandleCount;
3267 TInt startThreadHandleCount;
3268 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
3270 __UHEAP_SETFAIL(RHeap::EDeterministic, failAt++);
3272 TRAP(err, theTest = CRegistryDataTest::NewL(EFalse));
3274 __UHEAP_SETFAIL(RHeap::ENone, 0);
3279 // check that no handles have leaked
3280 TInt endProcessHandleCount;
3281 TInt endThreadHandleCount;
3282 RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
3284 TEST(startProcessHandleCount == endProcessHandleCount);
3285 TEST(startThreadHandleCount == endThreadHandleCount);
3289 while(err == KErrNoMemory);
3291 TheTest.Printf(_L("- Succeeded at heap failure rate of %i\n"), failAt);
3292 TEST2(err, KErrNone);
3296 @SYMTestCaseID SYSLIB-ECOM-UT-1408
3297 @SYMTestCaseDesc Unit tests for CRegistryData::IsAnyDiscoveredL
3298 @SYMTestPriority High
3299 @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
3300 @SYMTestExpectedResults IsAnyDiscovered should be false when CDriveData is created, and false when the drive is internalized with no dat file.
3301 It should be true when the drive is internalized and there is a dat file.
3304 void CRegistryDataTest::IsAnyDllDiscoveredTestL()
3306 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1408 "));
3307 if (SpiFileExists())
3309 IsAnyDllDiscoveredTestWithSpiL();
3311 IsAnyDllDiscoveredTestNoSpiL();
3314 void CRegistryDataTest::IsAnyDllDiscoveredTestWithSpiL()
3317 // Test DatFileExists for dat files on ROM when there is a SPI file
3320 iStateAccessor->ClearRegistrations(*iRegistryData);
3322 // when a CDriveData is created DatFileExists should be false
3323 CRegistryData::CDriveData* driveDataZ = CRegistryData::CDriveData::NewLC(EDriveZ, iRegistryData);
3324 iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataZ);
3325 CleanupStack::Pop(driveDataZ);
3326 TEST(!iRegistryData->IsAnyDllRegisteredWithDriveL(EDriveZ));
3329 void CRegistryDataTest::IsAnyDllDiscoveredTestNoSpiL()
3332 // Test IsAnyDiscovered for dat files on ROM when there is no SPI file
3335 iStateAccessor->ClearRegistrations(*iRegistryData);
3337 // when a CDriveData is created there should be no DLL entries so IsAnyDiscoveredL should be false
3338 CRegistryData::CDriveData* driveDataC = CRegistryData::CDriveData::NewLC(EDriveC, iRegistryData);
3339 iStateAccessor->AppendDriveDataL(*iRegistryData, driveDataC);
3340 CleanupStack::Pop(driveDataC);
3341 TEST(!iRegistryData->IsAnyDllRegisteredWithDriveL(EDriveC));
3345 Adds the dll data on a particular drive.
3347 @SYMTestCaseID SYSLIB-ECOM-UT-1407
3348 @SYMTestCaseDesc Tests for CRegistryData::CDllData::ProcessSecurityCheckL() function
3349 @SYMTestPriority High
3350 @SYMTestActions Creates CDllData objects and calls ProcessSecurityCheckL on them
3351 The CDllData with a missing DLL should return EFalse, the CDllData with invalid
3352 SID should return EFalse, and a valid CDllData should return ETrue and ensure the VID
3353 match the VID of the valid DLL.
3354 @SYMTestExpectedResults ProcessSecurityCheckL returns false when a plugin's dll doesn't exist or has an invalid SID, true otherwise.
3355 @SYMREQ PREQ1192, REQ6111
3357 void CRegistryDataTest::ProcessSecurityCheckTestL()
3359 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1407 "));
3361 TDriveUnit driveUnitC(EDriveC);
3362 CRegistryData *registryData = CRegistryData::NewL(TheFs);
3363 CleanupStack::PushL(registryData);
3364 CRegistryData::CDriveData *driveCData = CRegistryData::CDriveData::NewLC(driveUnitC, registryData);
3367 // Test that a missing DLL causes ProcessSecurityCheckL to return EFalse
3369 TEntry missingDllEntry;
3370 missingDllEntry.iName = KEComMissingDll;
3371 fileparse.Set(KEComMissingDll,NULL,NULL);
3372 CRegistryData::CDllData* missingDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),missingDllEntry.iModified,KNullUid,KNullUid, driveCData);
3373 TEST(!missingDllData->ProcessSecurityCheckL());
3374 CleanupStack::PopAndDestroy(missingDllData);
3377 // Test that an invalid SID causes ProcessSecurityCheckL to return EFalse
3379 TEntry mismatchedSidDllEntry;
3380 // The actual secure Id for this DLL is 0x10009DB1, here the corresponding ID is set to 0x01010101
3381 TUidType mismatchedSidUidType(KCInvalidUid, KCInvalidUid, KCInvalidUid);
3382 mismatchedSidDllEntry.iName = KEComExampleDllOnZSysBin;
3383 mismatchedSidDllEntry.iType = mismatchedSidUidType;
3384 fileparse.Set(KEComExampleDllOnZSysBin,NULL,NULL);
3385 CRegistryData::CDllData* mismatchedSidDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),mismatchedSidDllEntry.iModified,mismatchedSidUidType[1],mismatchedSidUidType[2], driveCData);
3386 TEST(!mismatchedSidDllData->ProcessSecurityCheckL());
3387 CleanupStack::PopAndDestroy(mismatchedSidDllData);
3390 // Test that a valid entry causes ProcessSecurityCheckL to return ETrue
3392 TUid KEcomExampleSecureId = {0x10009DB1};
3393 TEntry validDllEntry;
3394 TUidType validUidType(KCInvalidUid, KUidInterfaceImplementationCollection, KEcomExampleSecureId);
3395 validDllEntry.iName = KEComExampleDllOnZSysBin;
3396 validDllEntry.iType = validUidType;
3397 fileparse.Set(KEComExampleDllOnZSysBin(),NULL,NULL);
3398 CRegistryData::CDllData* validDllData = CRegistryData::CDllData::NewLC(fileparse.NameAndExt(),validDllEntry.iModified,validUidType[1],validUidType[2], driveCData);
3399 // Because ProcessSecurityCheckL is handled differently the first and second times it is called for a given DLL
3400 // ProcessSecurityCheckL is called twice here to test both cases (the fist time the security check is performed, and the second time
3401 // a cached value is used)
3402 TEST(validDllData->ProcessSecurityCheckL());
3403 TEST(validDllData->ProcessSecurityCheckL());
3404 // check the VID of the DLL.
3405 TEST((validDllData->iVid).iId == 0x70000001);
3406 CleanupStack::PopAndDestroy(validDllData);
3410 CleanupStack::PopAndDestroy(driveCData);
3411 CleanupStack::PopAndDestroy(registryData);
3415 Tests functionality of ListImplementationsL for an interface ID where the security checks
3416 for DLLs implementing the given interface fail
3418 @SYMTestCaseID SYSLIB-ECOM-UT-1405
3419 @SYMTestCaseDesc Tests for CRegistryData::ListImplementationsL() function
3420 @SYMTestPriority High
3421 @SYMTestActions Makes sure the failed DLL security checks are handled properly
3422 An RSC file with an incorrect SID is tested, followed by an RSC file with a missing DLL
3423 @SYMTestExpectedResults ECom plugin's with invalid DLLs are not returned.
3426 void CRegistryDataTest::FailedSecurityCheckTestListImplementationsL()
3428 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1405 "));
3429 // Set up for heap leak checking
3433 // Test that mismatching SIDs cause a plug-in to not be returned through ListImplementationsL
3434 // InvalidSIDPlugin.rsc and InvalidSIDPlugin.dll are on the C drive, but their SIDs do not match
3435 // This will cause the DLL security check to fail, and since there are no other implementations of this interface,
3436 // no implementations should be returned
3438 TUid ifUid1 = {0x101FE392}; // the interface UID for InvalidSIDPlugin
3440 TRAPD(err, iRegistryData->ListImplementationsL(ifUid1,iImplDataList));
3443 // Since there are no other plug-ins implementing {0x101FE392}, there should be no implementations found
3444 TEST2(err, KEComErrNoInterfaceIdentified);
3447 // Test that a missing DLL causes a plug-in to not be returned through ListImplementationsL
3448 // and that other valid implementations are rolled back to when this happens
3450 // EComRomRslvrExampleOnC.rsc is on the C drive, and has an implementation that upgrades EComRomRslvrExampleOnZ.rsc
3451 // The DLL corresponding to EComRomRslvrExampleOnC.rsc is missing, so will fail the security check
3452 // This means Ecom should fall back to the implementations from EComRomRslvrExampleOnZ
3454 TUid ifUid3 = {0x10009DC8}; // the interface UID for EComRomRslvrExampleDllOnZ and EComRomRslvrExampleDllOnC
3455 TRAP(err, iRegistryData->ListImplementationsL(ifUid3,iImplDataList));
3458 TEST2(err, KErrNone);
3459 CleanupClosePushL(iImplDataList);
3461 // Print UIDs of implementations
3462 _LIT(KUIDFormat,"Uid = 0x%08x\n");
3463 _LIT(KLists,"There are %d Implementations \n");
3465 TheTest.Printf(KLists, iImplDataList.Count());
3467 // Go through each of the implementations returned, and find the ones that match up with EComRomRslvrExampleRscOnZ
3468 // (not the ones from EComRomRslvrExampleRscOnC because it's DLL is missing)
3469 // EComRomRslvrExampleOnZ contains the implementation 0x10009DC7v2 and 0x10009DC6v1 (these should be found)
3470 // EComRomRslvrExampleOnC contains the implementation 0x10009DC7v1 and 0x10009DC6v2 (these should NOT be returned becuase of the missing DLL)
3471 TBool foundRightImplementation1 = EFalse;
3472 TBool foundRightImplementation2 = EFalse;
3473 for(TInt index = 0; index < iImplDataList.Count(); ++index)
3475 CImplementationInformation* implInfo = iImplDataList[index]->iImplInfo;
3476 TUid uid = implInfo->ImplementationUid();
3477 TInt version = implInfo->Version();
3478 if (uid.iUid == 0x10009DC6)
3481 // The implementation of 0x10009DC6 from EComRomRslvrExampleOnZ was found
3482 foundRightImplementation1 = ETrue;
3484 if (uid.iUid == 0x10009DC7)
3487 // The implementation of 0x10009DC7 from EComRomRslvrExampleOnZ was found
3488 foundRightImplementation2 = ETrue;
3490 TheTest.Printf(KUIDFormat, uid);
3492 // Test that both implementations were found
3493 TEST(foundRightImplementation1 && foundRightImplementation2);
3496 CleanupStack::PopAndDestroy(&iImplDataList);
3501 Tests functionality of ListImplementationsL for an interface id where the corresponding
3504 @SYMTestCaseID SYSLIB-ECOM-UT-1406
3505 @SYMTestCaseDesc Tests for CRegistryData::GetImplementationDllInfoForClientL() function
3506 @SYMTestPriority High
3507 @SYMTestActions Makes sure the plug-ins that will fail a security check are not returned through GetImplementationDllInfoForClientL
3508 InvalidSIDPlugin.rsc and InvalidSIDPlugin.dll are on the C drive, with non-matching SIDs, so will fail a security check
3509 Because the security check fails, no implementation should be returned
3510 EComRomRslvrExampleOnC is on the C drive, without its associated DLL so will fail a security check
3511 Because the DLL is not there, Ecom should fall back to the implementations on the Z drive in EComRomRslvrExampleOnZ
3512 @SYMTestExpectedResults ECom plugin's with invalid DLLs are not returned.
3515 void CRegistryDataTest::FailedSecurityCheckTestGetImplementationInfoL()
3517 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-1406 "));
3518 // Set up for heap leak checking
3522 // Test that mismatching SIDs cause a plug-in to not be returned through GetImplementationDllInfoForClientL
3524 TUid implUid1 = {0x101FE393}; // the implementation UID for InvalidSIDPlugin
3525 TUid ifUid1 = {0x101FE392}; // the interface UID for InvalidSIDPlugin
3526 TClientRequest clientReq;
3528 CImplementationInformation *implementationInfo = NULL;
3529 // Test for GetImplementatioDllInfoForClientL when security check is not done.
3530 TInt err = iRegistryData->GetImplementationDllInfoForClientL(clientReq, implUid1, ifUid1, dllInfo, implementationInfo, EFalse);
3531 TEST2(err, KErrNone);
3532 TEST(dllInfo.iName.Compare(_L("C:\\sys\\bin\\InvalidSIDPlugin.dll")) == 0);
3533 // Test for GetImplementatioDllInfoForClientL when security check is done.
3534 err = iRegistryData->GetImplementationDllInfoForClientL(clientReq, implUid1, ifUid1, dllInfo, implementationInfo, ETrue);
3535 // Because the security check failed for InvalidSIDPlugin and there are no other implementations of implementation UID 0x101FE393, KErrNotFound is returned
3536 TEST2(err, KErrNotFound);
3538 // Test that a missing DLL causes a plug-in to not be returned through GetImplementationDllInfoForClientL
3539 // and that other valid implementations are rolled back to when this happens
3541 TUid implUid3 = {0x10009DC7}; // EComRomRslvrExampleDllOnZ
3542 TUid ifUid3 = {0x10009DC8}; // EComRomRslvrExampleDllOnZ
3543 err = iRegistryData->GetImplementationDllInfoForClientL(clientReq, implUid3, ifUid3, dllInfo, implementationInfo, ETrue);
3544 TEST2(err, KErrNone);
3545 // Because the security check failed for EComRomRslvrExampleDllOnC the returned implementation should rollback to the implementation on the Z drive
3546 TEST(dllInfo.iName.Compare(_L("C:\\sys\\bin\\EComRomRslvrExampleOnZ.dll")) == 0);
3552 Test case for Defect ECOM non-spi handling of multiple localised resource files with same name but different extension.
3553 Only one dll is created.
3555 @SYMTestCaseID SYSLIB-ECOM-CT-1806
3556 @SYMTestCaseDesc This function is used to check no duplication DLL is created when
3557 there are multiple resource files with same name but different extensions.
3558 @SYMTestPriority High
3559 @SYMTestActions Use CDiscoverer::CDirScanner::ScanDriveL to start discovery plugins on C:.
3560 Check that the dll list only has one dll existing with specified dll and interface UID.
3561 @SYMTestExpectedResults The test must not fail.
3564 void CRegistryDataTest::CheckDuplicatPluginsOnCL()
3566 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1806 "));
3568 //clean up all resource files in C:
3571 TDriveUnit driveC = TDriveUnit(KDriveC);
3573 TRegistrarObserverStub* registrarObsv = new(ELeave) TRegistrarObserverStub;
3574 CleanupStack::PushL(registrarObsv);
3576 CRegistryData* registryData = CRegistryData::NewL(TheFs);
3577 CleanupStack::PushL(registryData);
3579 CRegistrar* registrar = CRegistrar::NewL(*registryData, *registrarObsv, TheFs);
3580 CleanupStack::PushL(registrar);
3582 TRegistryData_StateAccessor* stateAccessor= new(ELeave) TRegistryData_StateAccessor;
3583 CleanupStack::PushL(stateAccessor);
3585 //After construction check that: registry is empty
3586 TEST(stateAccessor->RegistrationsCount(*registryData) == 0);
3588 //Copies multiple resource file with same name but different extensions on C:.
3589 TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExDllOnZ, KEComExDllOnC));
3590 TEST2(err, KErrNone);
3591 TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileOnC));
3592 TEST2(err, KErrNone);
3593 _LIT(KEComRscFileA01OnC, "C:\\resource\\plugins\\EComExample5.A01");
3594 TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA01OnC));
3595 TEST2(err, KErrNone);
3596 _LIT(KEComRscFileA02OnC, "C:\\resource\\plugins\\EComExample5.A02");
3597 TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA02OnC));
3598 TEST2(err, KErrNone);
3601 TRegistrar_StateAccessor registrarStateAccessorStub;
3602 registrarStateAccessorStub.ScanDriveL(*registrar, driveC);
3605 TDll *DllList = NULL;
3606 TInt indx = stateAccessor->GetDllListL(*registryData, driveC, DllList);
3608 TEST(DllList->Count() == 1);
3609 CRegistryData::CDllData *dllData = (*DllList)[0];
3611 //Testing loading implementation from RAM(EComExample5.dll) with specified Dll and interface UID.
3612 TUid thirdDllUid = {0x101F847B};
3613 TEST(dllData->iDllEntry->GetThirdUid() == thirdDllUid);
3614 TUid InterfaceUid5={0x10009DC0};
3615 TEST2(stateAccessor->FindAnImplementation(*registryData, InterfaceUid5, driveC), ETrue);
3618 TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExDllOnC));
3619 TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileOnC));
3620 TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA01OnC));
3621 TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA02OnC));
3623 CleanupStack::PopAndDestroy(stateAccessor);
3624 CleanupStack::PopAndDestroy(registrar);
3625 CleanupStack::PopAndDestroy(registryData);
3626 CleanupStack::PopAndDestroy(registrarObsv);
3628 //back to orignal state before the test
3633 Test case for Defect ECOM non-spi handling of multiple localised resource files but without
3634 a proper RSC file based on language downgrade path.
3636 @SYMTestCaseID SYSLIB-ECOM-CT-1829
3637 @SYMTestCaseDesc This function is used to check no DLL is created when multiple resource files
3638 exists but no proper RSC file based on language downgrade path.
3639 @SYMTestPriority High
3640 @SYMTestActions Use CDiscoverer::CDirScanner::ScanDriveL to start discovery plugins on C:.
3641 Check that the dll list is empty after scanning.
3642 @SYMTestExpectedResults The test must not fail.
3646 void CRegistryDataTest::CheckNoPluginsOnCL()
3648 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1829 "));
3650 //clean up all resource files in C:
3653 TDriveUnit driveC = TDriveUnit(KDriveC);
3655 TRegistrarObserverStub* registrarObsv = new(ELeave) TRegistrarObserverStub;
3656 CleanupStack::PushL(registrarObsv);
3658 CRegistryData* registryData = CRegistryData::NewL(TheFs);
3659 CleanupStack::PushL(registryData);
3661 CRegistrar* registrar = CRegistrar::NewL(*registryData, *registrarObsv, TheFs);
3662 CleanupStack::PushL(registrar);
3664 TRegistryData_StateAccessor* stateAccessor= new(ELeave) TRegistryData_StateAccessor;
3665 CleanupStack::PushL(stateAccessor);
3667 //After construction check that registry is empty
3668 TEST(stateAccessor->RegistrationsCount(*registryData) == 0);
3670 //Copies only EComExample5.A01 and EComExample5.A02 to C:, but no EComExample5.RSC
3671 TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExDllOnZ, KEComExDllOnC));
3672 TEST2(err, KErrNone);
3673 _LIT(KEComRscFileA01OnC, "C:\\resource\\plugins\\EComExample5.A01");
3674 TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA01OnC));
3675 TEST2(err, KErrNone);
3676 _LIT(KEComRscFileA02OnC, "C:\\resource\\plugins\\EComExample5.A02");
3677 TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileA02OnC));
3678 TEST2(err, KErrNone);
3681 TRegistrar_StateAccessor registrarStateAccessorStub;
3682 registrarStateAccessorStub.ScanDriveL(*registrar, driveC);
3684 //check dll list. No dll is created.
3685 TDll *DllList = NULL;
3686 TInt indx = stateAccessor->GetDllListL(*registryData, driveC, DllList);
3688 TEST(DllList->Count() == 0);
3690 TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExDllOnC));
3691 TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA01OnC));
3692 TRAP(err, EComTestUtils::FileManDeleteFileL(KEComRscFileA02OnC));
3694 CleanupStack::PopAndDestroy(stateAccessor);
3695 CleanupStack::PopAndDestroy(registrar);
3696 CleanupStack::PopAndDestroy(registryData);
3697 CleanupStack::PopAndDestroy(registrarObsv);
3699 //back to orignal state before the test
3705 Test case for implementations with same implementation UID but different
3706 interface UIDs. Implementation UIDs should be globally unique. So this
3707 is an error condition. But to maintain backward compatibility,
3708 ECom will allow it. List operation and most of the time, create
3709 should work. Problem arises if client uses the create request which
3710 does not supply the interface UID. In that case ECom applies a set of
3711 rules to determine which of the duplicate to pick. The returned
3712 impl. may not be the one the client is expecting. The rules from high
3713 precedence to low are:
3714 1. ROM based > non-ROM based,
3715 2. High drive letter > low drive letter
3716 3. Low I/F UID > High I/F UID.
3717 Rule number 1 is tested in SYSLIB-ECOM-CIT-3161.
3718 This testcase tests rule number 2 and number 3.
3720 @SYMTestCaseID SYSLIB-ECOM-CT-3157
3721 @SYMTestCaseDesc This function verifies that ECom handles duplicated
3722 implementation UID as expected:
3723 - List operations always return the correct implementations.
3724 - Create request which does not specify the I/F UID would get
3725 the implementation with the lowest I/F UID.
3726 - Create request specifying both I/F UID and impl UID would
3727 get the correct implementation.
3728 @SYMTestPriority High
3729 @SYMTestActions 1. Add two plugins with duplicated impl. UID but different I/F UID.
3730 2. Perform list operation on each interface. Check that the
3731 correct implementation is returned in each case.
3732 3. Do a search by implementation UID only (I/F UID is zero).
3733 Check that ECom returns the implementation with the lower
3735 4. Do another search specifying both I/F UID and impl. UID.
3736 Check that ECom returns the correct implementation.
3737 5. Remove the implementation with lower I/F UID from the
3738 indexes. Do search by impl UID only. ECom should return the high
3740 @SYMTestExpectedResults The test must not fail.
3743 void CRegistryDataTest::DuplicateImplUidTestL()
3745 // Do not run this test in OOM mode. Main part of this test is
3746 // inserting implementation in iInterfaceImplIndex and iImplIndex.
3747 // This operation does not cleanup properly if OOM because it
3748 // relies on server exit.
3750 // This test uses 2 interfaces: KCExampleInterfaceUid (10009DC0) and
3751 // KCInvalidUid (10009999).
3752 // They have a common implementationUID KCExampleInterfaceImp.
3753 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3157 "));
3755 _LIT(KHighDllPath, "C:\\resource\\plugins\\interfacehigh.dll");
3756 _LIT(KLowDllPath, "C:\\resource\\plugins\\interfacelow.dll");
3758 _LIT(KHighDisplayName, "dupl impl. of 10009DC0");
3759 _LIT(KLowDisplayName, "dupl impl. of 10009999");
3761 // Create implementation with high interface UID
3762 TImplCreationStruct highIfUid(EDriveC,
3763 KCExampleInterfaceUid,
3764 KCExampleInterfaceImp,
3767 CreateImplL(highIfUid);
3769 // Create implementation with low interface UID
3770 TImplCreationStruct lowIfUid(EDriveC,
3772 KCExampleInterfaceImp,
3775 CreateImplL(lowIfUid);
3777 TheTest.Printf(_L("Testing low I/F UID overrides high I/F UID on same drive\n"));
3778 TestDuplicatedImplPrecedenceL(lowIfUid, highIfUid);
3780 _LIT(KHighDriveDllPath, "K:\\resource\\plugins\\highdriveletter.dll");
3781 _LIT(KHighDriveDisplayName, "K: impl. of i/f 10009DC0");
3782 TImplCreationStruct highDriveLetter(EDriveK,
3783 KCExampleInterfaceUid,
3784 KCExampleInterfaceImp,
3786 KHighDriveDisplayName);
3787 CreateImplL(highDriveLetter);
3789 // I/f UID of the dll in K: is same as highIfUid above.
3790 // But K: take precedence over C: by virtue of higher drive number.
3791 TheTest.Printf(_L("Testing high drive letter overrides low drive letter"));
3792 TestDuplicatedImplPrecedenceL(highDriveLetter, lowIfUid);
3795 /** Helper of DuplicateImplUidTestL. This function does the real
3796 work while DuplicateImplUidTestL just setup the test parameters.
3798 @param highprecedence - data of the implementation of higher precedence.
3799 @param lowprecedence - the other implementation of lower precedence.
3801 void CRegistryDataTest::TestDuplicatedImplPrecedenceL(
3802 const TImplCreationStruct& highprecedence,
3803 const TImplCreationStruct& lowprecedence)
3805 TUid commonImplUid = highprecedence.iImplUid;
3806 TEST2(lowprecedence.iImplUid.iUid, highprecedence.iImplUid.iUid);
3808 //=============================================================
3809 // Check index is empty
3810 TEST2(iStateAccessor->ImplementationsCount(*iRegistryData), 0);
3812 //=============================================================
3813 // Add implementation of lowprecedence to indexes
3814 TBool result = iRegistryData->InsertIntoIndexL(lowprecedence.iImplData,
3816 TEST2(result, ETrue);
3818 //=============================================================
3819 // Add implementation of highprecedence to indexes
3820 result = iRegistryData->InsertIntoIndexL(highprecedence.iImplData,
3822 TEST2(result, ETrue);
3824 //=============================================================
3825 // Check the two plugins are inserted in the indexes and list
3826 // operation works OK
3827 TUid tempUid = lowprecedence.iInterfaceUid;
3828 RImplDataArray impls;
3829 CleanupClosePushL(impls);
3830 iStateAccessor->GetImplementationInfoL(*iRegistryData, tempUid, impls);
3831 TEST2(impls.Count(), 1);
3832 TEST(impls[0]->iImplInfo->DisplayName() == lowprecedence.iImplDisplayName);
3834 // Next do a list on the other I/F.
3835 tempUid = highprecedence.iInterfaceUid;
3836 iStateAccessor->GetImplementationInfoL(*iRegistryData, tempUid, impls);
3837 TEST2(impls.Count(), 1);
3838 TEST(impls[0]->iImplInfo->DisplayName() == highprecedence.iImplDisplayName);
3840 //=============================================================
3841 // If not specify interface UID, FindImplementation should return
3842 // the implementation of high precedence
3843 CRegistryData::CImplementationData* searchResult = NULL;
3844 TInt err = iStateAccessor->FindImplementation(*iRegistryData,
3848 TEST2(err, KErrNone);
3849 TEST(searchResult == highprecedence.iImplData);
3851 //=============================================================
3852 // FindImplementation should return the correct implementation
3853 // if the interface UID is specified.
3854 err = iStateAccessor->FindImplementation(*iRegistryData,
3856 lowprecedence.iInterfaceUid,
3858 TEST2(err, KErrNone);
3859 TEST(searchResult == lowprecedence.iImplData);
3861 // Repeat FindImplementation test on the highprecedence interface UID
3862 err = iStateAccessor->FindImplementation(*iRegistryData,
3864 highprecedence.iInterfaceUid,
3866 TEST2(err, KErrNone);
3867 TEST(searchResult == highprecedence.iImplData);
3869 //=============================================================
3870 // Remove the implementation of higher precedence.
3871 TRAP(err, iRegistryData->RemoveFromIndexL(highprecedence.iDllData));
3872 TEST2(err, KErrNone);
3874 //=============================================================
3875 // Now only the implementation with low precedence is in the indexes
3876 err = iStateAccessor->FindImplementation(*iRegistryData,
3880 TEST2(err, KErrNone);
3881 TEST(searchResult == lowprecedence.iImplData);
3883 // Before exit, make sure the indexes are empty.
3884 TRAP(err, iRegistryData->RemoveFromIndexL(lowprecedence.iDllData));
3885 TEST2(err, KErrNone);
3887 // Check index is empty
3888 TEST2(iStateAccessor->ImplementationsCount(*iRegistryData), 0);
3889 CleanupStack::PopAndDestroy(&impls);
3892 Test case for making sure the flag for indication of language switch set properly when
3893 language downgrade change happens during the running time.
3895 @SYMTestCaseID SYSLIB-ECOM-UT-3171
3896 @SYMTestCaseDesc This function verifies that ECom set the flag for indicating
3897 language change properly:
3898 - False when there is no language switch activity.
3899 - True when language downgrade path is changed from non-localise to localise.
3900 - True when first language changed only as opposed to complete language downgrade path
3901 - False when there is language switch activity, however, the language downgrade
3903 @SYMTestPriority High
3904 @SYMTestActions 1. construct language downgrade path
3905 2. Sets up the system-wide locale and language downgrade path.
3906 3. Check flag whether set properly.
3907 @SYMTestExpectedResults The test must not fail.
3910 void CRegistryDataTest::LanguageChangedTestL()
3912 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3171 "));
3913 //exclude those changes for language downgrade path during start-up time
3914 if(!iStateAccessor->IsLanguageInitChanged(*iRegistryData))
3916 // Language files used for locale settings
3917 _LIT(KEComEnglishLocale, "elocl.01");
3918 _LIT(KEComSpanishLocale, "elocl.04");
3920 TLanguage downgradePathSetup[3];
3922 TExtendedLocale extendedLocale;
3924 TBool isLanguageChange = EFalse;
3925 //There is no language switch activity, expect EFalse
3926 TRAPD(err, iRegistryData->LanguageChangedL(isLanguageChange));
3928 TEST2(err, KErrNone);
3929 TEST2(isLanguageChange, EFalse);
3931 //change language downgrade path from non localise to localise.
3932 extendedLocale.LoadSystemSettings();
3933 #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
3934 extendedLocale.LoadLocale(KEComEnglishLocale);
3936 extendedLocale.LoadLocale(KEComEnglishLang,KEComEnglishReg,KEComEnglishColl);
3938 extendedLocale.SaveSystemSettings();
3940 downgradePathSetup[0] = ELangEnglish;
3941 downgradePathSetup[1] = ELangFrench;
3942 downgradePathSetup[2] = ELangGerman;
3943 SetLanguageL(downgradePathSetup);
3945 TRAP(err, iRegistryData->LanguageChangedL(isLanguageChange));
3947 TEST2(err, KErrNone);
3948 TEST2(isLanguageChange, ETrue);
3949 //Change first language from English to Spanish..
3950 extendedLocale.LoadSystemSettings();
3951 #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
3952 extendedLocale.LoadLocale(KEComSpanishLocale);
3954 extendedLocale.LoadLocale(KEComSpanishLang,KEComSpanishReg,KEComSpanishColl);
3956 extendedLocale.SaveSystemSettings();
3957 downgradePathSetup[0] =ELangSpanish;
3958 SetLanguageL(downgradePathSetup);
3959 TRAP(err, iRegistryData->LanguageChangedL(isLanguageChange));
3961 TEST2(err, KErrNone);
3962 TEST2(isLanguageChange, ETrue);
3964 //use same language downgrade path setting.
3965 SetLanguageL(downgradePathSetup);
3966 TRAP(err, iRegistryData->LanguageChangedL(isLanguageChange));
3968 TEST2(err, KErrNone);
3969 TEST2(isLanguageChange, EFalse);
3974 @SYMTestCaseID SYSLIB-ECOM-UT-3670
3975 @SYMTestCaseDesc This test verifies that ECom sets the iDrivesRemoved correctly when drives
3976 are added and removed
3977 @SYMTestPriority High
3978 @SYMTestActions Call UndoTemporaryUninstallL to install some drives
3979 Remove selected drives by calling TemporaryUninstallL
3980 Use the state accessor to verify that the iDrivesRemoved flag
3981 correctly stores the removed drives
3982 @SYMTestExpectedResults The iDrivesRemoved flag should match the removed drives
3985 void CRegistryDataTest::DrivesRemovedTestL()
3987 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3670 "));
3989 //Ensure that the following drives are all installed
3990 iRegistryData->UndoTemporaryUninstallL(EDriveA);
3991 iRegistryData->UndoTemporaryUninstallL(EDriveO);
3992 iRegistryData->UndoTemporaryUninstallL(EDriveF);
3993 iRegistryData->UndoTemporaryUninstallL(EDriveZ);
3995 //Test that there are no drives removed
3996 TEST2(iStateAccessor->DrivesRemoved(*iRegistryData), 0);
3998 //Remove a drive and check that the state indicates the correct drive
4000 iRegistryData->TemporaryUninstallL(EDriveZ);
4001 TInt drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
4002 TEST2(drivesRemoved, 0x2000000);
4004 //remove another drive then re-add the first and make sure the
4005 //correct drive is removed
4006 iRegistryData->TemporaryUninstallL(EDriveA);
4007 iRegistryData->UndoTemporaryUninstallL(EDriveZ);
4008 drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
4009 TEST2(drivesRemoved, 0x1);
4011 //Remove all existing drives plus that hasnt been mounted
4012 //and check the result
4013 iRegistryData->TemporaryUninstallL(EDriveA);
4014 iRegistryData->TemporaryUninstallL(EDriveO);
4015 iRegistryData->TemporaryUninstallL(EDriveF);
4016 iRegistryData->TemporaryUninstallL(EDriveZ);
4017 iRegistryData->TemporaryUninstallL(EDriveX);
4019 drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
4020 TEST2(drivesRemoved, 0x2004021);
4022 //Add some existing and some new drives check the result
4023 iRegistryData->UndoTemporaryUninstallL(EDriveF);
4024 iRegistryData->UndoTemporaryUninstallL(EDriveZ);
4025 iRegistryData->UndoTemporaryUninstallL(EDriveB);
4026 iRegistryData->UndoTemporaryUninstallL(EDriveR);
4028 drivesRemoved = iStateAccessor->DrivesRemoved(*iRegistryData);
4029 TEST2(drivesRemoved, 0x0004001);
4033 // Type definition for pointer to member function.
4034 // Used in calling the CRegistryDataTest member function for testing.
4035 typedef void (CRegistryDataTest::*ClassFuncPtrL) (void);
4038 @SYMTestCaseID SYSLIB-ECOM-CT-0751
4039 @SYMTestCaseDesc Function to call all test functions
4040 @SYMTestPriority High
4041 @SYMTestActions Calls up all test functions related to CRegistryData
4042 @SYMTestExpectedResults The test must not fail.
4046 Wrapper function to call all test functions
4047 @param testFunc pointer to test function
4048 @param aTestDesc test function name
4049 @param aIsFullDriveCDiscovery whether the constructor make full discovery on drive C
4051 LOCAL_C void DoBasicTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDriveCDiscovery)
4053 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0751 "));
4054 TheTest.Next(aTestDesc);
4057 // find out the number of open handles
4058 TInt startProcessHandleCount;
4059 TInt startThreadHandleCount;
4060 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
4062 CRegistryDataTest* theTest = CRegistryDataTest::NewL(aIsFullDriveCDiscovery);
4063 CleanupStack::PushL(theTest);
4065 (theTest->*testFuncL)();
4067 CleanupStack::PopAndDestroy(theTest);
4069 // check that no handles have leaked
4070 TInt endProcessHandleCount;
4071 TInt endThreadHandleCount;
4072 RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
4074 TEST(startProcessHandleCount == endProcessHandleCount);
4075 TEST(startThreadHandleCount == endThreadHandleCount);
4081 @SYMTestCaseID SYSLIB-ECOM-CT-0752
4082 @SYMTestCaseDesc Function to call all OOM test functions
4083 @SYMTestPriority High
4084 @SYMTestActions Calls up all OOM test functions related to CRegistryData
4085 @SYMTestExpectedResults The test must not fail.
4089 Wrapper function to call all OOM test functions
4090 @param testFuncL pointer to OOM test function
4091 @param aTestDesc test function name
4092 @param aIsFullDriveCDiscovery whether the constructor make full discovery on drive C
4094 LOCAL_C void DoOOMTestL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDriveCDiscovery)
4096 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0752 "));
4097 TheTest.Next(aTestDesc);
4104 // find out the number of open handles
4105 TInt startProcessHandleCount;
4106 TInt startThreadHandleCount;
4107 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
4109 CRegistryDataTest* theTest = CRegistryDataTest::NewL(aIsFullDriveCDiscovery);
4110 CleanupStack::PushL(theTest);
4112 __UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
4114 TRAP(err, (theTest->*testFuncL)());
4116 __UHEAP_SETFAIL(RHeap::ENone, 0);
4118 CleanupStack::PopAndDestroy(theTest);
4120 // check that no handles have leaked
4121 TInt endProcessHandleCount;
4122 TInt endThreadHandleCount;
4123 RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
4125 TEST(startProcessHandleCount == endProcessHandleCount);
4126 TEST(startThreadHandleCount == endThreadHandleCount);
4129 } while(err == KErrNoMemory);
4131 TEST2(err, KErrNone);
4132 TheTest.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
4136 Wrapper function for OOM test of function UpdateDllDataTest1L,UpdateDllDataTest2L,UpdateDllDataTest3L
4137 @param testFuncL pointer to OOM test function
4138 @param aTestDesc test function name
4139 @param aIsFullDriveCDiscovery whether the constructor makes full discovery on drive C
4140 @param aTestNumber The number identifies the test case of update dll data.
4142 LOCAL_C void DoOOMTestUpdateDllDataL(ClassFuncPtrL testFuncL, const TDesC& aTestDesc, TBool aIsFullDriveCDiscovery,TInt aTestNumber)
4144 TheTest.Next(aTestDesc);
4151 switch (aTestNumber)
4155 TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12UpgradedOnC));
4159 TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample14UpgradedOnC));
4163 TRAP(err,EComTestUtils::FileManDeleteFileL(KEcomExample12DowngradedOnC));
4166 // find out the number of open handles
4167 TInt startProcessHandleCount;
4168 TInt startThreadHandleCount;
4169 RThread().HandleCount(startProcessHandleCount, startThreadHandleCount);
4171 CRegistryDataTest* theTest = CRegistryDataTest::NewL(aIsFullDriveCDiscovery);
4172 CleanupStack::PushL(theTest);
4174 __UHEAP_SETFAIL(RHeap::EDeterministic, ++tryCount);
4176 TRAP(err, (theTest->*testFuncL)());
4178 __UHEAP_SETFAIL(RHeap::ENone, 0);
4180 CleanupStack::PopAndDestroy(theTest);
4182 // check that no handles have leaked
4183 TInt endProcessHandleCount;
4184 TInt endThreadHandleCount;
4185 RThread().HandleCount(endProcessHandleCount, endThreadHandleCount);
4187 TEST(startProcessHandleCount == endProcessHandleCount);
4188 TEST(startThreadHandleCount == endThreadHandleCount);
4191 } while(err == KErrNoMemory);
4193 TEST2(err, KErrNone);
4194 TheTest.Printf(_L("- server succeeded at heap failure rate of %i\n"), tryCount);
4198 LOCAL_C void DoTestsL()
4201 // Create backup server session here. When deleted it deletes safely.
4202 // Registrar object creates BackUpNotifier object which
4203 // internally creates CBaBackupSessionWrapper, an interface to BackUpSErver session opens 3 handles.
4204 // but when Registrar object is deleted it deletes one handle and two are left open.
4206 CBaBackupSessionWrapper *BackupSession = CBaBackupSessionWrapper::NewL();
4209 CreateDeleteTestL();
4210 DoBasicTestL(&CRegistryDataTest::FailedSecurityCheckTestListImplementationsL,_L("FailedSecurityCheckTestListImplementations Test"), ETrue);
4211 DoBasicTestL(&CRegistryDataTest::FailedSecurityCheckTestGetImplementationInfoL,_L("FailedSecurityCheckTestGetImplementationInfo Test"), ETrue);
4212 DoBasicTestL(&CRegistryDataTest::ProcessSecurityCheckTestL, _L("ProcessSecurityCheckTest Test"), ETrue);
4213 DoBasicTestL(&CRegistryDataTest::IsAnyDllDiscoveredTestL,_L("IsAnyDllDiscoveredTest Test"), ETrue);
4214 DoBasicTestL(&CRegistryDataTest::ImplementationDataTestL,_L("ImplementationData Test"), EFalse);
4215 DoBasicTestL(&CRegistryDataTest::InsertIntoIndexRemoveFromIndexTestL,_L("InsertIntoIndexRemoveFromIndex Test"), EFalse);
4216 DoBasicTestL(&CRegistryDataTest::RollbackTestL,_L("Rollback Test"), EFalse);
4217 DoBasicTestL(&CRegistryDataTest::AddDllDataTestL, _L("AddDllData Test"), ETrue);
4218 DoBasicTestL(&CRegistryDataTest::AddDllDataPlugIn3TestL, _L("AddDllData PlugIn3 Test"), ETrue);
4219 DoBasicTestL(&CRegistryDataTest::UpdateDllDataTest1L, _L("UpdateDllData Test 1"), ETrue);
4220 DoBasicTestL(&CRegistryDataTest::UpdateDllDataTest2L, _L("UpdateDllData Test 2"), ETrue);
4221 DoBasicTestL(&CRegistryDataTest::UpdateDllDataTest3L, _L("UpdateDllData Test 3"), ETrue);
4222 DoBasicTestL(&CRegistryDataTest::IsRegisteredWithDateUpdateDllDataTestL, _L("IsRegisteredWithDate and UpdateDllData Test"), ETrue);
4223 DoBasicTestL(&CRegistryDataTest::SetEnabledStateTestL, _L("SetEnabledState Test"), ETrue);
4224 DoBasicTestL(&CRegistryDataTest::FindImplementationTestL, _L("FindImplementation Test"), ETrue);
4225 DoBasicTestL(&CRegistryDataTest::ListImplementationsL, _L("ListImplementations Test for CRegistryData"), ETrue);
4226 DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT1L, _L("ListImplementations Test for CRegistryResolveTransaction 1"), ETrue);
4227 DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT2L, _L("ListImplementations Test for CRegistryResolveTransaction 2"), ETrue);
4228 DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT3L, _L("ListImplementations Test for CRegistryResolveTransaction 3"), ETrue);
4229 DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT4L, _L("ListImplementations Test for CRegistryResolveTransaction 4"), ETrue);
4230 DoBasicTestL(&CRegistryDataTest::ListImplementationsTestT5L, _L("ListImplementations Test for CRegistryResolveTransaction 5"), ETrue);
4231 DoBasicTestL(&CRegistryDataTest::ListExtendedInterfacesTestL, _L("ListExtendedInterfaces Test"), ETrue);
4233 DoBasicTestL(&CRegistryDataTest::DoUndoTemporaryUninstallTestL, _L("TemporaryUninstall and UndoTemporaryUninstall Test"), ETrue);
4234 DoBasicTestL(&CRegistryDataTest::DiscoveriesBeginCompleteTestL, _L("DiscoveriesBegin and DiscoveriesComplete Test"), ETrue);
4236 DoBasicTestL(&CRegistryDataTest::IndexedFindTestL, _L("IndexedFind Test"), ETrue);
4237 DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForClientTestL,_L("GetImplementationDllInfoForClientL Test"), ETrue);
4238 DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForServerTest,_L("GetImplementationDllInfoForServer Test"), ETrue);
4239 DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForClientPlugIn3TestL,_L("GetImplementationDllInfoForClientPlugIn3L Test"), ETrue);
4240 DoBasicTestL(&CRegistryDataTest::GetImplementationDllInfoForServerPlugIn3Test,_L("GetImplementationDllInfoForServerPlugIn3 Test"), ETrue);
4241 DoBasicTestL(&CRegistryDataTest::CheckDuplicatPluginsOnCL,_L("CheckDuplicatPluginsOnCL Test"), EFalse);
4242 DoBasicTestL(&CRegistryDataTest::CheckNoPluginsOnCL,_L("CheckNoPluginsOnCL Test"), EFalse);
4243 DoBasicTestL(&CRegistryDataTest::DuplicateImplUidTestL,_L("DuplicateImplUidTestL Test"), EFalse);
4244 DoBasicTestL(&CRegistryDataTest::LanguageChangedTestL,_L("LanguageChangedTestL Test"), EFalse);
4245 DoBasicTestL(&CRegistryDataTest::DrivesRemovedTestL,_L("DrivesRemovedTestL Test"), EFalse);
4249 OOMCreateDeleteTest();
4250 DoOOMTestL(&CRegistryDataTest::FailedSecurityCheckTestListImplementationsL,_L("OOM FailedSecurityCheckTestListImplementations Test"), ETrue);
4251 DoOOMTestL(&CRegistryDataTest::FailedSecurityCheckTestGetImplementationInfoL,_L("OOM FailedSecurityCheckTestGetImplementationInfo Test"), ETrue);
4252 DoOOMTestL(&CRegistryDataTest::ProcessSecurityCheckTestL, _L("OOM ProcessSecurityCheckTest Test"), ETrue);
4253 DoOOMTestL(&CRegistryDataTest::IsAnyDllDiscoveredTestL, _L("OOM IsAnyDllDiscoveredTestL Test"), ETrue);
4254 DoOOMTestL(&CRegistryDataTest::ImplementationDataTestL, _L("OOM ImplementationData Test"), EFalse);
4255 DoOOMTestL(&CRegistryDataTest::InsertIntoIndexRemoveFromIndexTestL, _L("OOM InsertIntoIndexRemoveFromIndex Test"), EFalse);
4256 DoOOMTestL(&CRegistryDataTest::RollbackTestL, _L("OOM Rollback Test"), EFalse);
4257 DoOOMTestL(&CRegistryDataTest::AddDllDataTestL, _L("OOM AddDllData Test"), ETrue);
4258 DoOOMTestL(&CRegistryDataTest::AddDllDataPlugIn3TestL, _L("OOM AddDllData PlugIn3 Test"), ETrue);
4259 DoOOMTestUpdateDllDataL(&CRegistryDataTest::UpdateDllDataTest1L, _L("OOM UpdateDllData Test 1"), ETrue, 1);
4260 DoOOMTestUpdateDllDataL(&CRegistryDataTest::UpdateDllDataTest2L, _L("OOM UpdateDllData Test 2"), ETrue, 2);
4261 DoOOMTestUpdateDllDataL(&CRegistryDataTest::UpdateDllDataTest3L, _L("OOM UpdateDllData Test 3"), ETrue, 3);
4262 DoOOMTestL(&CRegistryDataTest::IsRegisteredWithDateUpdateDllDataTestL, _L("IsRegisteredWithDate and UpdateDllData Test"), ETrue);
4263 DoOOMTestL(&CRegistryDataTest::SetEnabledStateTestL, _L("OOM SetEnabledState Test"), ETrue);
4264 DoOOMTestL(&CRegistryDataTest::FindImplementationTestL, _L("OOM FindImplementation Test"), ETrue);
4265 DoOOMTestL(&CRegistryDataTest::ListImplementationsL, _L("OOM ListImplementations Test for CRegistryData"), ETrue);
4266 DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT1L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 1"), ETrue);
4267 DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT2L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 2"), ETrue);
4268 DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT3L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 3"), ETrue);
4269 DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT4L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 4"), ETrue);
4270 DoOOMTestL(&CRegistryDataTest::ListImplementationsTestT5L, _L("OOM ListImplementations Test for CRegistryResolveTransaction 5"), ETrue);
4271 DoOOMTestL(&CRegistryDataTest::ListExtendedInterfacesTestL, _L("OOM ListExtendedInterfaces Test"), ETrue);
4272 DoOOMTestL(&CRegistryDataTest::DoUndoTemporaryUninstallTestL, _L("OOM Test for TemporaryUninstall and UndoTemporaryUninstall"), ETrue);
4273 DoOOMTestL(&CRegistryDataTest::DiscoveriesBeginCompleteTestL, _L("OOM Test for DiscoveriesBegin and DiscoveriesComplete"), ETrue);
4274 DoOOMTestL(&CRegistryDataTest::IndexedFindTestL, _L("OOM IndexedFind Test"), ETrue);
4275 DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForClientTestL,_L("OOM Test for GetImplementationDllInfoForClientL Test"), ETrue);
4276 DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForServerTest,_L("OOM Test for GetImplementationDllInfoForServer Test"), ETrue);
4277 DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForClientTestL,_L("OOM Test for GetImplementationDllInfoForClientPlugIn3L Test"), ETrue);
4278 DoOOMTestL(&CRegistryDataTest::GetImplementationDllInfoForServerTest,_L("OOM Test for GetImplementationDllInfoForServerPlugIn3L Test"), ETrue);
4279 DoOOMTestL(&CRegistryDataTest::LanguageChangedTestL,_L("OOM Test for LanguageChangedTestL Test"), ETrue);
4280 DoOOMTestL(&CRegistryDataTest::DrivesRemovedTestL,_L("OOM Test for DrivesRemovedTestL Test"), ETrue);
4282 // OOM test can not be performed on API StoreL nad RestoreL, since registry index file gets corrupted when its
4283 // data is not completely written, causing to fail in next call.
4284 delete BackupSession;
4287 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-UT-3712 "));
4288 ThreadPanicTest(_L("AddExtendedInterface Panic Testing"),AddExtendedInterfacePanicL);
4294 Copies the Plugins to specific folder for testing purpose
4296 LOCAL_C void CopyPluginsL()
4298 // Copy the dlls and .rsc files on to RAM
4299 TRAPD(err, EComTestUtils::FileManCopyFileL(KEComExDllOnZ, KEComExDllOnC));
4300 TEST2(err, KErrNone);
4301 TRAP(err, EComTestUtils::FileManCopyFileL(KEComRscFileOnZ, KEComRscFileOnC));
4302 TEST2(err, KErrNone);
4304 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExampleDllOnZ, KEComExampleDllOnC));
4305 TEST2(err, KErrNone);
4306 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample2DllOnZ, KEComExample2DllOnC));
4307 TEST2(err, KErrNone);
4308 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample3DllOnZ, KEComExample3DllOnC));
4309 TEST2(err, KErrNone);
4310 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12DllOnZ, KEComExample12DllOnC));
4311 TEST2(err, KErrNone);
4312 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample14DllOnZ, KEComExample14DllOnC));
4313 TEST2(err, KErrNone);
4314 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample15DllOnZ, KEComExample15DllOnC));
4315 TEST2(err, KErrNone);
4317 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExampleRscOnZ, KEComExampleRscOnC));
4318 TEST2(err, KErrNone);
4319 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample2RscOnZ, KEComExample2RscOnC));
4320 TEST2(err, KErrNone);
4321 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample3RscOnZ, KEComExample3RscOnC));
4322 TEST2(err, KErrNone);
4323 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12RscOnZ, KEComExample12RscOnC));
4324 TEST2(err, KErrNone);
4325 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample14RscOnZ, KEComExample14RscOnC));
4326 TEST2(err, KErrNone);
4327 TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample15RscOnZ, KEComExample15RscOnC));
4328 TEST2(err, KErrNone);
4330 // Test plug-in resource file SID that doesn't match the DLL
4331 TRAP(err, EComTestUtils::FileManCopyFileL(KEComInvalidDllOnZ, KEComInvalidDllOnC));
4332 TEST2(err, KErrNone);
4333 TRAP(err, EComTestUtils::FileManCopyFileL(KEComInvalidRscOnZ, KEComInvalidRscOnC));
4334 TEST2(err, KErrNone);
4336 TRAP(err, EComTestUtils::FileManCopyFileL(KMissingDllRomRscFile, KMissingDllRamRscFile));
4337 TEST2(err, KErrNone);
4338 TRAP(err, EComTestUtils::FileManCopyFileL(KRollbackForMissingDllRomDllFile, KRollbackForMissingDllRamDllFile));
4339 TEST2(err, KErrNone);
4340 TRAP(err, EComTestUtils::FileManCopyFileL(KRollbackForMissingDllRomRscFile, KRollbackForMissingDllRamRscFile));
4341 TEST2(err, KErrNone);
4343 // Wait, so that ECom server looks for plugins copied from Z: to C drive
4344 // ECOM server could be already started. It means that when we copy some
4345 // ECOM plugins from Z: to C: drive - ECOM server should look for and
4346 // find the new ECOM plugins. The ECOM server uses for that CDiscoverer::CIdleScanningTimer
4347 // which is an active object. So the discovering service is asynchronous. We have to
4348 // wait some time until it finishes. Otherwise ListImplementationsL could fail to find
4349 // requested implementations.
4350 User::After(KOneSecond * 3);
4353 //Initialise the Active Scheduler
4354 LOCAL_C void SetupL()
4356 // Construct and install the Active Scheduler. The Active Schedular is needed
4357 // by components used by this test as they are ActiveObjects.
4358 TheActiveScheduler = new(ELeave)CActiveScheduler;
4359 CActiveScheduler::Install(TheActiveScheduler);
4360 ECOMTU_KILL_SERVER_L(TheTest);
4363 GLDEF_C TInt E32Main()
4367 TheTest.Printf(_L("\n"));
4369 TheTest.Start(_L("Registry Data Tests"));
4371 TheTrapCleanup = CTrapCleanup::New();
4373 User::LeaveIfError(TheFs.Connect());
4375 TRAPD(err, SetupL());
4376 TEST2(err, KErrNone);
4380 TRAP(err, DoTestsL());
4381 TEST2(err, KErrNone);
4383 // Cleanup files. If the cleanup fails that is no problem,
4384 // as any subsequent tests will replace them. The only downside
4385 // would be the disk not being tidied
4389 delete TheTrapCleanup;
4390 delete TheActiveScheduler;