static void RecursiveRmDir(const TDesC& aDes) // // Delete directory contents recursively // { CDir* pD; TFileName n=aDes; n.Append(_L("*")); TInt r=TheFs.GetDir(n,KEntryAttMaskSupported,EDirsLast,pD); if (r==KErrNotFound || r==KErrPathNotFound) return; test_KErrNone(r); TInt count=pD->Count(); TInt i=0; while (i<count) { const TEntry& e=(*pD)[i++]; if (e.IsDir()) { TFileName dirName; dirName.Format(_L("%S%S\\"),&aDes,&e.iName); RecursiveRmDir(dirName); } else { TFileName fileName; fileName.Format(_L("%S%S"),&aDes,&e.iName); r=TheFs.Delete(fileName); test_KErrNone(r); } } delete pD; r=TheFs.RmDir(aDes); test_KErrNone(r); }
// ----------------------------------------------------------------------------- // CCapInfo::WriteSolutionTagL() // Writes SyncSolutionsService solution data to capability object. // ----------------------------------------------------------------------------- // void CCapInfo::WriteSolutionTagL( const TDesC& aContentName, const TSConSolutionInfo& aSolution ) { TRACE_FUNC_ENTRY; _LIT( KFormatUID, "UID=0x%08x" ); _LIT( KFormatName, "Name=%S" ); _LIT( KFormatDate, "Timestamp=%04d%02d%02dT%02d%02d%02dZ" ); WriteTagL( EExt, TXmlParser::EElementBegin ); WriteValueL( EXNam, aContentName ); TFileName temp; temp.Format( KFormatUID, aSolution.iUid ); WriteValueL( EXVal, temp ); temp.Format( KFormatName, &aSolution.iSolutionName ); WriteValueL( EXVal, temp ); if ( aSolution.iTime.Int64() != 0 ) { // write time TDateTime time = aSolution.iTime.DateTime(); temp.Format( KFormatDate, time.Year(), time.Month() + 1, time.Day() + 1, time.Hour(), time.Minute(), time.Second() ); WriteValueL( EXVal, temp ); } WriteTagL( EExt, TXmlParser::EElementEnd ); TRACE_FUNC_EXIT; }
void CPKCS12Handler::SaveCertificatesToDiskL() { LOG_("-> CPKCS12Handler::SaveCertificatesToDiskL()"); TInt certCount(0); // first the CAs (if any; not required necessarily) if (iCACerts) { certCount = iCACerts->Count(); LOG_1(" Saving %d CA Certificates", certCount); for (TInt i = 0; i < certCount; i++) { CX509Certificate* cert = iCACerts->At(i); // Generate filename with running identifier // Use TFileName, because the function isn't stack // critical TFileName fn; fn.Format(KCAFileNameStem(), i+1); WriteToFileL(cert->Encoding(), fn); } } LOG(else LOG_(" No CA Certs found!")); // Then the user certs if (iUserCerts) { certCount = iUserCerts->Count(); LOG_1(" Saving %d User Certificates", certCount); for (TInt i = 0; i < certCount; i++) { CX509Certificate* cert = iUserCerts->At(i); TFileName fn; fn.Format(KUserCertFileNameStem(), i+1); WriteToFileL(cert->Encoding(), fn); } } LOG(else LOG_(" No User Certs found!")); LOG_("<- CPKCS12Handler::SaveCertificatesToDiskL()"); }
// --------------------------------------------------------------------------- // CTestStartupListUpdater::ConstructL // --------------------------------------------------------------------------- // void CTestStartupListUpdater::ConstructL() { // Read settings to check if test case name is to be appended to file name. RSettingServer settingsServer; User::LeaveIfError( settingsServer.Connect() ); CleanupClosePushL( settingsServer ); TLoggerSettings loggerSettings; User::LeaveIfError( settingsServer.GetLoggerSettings( loggerSettings ) ); CleanupStack::PopAndDestroy( &settingsServer ); TFileName logFileName; if( loggerSettings.iAddTestCaseTitle ) { TName title; TestModuleIf().GetTestCaseTitleL( title ); logFileName.Format( KTestStartupListUpdaterLogFileWithTitle, &title ); } else { logFileName.Copy( KTestStartupListUpdaterLogFile ); } iLog = CStifLogger::NewL( KTestStartupListUpdaterLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); }
// ----------------------------------------------------------------------------- // DataFileL // return data filename as a TParse // ----------------------------------------------------------------------------- // LOCAL_C TParse DataFileL(RFs& aFs) { TBuf<256> path; TParse p; User::LeaveIfError(aFs.PrivatePath(path)); #ifndef RD_MULTIPLE_DRIVE p.Set(KHelperServerDataStorage,&path,NULL); #else //RD_MULTIPLE_DRIVE TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); aFs.DriveToChar( driveNumber, driveLetter ); TFileName helperServerDataStorage; helperServerDataStorage.Format( KHelperServerDataStorage, (TUint)driveLetter ); p.Set( helperServerDataStorage, &path, NULL ); #endif return p; }
TInt TFileOps::Open(TChar aDrvCh, TInt aNum) /// Open the file for testing, give error if there is not enough space for it. /// @param aDrvCh Drive letter. /// @param aNum File number suffix. { TVolumeInfo vol; TInt drv; TInt r = TheFs.CharToDrive(aDrvCh, drv); if (r != KErrNone) TTest::Fail(HERE, _L("CharToDrive(%c) returned %d"), (TUint)aDrvCh, r); r = TheFs.Volume(vol, drv); if (r != KErrNone) TTest::Fail(HERE, _L("Volume(%c:) returned %d"), (TUint)aDrvCh, r); iMax = I64LOW(vol.iFree / MAKE_TINT64(0,KBufLen)) / 2 - 1; if (iMax < 10) TTest::Fail(HERE, _L("Not enough space to do test, only %d KB available"), I64LOW(vol.iFree/1024)); Reset(); iName.Format(_L("%c:\\TEST_%d"), (TUint)aDrvCh, aNum); r = iF.Replace(TheFs, iName, EFileStreamText | EFileWrite); if (r == KErrNone) iOpen = ETrue; return r; }
void ThreadTestL(TInt aThread) { RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive())); TParse testIniFile; testIniFile.Set(drive.Name(), &KTestIniFile, NULL); TIniData data; CDictionaryStore* dict=CDictionaryFileStore::OpenLC(fs,testIniFile.FullName(),KTestUid); data.LoadL(*dict); CleanupStack::PopAndDestroy(); // dict TParse threadTestPath; threadTestPath.Set(drive.Name(), &KThreadTestPath, NULL); TFileName name; name.Format(threadTestPath.FullName(),aThread); dict=CDictionaryFileStore::OpenLC(fs,name,KTestUid); data.SaveL(*dict); dict->CommitL(); CleanupStack::PopAndDestroy(); TReal x=0.501; for (TInt ii=0;ii<1000;++ii) x=4.0*x*(1.0-x); dict=CDictionaryFileStore::OpenLC(fs,name,KTestUid); data.LoadL(*dict); CleanupStack::PopAndDestroy(); // dict fs.Delete(name); CleanupStack::PopAndDestroy(); // fs }
LOCAL_C TParse DataFile() #endif { #ifdef _DRM_TESTING TRAP_IGNORE( WriteL(_L8("DataFile")) ); #endif TParse p; #ifndef RD_MULTIPLE_DRIVE p.Set(KDbFileLocation,NULL,NULL); #else //RD_MULTIPLE_DRIVE TInt driveNumber( -1 ); TChar driveLetter; DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber ); aFs.DriveToChar( driveNumber, driveLetter ); TFileName dbFile; dbFile.Format( KDbFileLoc, (TUint)driveLetter ); p.Set(dbFile,NULL,NULL); #endif return p; }
LOCAL_C TInt MakeFileName(TInt aThreadId, TInt aFileNumber, RFs & aFs, TFileName& aName, TBool aMakeDir) // // creates a file name and makes all the directory components, if required // { TFileName path; path.Format(KPath, aThreadId); TChar driveLetter; TInt r; r = aFs.DriveToChar(gDriveNumber, driveLetter); if (r != KErrNone) { LogError(r, KDriveToChar, KNullDesC, driveLetter, 0); aFs.Close(); return(r); } path[0] = (TText) driveLetter; r = aFs.SetSessionPath(path); if (r != KErrNone) { LogError(r, KSetSessPath, path, 0, 0); aFs.Close(); return(r); } // add additional directories TInt fileNumber; fileNumber = aFileNumber; r = AppendPath(path, fileNumber, 0); if(r != KErrNone) { LogError(r, KAppendPath, path, fileNumber, 0); aFs.Close(); return(r); } if(aMakeDir) { r = aFs.MkDirAll(path); if (r != KErrNone && r != KErrAlreadyExists) { LogError(r, KMdAll, path, 0, 0); aFs.Close(); return(r); } } // and finally add file name path.Append(KFilePrefix); path.AppendNum(aFileNumber); aName = path; return(KErrNone); }
// ----------------------------------------------------------------------------- // CSifUiTest::RunTestCaseL // ----------------------------------------------------------------------------- // TInt CSifUiTest::RunTestCaseL( const TInt aCaseNumber, const TFileName& /*aConfig*/, TTestResult& aResult ) { if( !iVersionLogged ) { SendTestModuleVersion(); iVersionLogged = ETrue; } TInt returnValue = KErrNone; TCaseInfo caseInfo = Case ( aCaseNumber ); if( caseInfo.iMethod != NULL ) { _LIT( KLogStartTC, "Starting testcase [%S]" ); iLog->Log( KLogStartTC, &caseInfo.iCaseName ); // Switch to use test case (TC) logger if necessary if( iAddTestCaseTitleToLogName ) { if( iTCLog ) { delete iTCLog; iTCLog = NULL; } TName title; TestModuleIf().GetTestCaseTitleL( title ); TFileName logFileName; logFileName.Format( KSifUiTestLogFileWithTitle, &title ); iTCLog = CStifLogger::NewL( KSifUiTestLogPath, logFileName ); iLog = iTCLog; } // Run test case iMethod = caseInfo.iMethod; TRAPD( err, returnValue = ( this->*iMethod )( aResult ) ); // Restore standard log and close test case logger if( iAddTestCaseTitleToLogName ) { iLog = iStdLog; delete iTCLog; iTCLog = NULL; } // Leave if the case execution failed User::LeaveIfError( err ); } else { returnValue = KErrNotFound; } // Return case execution status (not the result of the case execution) return returnValue; }
void CBCTestPtiEngine::TestSpellL() { TBuf<8> spell; TInt err=iEngine->GetSpelling(0x7684, spell, EPtiPinyin); if(err==KErrNotSupported) { AssertTrueL(ETrue, _L("get spelling not support")); } else if(err==KErrNone) { spell.ZeroTerminate(); AssertTrueL(ETrue, spell); } else { AssertTrueL(ETrue, _L("get spelling failuer")); } //phonetic iEngine->ClearCurrentWord(); SimuInput(iEngine, _L("wei")); TInt number = iEngine->PhoneticSpellingCount(); TFileName msg; msg.Format(_L("phonetic spelling count: %d"), number); msg.ZeroTerminate(); AssertTrueL(ETrue, msg); spell=iEngine->GetPhoneticSpelling(0); AssertTrueL(ETrue, _L("get phonetic spelling for 0")); TBool result = iEngine->SelectPhoneticSpelling(0); AssertTrueL(ETrue, _L("select phonetic spelling for 0")); number = iEngine->SelectedPhoneticSpelling(); msg.Format(_L("selected phonetic spelling: %d"), number); msg.ZeroTerminate(); AssertTrueL(ETrue, msg); CDesCArray* array = new (ELeave) CDesCArrayFlat(16); CleanupStack::PushL(array); iEngine->GetPhoneticSpellingsL(*array); AssertTrueL(ETrue, _L("phonetic spellings got")); CleanupStack::PopAndDestroy(); //array }
// ----------------------------------------------------------------------------- // CCapInfo::ServiceInfoL(const TDesC& aDir) // Reads service xml-files from directory and writes them into capability // document. // ----------------------------------------------------------------------------- // void CCapInfo::ServiceInfoL(const TDesC& aDir, const RArray<TFileName>& aExcludeList, RArray<TFileName>& aFilesAdded) { TRACE_FUNC_ENTRY; CCapList* capList=CapList(); RArray<TFileName> array( KDefaultArrayGranularity ); CleanupClosePushL(array); CStringList* stringList=CStringList::NewLC(); CapUtil::GetFileListL(iFsSession, aDir, array); _LIT(KFormat, "%S%S"); TFileName name; TInt count=array.Count(); for (TInt i=0; i<count; i++) { TBool exludeFromList(EFalse); // Check if file is already added to list for ( TInt j=0; j<aExcludeList.Count() && !exludeFromList; j++ ) { if ( array[i].CompareF(aExcludeList[j]) == 0 ) { LOGGER_WRITE_1( "match found at pos %d", j); exludeFromList = ETrue; } } if ( !exludeFromList ) { name.Format(KFormat, &aDir, &array[i]); if (!CapUtil::CheckFileType(name, KXmlExtension)) { continue; // only accept .xml files } capList->List()->Reset(); capList->List()->ReadFromFileL( iFsSession, name ); if (capList->FindServiceL(stringList)) { WriteNewLineL(); WriteFromListL(stringList); User::LeaveIfError( aFilesAdded.Append(array[i]) ); LOGGER_WRITE_1( "File '%S' added to list", &array[i] ); } } } CleanupStack::PopAndDestroy(stringList); CleanupStack::PopAndDestroy(&array); TRACE_FUNC_EXIT; }
// ========================================================================== // FUNCTION: CreateContentSubdirectoriesL // ========================================================================== void CContainerStoreContentManager::CreateContentSubdirectoriesL() { TFileName directoryName; for( TInt i = 0; i < KNumberOfContentSubdirectories; i++ ) { _LIT( KFormatString, "%SC%i\\" ); directoryName.Format( KFormatString, &iUtils.PrivatePath(), i ); BaflUtils::EnsurePathExistsL( iUtils.FileSystem(), directoryName ); } // end for } // end CreateContentSubdirectoriesL
// ----------------------------------------------------------------------------- // Ctestsdktouchpane::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CTestSDKTouchPane::ConstructL() { iView = CTestSDKTPView::NewL(); iContainer = new( ELeave ) CTestSDKTPContainer(); iContainer->SetMopParent( iView ); iContainer->ConstructL( iView->ClientRect() ); CCoeEnv::Static()->AppUi()->AddToStackL( iContainer ); iContainer->MakeVisible( ETrue ); //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; CleanupClosePushL( settingServer ); TInt ret = settingServer.Connect(); if ( ret != KErrNone ) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings( loggerSettings ); if ( ret != KErrNone ) { User::Leave( ret ); } // Close Setting server session settingServer.Close(); CleanupStack::PopAndDestroy( &settingServer ); TFileName logFileName; if ( loggerSettings.iAddTestCaseTitle ) { TName title; TestModuleIf().GetTestCaseTitleL( title ); logFileName.Format( KtestsdktouchpaneLogFileWithTitle, &title ); } else { logFileName.Copy( KtestsdktouchpaneLogFile ); } iLog = CStifLogger::NewL( KtestsdktouchpaneLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); iOffset = CCoeEnv::Static()->AddResourceFileL( _L( "C:\\resource\\testsdktouchpane.rsc" ) ); }
// ----------------------------------------------------------------------------- // CCapInfo::FolderServiceL() // Writes folder service. Notice that this service is created in code because // pathinfo component is used to get folder names. // ----------------------------------------------------------------------------- // void CCapInfo::FolderServiceL() { TRACE_FUNC_ENTRY; TBuf<KBufSize> rootPath; TBuf<KBufSize> memoryType(KNullDesC); TFileName folderName; _LIT( KFormat, "%S%S" ); WriteNewLineL(); WriteTagL(EService, TXmlParser::EElementBegin); WriteValueL(EName, KFolderServiceName); WriteValueL(EUUID, KFolderServiceUid); WriteValueL(EVersion, KFolderServiceVersion); WriteTagL(EObject, TXmlParser::EElementBegin); WriteValueL(EType, KFolderServiceType); WriteTagL(EObject, TXmlParser::EElementEnd); TInt drive; TInt err; CapUtil::GetDefaultRootPathL( iFsSession, rootPath ); if( rootPath.Length() > 0 ) { err = iFsSession.CharToDrive( rootPath[0], drive ); if( err == KErrNone ) { CapUtil::GetMemoryType( iFsSession, memoryType, drive ); } } // EFolderImages folderName.Format( KFormat, &rootPath, &PathInfo::ImagesPath() ); WriteFolderL( KFolderImages, folderName, memoryType ); // EFolderGraphics folderName.Format( KFormat, &rootPath, &PathInfo::ImagesPath() ); WriteFolderL(KFolderGraphics, folderName, memoryType); // EFolderTones folderName.Format( KFormat, &rootPath, &PathInfo::DigitalSoundsPath() ); WriteFolderL(KFolderTones, folderName, memoryType); // EFolderMusic folderName.Format( KFormat, &rootPath, &PathInfo::SoundsPath() ); WriteFolderL(KFolderMusic, folderName, memoryType); // EFolderVideos folderName.Format( KFormat, &rootPath, &PathInfo::VideosPath() ); WriteFolderL(KFolderVideos, folderName, memoryType); // EFolderInstalls folderName.Format( KFormat, &rootPath, &PathInfo::InstallsPath() ); WriteFolderL(KFolderInstalls, folderName, memoryType); WriteTagL(EService, TXmlParser::EElementEnd); WriteNewLineL(); TRACE_FUNC_EXIT; }
TInt CCapabilityTestStep::TestDeferCaps(TInt aDeferIPCNo) { TInt result=0; TFileName csymodule; TFileName csyport; TInt port=0; switch(aDeferIPCNo) { case KCommOpenWithEcuart2: port++; case KCommOpenWithEcuart1: port++; case KCommOpenWithEcuart0: SR_MESSAGE_ID = ECommOpen; csymodule = _L("Ecuart"); csyport.Format(_L("COMM::%d"), port); break; case KCommOpenWithDummy2: port++; case KCommOpenWithDummy1: port++; case KCommOpenWithDummy0: default: SR_MESSAGE_ID = ECommOpen; csymodule = _L("Dummy"); csyport.Format(_L("%S::%d"), &csymodule, port); break; } const TDesC& module = csymodule; const TDesC& name = csyport; //Step 1: Load the CSY result = SendReceive(ECommLoadCommModule, TIpcArgs(&module)); //Step 2: Open the Port, (creating a subsession!!) return SendReceive(SR_MESSAGE_ID, TIpcArgs(&name,0,0,0)); }
void CMMCScBkupReadDataTransferRequestBase::DumpTransferDataL( RFs& aFsSession, const TDesC8& aData ) const { TPtrC subDirectory( KNullDesC ); // switch( ElementType() ) { case EMMCScBkupOwnerDataTypeJavaData: subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataJava); break; case EMMCScBkupOwnerDataTypeSystemData: subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataSystem); break; case EMMCScBkupOwnerDataTypePassiveData: subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataPassive); break; case EMMCScBkupOwnerDataTypeActiveData: subDirectory.Set(KMMCScBkupDataTransferDebuggingPathDataActive); break; default: User::Leave( KErrNotSupported ); break; } // const TSecureId secureId = DataOwner().SecureId(); _LIT(KMMCScBkupFormatDes, "%S%S"); TFileName transferDumpFileName; const TDesC& path = PathInfo::MemoryCardRootPath(); transferDumpFileName.Format(KMMCScBkupFormatDes, &path, &KMMCScBkupDataTransferDebuggingPathRoot); transferDumpFileName.Append( subDirectory ); transferDumpFileName.Append( KMMCScBkupDataTransferDebuggingPathDataRestore ); transferDumpFileName.AppendFormat( KMMCScBkupDataTransferDebuggingFileName, secureId.iId, 'a' + CurrentDrive() ); // RFile64 file; TInt error = KErrNone; TEntry entry; if ( aFsSession.Entry( transferDumpFileName, entry ) == KErrNone ) { // Already exists - append data error = file.Open( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); } else { entry.iSize = 0; error = file.Create( aFsSession, transferDumpFileName, EFileWrite | EFileStream | EFileShareExclusive ); } // User::LeaveIfError( error ); CleanupClosePushL( file ); error = file.Write( entry.iSize, aData ); CleanupStack::PopAndDestroy( &file ); }
// ========================================================================== // FUNCTION: CleanupTemporaryFile // ========================================================================== void CContainerStoreContentManager::WipeContentFiles( RFs& aFs ) { TFileName privatePath; TFileName directoryNameWithWildcard; aFs.PrivatePath( privatePath ); for( TInt i = 0; i < KNumberOfContentSubdirectories; i++ ) { _LIT( KFormatString, "%SC%i\\*" ); directoryNameWithWildcard.Format( KFormatString, &privatePath, i ); BaflUtils::DeleteFile( aFs, directoryNameWithWildcard ); } // end for }
void CTErrorStep::SetupErrorResFilesL() { // Create target path for resource files TInt err = iUtils.CreateDirectoryL(KLitV2ResFilePath); if(err != KErrNone && err != KErrAlreadyExists) { ERR_PRINTF2(_L("Create directory '%S' failed"), KLitV2ResFilePath); User::LeaveIfError(err); } // Delete any previous file from the test if any TParse parse; TBuf<128> path = KLitV2ResFilePath(); User::LeaveIfError(parse.Set(KResFileWild, &path, NULL)); err = iUtils.DeleteFileUsingWildcardL(parse.FullName()); if((err != KErrNone) && (err != KErrNotFound) && (err != KErrPathNotFound)) { ERR_PRINTF2(_L("DeleteFileUsingWildcardL for '%S' failed"), &parse.FullName()); User::LeaveIfError(err); } // Copy error resource files to target path previously created. TFileName src; TFileName trg; for(TInt index=EResFile1; index<=EResFile5; ++index) { src.Format(KSrcErrorResFileFmt, TTErrorResFile(index)); trg.Format(KTrgErrorResFileFmt, TTErrorResFile(index)); err = iUtils.CopyFileL(src,trg); if(err != KErrNone) { ERR_PRINTF2(_L("Copying resource file '%S' failed"), &src); User::LeaveIfError(err); } } }
// ----------------------------------------------------------------------------- // CTestSDKButtons::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CTestSDKButtons::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; CleanupClosePushL( settingServer ); TInt ret = settingServer.Connect(); if(ret != KErrNone) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings(loggerSettings); if(ret != KErrNone) { User::Leave(ret); } // Close Setting server session settingServer.Close(); CleanupStack::PopAndDestroy( &settingServer ); TFileName logFileName; if(loggerSettings.iAddTestCaseTitle) { TName title; TestModuleIf().GetTestCaseTitleL(title); logFileName.Format(KtestsdkbuttonsLogFileWithTitle, &title); } else { logFileName.Copy(KtestsdkbuttonsLogFile); } iLog = CStifLogger::NewL( KtestsdkbuttonsLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); TRect rect = CEikonEnv::Static()->EikAppUi()->ClientRect(); iContainer = CButtonControl::NewL( rect ); iOffset = CCoeEnv::Static()->AddResourceFileL( KResourceFile ); SendTestClassVersion(); }
// ----------------------------------------------------------------------------- // CTestSdkPrivateUiFramework::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CTestSdkPrivateUiFramework::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; CleanupClosePushL( settingServer ); TInt ret = settingServer.Connect(); if ( ret != KErrNone ) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings( loggerSettings ); if ( ret != KErrNone ) { User::Leave( ret ); } // Close Setting server session settingServer.Close(); CleanupStack::PopAndDestroy( &settingServer ); TFileName logFileName; if ( loggerSettings.iAddTestCaseTitle ) { TName title; TestModuleIf().GetTestCaseTitleL( title ); logFileName.Format( KtestsdkprivateuiframeworkLogFileWithTitle, &title ); } else { logFileName.Copy( KtestsdkprivateuiframeworkLogFile ); } iLog = CStifLogger::NewL( KtestsdkprivateuiframeworkLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); _LIT( KResourceFile, "c:\\resource\\testsdkprivateuiframework.rsc" ); iOffset = CCoeEnv::Static()->AddResourceFileL( KResourceFile ); }
// ----------------------------------------------------------------------------- // CDRM_CAF::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CDRM_CAF::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. User::LeaveIfError( iFs.Connect() ); // CleanupClosePushL( iFs ); CreateDirL(); RSettingServer settingServer; TInt ret = settingServer.Connect(); if(ret != KErrNone) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings(loggerSettings); if(ret != KErrNone) { User::Leave(ret); } // Close Setting server session settingServer.Close(); TFileName logFileName; if(loggerSettings.iAddTestCaseTitle) { TName title; TestModuleIf().GetTestCaseTitleL(title); logFileName.Format(KDRM_CAFLogFileWithTitle, &title); } else { logFileName.Copy(KDRM_CAFLogFile); } iLog = CStifLogger::NewL( KDRM_CAFLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); }
// ----------------------------------------------------------------------------- // Ctestsdkfonts::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CTestSdkFonts::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; CleanupClosePushL( settingServer ); TInt ret = settingServer.Connect(); if ( ret != KErrNone ) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings( loggerSettings ); if ( ret != KErrNone ) { User::Leave( ret ); } // Close Setting server session settingServer.Close(); CleanupStack::PopAndDestroy( &settingServer ); TFileName logFileName; if ( loggerSettings.iAddTestCaseTitle ) { TName title; TestModuleIf().GetTestCaseTitleL( title ); logFileName.Format( KtestsdkfontsLogFileWithTitle, &title ); } else { logFileName.Copy( KtestsdkfontsLogFile ); } iLog = CStifLogger::NewL( KtestsdkfontsLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); iFontAccess = new ( ELeave ) AknFontAccess; }
// ----------------------------------------------------------------------------- // CMmsClientMtmApiTest::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CMmsClientMtmApiTest::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; TInt ret = settingServer.Connect(); if(ret != KErrNone) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings(loggerSettings); if(ret != KErrNone) { User::Leave(ret); } // Close Setting server session settingServer.Close(); TFileName logFileName; if(loggerSettings.iAddTestCaseTitle) { TName title; TestModuleIf().GetTestCaseTitleL(title); logFileName.Format(KMmsClientMtmApiTestLogFileWithTitle, &title); } else { logFileName.Copy(KMmsClientMtmApiTestLogFile); } iLog = CStifLogger::NewL( KMmsClientMtmApiTestLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); iSession = CMsvSession::OpenSyncL(*this); iMtmRegistry = CClientMtmRegistry::NewL(*iSession); iClientMtm = (CMmsClientMtm *) iMtmRegistry-> NewMtmL(KUidMsgTypeMultimedia); SendTestClassVersion(); }
/** Auxilary function called to Copy the screen to bitmap (mbm) file. @param aHashIndex contains hashID. Bitmap is created with the aHashIndex as name */ EXPORT_C void CTHashReferenceImages::CopyScreenToBitmapL(const TDesC& aHashIndex) { CFbsBitmap *bitmap = new(ELeave)CFbsBitmap(); CleanupStack::PushL(bitmap); User::LeaveIfError(bitmap->Create(iBitmapDevice->SizeInPixels(), iBitmapDevice->DisplayMode())); TRect rect = TRect(iBitmapDevice->SizeInPixels()); CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap); CleanupStack::PushL(device); CFbsBitGc *gc; User::LeaveIfError(device->CreateContext(gc)); gc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc->BitBlt(TPoint(), iBitmap, rect); TFileName mbmFile; mbmFile.Format(iPath->Des(), &aHashIndex); bitmap->Save(mbmFile); delete gc; CleanupStack::PopAndDestroy(2); }
void CAafAppFileBrowserView::ShowFileProperties() { __LOGSTR_TOFILE("CAafAppFileBrowserView::ShowFileProperties() begins"); if (!IsCurrentItemDir()) { TEntry fileEntry; TFileName folderPath; __LOGSTR_TOFILE("CAafAppFileBrowserView::ShowFileProperties() step 01"); // File description iBrowserEngine->GetFileDescription2L(iListBox->CurrentItemIndex(), fileEntry, folderPath); // Load dialog from resources CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog(); dlg->PrepareLC(R_FILEPROPERTIES_DIALOG); // Set dialog title dlg->QueryHeading()->SetTextL(fileEntry.iName); // Form dialog body text folderPath = TFileName(KNullDesC); _LIT(KSizeString, "Size:\t%d Kb\n\nDate,\ntime:\t"); folderPath.Format(KSizeString, fileEntry.iSize/(1 << 10)); TBuf<30> dateString(KNullDesC); _LIT(KDateString, "%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); fileEntry.iModified.FormatL(dateString, KDateString); folderPath.Append(dateString); dlg->SetMessageTextL(folderPath); __LOGSTR_TOFILE("CAafAppFileBrowserView::ShowFileProperties() step 02"); // Run dialog dlg->RunLD(); } __LOGSTR_TOFILE("CSupAppFileBrowserView::ShowFileProperties() ends"); }
// ----------------------------------------------------------------------------- // CAdvancedTriggerSupervision::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CAdvancedTriggerSupervision::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. RSettingServer settingServer; TInt ret = settingServer.Connect(); if(ret != KErrNone) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings(loggerSettings); if(ret != KErrNone) { User::Leave(ret); } // Close Setting server session settingServer.Close(); TFileName logFileName; if(loggerSettings.iAddTestCaseTitle) { TName title; TestModuleIf().GetTestCaseTitleL(title); logFileName.Format(KAdvancedTriggerSupervisionLogFileWithTitle, &title); } else { logFileName.Copy(KAdvancedTriggerSupervisionLogFile); } iLog = CStifLogger::NewL( KAdvancedTriggerSupervisionLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); iProEngine= ProEngFactory::NewEngineL(); }
void CImMobilityLogger::DoCreateDefaultLogL(const TDesC& /*aFilePartName*/) #endif //__IM_MOBILITY_LOGGING { #ifdef __IM_MOBILITY_LOGGING if (iDefaultLogFileInUse) { return; } TFileName filename; filename.Format(KDefaultLogFileFormat, &KLogDir(), &aFilePartName); TInt err = iFileList[KDefaultLog].iFile.Replace(iFs, filename, EFileWrite | EFileShareAny); if (err == KErrNone) { iDefaultLogFileInUse = ETrue; } #endif //__IM_MOBILITY_LOGGING }
// ----------------------------------------------------------------------------- // Ctestdomalarm::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void Ctestdomalarm::ConstructL() { RSettingServer settingServer; CleanupClosePushL( settingServer ); TInt ret = settingServer.Connect(); if ( ret != KErrNone ) { User::Leave(ret); } TLoggerSettings loggerSettings; ret = settingServer.GetLoggerSettings( loggerSettings ); if ( ret != KErrNone ) { User::Leave( ret ); } settingServer.Close(); CleanupStack::PopAndDestroy( &settingServer ); TFileName logFileName; if ( loggerSettings.iAddTestCaseTitle ) { TName title; TestModuleIf().GetTestCaseTitleL( title ); logFileName.Format( KtestdomalarmLogFileWithTitle, &title ); } else { logFileName.Copy( KtestdomalarmLogFile ); } iLog = CStifLogger::NewL( KtestdomalarmLogPath, logFileName, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestClassVersion(); }
// ----------------------------------------------------------------------------- // CTFAStifTestLog::ConstructL // ----------------------------------------------------------------------------- void CTFAStifTestLog::ConstructL( void ) { TFileName fileName; TTime time; time.HomeTime(); TDateTime dateTime = time.DateTime(); RThread thread; #ifdef __LOG_HTML__ _LIT( KSuffix, "html" ); #else _LIT( KSuffix, "txt" ); #endif fileName.Format( _L( "%02d%02d%02d_%02d%02d%02d_%x.%S" ), dateTime.Year() - 2000, dateTime.Month() + 1, dateTime.Day() + 1, dateTime.Hour(), dateTime.Minute(), dateTime.Second(), (TUint)thread.Id(), &KSuffix ); iLogger = CStifLogger::NewL( _L( "c:\\logs\\testframework\\" ), fileName, CStifLogger::ETxt, CStifLogger::EFile, ETrue, EFalse, EFalse, EFalse, EFalse ); iOverflowHandler = new ( ELeave ) TTFAOverflowHandler; #ifdef __LOG_HTML__ iLogger->Log( _L8( "<html><head><title>TFA Log</title></head>\r\n<body>\r\n" ) ); #endif }