installationservices/swi/test/tuiscriptadaptors/tswisstep.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
   905 			break;
   905 			break;
   906 
   906 
   907 		case EUseFileName:
   907 		case EUseFileName:
   908 			SetTestStepName(KSwisInstallStep);
   908 			SetTestStepName(KSwisInstallStep);
   909 			break;
   909 			break;
   910 			
       
   911 		case ECheckInstallPerformance:
       
   912 		    SetTestStepName(KSwisInstallPerformanceStep);
       
   913 		    break;
       
   914 		
   910 		
   915 		case EUseCAF:
   911 		case EUseCAF:
   916 			SetTestStepName(KSwisInstallCAFStep);
   912 			SetTestStepName(KSwisInstallCAFStep);
   917 			break;
   913 			break;
   918 
   914 
  1214 	CleanupStack::PopAndDestroy(&util);
  1210 	CleanupStack::PopAndDestroy(&util);
  1215 	CleanupStack::PopAndDestroy(prefs);
  1211 	CleanupStack::PopAndDestroy(prefs);
  1216 	return TestStepResult();
  1212 	return TestStepResult();
  1217 	}
  1213 	}
  1218 
  1214 
  1219 void CSwisInstallStep::PrintPerformanceLog(TTime aTime)
       
  1220     {
       
  1221     _LIT(KPerformanceTestInfo, "PERFORMANCE_LOG_INFORMATION");
       
  1222     TDateTime timer = aTime.DateTime();
       
  1223     INFO_PRINTF6(_L("%S,%d:%d:%d:%d"), &KPerformanceTestInfo(), timer.Hour(), timer.Minute(), timer.Second(), timer.MicroSecond());
       
  1224     }
       
  1225 
       
  1226 TInt CSwisInstallStep::DoInstallL(CInstallPrefs& aInstallPrefs)
  1215 TInt CSwisInstallStep::DoInstallL(CInstallPrefs& aInstallPrefs)
  1227 	{
  1216 	{
  1228 	switch (iInstallType)
  1217 	switch (iInstallType)
  1229 		{
  1218 		{
  1230 		case EUseFileName:
  1219 		case EUseFileName:
  1235 			else
  1224 			else
  1236 				error = Launcher::Install(*iUi, iSisFileName, aInstallPrefs);
  1225 				error = Launcher::Install(*iUi, iSisFileName, aInstallPrefs);
  1237 			return error;
  1226 			return error;
  1238 			}
  1227 			}
  1239 
  1228 
  1240 		case ECheckInstallPerformance:
       
  1241 		    {
       
  1242 		    _LIT(KMaxDurationName, "MaxDuration");
       
  1243             _LIT(KMaxTestCaseDuration, "TEST_CASE_MAXIMUM_ALLOWED_DURATION");
       
  1244             _LIT(KActualTestCaseDuration, "TEST_CASE_ACTUAL_DURATION");
       
  1245             
       
  1246             TInt maxDuration = 0;
       
  1247             if(!GetIntFromConfig(ConfigSection(), KMaxDurationName, maxDuration))
       
  1248                 {
       
  1249                 ERR_PRINTF2(_L("%S could not be found in configuration."), &KMaxDurationName());
       
  1250                 User::Leave(KErrNotFound);
       
  1251                 }
       
  1252             
       
  1253 		    TInt error;
       
  1254 		    TTime startTime, endTime;
       
  1255 		    startTime.HomeTime(); // Set the start time
       
  1256 		    PrintPerformanceLog(startTime);
       
  1257 		    
       
  1258             if (iUseDeviceLanguages)
       
  1259                 error = Launcher::Install(*iUi, iSisFileName, aInstallPrefs, iDeviceLanguages);
       
  1260             else
       
  1261                 error = Launcher::Install(*iUi, iSisFileName, aInstallPrefs);
       
  1262             
       
  1263             // Calculate the time taken for installation in milliseconds
       
  1264             endTime.HomeTime();
       
  1265             PrintPerformanceLog(endTime);            
       
  1266             TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime);
       
  1267             TInt actualDuration = I64INT(duration.Int64())/1000;
       
  1268             
       
  1269             INFO_PRINTF3(_L("%S,%d"), &KMaxTestCaseDuration(), maxDuration);
       
  1270             INFO_PRINTF3(_L("%S,%d"), &KActualTestCaseDuration(), actualDuration);
       
  1271                         
       
  1272             if(actualDuration <= maxDuration)
       
  1273                 {
       
  1274                 INFO_PRINTF2(_L("This test meets performance requirement (Duration=%d)."), actualDuration);
       
  1275                 }
       
  1276             else
       
  1277                 {
       
  1278                 ERR_PRINTF2(_L("This test does not meet performance requirement (Duration=%d)."), actualDuration);
       
  1279                 error = KErrGeneral;
       
  1280                 SetTestStepResult(EFail);
       
  1281                 }
       
  1282                 
       
  1283             return error;
       
  1284 		    }
       
  1285 
  1229 
  1286 		case EUseOpenFileName:
  1230 		case EUseOpenFileName:
  1287 		// open the file as a shared for readers only
  1231 		// open the file as a shared for readers only
  1288 			{
  1232 			{
  1289 			RFs fs;
  1233 			RFs fs;
  2077 	{
  2021 	{
  2078 	}
  2022 	}
  2079 
  2023 
  2080 CSwisMmcStep::~CSwisMmcStep()
  2024 CSwisMmcStep::~CSwisMmcStep()
  2081 	{
  2025 	{
  2082 	#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  2083 	#ifndef SWI_TEXTSHELL_ROM
  2026 	#ifndef SWI_TEXTSHELL_ROM
  2084 	if (iBootMode != KTextShell)
  2027 	if (iBootMode != KTextShell)
  2085 		{
  2028 		{
  2086 		delete iSwiSidChecker;
  2029 		delete iSwiSidChecker;
  2087 		}
  2030 		}
  2088 	#endif
  2031 	#endif
  2089 	#endif
       
  2090 	}
  2032 	}
  2091 
  2033 
  2092 TVerdict CSwisMmcStep::doTestStepPreambleL()
  2034 TVerdict CSwisMmcStep::doTestStepPreambleL()
  2093 	{
  2035 	{
  2094 	// Get the System Startup Mode
  2036 	// Get the System Startup Mode
  2095 	User::LeaveIfError(RProperty::Get(KUidSystemCategory, KSystemStartupModeKey, iBootMode));
  2037 	User::LeaveIfError(RProperty::Get(KUidSystemCategory, KSystemStartupModeKey, iBootMode));
  2096 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK	
       
  2097 #ifndef SWI_TEXTSHELL_ROM
  2038 #ifndef SWI_TEXTSHELL_ROM
  2098 	if (iBootMode != KTextShell)
  2039 	if (iBootMode != KTextShell)
  2099 		{
  2040 		{
  2100 		if(!iSwiSidChecker && iOperation == EQuerySidViaApparcPlugin)
  2041 		if(!iSwiSidChecker && iOperation == EQuerySidViaApparcPlugin)
  2101 			{
  2042 			{
  2107 			}
  2048 			}
  2108 		}
  2049 		}
  2109 #else
  2050 #else
  2110 	// Since in Textshell ROM SSCForStartupMode1_target.rsc was replaces as SSCForStartupMode0.rsc
  2051 	// Since in Textshell ROM SSCForStartupMode1_target.rsc was replaces as SSCForStartupMode0.rsc
  2111 	// we always get the boot mode as 0 , reset the value to 1.
  2052 	// we always get the boot mode as 0 , reset the value to 1.
  2112 	iBootMode = KTextShell;
       
  2113 #endif
       
  2114 #else
       
  2115 	iBootMode = KTextShell;
  2053 	iBootMode = KTextShell;
  2116 #endif
  2054 #endif
  2117 
  2055 
  2118 	RFs fs;
  2056 	RFs fs;
  2119 	User::LeaveIfError(fs.Connect());
  2057 	User::LeaveIfError(fs.Connect());
  2402 						{
  2340 						{
  2403 						expectMatchingDrives = 4;
  2341 						expectMatchingDrives = 4;
  2404 						}
  2342 						}
  2405 			
  2343 			
  2406 					TInt presentMatchingDrives = 0;
  2344 					TInt presentMatchingDrives = 0;
  2407 					#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  2408 					for(TInt drive=EDriveA; drive<=EDriveZ; ++drive)
  2345 					for(TInt drive=EDriveA; drive<=EDriveZ; ++drive)
  2409 						{
  2346 						{
  2410 							if(iSwiSidChecker->AppRegisteredAt(sid, drive))
  2347 							if(iSwiSidChecker->AppRegisteredAt(sid, drive))
  2411 								{
  2348 								{
  2412 								// Adds new bit to bit mask if return is true.
  2349 								// Adds new bit to bit mask if return is true.
  2413 								presentMatchingDrives = presentMatchingDrives + (1 << (drive - EDriveA));
  2350 								presentMatchingDrives = presentMatchingDrives + (1 << (drive - EDriveA));
  2414 								INFO_PRINTF2(_L("AppRegisteredAt returned true for drive: %d"), drive);
  2351 								INFO_PRINTF2(_L("AppRegisteredAt returned true for drive: %d"), drive);
  2415 								}  
  2352 								}  
  2416 						}
  2353 						}
  2417 					#endif
  2354 			
  2418 					if(presentMatchingDrives != expectMatchingDrives)
  2355 					if(presentMatchingDrives != expectMatchingDrives)
  2419 						{
  2356 						{
  2420 						WARN_PRINTF4(_L("Matching drives mismatch for exe, SID = 0x%x - expected %d got %d"), 
  2357 						WARN_PRINTF4(_L("Matching drives mismatch for exe, SID = 0x%x - expected %d got %d"), 
  2421 									sid, expectMatchingDrives, presentMatchingDrives);
  2358 									sid, expectMatchingDrives, presentMatchingDrives);
  2422 						SetTestStepResult(EFail);
  2359 						SetTestStepResult(EFail);
  3017 //
  2954 //
  3018 // This ECOM loader function in apfile.dll is NOT exported so we need
  2955 // This ECOM loader function in apfile.dll is NOT exported so we need
  3019 // to duplicate it here so we can load the apparc plugin to be able to test it.
  2956 // to duplicate it here so we can load the apparc plugin to be able to test it.
  3020 //
  2957 //
  3021 //const TUid KAppSidCheckerInterfaceUid = {0x10281FBB};
  2958 //const TUid KAppSidCheckerInterfaceUid = {0x10281FBB};
  3022 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  3023 #ifndef SWI_TEXTSHELL_ROM
  2959 #ifndef SWI_TEXTSHELL_ROM
  3024 const TUid KAppSidCheckerInterfaceUidv2 = {0x20007D8C};
  2960 const TUid KAppSidCheckerInterfaceUidv2 = {0x20007D8C};
  3025 
  2961 
  3026 CAppSidChecker* CAppSidChecker::CheckerForAppType(TUid aAppTypeUid)
  2962 CAppSidChecker* CAppSidChecker::CheckerForAppType(TUid aAppTypeUid)
  3027 	{
  2963 	{
  3035 			_FOFF(CAppSidChecker, iDtor_ID_Key),
  2971 			_FOFF(CAppSidChecker, iDtor_ID_Key),
  3036 			NULL, resolverParams) );
  2972 			NULL, resolverParams) );
  3037 	return reinterpret_cast<CAppSidChecker*>(ptr);
  2973 	return reinterpret_cast<CAppSidChecker*>(ptr);
  3038 	}
  2974 	}
  3039 #endif
  2975 #endif
  3040 #endif
  2976 
  3041 /////
  2977 /////
  3042 //Step to Set RemoveWithLastDependent property
  2978 //Step to Set RemoveWithLastDependent property
  3043 /////
  2979 /////
  3044 
  2980 
  3045 CSwisSetRemoveWithLastDependent::CSwisSetRemoveWithLastDependent()
  2981 CSwisSetRemoveWithLastDependent::CSwisSetRemoveWithLastDependent()