os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComPluginReDiscoverPerfTestStep.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2006-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Te_EComPluginReDiscoverPerfTest.cpp
    15 // Implements the performance loggr for ECOM
    16 // 
    17 //
    18 
    19 /**
    20  @file
    21  @internalComponent
    22 */
    23 
    24 #include "Te_EComPluginReDiscoverPerfTestStep.h"
    25 #include <e32test.h>
    26 #include <bautils.h>
    27 #include <startup.hrh>
    28 #include <ecom/ecom.h>
    29 #include "Interface.h"
    30 #include "EcomTestUtils.h"
    31 
    32 #ifdef __ECOM_SERVER_PERFORMANCE__
    33 const TInt KOneSecond = 1000000;
    34 
    35 const TReal KNotifierRunLTimeLimitH2RAM = 2;					// mSec
    36 const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH2RAM = 80;	// mSec
    37 const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH2RAM = 40;	// mSec
    38 
    39 const TReal KNotifierRunLTimeLimitH4RAM = 1;               // mSec
    40 const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH4RAM = 40;   // mSec
    41 const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH4RAM = 20;   // mSec 
    42 		
    43 const TReal KNotifierRunLTimeLimitH4NAND = 6;               // mSec
    44 const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH4NAND = 50;   // mSec
    45 const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH4NAND = 20;   // mSec 
    46 
    47 const TReal KNotifierRunLTimeLimitH6RAM = 1;               // mSec
    48 const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH6RAM = 20;   // mSec
    49 const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH6RAM = 8;   // mSec 
    50 		
    51 const TReal KNotifierRunLTimeLimitH6NAND = 4;               // mSec
    52 const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH6NAND = 25;   // mSec
    53 const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH6NAND = 8;   // mSec 
    54 
    55 // The default benchmark checking threshold are defined as zero, for emulator platform.
    56 // The values will be changed for H2 or H4 OR H6 boards.
    57 // See CEComPluginReDiscoverPerfTest::SetBenchmarks()
    58 static TReal NotifierRunLTimeLimit = 0;				
    59 static TReal TimerRunLScanTwoRSCsOnOneDriveLimit = 0;	
    60 static TReal TimerRunLScanZeroRSCOnOneDriveLimit = 0;	
    61 
    62 _LIT(KRamOnlyEComCR629Example2RSC,			"Z:\\RAMOnly\\EComCR629Example2.rsc");
    63 _LIT(KEComExample12RSCOnZ,						"Z:\\RAMOnly\\EComExample12.rsc");
    64 _LIT(KEComExample12RSC1OnC,						"C:\\Resource\\Plugins\\EComExample12_1.rsc");
    65 _LIT(KEComExample12RSC2OnC,						"C:\\Resource\\Plugins\\EComExample12_2.rsc");
    66 _LIT(KEComRscDirName,						"\\Resource\\Plugins");
    67 _LIT(KEComCR629RSCFileName,					"\\Resource\\Plugins\\EComCR629Example1_");
    68 _LIT(KEComRSCFileExt,						".rsc");
    69 _LIT(KEComAllRSCFilesName,					"\\Resource\\Plugins\\*.rsc");
    70 #endif //__ECOM_SERVER_PERFORMANCE__
    71 
    72 CEComPluginReDiscoverPerfTest::CEComPluginReDiscoverPerfTest() : CEComPerfTestBase(KEComPluginReDiscoverPerfTest)
    73 	{
    74 	}
    75 
    76 CEComPluginReDiscoverPerfTest::~CEComPluginReDiscoverPerfTest()
    77 	{
    78 	}
    79 
    80 #ifdef __ECOM_SERVER_PERFORMANCE__
    81 /*
    82 	Set different benchmark thresholds for H2 or H4 or H6 boards. 
    83 	Emulator tests will not disable benchmark checking, so don't need to set values for it.
    84 **/
    85 void CEComPluginReDiscoverPerfTest::SetBenchmarksL()
    86 	{
    87 	THardwareConfiguration hardware_configuration = EComTestUtils::GetHardwareConfiguration();
    88 	switch (hardware_configuration)
    89 		{
    90 		case EPlatformH2RAM:
    91 	    	NotifierRunLTimeLimit = KNotifierRunLTimeLimitH2RAM;
    92 			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH2RAM;
    93 			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH2RAM;
    94 			INFO_PRINTF1(_L("Hardware configuration: H2 RAM"));
    95 			break;
    96 		
    97 		case EPlatformH2NAND:		
    98 			INFO_PRINTF1(_L("Hardware configuration: H2 NAND"));
    99 			INFO_PRINTF1(_L("***Performance testing on H2 NAND is not supported!***"));
   100 			SetTestStepResult(EFail);			
   101 			break;
   102 
   103 		case EPlatformH2NANDDP:
   104 			INFO_PRINTF1(_L("Hardware configuration: H2 NAND DP"));
   105 			INFO_PRINTF1(_L("***Performance testing on H2 NAND DP is not supported!***"));
   106 			SetTestStepResult(EFail);			
   107 			break;
   108 		
   109 		case EPlatformH4RAM:
   110 			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH4RAM;
   111 			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH4RAM;
   112 			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH4RAM;
   113 			INFO_PRINTF1(_L("Hardware configuration: H4 RAM"));
   114 			break;
   115 		
   116 		case EPlatformH4NAND:		
   117 			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH4NAND;
   118 			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH4NAND;
   119 			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH4NAND;
   120 			INFO_PRINTF1(_L("Hardware configuration: H4 NAND"));
   121 			break;
   122 		
   123 		case EPlatformH4NANDDP:	
   124 			INFO_PRINTF1(_L("Hardware configuration: H4 NAND DP"));
   125 			break;
   126 
   127 		case EPlatformH6RAM:
   128 			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH6RAM;
   129 			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH6RAM;
   130 			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH6RAM;
   131 			INFO_PRINTF1(_L("Hardware configuration: H6 RAM"));
   132 			break;
   133 		
   134 		case EPlatformH6NAND:		
   135 			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH6NAND;
   136 			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH6NAND;
   137 			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH6NAND;
   138 			INFO_PRINTF1(_L("Hardware configuration: H6 NAND"));
   139 			break;
   140 		
   141 		case EPlatformH6NANDDP:	
   142 			INFO_PRINTF1(_L("Hardware configuration: H6 NAND DP"));
   143 			break;
   144 			
   145 		case EPlatformWINSCW:
   146 			INFO_PRINTF1(_L("Hardware configuration: WINSCW"));
   147 			break;
   148 		
   149 		default:		
   150 			SetTestStepResult(EFail);
   151 			INFO_PRINTF1(_L("***Unrecognized platform!***"));
   152 			break;		
   153 		}
   154 	}
   155 
   156 TBool CEComPluginReDiscoverPerfTest::CheckTimeResults(TReal aTimeLimit, RArray<TEComPerfRealTimeResult>& aTimeResults)
   157 	{
   158 	TInt count = aTimeResults.Count();
   159 	
   160 	if(count)
   161 		{
   162 		switch(aTimeResults[0].iType)
   163 			{
   164 			case ECDiscovererNotifierRunL:
   165 				{
   166 				for(TInt idx = 0; idx < count; ++idx)
   167 					{
   168 					TReal elapsedTime = aTimeResults[idx].iEndTime - aTimeResults[idx].iStartTime;
   169 					INFO_PRINTF2(_L("Notifier RunL gets called for drive: %d"), aTimeResults[idx].iInfo);
   170 					CheckPerformance(elapsedTime, aTimeLimit, _L("Notifier RunL"));
   171 					}
   172 				break;
   173 				}
   174 			case ECDiscovererTimerRunL:
   175 				{
   176 				// Check timer runl only ran once
   177 				if(count>1)
   178 					{
   179 					INFO_PRINTF1(_L("Timer RunL ran more than once!\n"));
   180 					return EFalse;
   181 					}
   182 				else
   183 					{
   184 					const TEComPerfRealTimeResult& timeResult = aTimeResults[0];
   185 					TReal elapsedTime = aTimeResults[0].iEndTime - aTimeResults[0].iStartTime;
   186 					CheckPerformance(elapsedTime, aTimeLimit, _L("Timer RunL"));
   187 					}
   188 				break;
   189 				}
   190 			default:
   191 				{
   192 				INFO_PRINTF1(_L("Unrecognizable type for checking performance!\n"));
   193 				return EFalse;
   194 				}
   195 			}
   196 		return ETrue;
   197 		}
   198 	else // No time result retrieved
   199 		{
   200 		INFO_PRINTF1(_L("No time result Retrieved!\n"));
   201 		return EFalse;
   202 		}
   203 	}
   204 
   205 void CEComPluginReDiscoverPerfTest::CopyPluginCR629TestRSCOnDrive(TUint aDriveNum, TInt aNumOfCopies)
   206 	{
   207 	if(aNumOfCopies > 0)
   208 		{
   209 		TInt err=KErrNone;
   210 		TDriveUnit aDrive(aDriveNum);
   211 		TBuf<256> resourceFileName;
   212 		for(TInt num = 1; num<= aNumOfCopies; num++ )
   213 			{
   214 			resourceFileName.Zero();
   215 			resourceFileName.Append(aDrive.Name());
   216 			resourceFileName.Append(KEComCR629RSCFileName);
   217 			resourceFileName.AppendNum(num);
   218 			resourceFileName.Append(KEComRSCFileExt);
   219 			TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComCR629Example2RSC, resourceFileName));
   220 			TEST(err ==KErrNone);
   221 			}
   222 		}
   223 	else
   224 		{
   225 		INFO_PRINTF1(_L("Number of file copies should be greater than 0!\n"));
   226 		}
   227 	}
   228 
   229 void CEComPluginReDiscoverPerfTest::DeleteRSCFilesOnDrive(TUint aDriveNum)
   230 	{
   231 	TInt err=KErrNone;
   232 	TDriveUnit aDrive(aDriveNum);
   233 
   234 	TBuf<256> resourceFileName;
   235 	resourceFileName.Append(aDrive.Name());
   236 	resourceFileName.Append(KEComAllRSCFilesName);
   237 	TRAP(err, EComTestUtils::FileManDeleteFileL(resourceFileName));
   238 	}
   239 
   240 void CEComPluginReDiscoverPerfTest::DeleteRSCFolderOnDrive(TUint aDriveNum)
   241 	{
   242 	TInt err=KErrNone;
   243 	TDriveUnit aDrive(aDriveNum);
   244 
   245 	TBuf<256> resourceFileName;
   246 	resourceFileName.Append(aDrive.Name());
   247 	resourceFileName.Append(KEComAllRSCFilesName);
   248 	TRAP(err, EComTestUtils::FileManDeleteFileL(resourceFileName));
   249 
   250 	TBuf<256> resourceDirName;
   251 	resourceDirName.Append(aDrive.Name());
   252 	resourceDirName.Append(KEComRscDirName);
   253 	TRAP(err, EComTestUtils::FileManDeleteDirL(resourceDirName));
   254 	}
   255 
   256 #endif //__ECOM_SERVER_PERFORMANCE__
   257 
   258 /*
   259 	Test cases covered in the test step:
   260 	1. Multiple notification processing on single drive (C:)
   261 
   262 		1.1 Rediscovery on adding RSC files
   263 				Performance check on Notifier RunL
   264 				Functionality check on Notifier RunL
   265 				Performance check on Timer RunL
   266 				Functionality check on RediscoveryScanDirectoryL
   267 
   268 		1.2 Rediscovery on deleting RSC files
   269 				As above.
   270 		1.3 Rediscovery on adding RSC PlugIn3 files. It does the performance test 
   271 			for parsing new registry data.
   272 				As above.
   273 				
   274 	2. Multiple notification processing on multiple drives (C: and X: or E:)
   275 
   276 		2.1 Rediscovery on adding RSC files
   277 				As above.
   278 				
   279 		2.2 Rediscovery on deleting RSC filles
   280 				As above.
   281 				
   282 	3. MMC Remounting tests on drive E:
   283 
   284 		3.1 Before: has plugins
   285 			After: 	has plugins
   286 				As above.
   287 				
   288 		3.2 Before: has plugins
   289 			After: 	has no plugins
   290 				As above.
   291 				
   292 		3.3 Before: has no plugins
   293 			After: 	has plugins
   294 				As above.
   295 				
   296 		3.4 Before: has no plugins
   297 			After: 	has no plugins
   298 				As above.
   299 
   300 @pre For hardware test, MMC (E:) drive should be available.
   301 @return EPass if the test succeeds and the measured times pass the checks
   302 		EFail otherwise.
   303  */
   304 TVerdict CEComPluginReDiscoverPerfTest::doTestStepL()
   305 	{
   306 #ifdef __ECOM_SERVER_PERFORMANCE__
   307 	// Set benchmark threshold for different hardware platform, default values are 0s, for emulator.
   308 	SetBenchmarksL();
   309 	
   310 	//1. Multiple notification processing on single drive (C:)
   311 	INFO_PRINTF1(_L("1. Multiple notification processing on single drive (C:)"));		
   312 	
   313 	//1.1 Testing rediscovery performance on adding RSC files on C:
   314 		INFO_PRINTF1(_L("1.1 Testing rediscovery on adding RSC files onto drive C:"));
   315 		// Clean up Plugins
   316 		DeleteRSCFilesOnDrive(EDriveC);
   317 		User::After(KOneSecond * 3);
   318 		REComPerfTimeRecords timeRecords;
   319 
   320 		// Clean up time records on server.
   321 		TRAPD(err, timeRecords.ResetRecordsOnServerL());
   322 		TEST(err==KErrNone);
   323 		timeRecords.Reset();
   324 		CopyPluginCR629TestRSCOnDrive(EDriveC, 2);
   325 		User::After(KOneSecond * 3);
   326 		
   327 		// Now get all time records from server
   328 		TRAP(err, timeRecords.OpenL());
   329 		TEST(err==KErrNone);
   330 		TEST(timeRecords.Count() > 0);
   331 		
   332 		RArray<TEComPerfRealTimeResult> timeResults;
   333 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   334 		TEST(err==KErrNone);
   335 		// Test notifications were triggered and check performance of RunL of Notifiers
   336 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   337 		timeResults.Reset();
   338 		
   339 		RArray<TInt> timeResultsInfos;
   340 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   341 		TEST(err==KErrNone);
   342 		// Test notifications ONLY triggered on C: drive
   343 		TEST(timeResultsInfos.Count()==1);
   344 		TEST(timeResultsInfos[0] == EDriveC);
   345 		timeResultsInfos.Reset();
   346 		
   347 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   348 		TEST(err==KErrNone);
   349 		// Test Timer RunL ran only once and check performance.
   350 		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   351 		timeResults.Reset();
   352 		
   353 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   354 		TEST(err==KErrNone);
   355 		// Test directory scanning has and ONLY performed on C: drive
   356 		TEST(timeResultsInfos.Count()==1);
   357 		TEST(timeResultsInfos[0] == EDriveC);
   358 		timeResultsInfos.Reset();
   359 
   360 	//1.2 Testing rediscovery performance on deleting RSC files
   361 		INFO_PRINTF1(_L("1.2 Testing rediscovery on removing RSC files from drive C:"));
   362 		// Clean up time records on server.
   363 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   364 		TEST(err==KErrNone);
   365 		timeRecords.Reset();
   366 		DeleteRSCFilesOnDrive(EDriveC);
   367 		User::After(KOneSecond * 3);
   368 		
   369 		// Now get all time records from server.
   370 		TRAP(err, timeRecords.OpenL());
   371 		TEST(err==KErrNone);
   372 		TEST(timeRecords.Count() > 0);
   373 		
   374 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   375 		TEST(err==KErrNone);
   376 		// Test notifications were triggered and check performance of RunL of Notifiers
   377 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   378 		timeResults.Reset();
   379 		
   380 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   381 		TEST(err==KErrNone);
   382 		// Test notifications ONLY triggered on C: drive
   383 		TEST(timeResultsInfos.Count()==1);
   384 		TEST(timeResultsInfos[0] == EDriveC);
   385 		timeResultsInfos.Reset();
   386 		
   387 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   388 		TEST(err==KErrNone);
   389 		// Test Timer RunL ran only once and check performance.
   390 		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit, timeResults));
   391 		timeResults.Reset();
   392 		
   393 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   394 		TEST(err==KErrNone);
   395 		// Test directory scanning has and ONLY performed on C: drive
   396 		TEST(timeResultsInfos.Count()==1);
   397 		TEST(timeResultsInfos[0] == EDriveC);
   398 		timeResultsInfos.Reset();
   399 
   400 	//1.3 Testing rediscovery performance on adding RSC PLUGIN3 files on C:
   401 		INFO_PRINTF1(_L("1.3 Testing rediscovery on adding RSC PLUGIN3 files onto drive C:"));
   402 		// Clean up Plugins
   403 		DeleteRSCFilesOnDrive(EDriveC);
   404 		User::After(KOneSecond * 3);
   405 		
   406 		// Clean up time records on server.
   407 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   408 		TEST(err==KErrNone);
   409 		timeRecords.Reset();
   410 		// Adding RSC PLUGIN3 file twice
   411 		TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12RSCOnZ, KEComExample12RSC1OnC));
   412 		TEST(err==KErrNone);
   413 		TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12RSCOnZ, KEComExample12RSC2OnC));
   414 		TEST(err==KErrNone);
   415 		User::After(KOneSecond * 3);
   416 		
   417 		// Now get all time records from server
   418 		TRAP(err, timeRecords.OpenL());
   419 		TEST(err==KErrNone);
   420 		TEST(timeRecords.Count() > 0);
   421 		
   422 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   423 		TEST(err==KErrNone);
   424 		// Test notifications were triggered and check performance of RunL of Notifiers
   425 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   426 		timeResults.Reset();
   427 		
   428 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   429 		TEST(err==KErrNone);
   430 		// Test notifications ONLY triggered on C: drive
   431 		TEST(timeResultsInfos.Count()==1);
   432 		TEST(timeResultsInfos[0] == EDriveC);
   433 		timeResultsInfos.Reset();
   434 		
   435 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   436 		TEST(err==KErrNone);
   437 		// Test Timer RunL ran only once and check performance.
   438 		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   439 		timeResults.Reset();
   440 		
   441 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   442 		TEST(err==KErrNone);
   443 		// Test directory scanning has and ONLY performed on C: drive
   444 		TEST(timeResultsInfos.Count()==1);
   445 		TEST(timeResultsInfos[0] == EDriveC);
   446 		timeResultsInfos.Reset();
   447 		// Delete the RSC files
   448 		TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample12RSC1OnC));
   449 		TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample12RSC2OnC));
   450 		User::After(KOneSecond * 3);
   451 		
   452 	//2. Multiple notification processing on multiple drives (C: and X: or E:)
   453 		RFs fs;
   454 		TEST(fs.Connect()==KErrNone);
   455 
   456 	//2.1 Testing rediscovery performance on adding RSC files on multiple drives
   457 		// Clean up time records on server.
   458 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   459 		TEST(err==KErrNone);
   460 		timeRecords.Reset();
   461 		CopyPluginCR629TestRSCOnDrive(EDriveC, 2);
   462 #if defined(__WINSCW__) // C: and X: on emulator
   463 		INFO_PRINTF1(_L("2. Multiple notification processing on multiple drives (C: and X:)"));
   464 		INFO_PRINTF1(_L("2.1 Testing rediscovery on adding RSC files onto drive C: and X:"));
   465 		CopyPluginCR629TestRSCOnDrive(EDriveX, 2);
   466 #else // C: and E: on hardware
   467 		INFO_PRINTF1(_L("2. Multiple notification processing on multiple drives (C: and E:)"));
   468 		INFO_PRINTF1(_L("2.1 Testing rediscovery on adding RSC files onto drive C: and E:"));
   469 		
   470 		// Check the availability of E: drive and MMC card.
   471 		TDriveList drivelist;
   472 		TEST(fs.DriveList(drivelist)==KErrNone);
   473 		if (!(drivelist[EDriveE]))
   474 			{
   475 			SetTestStepResult(EFail);
   476 			INFO_PRINTF1(_L("*** Drive E: is not available for hardware tests! ***"));
   477 			DeleteRSCFilesOnDrive(EDriveC);
   478 			return TestStepResult();
   479 			}
   480 		
   481 		TDriveInfo aDriveInfo;
   482 		TEST(fs.Drive(aDriveInfo, EDriveE)==KErrNone);
   483 		if (aDriveInfo.iType != EMediaHardDisk)
   484 			{
   485 			SetTestStepResult(EFail);
   486 			INFO_PRINTF1(_L("*** MMC card is not available for hardware tests! ***"));
   487 			DeleteRSCFilesOnDrive(EDriveC);
   488 			return TestStepResult();
   489 			}		
   490 		
   491 		// Now copy files
   492 		CopyPluginCR629TestRSCOnDrive(EDriveE, 2);
   493 #endif // __WINSCW__
   494 		User::After(KOneSecond * 3);
   495 		
   496 		// Now get all time records from server.
   497 		TRAP(err, timeRecords.OpenL());
   498 		TEST(err==KErrNone);
   499 		TEST(timeRecords.Count() > 0);
   500 		
   501 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   502 		TEST(err==KErrNone);
   503 		// Test notifications were triggered and check performance of RunL of Notifiers
   504 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   505 		timeResults.Reset();
   506 		
   507 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   508 		TEST(err==KErrNone);
   509 		// Test notifications ONLY triggered on C: and X: (or E:) drive
   510 		TEST(timeResultsInfos.Count()==2);
   511 		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   512 #if defined(__WINSCW__) 
   513 		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   514 #else 
   515 		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   516 #endif // __WINSCW__
   517 		timeResultsInfos.Reset();
   518 		
   519 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   520 		TEST(err==KErrNone);
   521 		// Test Timer RunL ran only once and check performance.
   522 		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit * 2, timeResults));
   523 		timeResults.Reset();
   524 		
   525 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   526 		TEST(err==KErrNone);
   527 		// Test directory scanning has and ONLY performed on C: and X: (or E:) drive
   528 		TEST(timeResultsInfos.Count()==2);
   529 		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   530 #if defined(__WINSCW__) 
   531 		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   532 #else 
   533 		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   534 #endif // __WINSCW__
   535 		timeResultsInfos.Reset();
   536 		
   537 		
   538 	//2.2 Testing rediscovery performance on deleting RSC files on multiple drives
   539 		// Clean up time records on server.
   540 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   541 		TEST(err==KErrNone);
   542 		timeRecords.Reset();
   543 		DeleteRSCFilesOnDrive(EDriveC);
   544 #if defined(__WINSCW__) // C: and X: on emulator
   545 		INFO_PRINTF1(_L("2.2 Testing rediscovery on removing RSC files from drive C: and X:"));
   546 		DeleteRSCFolderOnDrive(EDriveX);
   547 #else // C: and E: on hardware
   548 		INFO_PRINTF1(_L("2.2 Testing rediscovery on removing RSC files from drive C: and E:"));
   549 		DeleteRSCFolderOnDrive(EDriveE);
   550 #endif // __WINSCW__
   551 		User::After(KOneSecond * 3);
   552 		
   553 		// Now get all time records from server.
   554 		TRAP(err, timeRecords.OpenL());
   555 		TEST(err==KErrNone);
   556 		TEST(timeRecords.Count() > 0);
   557 		
   558 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   559 		TEST(err==KErrNone);
   560 		// Test notifications were triggered and check performance of RunL of Notifiers
   561 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   562 		timeResults.Reset();
   563 		
   564 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   565 		TEST(err==KErrNone);
   566 		// Test notifications ONLY triggered on C: and X: (or E:) drive
   567 		TEST(timeResultsInfos.Count()==2);
   568 		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   569 #if defined(__WINSCW__) 
   570 		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   571 #else 
   572 		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   573 #endif // __WINSCW__
   574 		timeResultsInfos.Reset();
   575 		
   576 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   577 		TEST(err==KErrNone);
   578 		// Test Timer RunL ran only once and check performance.
   579 		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit * 2, timeResults));
   580 		timeResults.Reset();
   581 		
   582 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   583 		TEST(err==KErrNone);
   584 		// Test directory scanning has and ONLY performed on C: and X: (or E:) drive
   585 		TEST(timeResultsInfos.Count()==2);
   586 		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   587 #if defined(__WINSCW__) 
   588 		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   589 #else 
   590 		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   591 #endif // __WINSCW__
   592 		timeResultsInfos.Reset();
   593 
   594 
   595 	//3. MMC Remounting tests on drive E:
   596 	INFO_PRINTF1(_L("3. MMC Remounting tests on drive E:"));
   597 #if defined(__WINSCW__)
   598 	// Tests only run on hardware.
   599 	INFO_PRINTF1(_L("This test can only run on hardware, please see test results of hardware for further information."));
   600 #else
   601 		CopyPluginCR629TestRSCOnDrive(EDriveE, 2);
   602 		User::After(KOneSecond * 3);
   603 		
   604 	//3.1 before remounting: 	has plugins
   605 	//    after remounting: 	has plugins
   606 		INFO_PRINTF1(_L("3.1 Before Remount: has plugins; 	After Remount: has plugins"));
   607 		// Clean up time records on server.
   608 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   609 		TEST(err==KErrNone);
   610 		timeRecords.Reset();
   611 		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   612 		User::After(KOneSecond * 3);
   613 		
   614 		// Now get all time records from server.
   615 		TRAP(err, timeRecords.OpenL());
   616 		TEST(err==KErrNone);
   617 		TEST(timeRecords.Count() > 0);
   618 
   619 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   620 		TEST(err==KErrNone);
   621 		// Test notifications were triggered and check performance of RunL of Notifiers
   622 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   623 		timeResults.Reset();
   624 
   625 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   626 		// Test notifications ONLY triggered on E: drive
   627 		TEST(timeResultsInfos.Count()==1);
   628 		TEST(timeResultsInfos[0] == EDriveE);
   629 		timeResultsInfos.Reset();
   630 		
   631 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   632 		TEST(err==KErrNone);
   633 		// Test Timer RunL ran only once and check performance.
   634 		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   635 		timeResults.Reset();
   636 		
   637 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   638 		TEST(err==KErrNone);
   639 		// Test directory scanning has and ONLY performed on E: drive
   640 		TEST(timeResultsInfos.Count()==1);
   641 		TEST(timeResultsInfos[0] == EDriveE);
   642 		timeResultsInfos.Reset();
   643 
   644 	//3.2 before remounting: 	has plugins
   645 	//    after remounting: 	has no plugins
   646 		INFO_PRINTF1(_L("3.2 Before Remount: has plugins; 	After Remount: has no plugins"));
   647 		// Clean up time records on server.
   648 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   649 		TEST(err==KErrNone);
   650 		timeRecords.Reset();
   651 		DeleteRSCFolderOnDrive(EDriveE);
   652 		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   653 		User::After(KOneSecond * 3);
   654 		
   655 		// Now get all time records from server.
   656 		TRAP(err, timeRecords.OpenL());
   657 		TEST(err==KErrNone);
   658 		TEST(timeRecords.Count() > 0);
   659 		
   660 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   661 		TEST(err==KErrNone);
   662 		// Test notifications were triggered and check performance of RunL of Notifiers
   663 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   664 		timeResults.Reset();
   665 		
   666 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   667 		TEST(err==KErrNone);
   668 		// Test notifications ONLY triggered for E: drive
   669 		TEST(timeResultsInfos.Count()==1);
   670 		TEST(timeResultsInfos[0] == EDriveE);
   671 		timeResultsInfos.Reset();
   672 		
   673 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   674 		TEST(err==KErrNone);
   675 		// Test Timer RunL ran only once and check performance.
   676 		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit, timeResults));
   677 		timeResults.Reset();
   678 		
   679 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   680 		TEST(err==KErrNone);
   681 		// Test directory scanning has and ONLY performed on E: drive
   682 		TEST(timeResultsInfos.Count()==1);
   683 		TEST(timeResultsInfos[0] == EDriveE);
   684 		timeResultsInfos.Reset();
   685 
   686 	//3.3 before remounting: 	has no plugins
   687 	//    after remounting: 	has plugins
   688 		INFO_PRINTF1(_L("3.3 Before Remount: has no plugins; 	After Remount: has plugins"));
   689 		// Clean up time records on server.
   690 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   691 		TEST(err==KErrNone);
   692 		timeRecords.Reset();
   693 		CopyPluginCR629TestRSCOnDrive(EDriveE, 2);
   694 		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   695 		User::After(KOneSecond * 3);
   696 		
   697 		// Now get all time records from server.
   698 		TRAP(err, timeRecords.OpenL());
   699 		TEST(err==KErrNone);
   700 		TEST(timeRecords.Count() > 0);
   701 		
   702 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   703 		TEST(err==KErrNone);
   704 		// Test notifications were triggered and check performance of RunL of Notifiers
   705 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   706 		timeResults.Reset();
   707 		
   708 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   709 		TEST(err==KErrNone);
   710 		// Test notifications ONLY triggered for E: drive
   711 		TEST(timeResultsInfos.Count()==1);
   712 		TEST(timeResultsInfos[0] == EDriveE);
   713 		timeResultsInfos.Reset();
   714 		
   715 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   716 		TEST(err==KErrNone);
   717 		// Test Timer RunL ran only once and check performance.
   718 		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   719 		timeResults.Reset();
   720 		
   721 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   722 		TEST(err==KErrNone);
   723 		// Test directory scanning has and ONLY performed on E: drive
   724 		TEST(timeResultsInfos.Count()==1);
   725 		TEST(timeResultsInfos[0] == EDriveE);
   726 		timeResultsInfos.Reset();
   727 
   728 		DeleteRSCFolderOnDrive(EDriveE);
   729 		User::After(KOneSecond * 3);
   730 
   731 	//3.4 before remounting: 	has no plugin
   732 	//    after remounting: 	has no plugin
   733 		INFO_PRINTF1(_L("3.4 Before Remount: has no plugins; 	After Remount: has no plugins"));
   734 		// Clean up time records on server.
   735 		TRAP(err, timeRecords.ResetRecordsOnServerL());
   736 		TEST(err==KErrNone);
   737 		timeRecords.Reset();
   738 		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   739 		User::After(KOneSecond * 3);
   740 		
   741 		// Now get all time records from server.
   742 		TRAP(err, timeRecords.OpenL());
   743 		TEST(err==KErrNone);
   744 		TEST(timeRecords.Count() > 0);
   745 		
   746 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   747 		TEST(err==KErrNone);
   748 		// Test notifications were triggered and check performance of RunL of Notifiers
   749 		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   750 		timeResults.Reset();
   751 		
   752 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   753 		TEST(err==KErrNone);
   754 		// Test notifications ONLY triggered for E: drive
   755 		TEST(timeResultsInfos.Count()==1);
   756 		TEST(timeResultsInfos[0] == EDriveE);
   757 		timeResultsInfos.Reset();
   758 		
   759 		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   760 		TEST(err==KErrNone);
   761 		// Test Timer RunL ran only once and check performance.
   762 		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit, timeResults));
   763 		timeResults.Reset();
   764 		
   765 		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   766 		TEST(err==KErrNone);
   767 		// Test directory scanning has NOT performed
   768 		TEST(timeResultsInfos.Count()==0);
   769 		timeResultsInfos.Reset();
   770 		
   771 #endif // __WINSCW__
   772 		
   773 	// Final cleanup
   774 	DeleteRSCFilesOnDrive(EDriveC);
   775 	DeleteRSCFolderOnDrive(EDriveX);
   776 	DeleteRSCFolderOnDrive(EDriveE);
   777 #else
   778 	MacroNotDefinedError();
   779 #endif // __ECOM_SERVER_PERFORMANCE__
   780 
   781 	return TestStepResult();
   782 	}