diff -r ae54820ef82c -r 245df5276b97 installationservices/swi/test/tsisregistrytest/sessionstep.cpp --- a/installationservices/swi/test/tsisregistrytest/sessionstep.cpp Tue Jul 06 14:23:31 2010 +0300 +++ b/installationservices/swi/test/tsisregistrytest/sessionstep.cpp Wed Aug 18 09:55:45 2010 +0300 @@ -46,7 +46,7 @@ #include "sisregistryproperty.h" #include - +#include "sisregistryaccess_client.h" const TInt KDefaultBufferSize = 2048; ///////////////////////////////////////////////////////////////////// // defs, Constants used by test steps @@ -243,6 +243,8 @@ TVerdict CModifiableFileStep::doTestStepL() { + + RArray theFileNames; CleanupClosePushL(theFileNames); GetStringArrayFromConfigL(ConfigSection(), KModFileName, theFileNames); @@ -2776,3 +2778,158 @@ SetTestStepResult(EPass); return TestStepResult(); } + +//////////////////////////////////////////////////////////////////////////// +// CAddAppRegInfoStep +//////////////////////////////////////////////////////////////////////////// +CAddAppRegInfoStep::CAddAppRegInfoStep() + { + SetTestStepName(KIsFileRegisteredStep); + } + +TVerdict CAddAppRegInfoStep::doTestStepL() + { + TPtrC regFileName; + if(!GetStringFromConfig(ConfigSection(), _L("regFileName"), regFileName)) + { + ERR_PRINTF1(_L("Reg File Name was not found in ini")); + User::Leave(KErrNotFound); + } + + RSisRegistryAccessSession sisRegistryAccessSessionSession; + User::LeaveIfError(sisRegistryAccessSessionSession.Connect()); + CleanupClosePushL(sisRegistryAccessSessionSession); + + TInt res = sisRegistryAccessSessionSession.AddAppRegInfoL(regFileName, iTimeMeasuredExternally ); + + if(res != KErrNone) + { + ERR_PRINTF2(_L("Application Registration data not added successfuly , error %d"),res); + User::Leave(res); + } + CleanupStack::Pop(&sisRegistryAccessSessionSession); + SetTestStepResult(EPass); + return TestStepResult(); + } + +//////////////////////////////////////////////////////////////////////////// +// CRemoveAppRegInfoStep +//////////////////////////////////////////////////////////////////////////// + +CRemoveAppRegInfoStep::CRemoveAppRegInfoStep() + { + SetTestStepName(KIsFileRegisteredStep); + } + +TVerdict CRemoveAppRegInfoStep::doTestStepL() + { + TPtrC regFileName; + if(!GetStringFromConfig(ConfigSection(), _L("regFileName"), regFileName)) + { + ERR_PRINTF1(_L("Reg File Name was not found in ini")); + User::Leave(KErrNotFound); + } + + RSisRegistryAccessSession sisRegistryAccessSessionSession; + User::LeaveIfError(sisRegistryAccessSessionSession.Connect()); + CleanupClosePushL(sisRegistryAccessSessionSession); + + TInt res = sisRegistryAccessSessionSession.RemoveAppRegInfoL(regFileName, iTimeMeasuredExternally ); + + if(res != KErrNone) + { + ERR_PRINTF2(_L("Application Registration data not added successfuly , error %d"),res); + User::Leave(res); + } + CleanupStack::PopAndDestroy(&sisRegistryAccessSessionSession); + SetTestStepResult(EPass); + return TestStepResult(); + } + +////////////////////// +//////CheckAppRegData +///////////////////// + +CheckAppRegData::CheckAppRegData() + { + SetTestStepName(KIsFileRegisteredStep); + } + +TVerdict CheckAppRegData::doTestStepL() + { + SetTestStepResult(EPass); + // Verify if the reg data is removed properly or not + TBool isAppDataExists(EFalse); + Usif::RSoftwareComponentRegistry scrSession; + User::LeaveIfError(scrSession.Connect()); + CleanupClosePushL(scrSession); + GetBoolFromConfig(ConfigSection(), _L("appDataExists"), isAppDataExists); + if(isAppDataExists) + { + TPtrC appFileName; + if(GetStringFromConfig(ConfigSection(), _L("appFileName"), appFileName)) + { + TUid appUid; + TInt intAppUid(0); + if(!GetHexFromConfig(ConfigSection(), _L("appUid"), intAppUid)) + { + User::Leave(KErrNotFound); + } + + appUid = TUid::Uid(intAppUid); + RArray appUidArray; + CleanupClosePushL(appUidArray); + appUidArray.AppendL(appUid); + + //check if we have rolled back to the reg in rom after removal + Usif::RApplicationInfoView appRegistryView; + CleanupClosePushL(appRegistryView); + Usif::CAppInfoFilter* appInfoFilter = Usif::CAppInfoFilter::NewLC(); + appInfoFilter->SetAllApps(); + appRegistryView.OpenViewL(scrSession, appInfoFilter); + RPointerArray appInfo; + CleanupClosePushL(appInfo); + appRegistryView.GetNextAppInfoL(5, appInfo); + + for(TInt i = 0; i < 5 ; ++i) + { + if(appInfo[i]->Uid() == appUid) + { + if(appInfo[i]->FullName().Compare(appFileName) != 0) + { + SetTestStepResult(EFail); + CleanupStack::Pop(&appInfo); + appInfo.ResetAndDestroy(); + CleanupStack::PopAndDestroy(4, &scrSession); // appInfoFilter, appRegistryView, appUid, scrSession + return TestStepResult(); + } + break; + } + } + CleanupStack::Pop(&appInfo); + appInfo.ResetAndDestroy(); + CleanupStack::PopAndDestroy(3, &appUidArray); // appInfoFilter, appRegistryView, + } + } + else + { + TUid appUid = TUid::Uid(0); + TInt intAppUid(0); + if(!GetHexFromConfig(ConfigSection(), _L("appUid"), intAppUid)) + { + User::Leave(KErrNotFound); + } + appUid = TUid::Uid(intAppUid); + + TRAPD(err, scrSession.GetComponentIdForAppL(appUid)); + if(err != KErrNotFound) + { + SetTestStepResult(EFail); + CleanupStack::PopAndDestroy(&scrSession); + return TestStepResult(); + } + } + + CleanupStack::PopAndDestroy(&scrSession); + return TestStepResult(); + }