os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComPluginReDiscoverPerfTestStep.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/Te_EComPluginReDiscoverPerfTestStep.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,782 @@
     1.4 +// Copyright (c) 2006-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 +// Te_EComPluginReDiscoverPerfTest.cpp
    1.18 +// Implements the performance loggr for ECOM
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @internalComponent
    1.25 +*/
    1.26 +
    1.27 +#include "Te_EComPluginReDiscoverPerfTestStep.h"
    1.28 +#include <e32test.h>
    1.29 +#include <bautils.h>
    1.30 +#include <startup.hrh>
    1.31 +#include <ecom/ecom.h>
    1.32 +#include "Interface.h"
    1.33 +#include "EcomTestUtils.h"
    1.34 +
    1.35 +#ifdef __ECOM_SERVER_PERFORMANCE__
    1.36 +const TInt KOneSecond = 1000000;
    1.37 +
    1.38 +const TReal KNotifierRunLTimeLimitH2RAM = 2;					// mSec
    1.39 +const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH2RAM = 80;	// mSec
    1.40 +const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH2RAM = 40;	// mSec
    1.41 +
    1.42 +const TReal KNotifierRunLTimeLimitH4RAM = 1;               // mSec
    1.43 +const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH4RAM = 40;   // mSec
    1.44 +const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH4RAM = 20;   // mSec 
    1.45 +		
    1.46 +const TReal KNotifierRunLTimeLimitH4NAND = 6;               // mSec
    1.47 +const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH4NAND = 50;   // mSec
    1.48 +const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH4NAND = 20;   // mSec 
    1.49 +
    1.50 +const TReal KNotifierRunLTimeLimitH6RAM = 1;               // mSec
    1.51 +const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH6RAM = 20;   // mSec
    1.52 +const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH6RAM = 8;   // mSec 
    1.53 +		
    1.54 +const TReal KNotifierRunLTimeLimitH6NAND = 4;               // mSec
    1.55 +const TReal KTimerRunLScanTwoRSCsOnOneDriveLimitH6NAND = 25;   // mSec
    1.56 +const TReal KTimerRunLScanZeroRSCOnOneDriveLimitH6NAND = 8;   // mSec 
    1.57 +
    1.58 +// The default benchmark checking threshold are defined as zero, for emulator platform.
    1.59 +// The values will be changed for H2 or H4 OR H6 boards.
    1.60 +// See CEComPluginReDiscoverPerfTest::SetBenchmarks()
    1.61 +static TReal NotifierRunLTimeLimit = 0;				
    1.62 +static TReal TimerRunLScanTwoRSCsOnOneDriveLimit = 0;	
    1.63 +static TReal TimerRunLScanZeroRSCOnOneDriveLimit = 0;	
    1.64 +
    1.65 +_LIT(KRamOnlyEComCR629Example2RSC,			"Z:\\RAMOnly\\EComCR629Example2.rsc");
    1.66 +_LIT(KEComExample12RSCOnZ,						"Z:\\RAMOnly\\EComExample12.rsc");
    1.67 +_LIT(KEComExample12RSC1OnC,						"C:\\Resource\\Plugins\\EComExample12_1.rsc");
    1.68 +_LIT(KEComExample12RSC2OnC,						"C:\\Resource\\Plugins\\EComExample12_2.rsc");
    1.69 +_LIT(KEComRscDirName,						"\\Resource\\Plugins");
    1.70 +_LIT(KEComCR629RSCFileName,					"\\Resource\\Plugins\\EComCR629Example1_");
    1.71 +_LIT(KEComRSCFileExt,						".rsc");
    1.72 +_LIT(KEComAllRSCFilesName,					"\\Resource\\Plugins\\*.rsc");
    1.73 +#endif //__ECOM_SERVER_PERFORMANCE__
    1.74 +
    1.75 +CEComPluginReDiscoverPerfTest::CEComPluginReDiscoverPerfTest() : CEComPerfTestBase(KEComPluginReDiscoverPerfTest)
    1.76 +	{
    1.77 +	}
    1.78 +
    1.79 +CEComPluginReDiscoverPerfTest::~CEComPluginReDiscoverPerfTest()
    1.80 +	{
    1.81 +	}
    1.82 +
    1.83 +#ifdef __ECOM_SERVER_PERFORMANCE__
    1.84 +/*
    1.85 +	Set different benchmark thresholds for H2 or H4 or H6 boards. 
    1.86 +	Emulator tests will not disable benchmark checking, so don't need to set values for it.
    1.87 +**/
    1.88 +void CEComPluginReDiscoverPerfTest::SetBenchmarksL()
    1.89 +	{
    1.90 +	THardwareConfiguration hardware_configuration = EComTestUtils::GetHardwareConfiguration();
    1.91 +	switch (hardware_configuration)
    1.92 +		{
    1.93 +		case EPlatformH2RAM:
    1.94 +	    	NotifierRunLTimeLimit = KNotifierRunLTimeLimitH2RAM;
    1.95 +			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH2RAM;
    1.96 +			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH2RAM;
    1.97 +			INFO_PRINTF1(_L("Hardware configuration: H2 RAM"));
    1.98 +			break;
    1.99 +		
   1.100 +		case EPlatformH2NAND:		
   1.101 +			INFO_PRINTF1(_L("Hardware configuration: H2 NAND"));
   1.102 +			INFO_PRINTF1(_L("***Performance testing on H2 NAND is not supported!***"));
   1.103 +			SetTestStepResult(EFail);			
   1.104 +			break;
   1.105 +
   1.106 +		case EPlatformH2NANDDP:
   1.107 +			INFO_PRINTF1(_L("Hardware configuration: H2 NAND DP"));
   1.108 +			INFO_PRINTF1(_L("***Performance testing on H2 NAND DP is not supported!***"));
   1.109 +			SetTestStepResult(EFail);			
   1.110 +			break;
   1.111 +		
   1.112 +		case EPlatformH4RAM:
   1.113 +			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH4RAM;
   1.114 +			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH4RAM;
   1.115 +			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH4RAM;
   1.116 +			INFO_PRINTF1(_L("Hardware configuration: H4 RAM"));
   1.117 +			break;
   1.118 +		
   1.119 +		case EPlatformH4NAND:		
   1.120 +			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH4NAND;
   1.121 +			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH4NAND;
   1.122 +			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH4NAND;
   1.123 +			INFO_PRINTF1(_L("Hardware configuration: H4 NAND"));
   1.124 +			break;
   1.125 +		
   1.126 +		case EPlatformH4NANDDP:	
   1.127 +			INFO_PRINTF1(_L("Hardware configuration: H4 NAND DP"));
   1.128 +			break;
   1.129 +
   1.130 +		case EPlatformH6RAM:
   1.131 +			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH6RAM;
   1.132 +			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH6RAM;
   1.133 +			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH6RAM;
   1.134 +			INFO_PRINTF1(_L("Hardware configuration: H6 RAM"));
   1.135 +			break;
   1.136 +		
   1.137 +		case EPlatformH6NAND:		
   1.138 +			NotifierRunLTimeLimit = KNotifierRunLTimeLimitH6NAND;
   1.139 +			TimerRunLScanTwoRSCsOnOneDriveLimit = KTimerRunLScanTwoRSCsOnOneDriveLimitH6NAND;
   1.140 +			TimerRunLScanZeroRSCOnOneDriveLimit = KTimerRunLScanZeroRSCOnOneDriveLimitH6NAND;
   1.141 +			INFO_PRINTF1(_L("Hardware configuration: H6 NAND"));
   1.142 +			break;
   1.143 +		
   1.144 +		case EPlatformH6NANDDP:	
   1.145 +			INFO_PRINTF1(_L("Hardware configuration: H6 NAND DP"));
   1.146 +			break;
   1.147 +			
   1.148 +		case EPlatformWINSCW:
   1.149 +			INFO_PRINTF1(_L("Hardware configuration: WINSCW"));
   1.150 +			break;
   1.151 +		
   1.152 +		default:		
   1.153 +			SetTestStepResult(EFail);
   1.154 +			INFO_PRINTF1(_L("***Unrecognized platform!***"));
   1.155 +			break;		
   1.156 +		}
   1.157 +	}
   1.158 +
   1.159 +TBool CEComPluginReDiscoverPerfTest::CheckTimeResults(TReal aTimeLimit, RArray<TEComPerfRealTimeResult>& aTimeResults)
   1.160 +	{
   1.161 +	TInt count = aTimeResults.Count();
   1.162 +	
   1.163 +	if(count)
   1.164 +		{
   1.165 +		switch(aTimeResults[0].iType)
   1.166 +			{
   1.167 +			case ECDiscovererNotifierRunL:
   1.168 +				{
   1.169 +				for(TInt idx = 0; idx < count; ++idx)
   1.170 +					{
   1.171 +					TReal elapsedTime = aTimeResults[idx].iEndTime - aTimeResults[idx].iStartTime;
   1.172 +					INFO_PRINTF2(_L("Notifier RunL gets called for drive: %d"), aTimeResults[idx].iInfo);
   1.173 +					CheckPerformance(elapsedTime, aTimeLimit, _L("Notifier RunL"));
   1.174 +					}
   1.175 +				break;
   1.176 +				}
   1.177 +			case ECDiscovererTimerRunL:
   1.178 +				{
   1.179 +				// Check timer runl only ran once
   1.180 +				if(count>1)
   1.181 +					{
   1.182 +					INFO_PRINTF1(_L("Timer RunL ran more than once!\n"));
   1.183 +					return EFalse;
   1.184 +					}
   1.185 +				else
   1.186 +					{
   1.187 +					const TEComPerfRealTimeResult& timeResult = aTimeResults[0];
   1.188 +					TReal elapsedTime = aTimeResults[0].iEndTime - aTimeResults[0].iStartTime;
   1.189 +					CheckPerformance(elapsedTime, aTimeLimit, _L("Timer RunL"));
   1.190 +					}
   1.191 +				break;
   1.192 +				}
   1.193 +			default:
   1.194 +				{
   1.195 +				INFO_PRINTF1(_L("Unrecognizable type for checking performance!\n"));
   1.196 +				return EFalse;
   1.197 +				}
   1.198 +			}
   1.199 +		return ETrue;
   1.200 +		}
   1.201 +	else // No time result retrieved
   1.202 +		{
   1.203 +		INFO_PRINTF1(_L("No time result Retrieved!\n"));
   1.204 +		return EFalse;
   1.205 +		}
   1.206 +	}
   1.207 +
   1.208 +void CEComPluginReDiscoverPerfTest::CopyPluginCR629TestRSCOnDrive(TUint aDriveNum, TInt aNumOfCopies)
   1.209 +	{
   1.210 +	if(aNumOfCopies > 0)
   1.211 +		{
   1.212 +		TInt err=KErrNone;
   1.213 +		TDriveUnit aDrive(aDriveNum);
   1.214 +		TBuf<256> resourceFileName;
   1.215 +		for(TInt num = 1; num<= aNumOfCopies; num++ )
   1.216 +			{
   1.217 +			resourceFileName.Zero();
   1.218 +			resourceFileName.Append(aDrive.Name());
   1.219 +			resourceFileName.Append(KEComCR629RSCFileName);
   1.220 +			resourceFileName.AppendNum(num);
   1.221 +			resourceFileName.Append(KEComRSCFileExt);
   1.222 +			TRAP(err, EComTestUtils::FileManCopyFileL(KRamOnlyEComCR629Example2RSC, resourceFileName));
   1.223 +			TEST(err ==KErrNone);
   1.224 +			}
   1.225 +		}
   1.226 +	else
   1.227 +		{
   1.228 +		INFO_PRINTF1(_L("Number of file copies should be greater than 0!\n"));
   1.229 +		}
   1.230 +	}
   1.231 +
   1.232 +void CEComPluginReDiscoverPerfTest::DeleteRSCFilesOnDrive(TUint aDriveNum)
   1.233 +	{
   1.234 +	TInt err=KErrNone;
   1.235 +	TDriveUnit aDrive(aDriveNum);
   1.236 +
   1.237 +	TBuf<256> resourceFileName;
   1.238 +	resourceFileName.Append(aDrive.Name());
   1.239 +	resourceFileName.Append(KEComAllRSCFilesName);
   1.240 +	TRAP(err, EComTestUtils::FileManDeleteFileL(resourceFileName));
   1.241 +	}
   1.242 +
   1.243 +void CEComPluginReDiscoverPerfTest::DeleteRSCFolderOnDrive(TUint aDriveNum)
   1.244 +	{
   1.245 +	TInt err=KErrNone;
   1.246 +	TDriveUnit aDrive(aDriveNum);
   1.247 +
   1.248 +	TBuf<256> resourceFileName;
   1.249 +	resourceFileName.Append(aDrive.Name());
   1.250 +	resourceFileName.Append(KEComAllRSCFilesName);
   1.251 +	TRAP(err, EComTestUtils::FileManDeleteFileL(resourceFileName));
   1.252 +
   1.253 +	TBuf<256> resourceDirName;
   1.254 +	resourceDirName.Append(aDrive.Name());
   1.255 +	resourceDirName.Append(KEComRscDirName);
   1.256 +	TRAP(err, EComTestUtils::FileManDeleteDirL(resourceDirName));
   1.257 +	}
   1.258 +
   1.259 +#endif //__ECOM_SERVER_PERFORMANCE__
   1.260 +
   1.261 +/*
   1.262 +	Test cases covered in the test step:
   1.263 +	1. Multiple notification processing on single drive (C:)
   1.264 +
   1.265 +		1.1 Rediscovery on adding RSC files
   1.266 +				Performance check on Notifier RunL
   1.267 +				Functionality check on Notifier RunL
   1.268 +				Performance check on Timer RunL
   1.269 +				Functionality check on RediscoveryScanDirectoryL
   1.270 +
   1.271 +		1.2 Rediscovery on deleting RSC files
   1.272 +				As above.
   1.273 +		1.3 Rediscovery on adding RSC PlugIn3 files. It does the performance test 
   1.274 +			for parsing new registry data.
   1.275 +				As above.
   1.276 +				
   1.277 +	2. Multiple notification processing on multiple drives (C: and X: or E:)
   1.278 +
   1.279 +		2.1 Rediscovery on adding RSC files
   1.280 +				As above.
   1.281 +				
   1.282 +		2.2 Rediscovery on deleting RSC filles
   1.283 +				As above.
   1.284 +				
   1.285 +	3. MMC Remounting tests on drive E:
   1.286 +
   1.287 +		3.1 Before: has plugins
   1.288 +			After: 	has plugins
   1.289 +				As above.
   1.290 +				
   1.291 +		3.2 Before: has plugins
   1.292 +			After: 	has no plugins
   1.293 +				As above.
   1.294 +				
   1.295 +		3.3 Before: has no plugins
   1.296 +			After: 	has plugins
   1.297 +				As above.
   1.298 +				
   1.299 +		3.4 Before: has no plugins
   1.300 +			After: 	has no plugins
   1.301 +				As above.
   1.302 +
   1.303 +@pre For hardware test, MMC (E:) drive should be available.
   1.304 +@return EPass if the test succeeds and the measured times pass the checks
   1.305 +		EFail otherwise.
   1.306 + */
   1.307 +TVerdict CEComPluginReDiscoverPerfTest::doTestStepL()
   1.308 +	{
   1.309 +#ifdef __ECOM_SERVER_PERFORMANCE__
   1.310 +	// Set benchmark threshold for different hardware platform, default values are 0s, for emulator.
   1.311 +	SetBenchmarksL();
   1.312 +	
   1.313 +	//1. Multiple notification processing on single drive (C:)
   1.314 +	INFO_PRINTF1(_L("1. Multiple notification processing on single drive (C:)"));		
   1.315 +	
   1.316 +	//1.1 Testing rediscovery performance on adding RSC files on C:
   1.317 +		INFO_PRINTF1(_L("1.1 Testing rediscovery on adding RSC files onto drive C:"));
   1.318 +		// Clean up Plugins
   1.319 +		DeleteRSCFilesOnDrive(EDriveC);
   1.320 +		User::After(KOneSecond * 3);
   1.321 +		REComPerfTimeRecords timeRecords;
   1.322 +
   1.323 +		// Clean up time records on server.
   1.324 +		TRAPD(err, timeRecords.ResetRecordsOnServerL());
   1.325 +		TEST(err==KErrNone);
   1.326 +		timeRecords.Reset();
   1.327 +		CopyPluginCR629TestRSCOnDrive(EDriveC, 2);
   1.328 +		User::After(KOneSecond * 3);
   1.329 +		
   1.330 +		// Now get all time records from server
   1.331 +		TRAP(err, timeRecords.OpenL());
   1.332 +		TEST(err==KErrNone);
   1.333 +		TEST(timeRecords.Count() > 0);
   1.334 +		
   1.335 +		RArray<TEComPerfRealTimeResult> timeResults;
   1.336 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.337 +		TEST(err==KErrNone);
   1.338 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.339 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.340 +		timeResults.Reset();
   1.341 +		
   1.342 +		RArray<TInt> timeResultsInfos;
   1.343 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.344 +		TEST(err==KErrNone);
   1.345 +		// Test notifications ONLY triggered on C: drive
   1.346 +		TEST(timeResultsInfos.Count()==1);
   1.347 +		TEST(timeResultsInfos[0] == EDriveC);
   1.348 +		timeResultsInfos.Reset();
   1.349 +		
   1.350 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.351 +		TEST(err==KErrNone);
   1.352 +		// Test Timer RunL ran only once and check performance.
   1.353 +		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   1.354 +		timeResults.Reset();
   1.355 +		
   1.356 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.357 +		TEST(err==KErrNone);
   1.358 +		// Test directory scanning has and ONLY performed on C: drive
   1.359 +		TEST(timeResultsInfos.Count()==1);
   1.360 +		TEST(timeResultsInfos[0] == EDriveC);
   1.361 +		timeResultsInfos.Reset();
   1.362 +
   1.363 +	//1.2 Testing rediscovery performance on deleting RSC files
   1.364 +		INFO_PRINTF1(_L("1.2 Testing rediscovery on removing RSC files from drive C:"));
   1.365 +		// Clean up time records on server.
   1.366 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.367 +		TEST(err==KErrNone);
   1.368 +		timeRecords.Reset();
   1.369 +		DeleteRSCFilesOnDrive(EDriveC);
   1.370 +		User::After(KOneSecond * 3);
   1.371 +		
   1.372 +		// Now get all time records from server.
   1.373 +		TRAP(err, timeRecords.OpenL());
   1.374 +		TEST(err==KErrNone);
   1.375 +		TEST(timeRecords.Count() > 0);
   1.376 +		
   1.377 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.378 +		TEST(err==KErrNone);
   1.379 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.380 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.381 +		timeResults.Reset();
   1.382 +		
   1.383 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.384 +		TEST(err==KErrNone);
   1.385 +		// Test notifications ONLY triggered on C: drive
   1.386 +		TEST(timeResultsInfos.Count()==1);
   1.387 +		TEST(timeResultsInfos[0] == EDriveC);
   1.388 +		timeResultsInfos.Reset();
   1.389 +		
   1.390 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.391 +		TEST(err==KErrNone);
   1.392 +		// Test Timer RunL ran only once and check performance.
   1.393 +		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit, timeResults));
   1.394 +		timeResults.Reset();
   1.395 +		
   1.396 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.397 +		TEST(err==KErrNone);
   1.398 +		// Test directory scanning has and ONLY performed on C: drive
   1.399 +		TEST(timeResultsInfos.Count()==1);
   1.400 +		TEST(timeResultsInfos[0] == EDriveC);
   1.401 +		timeResultsInfos.Reset();
   1.402 +
   1.403 +	//1.3 Testing rediscovery performance on adding RSC PLUGIN3 files on C:
   1.404 +		INFO_PRINTF1(_L("1.3 Testing rediscovery on adding RSC PLUGIN3 files onto drive C:"));
   1.405 +		// Clean up Plugins
   1.406 +		DeleteRSCFilesOnDrive(EDriveC);
   1.407 +		User::After(KOneSecond * 3);
   1.408 +		
   1.409 +		// Clean up time records on server.
   1.410 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.411 +		TEST(err==KErrNone);
   1.412 +		timeRecords.Reset();
   1.413 +		// Adding RSC PLUGIN3 file twice
   1.414 +		TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12RSCOnZ, KEComExample12RSC1OnC));
   1.415 +		TEST(err==KErrNone);
   1.416 +		TRAP(err, EComTestUtils::FileManCopyFileL(KEComExample12RSCOnZ, KEComExample12RSC2OnC));
   1.417 +		TEST(err==KErrNone);
   1.418 +		User::After(KOneSecond * 3);
   1.419 +		
   1.420 +		// Now get all time records from server
   1.421 +		TRAP(err, timeRecords.OpenL());
   1.422 +		TEST(err==KErrNone);
   1.423 +		TEST(timeRecords.Count() > 0);
   1.424 +		
   1.425 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.426 +		TEST(err==KErrNone);
   1.427 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.428 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.429 +		timeResults.Reset();
   1.430 +		
   1.431 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.432 +		TEST(err==KErrNone);
   1.433 +		// Test notifications ONLY triggered on C: drive
   1.434 +		TEST(timeResultsInfos.Count()==1);
   1.435 +		TEST(timeResultsInfos[0] == EDriveC);
   1.436 +		timeResultsInfos.Reset();
   1.437 +		
   1.438 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.439 +		TEST(err==KErrNone);
   1.440 +		// Test Timer RunL ran only once and check performance.
   1.441 +		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   1.442 +		timeResults.Reset();
   1.443 +		
   1.444 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.445 +		TEST(err==KErrNone);
   1.446 +		// Test directory scanning has and ONLY performed on C: drive
   1.447 +		TEST(timeResultsInfos.Count()==1);
   1.448 +		TEST(timeResultsInfos[0] == EDriveC);
   1.449 +		timeResultsInfos.Reset();
   1.450 +		// Delete the RSC files
   1.451 +		TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample12RSC1OnC));
   1.452 +		TRAP(err, EComTestUtils::FileManDeleteFileL(KEComExample12RSC2OnC));
   1.453 +		User::After(KOneSecond * 3);
   1.454 +		
   1.455 +	//2. Multiple notification processing on multiple drives (C: and X: or E:)
   1.456 +		RFs fs;
   1.457 +		TEST(fs.Connect()==KErrNone);
   1.458 +
   1.459 +	//2.1 Testing rediscovery performance on adding RSC files on multiple drives
   1.460 +		// Clean up time records on server.
   1.461 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.462 +		TEST(err==KErrNone);
   1.463 +		timeRecords.Reset();
   1.464 +		CopyPluginCR629TestRSCOnDrive(EDriveC, 2);
   1.465 +#if defined(__WINSCW__) // C: and X: on emulator
   1.466 +		INFO_PRINTF1(_L("2. Multiple notification processing on multiple drives (C: and X:)"));
   1.467 +		INFO_PRINTF1(_L("2.1 Testing rediscovery on adding RSC files onto drive C: and X:"));
   1.468 +		CopyPluginCR629TestRSCOnDrive(EDriveX, 2);
   1.469 +#else // C: and E: on hardware
   1.470 +		INFO_PRINTF1(_L("2. Multiple notification processing on multiple drives (C: and E:)"));
   1.471 +		INFO_PRINTF1(_L("2.1 Testing rediscovery on adding RSC files onto drive C: and E:"));
   1.472 +		
   1.473 +		// Check the availability of E: drive and MMC card.
   1.474 +		TDriveList drivelist;
   1.475 +		TEST(fs.DriveList(drivelist)==KErrNone);
   1.476 +		if (!(drivelist[EDriveE]))
   1.477 +			{
   1.478 +			SetTestStepResult(EFail);
   1.479 +			INFO_PRINTF1(_L("*** Drive E: is not available for hardware tests! ***"));
   1.480 +			DeleteRSCFilesOnDrive(EDriveC);
   1.481 +			return TestStepResult();
   1.482 +			}
   1.483 +		
   1.484 +		TDriveInfo aDriveInfo;
   1.485 +		TEST(fs.Drive(aDriveInfo, EDriveE)==KErrNone);
   1.486 +		if (aDriveInfo.iType != EMediaHardDisk)
   1.487 +			{
   1.488 +			SetTestStepResult(EFail);
   1.489 +			INFO_PRINTF1(_L("*** MMC card is not available for hardware tests! ***"));
   1.490 +			DeleteRSCFilesOnDrive(EDriveC);
   1.491 +			return TestStepResult();
   1.492 +			}		
   1.493 +		
   1.494 +		// Now copy files
   1.495 +		CopyPluginCR629TestRSCOnDrive(EDriveE, 2);
   1.496 +#endif // __WINSCW__
   1.497 +		User::After(KOneSecond * 3);
   1.498 +		
   1.499 +		// Now get all time records from server.
   1.500 +		TRAP(err, timeRecords.OpenL());
   1.501 +		TEST(err==KErrNone);
   1.502 +		TEST(timeRecords.Count() > 0);
   1.503 +		
   1.504 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.505 +		TEST(err==KErrNone);
   1.506 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.507 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.508 +		timeResults.Reset();
   1.509 +		
   1.510 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.511 +		TEST(err==KErrNone);
   1.512 +		// Test notifications ONLY triggered on C: and X: (or E:) drive
   1.513 +		TEST(timeResultsInfos.Count()==2);
   1.514 +		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   1.515 +#if defined(__WINSCW__) 
   1.516 +		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   1.517 +#else 
   1.518 +		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   1.519 +#endif // __WINSCW__
   1.520 +		timeResultsInfos.Reset();
   1.521 +		
   1.522 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.523 +		TEST(err==KErrNone);
   1.524 +		// Test Timer RunL ran only once and check performance.
   1.525 +		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit * 2, timeResults));
   1.526 +		timeResults.Reset();
   1.527 +		
   1.528 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.529 +		TEST(err==KErrNone);
   1.530 +		// Test directory scanning has and ONLY performed on C: and X: (or E:) drive
   1.531 +		TEST(timeResultsInfos.Count()==2);
   1.532 +		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   1.533 +#if defined(__WINSCW__) 
   1.534 +		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   1.535 +#else 
   1.536 +		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   1.537 +#endif // __WINSCW__
   1.538 +		timeResultsInfos.Reset();
   1.539 +		
   1.540 +		
   1.541 +	//2.2 Testing rediscovery performance on deleting RSC files on multiple drives
   1.542 +		// Clean up time records on server.
   1.543 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.544 +		TEST(err==KErrNone);
   1.545 +		timeRecords.Reset();
   1.546 +		DeleteRSCFilesOnDrive(EDriveC);
   1.547 +#if defined(__WINSCW__) // C: and X: on emulator
   1.548 +		INFO_PRINTF1(_L("2.2 Testing rediscovery on removing RSC files from drive C: and X:"));
   1.549 +		DeleteRSCFolderOnDrive(EDriveX);
   1.550 +#else // C: and E: on hardware
   1.551 +		INFO_PRINTF1(_L("2.2 Testing rediscovery on removing RSC files from drive C: and E:"));
   1.552 +		DeleteRSCFolderOnDrive(EDriveE);
   1.553 +#endif // __WINSCW__
   1.554 +		User::After(KOneSecond * 3);
   1.555 +		
   1.556 +		// Now get all time records from server.
   1.557 +		TRAP(err, timeRecords.OpenL());
   1.558 +		TEST(err==KErrNone);
   1.559 +		TEST(timeRecords.Count() > 0);
   1.560 +		
   1.561 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.562 +		TEST(err==KErrNone);
   1.563 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.564 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.565 +		timeResults.Reset();
   1.566 +		
   1.567 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.568 +		TEST(err==KErrNone);
   1.569 +		// Test notifications ONLY triggered on C: and X: (or E:) drive
   1.570 +		TEST(timeResultsInfos.Count()==2);
   1.571 +		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   1.572 +#if defined(__WINSCW__) 
   1.573 +		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   1.574 +#else 
   1.575 +		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   1.576 +#endif // __WINSCW__
   1.577 +		timeResultsInfos.Reset();
   1.578 +		
   1.579 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.580 +		TEST(err==KErrNone);
   1.581 +		// Test Timer RunL ran only once and check performance.
   1.582 +		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit * 2, timeResults));
   1.583 +		timeResults.Reset();
   1.584 +		
   1.585 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.586 +		TEST(err==KErrNone);
   1.587 +		// Test directory scanning has and ONLY performed on C: and X: (or E:) drive
   1.588 +		TEST(timeResultsInfos.Count()==2);
   1.589 +		TEST(timeResultsInfos.Find(EDriveC)!=KErrNotFound);
   1.590 +#if defined(__WINSCW__) 
   1.591 +		TEST(timeResultsInfos.Find(EDriveX)!=KErrNotFound);
   1.592 +#else 
   1.593 +		TEST(timeResultsInfos.Find(EDriveE)!=KErrNotFound);
   1.594 +#endif // __WINSCW__
   1.595 +		timeResultsInfos.Reset();
   1.596 +
   1.597 +
   1.598 +	//3. MMC Remounting tests on drive E:
   1.599 +	INFO_PRINTF1(_L("3. MMC Remounting tests on drive E:"));
   1.600 +#if defined(__WINSCW__)
   1.601 +	// Tests only run on hardware.
   1.602 +	INFO_PRINTF1(_L("This test can only run on hardware, please see test results of hardware for further information."));
   1.603 +#else
   1.604 +		CopyPluginCR629TestRSCOnDrive(EDriveE, 2);
   1.605 +		User::After(KOneSecond * 3);
   1.606 +		
   1.607 +	//3.1 before remounting: 	has plugins
   1.608 +	//    after remounting: 	has plugins
   1.609 +		INFO_PRINTF1(_L("3.1 Before Remount: has plugins; 	After Remount: has plugins"));
   1.610 +		// Clean up time records on server.
   1.611 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.612 +		TEST(err==KErrNone);
   1.613 +		timeRecords.Reset();
   1.614 +		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   1.615 +		User::After(KOneSecond * 3);
   1.616 +		
   1.617 +		// Now get all time records from server.
   1.618 +		TRAP(err, timeRecords.OpenL());
   1.619 +		TEST(err==KErrNone);
   1.620 +		TEST(timeRecords.Count() > 0);
   1.621 +
   1.622 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.623 +		TEST(err==KErrNone);
   1.624 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.625 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.626 +		timeResults.Reset();
   1.627 +
   1.628 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.629 +		// Test notifications ONLY triggered on E: drive
   1.630 +		TEST(timeResultsInfos.Count()==1);
   1.631 +		TEST(timeResultsInfos[0] == EDriveE);
   1.632 +		timeResultsInfos.Reset();
   1.633 +		
   1.634 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.635 +		TEST(err==KErrNone);
   1.636 +		// Test Timer RunL ran only once and check performance.
   1.637 +		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   1.638 +		timeResults.Reset();
   1.639 +		
   1.640 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.641 +		TEST(err==KErrNone);
   1.642 +		// Test directory scanning has and ONLY performed on E: drive
   1.643 +		TEST(timeResultsInfos.Count()==1);
   1.644 +		TEST(timeResultsInfos[0] == EDriveE);
   1.645 +		timeResultsInfos.Reset();
   1.646 +
   1.647 +	//3.2 before remounting: 	has plugins
   1.648 +	//    after remounting: 	has no plugins
   1.649 +		INFO_PRINTF1(_L("3.2 Before Remount: has plugins; 	After Remount: has no plugins"));
   1.650 +		// Clean up time records on server.
   1.651 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.652 +		TEST(err==KErrNone);
   1.653 +		timeRecords.Reset();
   1.654 +		DeleteRSCFolderOnDrive(EDriveE);
   1.655 +		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   1.656 +		User::After(KOneSecond * 3);
   1.657 +		
   1.658 +		// Now get all time records from server.
   1.659 +		TRAP(err, timeRecords.OpenL());
   1.660 +		TEST(err==KErrNone);
   1.661 +		TEST(timeRecords.Count() > 0);
   1.662 +		
   1.663 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.664 +		TEST(err==KErrNone);
   1.665 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.666 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.667 +		timeResults.Reset();
   1.668 +		
   1.669 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.670 +		TEST(err==KErrNone);
   1.671 +		// Test notifications ONLY triggered for E: drive
   1.672 +		TEST(timeResultsInfos.Count()==1);
   1.673 +		TEST(timeResultsInfos[0] == EDriveE);
   1.674 +		timeResultsInfos.Reset();
   1.675 +		
   1.676 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.677 +		TEST(err==KErrNone);
   1.678 +		// Test Timer RunL ran only once and check performance.
   1.679 +		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit, timeResults));
   1.680 +		timeResults.Reset();
   1.681 +		
   1.682 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.683 +		TEST(err==KErrNone);
   1.684 +		// Test directory scanning has and ONLY performed on E: drive
   1.685 +		TEST(timeResultsInfos.Count()==1);
   1.686 +		TEST(timeResultsInfos[0] == EDriveE);
   1.687 +		timeResultsInfos.Reset();
   1.688 +
   1.689 +	//3.3 before remounting: 	has no plugins
   1.690 +	//    after remounting: 	has plugins
   1.691 +		INFO_PRINTF1(_L("3.3 Before Remount: has no plugins; 	After Remount: has plugins"));
   1.692 +		// Clean up time records on server.
   1.693 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.694 +		TEST(err==KErrNone);
   1.695 +		timeRecords.Reset();
   1.696 +		CopyPluginCR629TestRSCOnDrive(EDriveE, 2);
   1.697 +		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   1.698 +		User::After(KOneSecond * 3);
   1.699 +		
   1.700 +		// Now get all time records from server.
   1.701 +		TRAP(err, timeRecords.OpenL());
   1.702 +		TEST(err==KErrNone);
   1.703 +		TEST(timeRecords.Count() > 0);
   1.704 +		
   1.705 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.706 +		TEST(err==KErrNone);
   1.707 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.708 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.709 +		timeResults.Reset();
   1.710 +		
   1.711 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.712 +		TEST(err==KErrNone);
   1.713 +		// Test notifications ONLY triggered for E: drive
   1.714 +		TEST(timeResultsInfos.Count()==1);
   1.715 +		TEST(timeResultsInfos[0] == EDriveE);
   1.716 +		timeResultsInfos.Reset();
   1.717 +		
   1.718 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.719 +		TEST(err==KErrNone);
   1.720 +		// Test Timer RunL ran only once and check performance.
   1.721 +		TEST(CheckTimeResults(TimerRunLScanTwoRSCsOnOneDriveLimit, timeResults));
   1.722 +		timeResults.Reset();
   1.723 +		
   1.724 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.725 +		TEST(err==KErrNone);
   1.726 +		// Test directory scanning has and ONLY performed on E: drive
   1.727 +		TEST(timeResultsInfos.Count()==1);
   1.728 +		TEST(timeResultsInfos[0] == EDriveE);
   1.729 +		timeResultsInfos.Reset();
   1.730 +
   1.731 +		DeleteRSCFolderOnDrive(EDriveE);
   1.732 +		User::After(KOneSecond * 3);
   1.733 +
   1.734 +	//3.4 before remounting: 	has no plugin
   1.735 +	//    after remounting: 	has no plugin
   1.736 +		INFO_PRINTF1(_L("3.4 Before Remount: has no plugins; 	After Remount: has no plugins"));
   1.737 +		// Clean up time records on server.
   1.738 +		TRAP(err, timeRecords.ResetRecordsOnServerL());
   1.739 +		TEST(err==KErrNone);
   1.740 +		timeRecords.Reset();
   1.741 +		TEST(fs.RemountDrive(EDriveE)==KErrNone);
   1.742 +		User::After(KOneSecond * 3);
   1.743 +		
   1.744 +		// Now get all time records from server.
   1.745 +		TRAP(err, timeRecords.OpenL());
   1.746 +		TEST(err==KErrNone);
   1.747 +		TEST(timeRecords.Count() > 0);
   1.748 +		
   1.749 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererNotifierRunL, timeResults));
   1.750 +		TEST(err==KErrNone);
   1.751 +		// Test notifications were triggered and check performance of RunL of Notifiers
   1.752 +		TEST(CheckTimeResults(NotifierRunLTimeLimit, timeResults));
   1.753 +		timeResults.Reset();
   1.754 +		
   1.755 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererNotifierRunL, timeResultsInfos));
   1.756 +		TEST(err==KErrNone);
   1.757 +		// Test notifications ONLY triggered for E: drive
   1.758 +		TEST(timeResultsInfos.Count()==1);
   1.759 +		TEST(timeResultsInfos[0] == EDriveE);
   1.760 +		timeResultsInfos.Reset();
   1.761 +		
   1.762 +		TRAP(err, timeRecords.RetrieveResultsByTypeL(ECDiscovererTimerRunL, timeResults));
   1.763 +		TEST(err==KErrNone);
   1.764 +		// Test Timer RunL ran only once and check performance.
   1.765 +		TEST(CheckTimeResults(TimerRunLScanZeroRSCOnOneDriveLimit, timeResults));
   1.766 +		timeResults.Reset();
   1.767 +		
   1.768 +		TRAP(err, timeRecords.RetrieveResultsInfoByTypeL(ECDiscovererRediscoveryScanDirectoryL, timeResultsInfos));
   1.769 +		TEST(err==KErrNone);
   1.770 +		// Test directory scanning has NOT performed
   1.771 +		TEST(timeResultsInfos.Count()==0);
   1.772 +		timeResultsInfos.Reset();
   1.773 +		
   1.774 +#endif // __WINSCW__
   1.775 +		
   1.776 +	// Final cleanup
   1.777 +	DeleteRSCFilesOnDrive(EDriveC);
   1.778 +	DeleteRSCFolderOnDrive(EDriveX);
   1.779 +	DeleteRSCFolderOnDrive(EDriveE);
   1.780 +#else
   1.781 +	MacroNotDefinedError();
   1.782 +#endif // __ECOM_SERVER_PERFORMANCE__
   1.783 +
   1.784 +	return TestStepResult();
   1.785 +	}