diff -r 7333d7932ef7 -r 8b7f4e561641 installationservices/swi/test/tuiscriptadaptors/swifileutilitysteps.cpp --- a/installationservices/swi/test/tuiscriptadaptors/swifileutilitysteps.cpp Tue Aug 31 15:21:33 2010 +0300 +++ b/installationservices/swi/test/tuiscriptadaptors/swifileutilitysteps.cpp Wed Sep 01 12:22:02 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" @@ -128,3 +128,69 @@ SetTestStepResult(EPass); return TestStepResult(); } + + +CSwiFileExistsStep::CSwiFileExistsStep() + { + SetTestStepName(KSwiFileExistsStep); + } + + +TVerdict CSwiFileExistsStep::doTestStepL() + { + SetTestStepResult(EFail); + + RTestUtilSessionSwi testUtil; + User::LeaveIfError(testUtil.Connect()); + CleanupClosePushL(testUtil); + + _LIT(KNoOfFiles, "FilesCount"); + _LIT(KFile, "File"); + + TInt filesCount(0); + GetIntFromConfig(ConfigSection(), KNoOfFiles(), filesCount); + + if(filesCount == 0) + { + User::Leave(KErrArgument); + } + + for(TInt i=0; i file; + file = KFile; + GenerateIndexedAttributeNameL(file, filesCount); + + TPtrC fileName; + GetStringFromConfig(ConfigSection(), file, fileName); + + HBufC* fileNameBuf = fileName.AllocLC(); + TBool result= testUtil.FileExistsL(*fileNameBuf); + + if(!result) + { + INFO_PRINTF2(_L("File not found - %S ."), fileNameBuf); + CleanupStack::PopAndDestroy(fileNameBuf); + return TestStepResult(); + } + else + { + INFO_PRINTF2(_L("File exists - %S ."), fileNameBuf); + CleanupStack::PopAndDestroy(fileNameBuf); + } + } + + CleanupStack::PopAndDestroy(&testUtil); + + SetTestStepResult(EPass); + return TestStepResult(); + } + + +void CSwiFileExistsStep::GenerateIndexedAttributeNameL(TDes& aInitialAttributeName, TInt aIndex) + { + const TInt MAX_INT_STR_LEN = 8; + TBuf integerAppendStr; + integerAppendStr.Format(_L("%d"), aIndex); + aInitialAttributeName.Append(integerAppendStr); + }