os/ossrv/lowlevellibsandfws/pluginfw/Framework/PluginUpgradeTest/t_pluginupgrade.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/PluginUpgradeTest/t_pluginupgrade.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1266 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// This file contains code to test the plugin upgrade feature of ecom as required by CR 65BCA3.
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32test.h>
1.22 +#include <e32panic.h>
1.23 +#include <f32file.h>
1.24 +#include <bautils.h>
1.25 +#include "../EcomTestUtils/EcomTestUtils.h"
1.26 +
1.27 +#include <ecom/ecom.h>
1.28 +#include "EComUidCodes.h"
1.29 +#include "Interface.h" // interface to Plugins
1.30 +
1.31 +// RAM Only RSC and DLL
1.32 +_LIT(KRamOnlyEComUpgradeExample1DLL, "Z:\\RAMOnly\\EComUpgradeExample1.dll");
1.33 +_LIT(KRamOnlyEComUpgradeExample1RSC, "Z:\\RAMOnly\\EComUpgradeExample1.rsc");
1.34 +
1.35 +_LIT(KRamOnlyEComUpgradeExample2DLL, "Z:\\RAMOnly\\EComUpgradeExample2.dll");
1.36 +_LIT(KRamOnlyEComUpgradeExample2RSC, "Z:\\RAMOnly\\EComUpgradeExample2.rsc");
1.37 +
1.38 +_LIT(KRamOnlyEComUpgradeExample3DLL, "Z:\\RAMOnly\\EComUpgradeExample3.dll");
1.39 +_LIT(KRamOnlyEComUpgradeExample3RSC, "Z:\\RAMOnly\\EComUpgradeExample3.rsc");
1.40 +
1.41 +_LIT(KEComUpgradeExample1DLLOnC, "C:\\sys\\bin\\EComUpgradeExample1.dll");
1.42 +_LIT(KEComUpgradeExample1RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeExample1.rsc");
1.43 +
1.44 +_LIT(KEComUpgradeExample2DLLOnC, "C:\\sys\\bin\\EComUpgradeExample2.dll");
1.45 +_LIT(KEComUpgradeExample2RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeExample2.rsc");
1.46 +
1.47 +_LIT(KEComUpgradeExample3DLLOnC, "C:\\sys\\bin\\EComUpgradeExample3.dll");
1.48 +_LIT(KEComUpgradeExample3RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeExample3.rsc");
1.49 +
1.50 +_LIT(KRamOnlyEComUpgradeROExample1DLL, "Z:\\RAMOnly\\EComUpgradeROExample1.dll");
1.51 +_LIT(KRamOnlyEComUpgradeROExample1RSC, "Z:\\RAMOnly\\EComUpgradeROExample1.rsc");
1.52 +
1.53 +_LIT(KRamOnlyEComUpgradeROExample2DLL, "Z:\\RAMOnly\\EComUpgradeROExample2.dll");
1.54 +_LIT(KRamOnlyEComUpgradeROExample2RSC, "Z:\\RAMOnly\\EComUpgradeROExample2.rsc");
1.55 +
1.56 +_LIT(KRamOnlyEComUpgradeROExample3DLL, "Z:\\RAMOnly\\EComUpgradeROExample3.dll");
1.57 +_LIT(KRamOnlyEComUpgradeROExample3RSC, "Z:\\RAMOnly\\EComUpgradeROExample3.rsc");
1.58 +
1.59 +_LIT(KEComUpgradeROExample1DLLOnC, "C:\\sys\\bin\\EComUpgradeROExample1.dll");
1.60 +_LIT(KEComUpgradeROExample1RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeROExample1.rsc");
1.61 +
1.62 +_LIT(KEComUpgradeROExample2DLLOnC, "C:\\sys\\bin\\EComUpgradeROExample2.dll");
1.63 +_LIT(KEComUpgradeROExample2RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeROExample2.rsc");
1.64 +
1.65 +_LIT(KEComUpgradeROExample3DLLOnC, "C:\\sys\\bin\\EComUpgradeROExample3.dll");
1.66 +_LIT(KEComUpgradeROExample3RSCOnC, "C:\\Resource\\Plugins\\EComUpgradeROExample3.rsc");
1.67 +
1.68 +const TInt KOneSecond = 1000000;
1.69 +const TInt KInterfaceUid = 0x10009DBA;
1.70 +const TInt KRomOnlyInterfaceUid = 0x10009DBD;
1.71 +const TInt KImplementationUid = 0x10009DBB;
1.72 +const TInt KRomOnlyImplementationUid = 0x10009DBE;
1.73 +
1.74 +LOCAL_D RTest TheTest(_L("Plugin Upgrade Test"));
1.75 +
1.76 +/**
1.77 +Test macroes and functions
1.78 +*/
1.79 +static void Check(TInt aValue, TInt aExpected, TInt aLine)
1.80 + {
1.81 + if(aValue != aExpected)
1.82 + {
1.83 + RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
1.84 + TheTest(EFalse, aLine);
1.85 + }
1.86 + }
1.87 +#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
1.88 +
1.89 +/**
1.90 +Kill Ecom Server for testing purposes
1.91 +*/
1.92 +static void KillEComServerL()
1.93 + {
1.94 + //Need to ensure that the EComServer process is killed before even starting this test by using
1.95 + //the EComTestUtils library
1.96 + _LIT(KEComServerProcessName,"ecomserver");
1.97 + TRAPD(error, EComTestUtils::KillProcessL(KEComServerProcessName));
1.98 + error=error;
1.99 + }
1.100 +
1.101 +class RPluginUpgradeTest
1.102 + {
1.103 +public:
1.104 + static void UpgradePluginSameNameLowerVersionL(TBool aIsRomOnly);
1.105 + static void UpgradePluginDifferentNameLowerVersionL(TBool aIsRomOnly);
1.106 + static void UpgradePluginSameNameHigherVersionL(TBool aIsRomOnly);
1.107 + static void UpgradePluginDifferentNameHigherVersionL(TBool aIsRomOnly);
1.108 + static void UpgradePluginSameNameSameVersionL(TBool aIsRomOnly);
1.109 + static void UpgradePluginDifferentNameSameVersionL(TBool aIsRomOnly);
1.110 + };
1.111 +
1.112 +/**
1.113 +Copies the Plugins to specific folder for testing purpose
1.114 +*/
1.115 +LOCAL_C void CopyPluginSameNameLowerVersion(TBool aIsRomOnly)
1.116 + {
1.117 + TInt err=KErrNone;
1.118 + if(aIsRomOnly)
1.119 + {
1.120 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1DLL, KEComUpgradeROExample2DLLOnC));
1.121 + TEST2(err, KErrNone);
1.122 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1RSC, KEComUpgradeROExample2RSCOnC));
1.123 + TEST2(err, KErrNone);
1.124 + }
1.125 + else
1.126 + {
1.127 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1DLL, KEComUpgradeExample2DLLOnC));
1.128 + TEST2(err, KErrNone);
1.129 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1RSC, KEComUpgradeExample2RSCOnC));
1.130 + TEST2(err, KErrNone);
1.131 + }
1.132 + }
1.133 +
1.134 +LOCAL_C void CopyPluginDifferentNameLowerVersion(TBool aIsRomOnly)
1.135 + {
1.136 + TInt err=KErrNone;
1.137 + if(aIsRomOnly)
1.138 + {
1.139 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1DLL, KEComUpgradeROExample1DLLOnC));
1.140 + TEST2(err, KErrNone);
1.141 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample1RSC, KEComUpgradeROExample1RSCOnC));
1.142 + TEST2(err, KErrNone);
1.143 + }
1.144 + else
1.145 + {
1.146 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1DLL, KEComUpgradeExample1DLLOnC));
1.147 + TEST2(err, KErrNone);
1.148 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample1RSC, KEComUpgradeExample1RSCOnC));
1.149 + TEST2(err, KErrNone);
1.150 + }
1.151 + }
1.152 +
1.153 +LOCAL_C void CopyPluginSameNameHigherVersion(TBool aIsRomOnly)
1.154 + {
1.155 + TInt err=KErrNone;
1.156 + if(aIsRomOnly)
1.157 + {
1.158 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3DLL, KEComUpgradeROExample2DLLOnC));
1.159 + TEST2(err, KErrNone);
1.160 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3RSC, KEComUpgradeROExample2RSCOnC));
1.161 + TEST2(err, KErrNone);
1.162 + }
1.163 + else
1.164 + {
1.165 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3DLL, KEComUpgradeExample2DLLOnC));
1.166 + TEST2(err, KErrNone);
1.167 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3RSC, KEComUpgradeExample2RSCOnC));
1.168 + TEST2(err, KErrNone);
1.169 + }
1.170 + }
1.171 +
1.172 +LOCAL_C void CopyPluginDifferentNameHigherVersion(TBool aIsRomOnly)
1.173 + {
1.174 + TInt err=KErrNone;
1.175 + if(aIsRomOnly)
1.176 + {
1.177 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3DLL, KEComUpgradeROExample3DLLOnC));
1.178 + TEST2(err, KErrNone);
1.179 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample3RSC, KEComUpgradeROExample3RSCOnC));
1.180 + TEST2(err, KErrNone);
1.181 + }
1.182 + else
1.183 + {
1.184 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3DLL, KEComUpgradeExample3DLLOnC));
1.185 + TEST2(err, KErrNone);
1.186 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample3RSC, KEComUpgradeExample3RSCOnC));
1.187 + TEST2(err, KErrNone);
1.188 + }
1.189 + }
1.190 +
1.191 +LOCAL_C void CopyPluginSameNameSameVersion(TBool aIsRomOnly)
1.192 + {
1.193 + TInt err=KErrNone;
1.194 + if(aIsRomOnly)
1.195 + {
1.196 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2DLL, KEComUpgradeROExample2DLLOnC));
1.197 + TEST2(err, KErrNone);
1.198 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2RSC, KEComUpgradeROExample2RSCOnC));
1.199 + TEST2(err, KErrNone);
1.200 + }
1.201 + else
1.202 + {
1.203 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2DLL, KEComUpgradeExample2DLLOnC));
1.204 + TEST2(err, KErrNone);
1.205 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2RSC, KEComUpgradeExample2RSCOnC));
1.206 + TEST2(err, KErrNone);
1.207 + }
1.208 + }
1.209 +
1.210 +LOCAL_C void CopyPluginDifferentNameSameVersion(TBool aIsRomOnly)
1.211 + {
1.212 + TInt err=KErrNone;
1.213 + if(aIsRomOnly)
1.214 + {
1.215 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2DLL, KEComUpgradeROExample3DLLOnC));
1.216 + TEST2(err, KErrNone);
1.217 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeROExample2RSC, KEComUpgradeROExample3RSCOnC));
1.218 + TEST2(err, KErrNone);
1.219 + }
1.220 + else
1.221 + {
1.222 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2DLL, KEComUpgradeExample3DLLOnC));
1.223 + TEST2(err, KErrNone);
1.224 + TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComUpgradeExample2RSC, KEComUpgradeExample3RSCOnC));
1.225 + TEST2(err, KErrNone);
1.226 + }
1.227 + }
1.228 +
1.229 +inline LOCAL_C void ResetEcom()
1.230 + {
1.231 + // close session
1.232 + REComSession::FinalClose();
1.233 +
1.234 + // kill ecomserver
1.235 + KillEComServerL();
1.236 + }
1.237 +
1.238 +// Deleting plugin from the RAM for cleanup purpose
1.239 +inline LOCAL_C void DeleteUpgradeExample1Plugins(TBool aIsRomOnly)
1.240 + {
1.241 + TInt err=KErrNone;
1.242 + if(aIsRomOnly)
1.243 + {
1.244 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample1DLLOnC));
1.245 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample1RSCOnC));
1.246 + }
1.247 + else
1.248 + {
1.249 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample1DLLOnC));
1.250 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample1RSCOnC));
1.251 + }
1.252 + }
1.253 +
1.254 +inline LOCAL_C void DeleteUpgradeExample2Plugins(TBool aIsRomOnly)
1.255 + {
1.256 + TInt err=KErrNone;
1.257 + if(aIsRomOnly)
1.258 + {
1.259 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample2DLLOnC));
1.260 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample2RSCOnC));
1.261 + }
1.262 + else
1.263 + {
1.264 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample2DLLOnC));
1.265 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample2RSCOnC));
1.266 + }
1.267 + }
1.268 +
1.269 +inline LOCAL_C void DeleteUpgradeExample3Plugins(TBool aIsRomOnly)
1.270 + {
1.271 + TInt err=KErrNone;
1.272 + if(aIsRomOnly)
1.273 + {
1.274 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample3DLLOnC));
1.275 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeROExample3RSCOnC));
1.276 + }
1.277 + else
1.278 + {
1.279 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample3DLLOnC));
1.280 + TRAP(err, EComTestUtils::FileManDeleteFileL(KEComUpgradeExample3RSCOnC));
1.281 + }
1.282 + }
1.283 +
1.284 +inline LOCAL_C void CheckDefaultPluginOnZ(TBool aIsRomOnly)
1.285 + {
1.286 + RImplInfoPtrArray implArray;
1.287 + TUid interfaceUid;
1.288 +
1.289 + if(aIsRomOnly)
1.290 + {
1.291 + /**
1.292 + The following Plugin exists on the Z drive and will be discovered by ECOM during startup.
1.293 +
1.294 + Interface UID DLL UID Imp. UID Version DllFile
1.295 + ---------------------------------------------------------------------------------------
1.296 + 0x10009DBD 0x10009DBC 0x10009DBE 2 Z:\\..\\EComUpgradeExample2.dll
1.297 + **/
1.298 + interfaceUid = TUid::Uid(KRomOnlyInterfaceUid);
1.299 + }
1.300 + else
1.301 + {
1.302 + /**
1.303 + The following Plugin exists on the Z drive and will be discovered by ECOM during startup.
1.304 +
1.305 + Interface UID DLL UID Imp. UID Version DllFile
1.306 + ---------------------------------------------------------------------------------------
1.307 + 0x10009DBA 0x10009DB9 0x10009DBB 2 Z:\\..\\EComUpgradeExample2.dll
1.308 + **/
1.309 + interfaceUid = TUid::Uid(KInterfaceUid);
1.310 + }
1.311 +
1.312 + // Get implementations for IF UID 0x10009DBA
1.313 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.314 +
1.315 + //Expected number of implementations returned
1.316 + TEST2(implArray.Count(), 1);
1.317 +
1.318 + //Check that the implementation uid returned matched the specs above
1.319 + TUid implUid = implArray[0]->ImplementationUid();
1.320 + TInt version = implArray[0]->Version();
1.321 + TInt drive = implArray[0]->Drive();
1.322 +
1.323 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.324 +
1.325 + // imp. uid
1.326 + if(aIsRomOnly)
1.327 + {
1.328 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.329 + }
1.330 + else
1.331 + {
1.332 + TEST2(implUid.iUid, KImplementationUid);
1.333 + }
1.334 + // version
1.335 + TEST2(version, 2);
1.336 + // Z drive
1.337 + TEST2(drive, EDriveZ);
1.338 +
1.339 + implArray.ResetAndDestroy();
1.340 + }
1.341 +
1.342 +/**
1.343 +@SYMTestCaseID SYSLIB-ECOM-CT-1596
1.344 +@SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the
1.345 + upgrading DLL/RSC name is the same as the DLL/RSC name to be
1.346 + upgraded but has a lower version.
1.347 +@SYMTestPriority High
1.348 +@SYMTestActions Call REComSession::ListImplementations() and check V1 implementation
1.349 + on Z drive exists.
1.350 + Copy DLL/RSC with same name and lower version to C drive.
1.351 + Call REComSession::ListImplementations() and check V1 implementation
1.352 + upgrades on C drive has not upgraded the original implementation on Z drive.
1.353 + Restart ECOM (to test subsequent boot condition i.e. loading from dat file
1.354 + Call REComSession::ListImplementations() and check V1 implementation
1.355 + upgrades on C drive has not upgraded the original implementation on Z drive.
1.356 + Check for no crash and memory leaks.
1.357 + The same test is repeated for Rom Only drives. And no upgrade in version is
1.358 + observed.
1.359 +@SYMTestExpectedResults The test must not fail.
1.360 +@SYMDEF DEF080682
1.361 +*/
1.362 +void RPluginUpgradeTest::UpgradePluginSameNameLowerVersionL(TBool aIsRomOnly)
1.363 + {
1.364 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1596 "));
1.365 + __UHEAP_MARK;
1.366 +
1.367 + ResetEcom();
1.368 +
1.369 + CheckDefaultPluginOnZ(aIsRomOnly);
1.370 +
1.371 + TUid interfaceUid;
1.372 + if(aIsRomOnly)
1.373 + {
1.374 + interfaceUid = TUid::Uid(KRomOnlyInterfaceUid);
1.375 + }
1.376 + else
1.377 + {
1.378 + interfaceUid = TUid::Uid(KInterfaceUid);
1.379 + }
1.380 + RImplInfoPtrArray implArray;
1.381 +
1.382 + /**
1.383 + The following plugin is now added to the C drive and ECOM will do a rediscovery and
1.384 + will not discover it.
1.385 +
1.386 + Interface UID DLL UID Imp. UID Version DllFile
1.387 + ---------------------------------------------------------------------------------------
1.388 + for ROM only
1.389 + 0x10009DBD 0x10009DBC 0x10009DBE 1 C:\\..\\EComUpgradeROExample2.dll
1.390 + otherwise
1.391 + 0x10009DBA 0x10009DB9 0x10009DBB 1 C:\\..\\EComUpgradeExample2.dll
1.392 + **/
1.393 +
1.394 + CopyPluginSameNameLowerVersion(aIsRomOnly);
1.395 + // Give ECOM a chance to discover new plugins.
1.396 + // Otherwise ListImplementationsL could fail to find requested implementations.
1.397 + User::After(KOneSecond * 3);
1.398 +
1.399 + // The directory notifier will now detect that a new plugin has been added to the C drive and will cause
1.400 + // ECOM to perform a new discovery.
1.401 +
1.402 + // Get implementations for IF UID 0x10009DBA
1.403 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.404 +
1.405 + //Expected number of implementations returned
1.406 + TEST2(implArray.Count(), 1);
1.407 +
1.408 + //Check that the implementation uid returned matched the specs above
1.409 + TUid implUid = implArray[0]->ImplementationUid();
1.410 + TInt version = implArray[0]->Version();
1.411 + TInt drive = implArray[0]->Drive();
1.412 +
1.413 + RDebug::Print(_L("After new implementation is discovered...\n"));
1.414 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.415 + if(aIsRomOnly)
1.416 + {
1.417 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.418 + TEST2(version, 2);
1.419 + TEST2(drive, EDriveZ);
1.420 + }
1.421 + else
1.422 + {
1.423 + TEST2(implUid.iUid, KImplementationUid);
1.424 + TEST2(version, 2);
1.425 + TEST2(drive, EDriveZ);
1.426 + }
1.427 +
1.428 + implArray.ResetAndDestroy();
1.429 +
1.430 + // close session
1.431 + REComSession::FinalClose();
1.432 +
1.433 + // kill ecomserver
1.434 + KillEComServerL();
1.435 +
1.436 + // Get implementations for IF UID 0x10009DBA
1.437 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.438 +
1.439 + //Expected number of implementations returned
1.440 + TEST2(implArray.Count(), 1);
1.441 +
1.442 + //Check that the implementation uid returned matched the specs above
1.443 + implUid = implArray[0]->ImplementationUid();
1.444 + version = implArray[0]->Version();
1.445 + drive = implArray[0]->Drive();
1.446 +
1.447 + RDebug::Print(_L("After restart...\n"));
1.448 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.449 + if(aIsRomOnly)
1.450 + {
1.451 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.452 + TEST2(version, 2);
1.453 + TEST2(drive, EDriveZ);
1.454 + }
1.455 + else
1.456 + {
1.457 + TEST2(implUid.iUid, KImplementationUid);
1.458 + TEST2(version, 2);
1.459 + TEST2(drive, EDriveZ);
1.460 + }
1.461 +
1.462 + implArray.ResetAndDestroy();
1.463 +
1.464 + // close session
1.465 + REComSession::FinalClose();
1.466 +
1.467 + // tidy up
1.468 + // Remove plugins from C drive
1.469 + DeleteUpgradeExample2Plugins(aIsRomOnly);
1.470 +
1.471 + // Give ECOM a chance to rediscover after deletion of plugins.
1.472 + User::After(KOneSecond * 3);
1.473 +
1.474 + // close session
1.475 + REComSession::FinalClose();
1.476 +
1.477 + // kill ecomserver
1.478 + KillEComServerL();
1.479 +
1.480 + __UHEAP_MARKEND;
1.481 + }
1.482 +
1.483 +
1.484 +/**
1.485 +@SYMTestCaseID SYSLIB-ECOM-CT-1597
1.486 +@SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the
1.487 + upgrading DLL/RSC name is different from the DLL/RSC to be upgraded.
1.488 + See CR65BCA3 even when the version is lower.
1.489 +@SYMTestPriority High
1.490 +@SYMTestActions Call REComSession::ListImplementations() and check V2 implementation
1.491 + on Z drive exists.
1.492 + Copy DLL/RSC with different name and V1 to DLL/RSC to C drive.
1.493 + Call REComSession::ListImplementations() and check the original V2
1.494 + implementation on Z drive has not been upgraded.
1.495 + Check for no crash and memory leaks.
1.496 + The same test is repeated for Rom Only drives. And no upgrade in version is
1.497 + observed.
1.498 +@SYMTestExpectedResults The test must not fail.
1.499 +@SYMDEF DEF080682
1.500 +*/
1.501 +void RPluginUpgradeTest::UpgradePluginDifferentNameLowerVersionL(TBool aIsRomOnly)
1.502 + {
1.503 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1597 "));
1.504 + __UHEAP_MARK;
1.505 +
1.506 + ResetEcom();
1.507 +
1.508 + CheckDefaultPluginOnZ(aIsRomOnly);
1.509 +
1.510 + TUid interfaceUid = TUid::Null();
1.511 + if(aIsRomOnly)
1.512 + {
1.513 + interfaceUid = TUid::Uid(KRomOnlyInterfaceUid);
1.514 + }
1.515 + else
1.516 + {
1.517 + interfaceUid = TUid::Uid(KInterfaceUid);
1.518 + }
1.519 + RImplInfoPtrArray implArray;
1.520 +
1.521 + /**
1.522 + The following plugin is now added to the C drive and ECOM will do a rediscovery and attempt to discover it.
1.523 +
1.524 + Interface UID DLL UID Imp. UID Version DllFile
1.525 + ----------------------------------------------------------------------------------------
1.526 + for ROM only
1.527 + 0x10009DBD 0x10009DBC 0x10009DBE 1 C:\\..\\EComUpgradeROExample1.dll
1.528 + otherwise
1.529 + 0x10009DBA 0x10009DB9 0x10009DBB 1 C:\\..\\EComUpgradeExample1.dll
1.530 + **/
1.531 +
1.532 + CopyPluginDifferentNameLowerVersion(aIsRomOnly);
1.533 + // Give ECOM a chance to discover new plugins.
1.534 + // Otherwise ListImplementationsL could fail to find requested implementations.
1.535 + User::After(KOneSecond * 3);
1.536 +
1.537 + // The directory notifier will now detect that a new plugin has been added to the C drive and will cause
1.538 + // ECOM to perform a new discovery.
1.539 +
1.540 + // The upgrade should fail an dthe existing implementation on the Z should remain
1.541 +
1.542 + // Get implementations for IF UID 0x10009DBA
1.543 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.544 +
1.545 + //Expected number of implementations returned
1.546 + TEST2(implArray.Count(), 1);
1.547 +
1.548 + //Check that the implementation uid returned matched the specs above
1.549 + TUid implUid = implArray[0]->ImplementationUid();
1.550 + TInt version = implArray[0]->Version();
1.551 + TInt drive = implArray[0]->Drive();
1.552 +
1.553 + RDebug::Print(_L("After new implementation is discovered...\n"));
1.554 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.555 + if(aIsRomOnly)
1.556 + {
1.557 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.558 + TEST2(version, 2);
1.559 + TEST2(drive, EDriveZ);
1.560 + }
1.561 + else
1.562 + {
1.563 + TEST2(implUid.iUid, KImplementationUid);
1.564 + TEST2(version, 2);
1.565 + TEST2(drive, EDriveZ);
1.566 + }
1.567 + implArray.ResetAndDestroy();
1.568 +
1.569 + // close session
1.570 + REComSession::FinalClose();
1.571 +
1.572 + // kill ecomserver
1.573 + KillEComServerL();
1.574 +
1.575 + // Get implementations for IF UID 0x10009DBA
1.576 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.577 +
1.578 + //Expected number of implementations returned
1.579 + TEST2(implArray.Count(), 1);
1.580 +
1.581 + //Check that the implementation uid returned matched the specs above
1.582 + implUid = implArray[0]->ImplementationUid();
1.583 + version = implArray[0]->Version();
1.584 + drive = implArray[0]->Drive();
1.585 +
1.586 + RDebug::Print(_L("After restart...\n"));
1.587 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.588 + if(aIsRomOnly)
1.589 + {
1.590 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.591 + TEST2(version, 2);
1.592 + TEST2(drive, EDriveZ);
1.593 + }
1.594 + else
1.595 + {
1.596 + TEST2(implUid.iUid, KImplementationUid);
1.597 + TEST2(version, 2);
1.598 + TEST2(drive, EDriveZ);
1.599 + }
1.600 + implArray.ResetAndDestroy();
1.601 +
1.602 + // close session
1.603 + REComSession::FinalClose();
1.604 +
1.605 + // tidy up
1.606 + // Remove plugins from C drive
1.607 + DeleteUpgradeExample1Plugins(aIsRomOnly);
1.608 +
1.609 + // Give ECOM a chance to rediscover after deletion of plugins.
1.610 + User::After(KOneSecond * 3);
1.611 +
1.612 + // close session
1.613 + REComSession::FinalClose();
1.614 +
1.615 + // kill ecomserver
1.616 + KillEComServerL();
1.617 +
1.618 + __UHEAP_MARKEND;
1.619 + }
1.620 +
1.621 +
1.622 +/*
1.623 +@SYMTestCaseID SYSLIB-ECOM-CT-0286
1.624 +@SYMTestCaseDesc Tests to ensure that an implementation can be upgraded when the
1.625 + upgrading DLL/RSC name is the same as the DLL/RSC name to be
1.626 + upgraded.
1.627 + See CR65BCA3.
1.628 +@SYMTestPriority High
1.629 +@SYMTestActions Call REComSession::ListImplementations() and check V1 implementation
1.630 + on Z drive exists.
1.631 + Copy DLL/RSC with same name as DLL/RSC to be upgraded to C drive.
1.632 + Call REComSession::ListImplementations() and check V3 implementation
1.633 + upgrades on C drive has upgraded the original implementation on Z drive.
1.634 + Restart ECOM (to test subsequent boot condition i.e. loading from dat file
1.635 + Call REComSession::ListImplementations() and check V3 implementation
1.636 + upgrades on C drive has upgraded the original implementation on Z drive.
1.637 + Check for no crash and memory leaks.
1.638 + The same test is repeated for Rom Only drives. And no upgrade in version is
1.639 + observed.
1.640 +@SYMTestExpectedResults The test must not fail.
1.641 +@SYMPREQ PREQ277
1.642 +@SYMDEF DEF080682
1.643 +*/
1.644 +void RPluginUpgradeTest::UpgradePluginSameNameHigherVersionL(TBool aIsRomOnly)
1.645 + {
1.646 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0286 "));
1.647 + __UHEAP_MARK;
1.648 +
1.649 + ResetEcom();
1.650 +
1.651 + CheckDefaultPluginOnZ(aIsRomOnly);
1.652 +
1.653 + TUid interfaceUid;
1.654 + if(aIsRomOnly)
1.655 + {
1.656 + interfaceUid = TUid::Uid(KRomOnlyInterfaceUid);
1.657 + }
1.658 + else
1.659 + {
1.660 + interfaceUid = TUid::Uid(KInterfaceUid);
1.661 + }
1.662 + RImplInfoPtrArray implArray;
1.663 +
1.664 + /**
1.665 + The following plugin is now added to the C drive and ECOM will do a rediscovery and discover it.
1.666 +
1.667 + Interface UID DLL UID Imp. UID Version DllFile
1.668 + ------------------------------------------------------------------------------------------------------------------------------------------
1.669 + for ROM only
1.670 + 0x10009DBD 0x10009DBC 0x10009DBE 3 C:\\..\\EComUpgradeROExample2.dll
1.671 + otherwise
1.672 + 0x10009DBA 0x10009DB9 0x10009DBB 3 C:\\..\\EComUpgradeExample2.dll
1.673 + **/
1.674 +
1.675 + CopyPluginSameNameHigherVersion(aIsRomOnly);
1.676 + // Give ECOM a chance to discover new plugins.
1.677 + // Otherwise ListImplementationsL could fail to find requested implementations.
1.678 + User::After(KOneSecond * 3);
1.679 +
1.680 + // The directory notifier will now detect that a new plugin has been added to the C drive and will cause
1.681 + // ECOM to perform a new discovery.
1.682 +
1.683 + // Get implementations for IF UID 0x10009DBA
1.684 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.685 +
1.686 + //Expected number of implementations returned
1.687 + TEST2(implArray.Count(), 1);
1.688 +
1.689 + //Check that the implementation uid returned matched the specs above
1.690 + TUid implUid = implArray[0]->ImplementationUid();
1.691 + TInt version = implArray[0]->Version();
1.692 + TInt drive = implArray[0]->Drive();
1.693 +
1.694 + RDebug::Print(_L("After new implementation is discovered...\n"));
1.695 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.696 + if(aIsRomOnly)
1.697 + {
1.698 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.699 + TEST2(version, 2);
1.700 + TEST2(drive, EDriveZ);
1.701 + }
1.702 + else
1.703 + {
1.704 + TEST2(implUid.iUid, KImplementationUid);
1.705 + TEST2(version, 3);
1.706 + TEST2(drive, EDriveC);
1.707 + }
1.708 +
1.709 + implArray.ResetAndDestroy();
1.710 +
1.711 + // close session
1.712 + REComSession::FinalClose();
1.713 +
1.714 + // kill ecomserver
1.715 + KillEComServerL();
1.716 +
1.717 + // Get implementations for IF UID 0x10009DBA
1.718 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.719 +
1.720 + //Expected number of implementations returned
1.721 + TEST2(implArray.Count(), 1);
1.722 +
1.723 + //Check that the implementation uid returned matched the specs above
1.724 + implUid = implArray[0]->ImplementationUid();
1.725 + version = implArray[0]->Version();
1.726 + drive = implArray[0]->Drive();
1.727 +
1.728 + RDebug::Print(_L("After restart...\n"));
1.729 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.730 + if(aIsRomOnly)
1.731 + {
1.732 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.733 + TEST2(version, 2);
1.734 + TEST2(drive, EDriveZ);
1.735 + }
1.736 + else
1.737 + {
1.738 + TEST2(implUid.iUid, KImplementationUid);
1.739 + TEST2(version, 3);
1.740 + TEST2(drive, EDriveC);
1.741 + }
1.742 + implArray.ResetAndDestroy();
1.743 +
1.744 + // close session
1.745 + REComSession::FinalClose();
1.746 +
1.747 + // tidy up
1.748 + // Remove plugins from C drive
1.749 + DeleteUpgradeExample2Plugins(aIsRomOnly);
1.750 +
1.751 + // Give ECOM a chance to rediscover after deletion of plugins.
1.752 + User::After(KOneSecond * 3);
1.753 +
1.754 + // close session
1.755 + REComSession::FinalClose();
1.756 +
1.757 + // kill ecomserver
1.758 + KillEComServerL();
1.759 +
1.760 + __UHEAP_MARKEND;
1.761 + }
1.762 +
1.763 +/**
1.764 +@SYMTestCaseID SYSLIB-ECOM-CT-0287
1.765 +@SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the
1.766 + upgrading DLL/RSC name is different from the DLL/RSC to be upgraded.
1.767 + See CR65BCA3.
1.768 +@SYMTestPriority High
1.769 +@SYMTestActions Call REComSession::ListImplementations() and check V1 implementation
1.770 + on Z drive exists.
1.771 + Copy DLL/RSC with different name to DLL/RSC to be upgraded to C drive.
1.772 + Call REComSession::ListImplementations() and check the original V2
1.773 + implementation on Z drive has not been upgraded.
1.774 + Check for no crash and memory leaks.
1.775 + The same test is repeated for Rom Only drives. And no upgrade in version is
1.776 + observed.
1.777 +@SYMTestExpectedResults The test must not fail.
1.778 +@SYMPREQ PREQ277
1.779 +@SYMDEF DEF080682
1.780 +*/
1.781 +void RPluginUpgradeTest::UpgradePluginDifferentNameHigherVersionL(TBool aIsRomOnly)
1.782 + {
1.783 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0287 "));
1.784 + __UHEAP_MARK;
1.785 +
1.786 + ResetEcom();
1.787 +
1.788 + CheckDefaultPluginOnZ(aIsRomOnly);
1.789 +
1.790 + TUid interfaceUid;
1.791 + if(aIsRomOnly)
1.792 + {
1.793 + interfaceUid = TUid::Uid(KRomOnlyInterfaceUid);
1.794 + }
1.795 + else
1.796 + {
1.797 + interfaceUid = TUid::Uid(KInterfaceUid);
1.798 + }
1.799 + RImplInfoPtrArray implArray;
1.800 +
1.801 + /**
1.802 + The following plugin is now added to the C drive and ECOM will do a rediscovery and attempt to discover it.
1.803 +
1.804 + Interface UID DLL UID Imp. UID Version DllFile
1.805 + ------------------------------------------------------------------------------------------------------------------------------------------
1.806 + for ROM only
1.807 + 0x10009DBD 0x10009DBC 0x10009DBE 3 C:\\..\\EComUpgradeROExample3.dll
1.808 + otherwise
1.809 + 0x10009DBA 0x10009DB9 0x10009DBB 3 C:\\..\\EComUpgradeExample3.dll
1.810 + **/
1.811 +
1.812 + CopyPluginDifferentNameHigherVersion(aIsRomOnly);
1.813 + // Give ECOM a chance to discover new plugins.
1.814 + // Otherwise ListImplementationsL could fail to find requested implementations.
1.815 + User::After(KOneSecond * 3);
1.816 +
1.817 + // The directory notifier will now detect that a new plugin has been added to the C drive and will cause
1.818 + // ECOM to perform a new discovery.
1.819 +
1.820 + // The upgrade should fail an dthe existing implementation on the Z should remain
1.821 +
1.822 + // Get implementations for IF UID 0x10009DBA
1.823 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.824 +
1.825 + //Expected number of implementations returned
1.826 + TEST2(implArray.Count(), 1);
1.827 +
1.828 + //Check that the implementation uid returned matched the specs above
1.829 + TUid implUid = implArray[0]->ImplementationUid();
1.830 + TInt version = implArray[0]->Version();
1.831 + TInt drive = implArray[0]->Drive();
1.832 +
1.833 + RDebug::Print(_L("After new implementation is discovered...\n"));
1.834 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.835 + if(aIsRomOnly)
1.836 + {
1.837 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.838 + TEST2(version, 2);
1.839 + TEST2(drive, EDriveZ);
1.840 + }
1.841 + else
1.842 + {
1.843 + TEST2(implUid.iUid, KImplementationUid);
1.844 + TEST2(version, 2);
1.845 + TEST2(drive, EDriveZ);
1.846 + }
1.847 + implArray.ResetAndDestroy();
1.848 +
1.849 + // close session
1.850 + REComSession::FinalClose();
1.851 +
1.852 + // kill ecomserver
1.853 + KillEComServerL();
1.854 +
1.855 + // Get implementations for IF UID 0x10009DBA
1.856 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.857 +
1.858 + //Expected number of implementations returned
1.859 + TEST2(implArray.Count(), 1);
1.860 +
1.861 + //Check that the implementation uid returned matched the specs above
1.862 + implUid = implArray[0]->ImplementationUid();
1.863 + version = implArray[0]->Version();
1.864 + drive = implArray[0]->Drive();
1.865 +
1.866 + RDebug::Print(_L("After restart...\n"));
1.867 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.868 + if(aIsRomOnly)
1.869 + {
1.870 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.871 + TEST2(version, 2);
1.872 + TEST2(drive, EDriveZ);
1.873 + }
1.874 + else
1.875 + {
1.876 + TEST2(implUid.iUid, KImplementationUid);
1.877 + TEST2(version, 2);
1.878 + TEST2(drive, EDriveZ);
1.879 + }
1.880 + implArray.ResetAndDestroy();
1.881 +
1.882 + // close session
1.883 + REComSession::FinalClose();
1.884 +
1.885 + // tidy up
1.886 + // Remove plugins from C drive
1.887 + DeleteUpgradeExample3Plugins(aIsRomOnly);
1.888 +
1.889 + // Give ECOM a chance to rediscover after deletion of plugins.
1.890 + User::After(KOneSecond * 3);
1.891 +
1.892 + // close session
1.893 + REComSession::FinalClose();
1.894 +
1.895 + // kill ecomserver
1.896 + KillEComServerL();
1.897 +
1.898 + __UHEAP_MARKEND;
1.899 + }
1.900 +
1.901 +/**
1.902 +@SYMTestCaseID SYSLIB-ECOM-CT-0288
1.903 +@SYMTestCaseDesc Tests to ensure that an implementation can be upgraded when the
1.904 + upgrading DLL/RSC name is the same as the DLL/RSC name to be
1.905 + upgraded and also the version is the same.
1.906 + See CR65BCA3.
1.907 +@SYMTestPriority High
1.908 +@SYMTestActions Call REComSession::ListImplementations() and check V1 implementation
1.909 + on Z drive exists.
1.910 + Copy DLL/RSC with same name as DLL/RSC to be upgraded to C drive.
1.911 + Call REComSession::ListImplementations() and check V2 implementation
1.912 + upgrades on C drive has upgraded the original implementation on Z drive.
1.913 + Check for no crash and memory leaks.
1.914 + Restart ECOM (to test subsequent boot condition i.e. loading from dat file
1.915 + Call REComSession::ListImplementations() and check V2 implementation
1.916 + upgrades on C drive has upgraded the original implementation on Z drive.
1.917 + The same test is repeated for Rom Only drives. And no upgrade in version is
1.918 + observed.
1.919 +@SYMTestExpectedResults The test must not fail.
1.920 +@SYMPREQ PREQ277
1.921 +@SYMDEF DEF080682
1.922 +*/
1.923 +void RPluginUpgradeTest::UpgradePluginSameNameSameVersionL(TBool aIsRomOnly)
1.924 + {
1.925 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0288 "));
1.926 + __UHEAP_MARK;
1.927 +
1.928 + ResetEcom();
1.929 +
1.930 + CheckDefaultPluginOnZ(aIsRomOnly);
1.931 +
1.932 + TUid interfaceUid;
1.933 + if(aIsRomOnly)
1.934 + {
1.935 + interfaceUid = TUid::Uid(KRomOnlyInterfaceUid);
1.936 + }
1.937 + else
1.938 + {
1.939 + interfaceUid = TUid::Uid(KInterfaceUid);
1.940 + }
1.941 + RImplInfoPtrArray implArray;
1.942 +
1.943 + /**
1.944 + The following plugin is now added to the C drive and ECOM will do a rediscovery and discover it.
1.945 +
1.946 + Interface UID DLL UID Imp. UID Version DllFile
1.947 + ------------------------------------------------------------------------------------------------------------------------------------------
1.948 + for ROM only
1.949 + 0x10009DBD 0x10009DBC 0x10009DBE 2 C:\\..\\EComUpgradeROExample2.dll
1.950 + otherwise
1.951 + 0x10009DBA 0x10009DB9 0x10009DBB 2 C:\\..\\EComUpgradeExample2.dll
1.952 + **/
1.953 +
1.954 + CopyPluginSameNameSameVersion(aIsRomOnly);
1.955 + // Give ECOM a chance to discover new plugins.
1.956 + // Otherwise ListImplementationsL could fail to find requested implementations.
1.957 + User::After(KOneSecond * 3);
1.958 +
1.959 + // The directory notifier will now detect that a new plugin has been added to the C drive and will cause
1.960 + // ECOM to perform a new discovery.
1.961 +
1.962 + // Get implementations for IF UID 0x10009DBA
1.963 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.964 +
1.965 + //Expected number of implementations returned
1.966 + TEST2(implArray.Count(), 1);
1.967 +
1.968 + //Check that the implementation uid returned matched the specs above
1.969 + TUid implUid = implArray[0]->ImplementationUid();
1.970 + TInt version = implArray[0]->Version();
1.971 + TInt drive = implArray[0]->Drive();
1.972 +
1.973 + RDebug::Print(_L("After new implementation is discovered...\n"));
1.974 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.975 + if(aIsRomOnly)
1.976 + {
1.977 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.978 + TEST2(version, 2);
1.979 + TEST2(drive, EDriveZ);
1.980 + }
1.981 + else
1.982 + {
1.983 + TEST2(implUid.iUid, KImplementationUid);
1.984 + TEST2(version, 2);
1.985 + TEST2(drive, EDriveC);
1.986 + }
1.987 + implArray.ResetAndDestroy();
1.988 +
1.989 + // close session
1.990 + REComSession::FinalClose();
1.991 +
1.992 + // kill ecomserver
1.993 + KillEComServerL();
1.994 +
1.995 + // Get implementations for IF UID 0x10009DBA
1.996 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.997 +
1.998 + //Expected number of implementations returned
1.999 + TEST2(implArray.Count(), 1);
1.1000 +
1.1001 + //Check that the implementation uid returned matched the specs above
1.1002 + implUid = implArray[0]->ImplementationUid();
1.1003 + version = implArray[0]->Version();
1.1004 + drive = implArray[0]->Drive();
1.1005 +
1.1006 + RDebug::Print(_L("After restart...\n"));
1.1007 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.1008 + if(aIsRomOnly)
1.1009 + {
1.1010 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.1011 + TEST2(version, 2);
1.1012 + TEST2(drive, EDriveZ);
1.1013 + }
1.1014 + else
1.1015 + {
1.1016 + TEST2(implUid.iUid, KImplementationUid);
1.1017 + TEST2(version, 2);
1.1018 + TEST2(drive, EDriveC);
1.1019 + }
1.1020 + implArray.ResetAndDestroy();
1.1021 +
1.1022 + // close session
1.1023 + REComSession::FinalClose();
1.1024 +
1.1025 + // tidy up
1.1026 + // Remove plugins from C drive
1.1027 + DeleteUpgradeExample2Plugins(aIsRomOnly);
1.1028 + // Give ECOM a chance to rediscover after deletion of plugins.
1.1029 + User::After(KOneSecond * 3);
1.1030 +
1.1031 + // close session
1.1032 + REComSession::FinalClose();
1.1033 +
1.1034 + // kill ecomserver
1.1035 + KillEComServerL();
1.1036 +
1.1037 + __UHEAP_MARKEND;
1.1038 + }
1.1039 +
1.1040 +/**
1.1041 +@SYMTestCaseID SYSLIB-ECOM-CT-0289
1.1042 +@SYMTestCaseDesc Tests to ensure that an implementation will not be upgraded when the
1.1043 + upgrading DLL/RSC name is different from the DLL/RSC to be upgraded
1.1044 + and also the version is the same.
1.1045 + See CR65BCA3.
1.1046 +@SYMTestPriority High
1.1047 +@SYMTestActions Call REComSession::ListImplementations() and check V2 implementation
1.1048 + on Z drive exists.
1.1049 + Copy DLL/RSC with different name, but same version, to DLL/RSC to be
1.1050 + upgraded to C drive.
1.1051 + Call REComSession::ListImplementations() and check the original V2
1.1052 + implementation on Z drive has not been upgraded.
1.1053 + Check for no crash and memory leaks.
1.1054 + The same test is repeated for Rom Only drives. And no upgrade in version is
1.1055 + observed.
1.1056 +@SYMTestExpectedResults The test must not fail.
1.1057 +@SYMPREQ PREQ277
1.1058 +@SYMDEF DEF080682
1.1059 +*/
1.1060 +void RPluginUpgradeTest::UpgradePluginDifferentNameSameVersionL(TBool aIsRomOnly)
1.1061 + {
1.1062 + TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0289 "));
1.1063 + __UHEAP_MARK;
1.1064 +
1.1065 + ResetEcom();
1.1066 +
1.1067 + CheckDefaultPluginOnZ(aIsRomOnly);
1.1068 +
1.1069 + TUid interfaceUid;
1.1070 + if(aIsRomOnly)
1.1071 + {
1.1072 + interfaceUid = TUid::Uid(KRomOnlyInterfaceUid);
1.1073 + }
1.1074 + else
1.1075 + {
1.1076 + interfaceUid = TUid::Uid(KInterfaceUid);
1.1077 + }
1.1078 + RImplInfoPtrArray implArray;
1.1079 +
1.1080 + /**
1.1081 + The following plugin is now added to the C drive and ECOM will do a rediscovery and attempt to discover it.
1.1082 +
1.1083 + Interface UID DLL UID Imp. UID Version DllFile
1.1084 + ----------------------------------------------------------------------------------------
1.1085 + for ROM only
1.1086 + 0x10009DBD 0x10009DBC 0x10009DBE 2 C:\\..\\EComUpgradeROExample3.dll
1.1087 + otherwise
1.1088 + 0x10009DBA 0x10009DB9 0x10009DBB 2 C:\\..\\EComUpgradeExample3.dll
1.1089 + **/
1.1090 +
1.1091 + CopyPluginDifferentNameSameVersion(aIsRomOnly);
1.1092 + // Give ECOM a chance to discover new plugins.
1.1093 + // Otherwise ListImplementationsL could fail to find requested implementations.
1.1094 + User::After(KOneSecond * 3);
1.1095 +
1.1096 + // The directory notifier will now detect that a new plugin has been added to the C drive and will cause
1.1097 + // ECOM to perform a new discovery.
1.1098 +
1.1099 + // The upgrade should fail an dthe existing implementation on the Z should remain
1.1100 +
1.1101 + // Get implementations for IF UID 0x10009DBA
1.1102 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.1103 +
1.1104 + //Expected number of implementations returned
1.1105 + TEST2(implArray.Count(), 1);
1.1106 +
1.1107 + //Check that the implementation uid returned matched the specs above
1.1108 + TUid implUid = implArray[0]->ImplementationUid();
1.1109 + TInt version = implArray[0]->Version();
1.1110 + TInt drive = implArray[0]->Drive();
1.1111 + RDebug::Print(_L("After new implementation is discovered...\n"));
1.1112 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.1113 +
1.1114 + if(aIsRomOnly)
1.1115 + {
1.1116 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.1117 + TEST2(version, 2);
1.1118 + TEST2(drive, EDriveZ);
1.1119 + }
1.1120 + else
1.1121 + {
1.1122 + TEST2(implUid.iUid, KImplementationUid);
1.1123 + TEST2(version, 2);
1.1124 + TEST2(drive, EDriveZ);
1.1125 + }
1.1126 + implArray.ResetAndDestroy();
1.1127 +
1.1128 + // close session
1.1129 + REComSession::FinalClose();
1.1130 +
1.1131 + // kill ecomserver
1.1132 + KillEComServerL();
1.1133 +
1.1134 + // Get implementations for IF UID 0x10009DBA
1.1135 + REComSession::ListImplementationsL(interfaceUid, implArray);
1.1136 +
1.1137 + //Expected number of implementations returned
1.1138 + TEST2(implArray.Count(), 1);
1.1139 +
1.1140 + //Check that the implementation uid returned matched the specs above
1.1141 + implUid = implArray[0]->ImplementationUid();
1.1142 + version = implArray[0]->Version();
1.1143 + drive = implArray[0]->Drive();
1.1144 + RDebug::Print(_L("After new implementation is discovered...\n"));
1.1145 + RDebug::Print(_L("implUid = 0x%x, version = %d drive = %d \n"), implUid, version, drive);
1.1146 +
1.1147 + if(aIsRomOnly)
1.1148 + {
1.1149 + TEST2(implUid.iUid, KRomOnlyImplementationUid);
1.1150 + TEST2(version, 2);
1.1151 + TEST2(drive, EDriveZ);
1.1152 + }
1.1153 + else
1.1154 + {
1.1155 + TEST2(implUid.iUid, KImplementationUid);
1.1156 + TEST2(version, 2);
1.1157 + TEST2(drive, EDriveZ);
1.1158 + }
1.1159 + implArray.ResetAndDestroy();
1.1160 +
1.1161 + // close session
1.1162 + REComSession::FinalClose();
1.1163 +
1.1164 + // tidy up
1.1165 + // Remove plugins from C drive
1.1166 + DeleteUpgradeExample3Plugins(aIsRomOnly);
1.1167 + // Give ECOM a chance to rediscover after deletion of plugins.
1.1168 + User::After(KOneSecond * 3);
1.1169 +
1.1170 + // close session
1.1171 + REComSession::FinalClose();
1.1172 +
1.1173 + // kill ecomserver
1.1174 + KillEComServerL();
1.1175 +
1.1176 + __UHEAP_MARKEND;
1.1177 + }
1.1178 +
1.1179 +LOCAL_C void RunTestL()
1.1180 + {
1.1181 + __UHEAP_MARK;
1.1182 +
1.1183 +
1.1184 + TheTest.Next(_L("Upgrade rom only plugin with same name and lower version"));
1.1185 + RPluginUpgradeTest::UpgradePluginSameNameLowerVersionL(ETrue);
1.1186 +
1.1187 + TheTest.Next(_L("Upgrade rom only plugin with different name and lower version"));
1.1188 + RPluginUpgradeTest::UpgradePluginDifferentNameLowerVersionL(ETrue);
1.1189 +
1.1190 + TheTest.Next(_L("Upgrade rom only plugin with same name and higher version"));
1.1191 + RPluginUpgradeTest::UpgradePluginSameNameHigherVersionL(ETrue);
1.1192 +
1.1193 + TheTest.Next(_L("Upgrade rom only plugin with different name and higher version"));
1.1194 + RPluginUpgradeTest::UpgradePluginDifferentNameHigherVersionL(ETrue);
1.1195 +
1.1196 + TheTest.Next(_L("Upgrade rom only plugin with same name and same version"));
1.1197 + RPluginUpgradeTest::UpgradePluginSameNameSameVersionL(ETrue);
1.1198 +
1.1199 + TheTest.Next(_L("Upgrade rom only plugin with different name and same version"));
1.1200 + RPluginUpgradeTest::UpgradePluginDifferentNameSameVersionL(ETrue);
1.1201 +
1.1202 + TheTest.Next(_L("Upgrade plugin with same name and lower version"));
1.1203 + RPluginUpgradeTest::UpgradePluginSameNameLowerVersionL(EFalse);
1.1204 +
1.1205 + TheTest.Next(_L("Upgrade plugin with different name and lower version"));
1.1206 + RPluginUpgradeTest::UpgradePluginDifferentNameLowerVersionL(EFalse);
1.1207 +
1.1208 + TheTest.Next(_L("Upgrade plugin with same name and higher version"));
1.1209 + RPluginUpgradeTest::UpgradePluginSameNameHigherVersionL(EFalse);
1.1210 +
1.1211 + TheTest.Next(_L("Upgrade plugin with different name and higher version"));
1.1212 + RPluginUpgradeTest::UpgradePluginDifferentNameHigherVersionL(EFalse);
1.1213 +
1.1214 + TheTest.Next(_L("Upgrade plugin with same name and same version"));
1.1215 + RPluginUpgradeTest::UpgradePluginSameNameSameVersionL(EFalse);
1.1216 +
1.1217 + TheTest.Next(_L("Upgrade plugin with different name and same version"));
1.1218 + RPluginUpgradeTest::UpgradePluginDifferentNameSameVersionL(EFalse);
1.1219 +
1.1220 + __UHEAP_MARKEND;
1.1221 + }
1.1222 +
1.1223 +void CleanupPluginFiles()
1.1224 + {
1.1225 + DeleteUpgradeExample1Plugins(EFalse);
1.1226 + DeleteUpgradeExample2Plugins(EFalse);
1.1227 + DeleteUpgradeExample3Plugins(EFalse);
1.1228 + DeleteUpgradeExample1Plugins(ETrue);
1.1229 + DeleteUpgradeExample2Plugins(ETrue);
1.1230 + DeleteUpgradeExample3Plugins(ETrue);
1.1231 + }
1.1232 +
1.1233 +GLDEF_C TInt E32Main()
1.1234 + {
1.1235 + __UHEAP_MARK;
1.1236 +
1.1237 + TheTest.Title();
1.1238 + TheTest.Start(_L("Plugin Upgrade Tests."));
1.1239 +
1.1240 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.1241 + CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
1.1242 + CActiveScheduler::Install(scheduler);
1.1243 +
1.1244 + // Cleanup files
1.1245 + CleanupPluginFiles();
1.1246 +
1.1247 + //run tests
1.1248 + TRAPD(err,RunTestL());
1.1249 +
1.1250 + // Cleanup files
1.1251 + if(err != KErrNone)
1.1252 + {
1.1253 + CleanupPluginFiles();
1.1254 + }
1.1255 +
1.1256 + TEST2(err, KErrNone);
1.1257 +
1.1258 + // cleanup session
1.1259 + REComSession::FinalClose();
1.1260 +
1.1261 + delete scheduler;
1.1262 + delete cleanup;
1.1263 +
1.1264 + TheTest.End();
1.1265 + TheTest.Close();
1.1266 +
1.1267 + __UHEAP_MARKEND;
1.1268 + return(0);
1.1269 + }