sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // This file contains code to test the plugin upgrade feature of ecom as required by CR 65BCA3. sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "../EcomTestUtils/EcomTestUtils.h" sl@0: sl@0: #include sl@0: #include "EComUidCodes.h" sl@0: #include "Interface.h" // interface to Plugins sl@0: sl@0: // RAM Only RSC and DLL sl@0: _LIT(KRamOnlyEComUpgradeExample1DLL, "Z:\\RAMOnly\\EComUpgradeExample1.dll"); sl@0: _LIT(KRamOnlyEComUpgradeExample1RSC, "Z:\\RAMOnly\\EComUpgradeExample1.rsc"); sl@0: sl@0: _LIT(KRamOnlyEComUpgradeExample2DLL, "Z:\\RAMOnly\\EComUpgradeExample2.dll"); sl@0: _LIT(KRamOnlyEComUpgradeExample2RSC, "Z:\\RAMOnly\\EComUpgradeExample2.rsc"); sl@0: sl@0: _LIT(KRamOnlyEComUpgradeExample3DLL, "Z:\\RAMOnly\\EComUpgradeExample3.dll"); sl@0: _LIT(KRamOnlyEComUpgradeExample3RSC, "Z:\\RAMOnly\\EComUpgradeExample3.rsc"); sl@0: sl@0: _LIT(KEComUpgradeExample1DLLOnC, "C:\\sys\\bin\\EComUpgradeExample1.dll"); sl@0: _LIT(KEComUpgradeExample1RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeExample1.rsc"); sl@0: sl@0: _LIT(KEComUpgradeExample2DLLOnC, "C:\\sys\\bin\\EComUpgradeExample2.dll"); sl@0: _LIT(KEComUpgradeExample2RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeExample2.rsc"); sl@0: sl@0: _LIT(KEComUpgradeExample3DLLOnC, "C:\\sys\\bin\\EComUpgradeExample3.dll"); sl@0: _LIT(KEComUpgradeExample3RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeExample3.rsc"); sl@0: sl@0: _LIT(KRamOnlyEComUpgradeROExample1DLL, "Z:\\RAMOnly\\EComUpgradeROExample1.dll"); sl@0: _LIT(KRamOnlyEComUpgradeROExample1RSC, "Z:\\RAMOnly\\EComUpgradeROExample1.rsc"); sl@0: sl@0: _LIT(KRamOnlyEComUpgradeROExample2DLL, "Z:\\RAMOnly\\EComUpgradeROExample2.dll"); sl@0: _LIT(KRamOnlyEComUpgradeROExample2RSC, "Z:\\RAMOnly\\EComUpgradeROExample2.rsc"); sl@0: sl@0: _LIT(KRamOnlyEComUpgradeROExample3DLL, "Z:\\RAMOnly\\EComUpgradeROExample3.dll"); sl@0: _LIT(KRamOnlyEComUpgradeROExample3RSC, "Z:\\RAMOnly\\EComUpgradeROExample3.rsc"); sl@0: sl@0: _LIT(KEComUpgradeROExample1DLLOnC, "C:\\sys\\bin\\EComUpgradeROExample1.dll"); sl@0: _LIT(KEComUpgradeROExample1RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeROExample1.rsc"); sl@0: sl@0: _LIT(KEComUpgradeROExample2DLLOnC, "C:\\sys\\bin\\EComUpgradeROExample2.dll"); sl@0: _LIT(KEComUpgradeROExample2RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeROExample2.rsc"); sl@0: sl@0: _LIT(KEComUpgradeROExample3DLLOnC, "C:\\sys\\bin\\EComUpgradeROExample3.dll"); sl@0: _LIT(KEComUpgradeROExample3RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeROExample3.rsc"); sl@0: sl@0: const TInt KOneSecond = 1000000; sl@0: const TInt KInterfaceUid = 0x10009DBA; sl@0: const TInt KRomOnlyInterfaceUid = 0x10009DBD; sl@0: const TInt KImplementationUid = 0x10009DBB; sl@0: const TInt KRomOnlyImplementationUid = 0x10009DBE; sl@0: sl@0: LOCAL_D RTest TheTest(_L("Plugin Upgrade Test")); sl@0: sl@0: /** sl@0: Test macroes and functions sl@0: */ sl@0: static void Check(TInt aValue, TInt aExpected, TInt aLine) sl@0: { sl@0: if(aValue != aExpected) sl@0: { sl@0: RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); sl@0: TheTest(EFalse, aLine); sl@0: } sl@0: } sl@0: #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__) sl@0: sl@0: /** sl@0: Kill Ecom Server for testing purposes sl@0: */ sl@0: static void KillEComServerL() sl@0: { sl@0: //Need to ensure that the EComServer process is killed before even starting this test by using sl@0: //the EComTestUtils library sl@0: _LIT(KEComServerProcessName,"ecomserver"); sl@0: TRAPD(error, EComTestUtils::KillProcessL(KEComServerProcessName)); sl@0: error=error; sl@0: } sl@0: sl@0: class RPluginUpgradeTest sl@0: { sl@0: public: sl@0: static void UpgradePluginSameNameLowerVersionL(TBool aIsRomOnly); sl@0: static void UpgradePluginDifferentNameLowerVersionL(TBool aIsRomOnly); sl@0: static void UpgradePluginSameNameHigherVersionL(TBool aIsRomOnly); sl@0: static void UpgradePluginDifferentNameHigherVersionL(TBool aIsRomOnly); sl@0: static void UpgradePluginSameNameSameVersionL(TBool aIsRomOnly); sl@0: static void UpgradePluginDifferentNameSameVersionL(TBool aIsRomOnly); sl@0: }; sl@0: sl@0: /** sl@0: Copies the Plugins to specific folder for testing purpose sl@0: */ sl@0: LOCAL_C void CopyPluginSameNameLowerVersion(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1DLL, KEComUpgradeROExample2DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1RSC, KEComUpgradeROExample2RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1DLL, KEComUpgradeExample2DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1RSC, KEComUpgradeExample2RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: } sl@0: sl@0: LOCAL_C void CopyPluginDifferentNameLowerVersion(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1DLL, KEComUpgradeROExample1DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1RSC, KEComUpgradeROExample1RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1DLL, KEComUpgradeExample1DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1RSC, KEComUpgradeExample1RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: } sl@0: sl@0: LOCAL_C void CopyPluginSameNameHigherVersion(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3DLL, KEComUpgradeROExample2DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3RSC, KEComUpgradeROExample2RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3DLL, KEComUpgradeExample2DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3RSC, KEComUpgradeExample2RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: } sl@0: sl@0: LOCAL_C void CopyPluginDifferentNameHigherVersion(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3DLL, KEComUpgradeROExample3DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3RSC, KEComUpgradeROExample3RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3DLL, KEComUpgradeExample3DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3RSC, KEComUpgradeExample3RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: } sl@0: sl@0: LOCAL_C void CopyPluginSameNameSameVersion(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2DLL, KEComUpgradeROExample2DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2RSC, KEComUpgradeROExample2RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2DLL, KEComUpgradeExample2DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2RSC, KEComUpgradeExample2RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: } sl@0: sl@0: LOCAL_C void CopyPluginDifferentNameSameVersion(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2DLL, KEComUpgradeROExample3DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2RSC, KEComUpgradeROExample3RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2DLL, KEComUpgradeExample3DLLOnC)); sl@0: TEST2(err, KErrNone); sl@0: TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2RSC, KEComUpgradeExample3RSCOnC)); sl@0: TEST2(err, KErrNone); sl@0: } sl@0: } sl@0: sl@0: inline LOCAL_C void ResetEcom() sl@0: { sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: } sl@0: sl@0: // Deleting plugin from the RAM for cleanup purpose sl@0: inline LOCAL_C void DeleteUpgradeExample1Plugins(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample1DLLOnC)); sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample1RSCOnC)); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample1DLLOnC)); sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample1RSCOnC)); sl@0: } sl@0: } sl@0: sl@0: inline LOCAL_C void DeleteUpgradeExample2Plugins(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample2DLLOnC)); sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample2RSCOnC)); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample2DLLOnC)); sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample2RSCOnC)); sl@0: } sl@0: } sl@0: sl@0: inline LOCAL_C void DeleteUpgradeExample3Plugins(TBool aIsRomOnly) sl@0: { sl@0: TInt err=KErrNone; sl@0: if(aIsRomOnly) sl@0: { sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample3DLLOnC)); sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample3RSCOnC)); sl@0: } sl@0: else sl@0: { sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample3DLLOnC)); sl@0: TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample3RSCOnC)); sl@0: } sl@0: } sl@0: sl@0: inline LOCAL_C void CheckDefaultPluginOnZ(TBool aIsRomOnly) sl@0: { sl@0: RImplInfoPtrArray implArray; sl@0: TUid interfaceUid; sl@0: sl@0: if(aIsRomOnly) sl@0: { sl@0: /** sl@0: The following Plugin exists on the Z drive and will be discovered by ECOM during startup. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: --------------------------------------------------------------------------------------- sl@0: 0x10009DBD 0x10009DBC 0x10009DBE 2 Z:\\..\\EComUpgradeExample2.dll sl@0: **/ sl@0: interfaceUid = TUid::Uid(KRomOnlyInterfaceUid); sl@0: } sl@0: else sl@0: { sl@0: /** sl@0: The following Plugin exists on the Z drive and will be discovered by ECOM during startup. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: --------------------------------------------------------------------------------------- sl@0: 0x10009DBA 0x10009DB9 0x10009DBB 2 Z:\\..\\EComUpgradeExample2.dll sl@0: **/ sl@0: interfaceUid = TUid::Uid(KInterfaceUid); sl@0: } sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: TUid implUid = implArray[0]->ImplementationUid(); sl@0: TInt version = implArray[0]->Version(); sl@0: TInt drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: sl@0: // imp. uid sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: } sl@0: // version sl@0: TEST2(version, 2); sl@0: // Z drive sl@0: TEST2(drive, EDriveZ); sl@0: sl@0: implArray.ResetAndDestroy(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-1596 sl@0: @SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the sl@0: upgrading DLL/RSC name is the same as the DLL/RSC name to be sl@0: upgraded but has a lower version. sl@0: @SYMTestPriority High sl@0: @SYMTestActions Call REComSession::ListImplementations() and check V1 implementation sl@0: on Z drive exists. sl@0: Copy DLL/RSC with same name and lower version to C drive. sl@0: Call REComSession::ListImplementations() and check V1 implementation sl@0: upgrades on C drive has not upgraded the original implementation on Z drive. sl@0: Restart ECOM (to test subsequent boot condition i.e. loading from dat file sl@0: Call REComSession::ListImplementations() and check V1 implementation sl@0: upgrades on C drive has not upgraded the original implementation on Z drive. sl@0: Check for no crash and memory leaks. sl@0: The same test is repeated for Rom Only drives. And no upgrade in version is sl@0: observed. sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMDEF DEF080682 sl@0: */ sl@0: void RPluginUpgradeTest::UpgradePluginSameNameLowerVersionL(TBool aIsRomOnly) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1596 ")); sl@0: __UHEAP_MARK; sl@0: sl@0: ResetEcom(); sl@0: sl@0: CheckDefaultPluginOnZ(aIsRomOnly); sl@0: sl@0: TUid interfaceUid; sl@0: if(aIsRomOnly) sl@0: { sl@0: interfaceUid = TUid::Uid(KRomOnlyInterfaceUid); sl@0: } sl@0: else sl@0: { sl@0: interfaceUid = TUid::Uid(KInterfaceUid); sl@0: } sl@0: RImplInfoPtrArray implArray; sl@0: sl@0: /** sl@0: The following plugin is now added to the C drive and ECOM will do a rediscovery and sl@0: will not discover it. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: --------------------------------------------------------------------------------------- sl@0: for ROM only sl@0: 0x10009DBD 0x10009DBC 0x10009DBE 1 C:\\..\\EComUpgradeROExample2.dll sl@0: otherwise sl@0: 0x10009DBA 0x10009DB9 0x10009DBB 1 C:\\..\\EComUpgradeExample2.dll sl@0: **/ sl@0: sl@0: CopyPluginSameNameLowerVersion(aIsRomOnly); sl@0: // Give ECOM a chance to discover new plugins. sl@0: // Otherwise ListImplementationsL could fail to find requested implementations. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // The directory notifier will now detect that a new plugin has been added to the C drive and will cause sl@0: // ECOM to perform a new discovery. sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: TUid implUid = implArray[0]->ImplementationUid(); sl@0: TInt version = implArray[0]->Version(); sl@0: TInt drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After new implementation is discovered...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: implUid = implArray[0]->ImplementationUid(); sl@0: version = implArray[0]->Version(); sl@0: drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After restart...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // tidy up sl@0: // Remove plugins from C drive sl@0: DeleteUpgradeExample2Plugins(aIsRomOnly); sl@0: sl@0: // Give ECOM a chance to rediscover after deletion of plugins. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-1597 sl@0: @SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the sl@0: upgrading DLL/RSC name is different from the DLL/RSC to be upgraded. sl@0: See CR65BCA3 even when the version is lower. sl@0: @SYMTestPriority High sl@0: @SYMTestActions Call REComSession::ListImplementations() and check V2 implementation sl@0: on Z drive exists. sl@0: Copy DLL/RSC with different name and V1 to DLL/RSC to C drive. sl@0: Call REComSession::ListImplementations() and check the original V2 sl@0: implementation on Z drive has not been upgraded. sl@0: Check for no crash and memory leaks. sl@0: The same test is repeated for Rom Only drives. And no upgrade in version is sl@0: observed. sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMDEF DEF080682 sl@0: */ sl@0: void RPluginUpgradeTest::UpgradePluginDifferentNameLowerVersionL(TBool aIsRomOnly) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1597 ")); sl@0: __UHEAP_MARK; sl@0: sl@0: ResetEcom(); sl@0: sl@0: CheckDefaultPluginOnZ(aIsRomOnly); sl@0: sl@0: TUid interfaceUid = TUid::Null(); sl@0: if(aIsRomOnly) sl@0: { sl@0: interfaceUid = TUid::Uid(KRomOnlyInterfaceUid); sl@0: } sl@0: else sl@0: { sl@0: interfaceUid = TUid::Uid(KInterfaceUid); sl@0: } sl@0: RImplInfoPtrArray implArray; sl@0: sl@0: /** sl@0: The following plugin is now added to the C drive and ECOM will do a rediscovery and attempt to discover it. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: ---------------------------------------------------------------------------------------- sl@0: for ROM only sl@0: 0x10009DBD 0x10009DBC 0x10009DBE 1 C:\\..\\EComUpgradeROExample1.dll sl@0: otherwise sl@0: 0x10009DBA 0x10009DB9 0x10009DBB 1 C:\\..\\EComUpgradeExample1.dll sl@0: **/ sl@0: sl@0: CopyPluginDifferentNameLowerVersion(aIsRomOnly); sl@0: // Give ECOM a chance to discover new plugins. sl@0: // Otherwise ListImplementationsL could fail to find requested implementations. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // The directory notifier will now detect that a new plugin has been added to the C drive and will cause sl@0: // ECOM to perform a new discovery. sl@0: sl@0: // The upgrade should fail an dthe existing implementation on the Z should remain sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: TUid implUid = implArray[0]->ImplementationUid(); sl@0: TInt version = implArray[0]->Version(); sl@0: TInt drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After new implementation is discovered...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: implUid = implArray[0]->ImplementationUid(); sl@0: version = implArray[0]->Version(); sl@0: drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After restart...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // tidy up sl@0: // Remove plugins from C drive sl@0: DeleteUpgradeExample1Plugins(aIsRomOnly); sl@0: sl@0: // Give ECOM a chance to rediscover after deletion of plugins. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: sl@0: /* sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-0286 sl@0: @SYMTestCaseDesc Tests to ensure that an implementation can be upgraded when the sl@0: upgrading DLL/RSC name is the same as the DLL/RSC name to be sl@0: upgraded. sl@0: See CR65BCA3. sl@0: @SYMTestPriority High sl@0: @SYMTestActions Call REComSession::ListImplementations() and check V1 implementation sl@0: on Z drive exists. sl@0: Copy DLL/RSC with same name as DLL/RSC to be upgraded to C drive. sl@0: Call REComSession::ListImplementations() and check V3 implementation sl@0: upgrades on C drive has upgraded the original implementation on Z drive. sl@0: Restart ECOM (to test subsequent boot condition i.e. loading from dat file sl@0: Call REComSession::ListImplementations() and check V3 implementation sl@0: upgrades on C drive has upgraded the original implementation on Z drive. sl@0: Check for no crash and memory leaks. sl@0: The same test is repeated for Rom Only drives. And no upgrade in version is sl@0: observed. sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMPREQ PREQ277 sl@0: @SYMDEF DEF080682 sl@0: */ sl@0: void RPluginUpgradeTest::UpgradePluginSameNameHigherVersionL(TBool aIsRomOnly) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0286 ")); sl@0: __UHEAP_MARK; sl@0: sl@0: ResetEcom(); sl@0: sl@0: CheckDefaultPluginOnZ(aIsRomOnly); sl@0: sl@0: TUid interfaceUid; sl@0: if(aIsRomOnly) sl@0: { sl@0: interfaceUid = TUid::Uid(KRomOnlyInterfaceUid); sl@0: } sl@0: else sl@0: { sl@0: interfaceUid = TUid::Uid(KInterfaceUid); sl@0: } sl@0: RImplInfoPtrArray implArray; sl@0: sl@0: /** sl@0: The following plugin is now added to the C drive and ECOM will do a rediscovery and discover it. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: ------------------------------------------------------------------------------------------------------------------------------------------ sl@0: for ROM only sl@0: 0x10009DBD 0x10009DBC 0x10009DBE 3 C:\\..\\EComUpgradeROExample2.dll sl@0: otherwise sl@0: 0x10009DBA 0x10009DB9 0x10009DBB 3 C:\\..\\EComUpgradeExample2.dll sl@0: **/ sl@0: sl@0: CopyPluginSameNameHigherVersion(aIsRomOnly); sl@0: // Give ECOM a chance to discover new plugins. sl@0: // Otherwise ListImplementationsL could fail to find requested implementations. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // The directory notifier will now detect that a new plugin has been added to the C drive and will cause sl@0: // ECOM to perform a new discovery. sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: TUid implUid = implArray[0]->ImplementationUid(); sl@0: TInt version = implArray[0]->Version(); sl@0: TInt drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After new implementation is discovered...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 3); sl@0: TEST2(drive, EDriveC); sl@0: } sl@0: sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: implUid = implArray[0]->ImplementationUid(); sl@0: version = implArray[0]->Version(); sl@0: drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After restart...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 3); sl@0: TEST2(drive, EDriveC); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // tidy up sl@0: // Remove plugins from C drive sl@0: DeleteUpgradeExample2Plugins(aIsRomOnly); sl@0: sl@0: // Give ECOM a chance to rediscover after deletion of plugins. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-0287 sl@0: @SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the sl@0: upgrading DLL/RSC name is different from the DLL/RSC to be upgraded. sl@0: See CR65BCA3. sl@0: @SYMTestPriority High sl@0: @SYMTestActions Call REComSession::ListImplementations() and check V1 implementation sl@0: on Z drive exists. sl@0: Copy DLL/RSC with different name to DLL/RSC to be upgraded to C drive. sl@0: Call REComSession::ListImplementations() and check the original V2 sl@0: implementation on Z drive has not been upgraded. sl@0: Check for no crash and memory leaks. sl@0: The same test is repeated for Rom Only drives. And no upgrade in version is sl@0: observed. sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMPREQ PREQ277 sl@0: @SYMDEF DEF080682 sl@0: */ sl@0: void RPluginUpgradeTest::UpgradePluginDifferentNameHigherVersionL(TBool aIsRomOnly) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0287 ")); sl@0: __UHEAP_MARK; sl@0: sl@0: ResetEcom(); sl@0: sl@0: CheckDefaultPluginOnZ(aIsRomOnly); sl@0: sl@0: TUid interfaceUid; sl@0: if(aIsRomOnly) sl@0: { sl@0: interfaceUid = TUid::Uid(KRomOnlyInterfaceUid); sl@0: } sl@0: else sl@0: { sl@0: interfaceUid = TUid::Uid(KInterfaceUid); sl@0: } sl@0: RImplInfoPtrArray implArray; sl@0: sl@0: /** sl@0: The following plugin is now added to the C drive and ECOM will do a rediscovery and attempt to discover it. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: ------------------------------------------------------------------------------------------------------------------------------------------ sl@0: for ROM only sl@0: 0x10009DBD 0x10009DBC 0x10009DBE 3 C:\\..\\EComUpgradeROExample3.dll sl@0: otherwise sl@0: 0x10009DBA 0x10009DB9 0x10009DBB 3 C:\\..\\EComUpgradeExample3.dll sl@0: **/ sl@0: sl@0: CopyPluginDifferentNameHigherVersion(aIsRomOnly); sl@0: // Give ECOM a chance to discover new plugins. sl@0: // Otherwise ListImplementationsL could fail to find requested implementations. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // The directory notifier will now detect that a new plugin has been added to the C drive and will cause sl@0: // ECOM to perform a new discovery. sl@0: sl@0: // The upgrade should fail an dthe existing implementation on the Z should remain sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: TUid implUid = implArray[0]->ImplementationUid(); sl@0: TInt version = implArray[0]->Version(); sl@0: TInt drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After new implementation is discovered...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: implUid = implArray[0]->ImplementationUid(); sl@0: version = implArray[0]->Version(); sl@0: drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After restart...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // tidy up sl@0: // Remove plugins from C drive sl@0: DeleteUpgradeExample3Plugins(aIsRomOnly); sl@0: sl@0: // Give ECOM a chance to rediscover after deletion of plugins. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-0288 sl@0: @SYMTestCaseDesc Tests to ensure that an implementation can be upgraded when the sl@0: upgrading DLL/RSC name is the same as the DLL/RSC name to be sl@0: upgraded and also the version is the same. sl@0: See CR65BCA3. sl@0: @SYMTestPriority High sl@0: @SYMTestActions Call REComSession::ListImplementations() and check V1 implementation sl@0: on Z drive exists. sl@0: Copy DLL/RSC with same name as DLL/RSC to be upgraded to C drive. sl@0: Call REComSession::ListImplementations() and check V2 implementation sl@0: upgrades on C drive has upgraded the original implementation on Z drive. sl@0: Check for no crash and memory leaks. sl@0: Restart ECOM (to test subsequent boot condition i.e. loading from dat file sl@0: Call REComSession::ListImplementations() and check V2 implementation sl@0: upgrades on C drive has upgraded the original implementation on Z drive. sl@0: The same test is repeated for Rom Only drives. And no upgrade in version is sl@0: observed. sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMPREQ PREQ277 sl@0: @SYMDEF DEF080682 sl@0: */ sl@0: void RPluginUpgradeTest::UpgradePluginSameNameSameVersionL(TBool aIsRomOnly) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0288 ")); sl@0: __UHEAP_MARK; sl@0: sl@0: ResetEcom(); sl@0: sl@0: CheckDefaultPluginOnZ(aIsRomOnly); sl@0: sl@0: TUid interfaceUid; sl@0: if(aIsRomOnly) sl@0: { sl@0: interfaceUid = TUid::Uid(KRomOnlyInterfaceUid); sl@0: } sl@0: else sl@0: { sl@0: interfaceUid = TUid::Uid(KInterfaceUid); sl@0: } sl@0: RImplInfoPtrArray implArray; sl@0: sl@0: /** sl@0: The following plugin is now added to the C drive and ECOM will do a rediscovery and discover it. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: ------------------------------------------------------------------------------------------------------------------------------------------ sl@0: for ROM only sl@0: 0x10009DBD 0x10009DBC 0x10009DBE 2 C:\\..\\EComUpgradeROExample2.dll sl@0: otherwise sl@0: 0x10009DBA 0x10009DB9 0x10009DBB 2 C:\\..\\EComUpgradeExample2.dll sl@0: **/ sl@0: sl@0: CopyPluginSameNameSameVersion(aIsRomOnly); sl@0: // Give ECOM a chance to discover new plugins. sl@0: // Otherwise ListImplementationsL could fail to find requested implementations. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // The directory notifier will now detect that a new plugin has been added to the C drive and will cause sl@0: // ECOM to perform a new discovery. sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: TUid implUid = implArray[0]->ImplementationUid(); sl@0: TInt version = implArray[0]->Version(); sl@0: TInt drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After new implementation is discovered...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveC); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: implUid = implArray[0]->ImplementationUid(); sl@0: version = implArray[0]->Version(); sl@0: drive = implArray[0]->Drive(); sl@0: sl@0: RDebug::Print(_L("After restart...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveC); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // tidy up sl@0: // Remove plugins from C drive sl@0: DeleteUpgradeExample2Plugins(aIsRomOnly); sl@0: // Give ECOM a chance to rediscover after deletion of plugins. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-0289 sl@0: @SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the sl@0: upgrading DLL/RSC name is different from the DLL/RSC to be upgraded sl@0: and also the version is the same. sl@0: See CR65BCA3. sl@0: @SYMTestPriority High sl@0: @SYMTestActions Call REComSession::ListImplementations() and check V2 implementation sl@0: on Z drive exists. sl@0: Copy DLL/RSC with different name, but same version, to DLL/RSC to be sl@0: upgraded to C drive. sl@0: Call REComSession::ListImplementations() and check the original V2 sl@0: implementation on Z drive has not been upgraded. sl@0: Check for no crash and memory leaks. sl@0: The same test is repeated for Rom Only drives. And no upgrade in version is sl@0: observed. sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMPREQ PREQ277 sl@0: @SYMDEF DEF080682 sl@0: */ sl@0: void RPluginUpgradeTest::UpgradePluginDifferentNameSameVersionL(TBool aIsRomOnly) sl@0: { sl@0: TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0289 ")); sl@0: __UHEAP_MARK; sl@0: sl@0: ResetEcom(); sl@0: sl@0: CheckDefaultPluginOnZ(aIsRomOnly); sl@0: sl@0: TUid interfaceUid; sl@0: if(aIsRomOnly) sl@0: { sl@0: interfaceUid = TUid::Uid(KRomOnlyInterfaceUid); sl@0: } sl@0: else sl@0: { sl@0: interfaceUid = TUid::Uid(KInterfaceUid); sl@0: } sl@0: RImplInfoPtrArray implArray; sl@0: sl@0: /** sl@0: The following plugin is now added to the C drive and ECOM will do a rediscovery and attempt to discover it. sl@0: sl@0: Interface UID DLL UID Imp. UID Version DllFile sl@0: ---------------------------------------------------------------------------------------- sl@0: for ROM only sl@0: 0x10009DBD 0x10009DBC 0x10009DBE 2 C:\\..\\EComUpgradeROExample3.dll sl@0: otherwise sl@0: 0x10009DBA 0x10009DB9 0x10009DBB 2 C:\\..\\EComUpgradeExample3.dll sl@0: **/ sl@0: sl@0: CopyPluginDifferentNameSameVersion(aIsRomOnly); sl@0: // Give ECOM a chance to discover new plugins. sl@0: // Otherwise ListImplementationsL could fail to find requested implementations. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // The directory notifier will now detect that a new plugin has been added to the C drive and will cause sl@0: // ECOM to perform a new discovery. sl@0: sl@0: // The upgrade should fail an dthe existing implementation on the Z should remain sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: TUid implUid = implArray[0]->ImplementationUid(); sl@0: TInt version = implArray[0]->Version(); sl@0: TInt drive = implArray[0]->Drive(); sl@0: RDebug::Print(_L("After new implementation is discovered...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: // Get implementations for IF UID 0x10009DBA sl@0: REComSession::ListImplementationsL(interfaceUid, implArray); sl@0: sl@0: //Expected number of implementations returned sl@0: TEST2(implArray.Count(), 1); sl@0: sl@0: //Check that the implementation uid returned matched the specs above sl@0: implUid = implArray[0]->ImplementationUid(); sl@0: version = implArray[0]->Version(); sl@0: drive = implArray[0]->Drive(); sl@0: RDebug::Print(_L("After new implementation is discovered...\n")); sl@0: RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive); sl@0: sl@0: if(aIsRomOnly) sl@0: { sl@0: TEST2(implUid.iUid, KRomOnlyImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: else sl@0: { sl@0: TEST2(implUid.iUid, KImplementationUid); sl@0: TEST2(version, 2); sl@0: TEST2(drive, EDriveZ); sl@0: } sl@0: implArray.ResetAndDestroy(); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // tidy up sl@0: // Remove plugins from C drive sl@0: DeleteUpgradeExample3Plugins(aIsRomOnly); sl@0: // Give ECOM a chance to rediscover after deletion of plugins. sl@0: User::After(KOneSecond * 3); sl@0: sl@0: // close session sl@0: REComSession::FinalClose(); sl@0: sl@0: // kill ecomserver sl@0: KillEComServerL(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: LOCAL_C void RunTestL() sl@0: { sl@0: __UHEAP_MARK; sl@0: sl@0: sl@0: TheTest.Next(_L("Upgrade rom only plugin with same name and lower version")); sl@0: RPluginUpgradeTest::UpgradePluginSameNameLowerVersionL(ETrue); sl@0: sl@0: TheTest.Next(_L("Upgrade rom only plugin with different name and lower version")); sl@0: RPluginUpgradeTest::UpgradePluginDifferentNameLowerVersionL(ETrue); sl@0: sl@0: TheTest.Next(_L("Upgrade rom only plugin with same name and higher version")); sl@0: RPluginUpgradeTest::UpgradePluginSameNameHigherVersionL(ETrue); sl@0: sl@0: TheTest.Next(_L("Upgrade rom only plugin with different name and higher version")); sl@0: RPluginUpgradeTest::UpgradePluginDifferentNameHigherVersionL(ETrue); sl@0: sl@0: TheTest.Next(_L("Upgrade rom only plugin with same name and same version")); sl@0: RPluginUpgradeTest::UpgradePluginSameNameSameVersionL(ETrue); sl@0: sl@0: TheTest.Next(_L("Upgrade rom only plugin with different name and same version")); sl@0: RPluginUpgradeTest::UpgradePluginDifferentNameSameVersionL(ETrue); sl@0: sl@0: TheTest.Next(_L("Upgrade plugin with same name and lower version")); sl@0: RPluginUpgradeTest::UpgradePluginSameNameLowerVersionL(EFalse); sl@0: sl@0: TheTest.Next(_L("Upgrade plugin with different name and lower version")); sl@0: RPluginUpgradeTest::UpgradePluginDifferentNameLowerVersionL(EFalse); sl@0: sl@0: TheTest.Next(_L("Upgrade plugin with same name and higher version")); sl@0: RPluginUpgradeTest::UpgradePluginSameNameHigherVersionL(EFalse); sl@0: sl@0: TheTest.Next(_L("Upgrade plugin with different name and higher version")); sl@0: RPluginUpgradeTest::UpgradePluginDifferentNameHigherVersionL(EFalse); sl@0: sl@0: TheTest.Next(_L("Upgrade plugin with same name and same version")); sl@0: RPluginUpgradeTest::UpgradePluginSameNameSameVersionL(EFalse); sl@0: sl@0: TheTest.Next(_L("Upgrade plugin with different name and same version")); sl@0: RPluginUpgradeTest::UpgradePluginDifferentNameSameVersionL(EFalse); sl@0: sl@0: __UHEAP_MARKEND; sl@0: } sl@0: sl@0: void CleanupPluginFiles() sl@0: { sl@0: DeleteUpgradeExample1Plugins(EFalse); sl@0: DeleteUpgradeExample2Plugins(EFalse); sl@0: DeleteUpgradeExample3Plugins(EFalse); sl@0: DeleteUpgradeExample1Plugins(ETrue); sl@0: DeleteUpgradeExample2Plugins(ETrue); sl@0: DeleteUpgradeExample3Plugins(ETrue); sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: sl@0: TheTest.Title(); sl@0: TheTest.Start(_L("Plugin Upgrade Tests.")); sl@0: sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: CActiveScheduler* scheduler = new(ELeave)CActiveScheduler; sl@0: CActiveScheduler::Install(scheduler); sl@0: sl@0: // Cleanup files sl@0: CleanupPluginFiles(); sl@0: sl@0: //run tests sl@0: TRAPD(err,RunTestL()); sl@0: sl@0: // Cleanup files sl@0: if(err != KErrNone) sl@0: { sl@0: CleanupPluginFiles(); sl@0: } sl@0: sl@0: TEST2(err, KErrNone); sl@0: sl@0: // cleanup session sl@0: REComSession::FinalClose(); sl@0: sl@0: delete scheduler; sl@0: delete cleanup; sl@0: sl@0: TheTest.End(); sl@0: TheTest.Close(); sl@0: sl@0: __UHEAP_MARKEND; sl@0: return(0); sl@0: }