/*
-------------------------------------------------------------------------------

    Class: CStifSectionParser

    Method: GetNextItemLineL

    Description: Parses a next line for items parsing with a tag.

    If start tag is empty the parsing starts beging of the section.

    Parameters: const TDesC& aTag: in: Indicates parsing start point
                TTagToReturnValue aTagIndicator: in: Will aTag included to the
                returned object(For default the tag will be added)

    Return Values:  CStifItemParser* : pointer to CStifItemParser object
                    NULL will return if iLineIndicator is false
                    NULL will return if ParseStartAndEndPos() method returns -1
                    NULL will return if length is 0 or negative
                    NULL will return if iStartPos is 0

    Errors/Exceptions: Leaves if called CStifItemParser::NewL method fails

    Status: Approved

-------------------------------------------------------------------------------
*/
EXPORT_C CStifItemParser* CStifSectionParser::GetNextItemLineL(
                                            const TDesC& aTag,
                                            TTagToReturnValue aTagIndicator )
    {
    // GetLine() or GetItemLineL() method is not called
    if ( !iLineIndicator )
        {
        __TRACE( KInfo, 
            ( _L( "STIFPARSER: GetNextItemLineL method returns a NULL" ) ) );
        return NULL;
        }

    TInt startPos( 0 );
    TInt endPos( 0 );
    TInt length( 0 );

    TInt ret = ParseStartAndEndPos( iSection, aTag, aTagIndicator,
                                    startPos, endPos, length );
    // No parsing found
    if ( KErrNone != ret || length <= 0 || startPos < 0 )
        {
        __TRACE( KInfo, 
            ( _L( "STIFPARSER: GetNextItemLineL method returns a NULL" )  ) );
        return NULL;
        }

    CStifItemParser* line = CStifItemParser::NewL(
                                            iSection, startPos, length );

    return line;

    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineContainer

    Method: StartContinerL

    Description: StartContinerL call CUIEngineRunner to starting test case execution

    Parameters: None

    Return Values: TInt KErrNone: Always returned KErrNone

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/
TInt CUIEngineContainer::StartContainerL()
    {
    
    __TRACE( KPrint, ( _L( "CUIEngineContainer::StartContainerL. Running test case: %S"), 
        &( iTestInfo.iTestCaseInfo.iTitle ) ) );
        
    // Start printer
    iPrinter = CUIEnginePrinter::NewL( this );
    iPrinter->StartL( iTestCase );

    // Start remote
    iRemote = CUIEngineRemote::NewL( this );
    iRemote->StartL( iTestCase );

    // Start runner
    iRunner = CUIEngineRunner::NewL( this );
    iRunner->StartL( iTestCase );

    // Update state of test case
    iState = ERunning;

    __TRACE( KPrint, ( _L( "CUIEngineContainer::StartContainerL: started") ) );

    return KErrNone;

    }
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: ServiceL

    Description: Trap harness for dispatcher

    Parameters: const RMessage& aMessage  :inout:   Message

    Return Values: None

    Errors/Exceptions: None

    Status: Proposal

-------------------------------------------------------------------------------
*/
void CTestModule::ServiceL( const RMessage2& aMessage )
    {

    // NOTE! HW testing slows down dramatically if adds commants here

    //__TRACE( KMessage,( _L( "CTestModule::ServiceL in" ) ) );

    TInt r = KErrNone;
    TRAPD( ret, r = DispatchMessageL( aMessage ) );

    if ( ret != KErrNone )
        {
        // Complete message on leaving cases with leave code.
        __TRACE( KError, ( CStifLogger::ERed, _L( "CTestModule::DispatchMessageL leaved" ) ) );
        aMessage.Complete( ret );
        }

    // Complete message with error code originating from message handling
    // function.
    if ( r != KErrNone )
        {
        __TRACE( KError, ( CStifLogger::ERed, _L( "CTestModule::DispatchMessageL returned error" ) ) );
        aMessage.Complete( r );
        }

     // __TRACE( KMessage,( _L( "CTestModule::ServiceL out" ) ) );

    }
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: FreeCaseData

    Description: Frees the test case data and test module that is used in
    enumeration.

    Parameters: None

    Return Values: TInt                             Error code

    Errors/Exceptions: None

    Status: Proposal

-------------------------------------------------------------------------------
*/
TInt CTestModule::FreeCaseData()
    {

    __TRACE( KMessage,( _L( "CTestModule::FreeCaseData in" ) ) );
 
    TInt r = KErrNone;

    if( iEnumerateModule )
        {
        
        // Deallocate testcase memory
        iEnumerateModule->FreeEnumerationData();

        // Free the module
        r = FreeTestModule( iEnumerateModule );

        iEnumerateModule = NULL;

        }

    __TRACE( KMessage,( _L( "CTestModule::FreeCaseData out" ) ) );

    return r;

    }
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: CreateModuleSessionL

    Description: Creates a new module session.
    Just take the initialisation file name from message.

    Parameters: const RMessage& aMessage  :inout:   Message to be handled

    Return Values: TInt                             Operation result

    Errors/Exceptions: Leaves if memory allocation fails

    Status: Proposal

-------------------------------------------------------------------------------
*/
TInt CTestModule::CreateModuleSessionL( const RMessage2& aMessage )
    {

    __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession in" ) ) );

    // Take parameters
    TFileName ini;
    TRAPD( res, aMessage.ReadL( 0, ini ) );
    if( res != KErrNone )
        {
        PanicClient( EBadDescriptor, aMessage );
        return res;
        }

    // Construct heap buffer for initialization file name
    iIniBuffer = HBufC::NewL( ini.Length() );
    iIni.Set ( iIniBuffer->Des() );
    iIni.Copy ( ini );

    aMessage.Complete( KErrNone );

    __TRACE( KMessage,( _L( "CTestModule::CreateModuleSession out" ) ) );

    return KErrNone;

    }
/*
-------------------------------------------------------------------------------

    Class: CStifParser

    Method: ConstructL

    Description: Symbian OS second phase constructor

    Symbian OS default constructor can leave.

    Connecting and opening configuration file if path and file information is 
    given. If path and file information is not given and information is given 
    in buffer then create parser according to the buffer.
    
    Parameters: const TDesC& aPath: in: Source path definition
                const TDesC& aConfig: in: Configuration filename
                const TDesC& aBuffer: in: Buffer of the parsed information

    Return Values: None

    Errors/Exceptions:  Leaves if called Connect method fails
                        Leaves if called SetSessionPath method fails
                        Leaves if called Open method fails
                        Leaves if HBufC::NewL operation leaves

    Status: Proposal

-------------------------------------------------------------------------------
*/
void CStifParser::ConstructL( const TDesC& aPath,
                                const TDesC& aConfig,
                                const TDesC& aBuffer)
    {
    if( aPath == KNullDesC && aConfig == KNullDesC && aBuffer != KNullDesC )
        {
        // Set mode
        iParsingMode = EBufferParsing;

        // Construct modifiable heap-based descriptor.
        iBufferTmp = HBufC::NewL( aBuffer.Length() );
        //iBuffer = iBufferTmp->Des();
        iBuffer.Set( iBufferTmp->Des() );
        // Copy content
        iBuffer.Copy( aBuffer );
        }

    else
        {
        User::LeaveIfError( iFileServer.Connect() );
    
        __TRACE( KInfo, ( _L( "STIFPARSER: Open configfile '%S%S'" ),
                &aPath, &aConfig ) );
                
        User::LeaveIfError( iFileServer.SetSessionPath( aPath ) );
        User::LeaveIfError( iFile.Open( 
                            iFileServer, aConfig, EFileRead | EFileShareAny ) );

        //Check whether the file is unicoded
        __TRACE(KInfo, (_L("STIFPARSER: Check if the file is unicode")));
        _LIT(KUnicode, "#UNICODE");
        const TInt KUnicodeLength(8 * 2 + 2); //times two, because we want to read unicode string using 8bit descriptor
                                              //two characters more because on some systems FEFF is always added on the beginning of unicode file
        TInt size(0);

        User::LeaveIfError(iFile.Size(size));

        if(size >= KUnicodeLength)
            {
            TBuf8<KUnicodeLength> buf;

            User::LeaveIfError(iFile.Read(0, buf));
            TPtrC16 bufuni((TUint16 *)(buf.Ptr()), buf.Length() / 2);
            if(bufuni.Find(KUnicode) != KErrNotFound)
                {
                iIsUnicode = ETrue;
                __TRACE(KInfo, (_L("STIFPARSER: File is unicode")));
                }
            }
        
        //Create file parser object
        iFileParser = CStifFileParser::NewL(iFileServer, iFile, iIsUnicode, iCommentType);
        }

    iOffset = 0;

    }
/*
-------------------------------------------------------------------------------

    Class: CStifSectionParser

    Method: GetItemLineL

    Description: Parses a line for items parsing.

    If start tag is empty the parsing starts beging of the section.

    Parameters: const TDesC& aTag: in: Indicates parsing start point.
                TTagToReturnValue aTagIndicator: in: Will aTag included to the
                returned object(For default the tag will be added)

    Return Values:  CStifItemParser* : pointer to CStifItemParser object
                    NULL will return if ParseStartAndEndPos() method returns -1
                    NULL will return if length is 0 or negative
                    NULL will return if iStartPos is 0

    Errors/Exceptions: Leaves if called CStifItemParser::NewL method fails

    Status: Approved

-------------------------------------------------------------------------------
*/
EXPORT_C CStifItemParser* CStifSectionParser::GetItemLineL( const TDesC& aTag,
                                            TTagToReturnValue aTagIndicator )
    {
    TInt startPos( 0 );
    TInt endPos( 0 );
    TInt length( 0 );

    // Indicator that GetItemLineL has been used
    iLineIndicator = ETrue;

    iSkipAndMarkPos = 0;

    TInt ret = ParseStartAndEndPos( iSection, aTag, aTagIndicator,
                                    startPos, endPos, length );

    // No parsing found
    if ( KErrNone != ret || length <= 0 || startPos < 0 )
        {
        __TRACE( 
            KInfo, ( _L( "STIFPARSER: GetItemLineL method returns a NULL" ) ) );
        return NULL;
        }

    CStifItemParser* line = CStifItemParser::NewL(
                                            iSection, startPos, length );

    return line;

    }
/*
-------------------------------------------------------------------------------

    Class: CStifSectionParser

    Method: ~CStifSectionParser

    Description: Destructor

    Parameters: None

    Return Values: None

    Errors/Exceptions: None

    Status: Approved

-------------------------------------------------------------------------------
*/    
CStifSectionParser::~CStifSectionParser()
    {
    __TRACE( KInfo, ( _L( "STIFPARSER: Call destructor '~CStifSectionParser'" ) ) );

    delete iHBufferSection;

    }
/*
-------------------------------------------------------------------------------

    Class: CUnderTaker

    Method: RunError

    Description: Handle errors. RunL function does not leave, so one should
    never come here. 

    Print trace and let framework handle error( i.e to do Panic )

    Parameters: TInt aError:                  :in:  Error code

    Return Values:  TInt                            Error code

    Errors/Exceptions: None

    Status: Proposal

-------------------------------------------------------------------------------
*/
TInt CUnderTaker::RunError( TInt aError )
    {
    __TRACE( KError,( _L( "CUnderTaker::RunError" ) ) );

    return aError;

    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineRunner

    Method: DoCancel

    Description: Cancel active request.

    Parameters: None

    Return Values: None

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/
void CUIEngineRunner::DoCancel()
    {

    __TRACE( KPrint, ( _L( "CUIEngineRunner::DoCancel") ) );
    iTestCase.CancelAsyncRequest( ETestCaseRunTestCase );
    
    }
	void FileSharingWidget::initializeInternal()
	{
        PreviewContentWidget::initializeInternal();

		__TRACE(
            "fs",
            "initializing file sharing widget\n" <<
            FsInfo_->ToLogString()
        );

		setMouseTracking(true);

		setInitialWidgetSizeAndState();

		if (FsInfo_->IsOutgoing())
		{
			const auto &uploadingProcessId = FsInfo_->GetUploadingProcessId();
			if (!uploadingProcessId.isEmpty())
			{
				assert(FsInfo_->IsOutgoing());
				assert(FsInfo_->HasLocalPath());

				resumeUploading();

				return;
			}
		}

		connectMetainfoSignal(true);
		requestMetainfo();

        invalidateSizes();
        update();
	}
    void PreviewContentWidget::setPreview(const QPixmap &preview)
    {
        assert(!preview.isNull());

        __TRACE(
            "preview",
            "setting preview\n" <<
            toLogString() << "\n"
            "----------------------------\n"
            "    preview_size=<" << preview.size() << ">"
        );

        if (PreviewGenuineSize_.isEmpty())
        {
            setPreviewGenuineSize(preview.size());
        }

        Preview_ = preview;

        limitPreviewSize();

        invalidateSizes();

        update();
    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineContainer

    Method: ConstructL

    Description: Symbian OS second phase constructor

    Symbian OS default constructor can leave

    Parameters: None

    Return Values: None

    Errors/Exceptions: Leaves if called Open method returns error

    Status: Draft

-------------------------------------------------------------------------------
*/
void CUIEngineContainer::ConstructL()
    {
    __TRACE( KPrint, (  _L( "CUIEngineContainer::ConstructL.") ) );

    // Open test case
    User::LeaveIfError( iTestCase.Open( iTestEngineServ, iTestInfoPckg ) );
    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineErrorPrinter

    Method: ~CUIEngineErrorPrinter

    Description: Destructor.

    Parameters: None

    Return Values: None

    Errors/Exceptions: None

    Status: Draft
    
-------------------------------------------------------------------------------
*/
CUIEngineErrorPrinter::~CUIEngineErrorPrinter( )
    {
    
    __TRACE( KPrint, ( _L( "CUIEngineErrorPrinter::~CUIEngineErrorPrinter") ) );
    Cancel();
    
    }
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: ~CTestModule

    Description: Destructor.
    Deallocate memory and close handles.

    Parameters: None

    Return Values: None

    Errors/Exceptions: None.

    Status: Proposal

-------------------------------------------------------------------------------
*/
CTestModule::~CTestModule()
    {

    __TRACE( KVerbose, ( _L( "Closing test module" ) ) );
        
    // Free test case related data. No error checking here, because if freeing
    // fails, then nothing can be done in destructor.
    FreeCaseData();

    // Delete all test module instances.
    // Cleanup all RTestExecution has been opened by client but not properly
    // closed for example if timeout occurs and client died. This almost do
    // same than CloseSession() in "if( iTestExecutionHandle )" branch.
    if( iTestExecutionHandle )
        {
        TInt handle = 0;
        CObject* theObj = NULL;
        TInt count = iTestExecutionHandle->Count();

        for( TInt i = 0 ; i < count; i++ )
            {
            // Get pointer to CTestExecution
            theObj=iTestExecutionHandle->operator[]( i );
            if( theObj )
                {
                handle=iTestExecutionHandle->At( theObj );

                CTestExecution* testcase = (CTestExecution*) theObj;
                // Cancels test(s) execution(timeout, exit, etc)
                // For example TestCombiner is timeouted => TestCombiner's
                // TestServer+TestModule(s) should cancel also.
                testcase->CancelTestExecution();
                // CTestExecution will panic if test case is ongoing!!! This
                // should be stopped, client should handless this.
                iTestExecutionHandle->Remove( handle );
                }
            }

        delete iTestExecutionHandle;
        iTestExecutionHandle = NULL;

        }

    // Delete all FREE Test Module instances.
    if( iTestModuleInstances )
        {
        iTestModuleInstances->ResetAndDestroy();
        delete iTestModuleInstances;
        iTestModuleInstances = NULL;
        }

    // Delete ini file heap buffer
    delete iIniBuffer;
    iIniBuffer = NULL;

    // Delete array of test case titles
    iTestCaseTitlesMap.ResetAndDestroy();
    iTestCaseTitlesMap.Close();
    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineRunner

    Method: RunL

    Description: RunL handles completed requests.

    Parameters: None

    Return Values: None

    Errors/Exceptions: Leaves if iStatus is not KErrNone, error is handled in
                       RunError called by CActiveObject

    Status: Draft

-------------------------------------------------------------------------------
*/
void CUIEngineRunner::RunL()
    {
    __TRACE( KPrint, ( _L( "CUIEngineRunner::RunL") ) );

    // Complete with the result of the test case
    iUIEngineContainer->TestCaseExecuted( iFullTestResult, iStatus.Int() );

    }
Beispiel #17
0
EXPORT_C void Dbms::Panic(const TDesC& aCategory,TInt aCode)
//
// Panic the client
// Outside of the server this calls User::Panic, within it calls the server and LEAVES!
//
	{
	__TRACE(aCategory);
	__TRACE(aCode);
	CDbsServer* server=CDbsServer::Instance();
	if (server)
		{
		server->Panic(aCategory,aCode);
		__LEAVE(KDbsLeavePanic);
		}
	else
		User::Panic(aCategory,aCode);
	}
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: NewTestExecutionL

    Description: Create new test execution subsession
    
    Parameters: const RMessage& aMessage  :inout:   Message to be handled
    
    Return Values: TInt                             Operation result

    Errors/Exceptions: Function leaves if object can't be created or
                       it can't be added to container.
                       Function panics client if message contains invalid
                       descriptor.

    Status: Proposal
    
-------------------------------------------------------------------------------
*/
TInt CTestModule::NewTestExecutionL( const RMessage2& aMessage )
    {

    __TRACE( KMessage,( _L( "CTestModule::NewTestExecutionL in" ) ) );

    // Get data from message
    TInt caseNumber = aMessage.Int0();
    TFileName config;
    
    TRAPD( res, aMessage.ReadL( 1, config ) );
    if( res != KErrNone )
        {
        PanicClient( EBadDescriptor, aMessage );
        return res;
        }

    // Make new object
    CTestExecution* execution=CTestExecution::NewL( this, caseNumber, config );

    // add object to object container to generate unique id
    iContainer->AddL( execution );

    // add object to object index; this returns a unique handle so we can get it again
    TInt handle=iTestExecutionHandle->AddL( execution );

    // write the handle to client
    TPckg<TInt> handlePckg( handle );
    TRAP( res, aMessage.WriteL( 3, handlePckg ) );
    if( res != KErrNone )
        {
        iTestExecutionHandle->Remove( handle );
        PanicClient( EBadDescriptor, aMessage );
        return res;
        }

    // notch up another resource
    iResourceCount++;

    // Complete message
    aMessage.Complete( KErrNone );

    __TRACE( KMessage,( _L( "CTestModule::NewTestExecutionL out" ) ) );

    return KErrNone;
    }
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: PanicClient

    Description: Panic clients.

    Parameters: TInt aPanic                   :in:  Panic code

    Return Values: None

    Errors/Exceptions: None

    Status: Approved

-------------------------------------------------------------------------------
*/
void CTestModule::PanicClient( const TInt aPanic, const RMessage2& aMessage ) const
    {

    __TRACE( KError,( _L( "CTestModule::PanicClient code = %d" ), aPanic ) );

    _LIT( KTxtTestModule,"CTestModule" );

    aMessage.Panic( KTxtTestModule, aPanic );
    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineRunner

    Method: CUIEngineRunner

    Description: Default constructor

    C++ default constructor can NOT contain any code, that
    might leave.

    Parameters: None
    
    Return Values: None

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/
CUIEngineRunner::CUIEngineRunner( CUIEngineContainer* aUIEngineContainer) :
    CActive( CActive::EPriorityStandard ),
    iUIEngineContainer( aUIEngineContainer ),
    iFullTestResultPckg( iFullTestResult )
    {
    __TRACE( KPrint, ( _L( "CUIEngineRunner::CUIEngineRunner") ) );
    __ASSERT_ALWAYS( aUIEngineContainer, User::Panic( _L("Null pointer"), KErrGeneral ) );

    CActiveScheduler::Add( this );
    }
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: GetTestCasesL

    Description: Get test cases. Enumerate test cases must be called before
    calling this function.

    Function releases the test module reserved by EnumerateTestCase().

    Parameters: const RMessage& aMessage  :inout:   Message to be handled

    Return Values: TInt                             Operation result

    Errors/Exceptions: Leaves if cases have not been enumerated.

    Status: Proposal

-------------------------------------------------------------------------------
*/
TInt CTestModule::GetTestCasesL( const RMessage2& aMessage )
    {

    __TRACE( KMessage,( _L( "CTestModule::GetTestCasesL in" ) ) );

    // Leave if cases have not been enumerated.
    //User::LeaveIfNull(( TAny* ) iEnumerateModule->TestCases() );
    if( ( TAny* ) iEnumerateModule->TestCases() == NULL )
        {
        User::Leave( KErrGeneral );
        }

    const TInt len = sizeof( TTestCaseInfo );
    
    // Get cases
    const RPointerArray<TTestCaseInfo>& cases = *iEnumerateModule->TestCases();

    // Get number of cases
    const TInt Kcount = cases.Count();

    // Loop through case and copy then to client's descriptor.
    for( TInt i = 0; i < Kcount; i++ )
        {

        // Construct package for source data
        TTestCaseInfoPckg tmpPackage( *cases[i] );

        // Write to correct location
        aMessage.WriteL( 0, tmpPackage, i *len );

        }

    // Free case data and the test module
    User::LeaveIfError( FreeCaseData() );

    // Finished
    aMessage.Complete( KErrNone );

    __TRACE( KMessage,( _L( "CTestModule::GetTestCasesL out" ) ) );

    return KErrNone;

    }
/*
-------------------------------------------------------------------------------

    Class: CTestModule

    Method: ConstructL

    Description: Second level constructor.
    
    Parameters: CTestServer* aServer          :in:  Server

    Return Values: None

    Errors/Exceptions: Leaves if:
                       base class CreateL leaves
                       Object index creation fails
                       Object container creation fails
                       Pointer array construction fails                       

    Status: Approved

-------------------------------------------------------------------------------
*/
void CTestModule::ConstructL( CTestServer* aServer )
    {

	__TRACE( KVerbose, ( _L( "CTestModule::ConstructL - constructing server session" ) ) );

    // second-phase construct base class
    //CSession2::CreateL( /* *aServer */ );
    iTestServer = aServer;

    // create new object index
    iTestExecutionHandle = CObjectIx::NewL();

    // Initialize the object container using the object
    // container index in the server.
    iContainer = iTestServer->NewContainerL();

    iTestModuleInstances = new( ELeave ) RPointerArray<CTestModuleContainer>;

	__TRACE( KError, ( _L( "CTestModule::ConstructL - constructing server session done" ) ) );

    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineRunner

    Method: StartTestL

    Description: Starts testing

    Parameters: RTestCase& aTestCase: in: Handle to test case
                TFullTestResultPckg& aFullTestResultPckg: in: Handle to TFullTestResultPckg

    Return Values: None

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/
void CUIEngineRunner::StartL( RTestCase& aTestCase )
    {
    __TRACE( KPrint, ( _L( "CUIEngineRunner::StartTestL") ) );

    iTestCase = aTestCase;

    if ( IsActive() )
        User::Leave( KErrInUse );

    SetActive();
    iTestCase.RunTestCase( iFullTestResultPckg, iStatus );
    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineErrorPrinter

    Method: CUIEngineErrorPrinter

    Description: Constructor.
    
    Parameters: None

    Return Values: None

    Errors/Exceptions: None

    Status: Draft
    
-------------------------------------------------------------------------------
*/
CUIEngineErrorPrinter::CUIEngineErrorPrinter( CUIEngine* aUIEngine ): 
    CActive( EPriorityStandard ),
    iUIEngine( aUIEngine ),
    iErrorPckg( iError )
    {
    
     __TRACE( KPrint, ( _L( "CUIEngineErrorPrinter::CUIEngineErrorPrinter") ) );
    __ASSERT_ALWAYS( aUIEngine, User::Panic( _L("Null pointer"), KErrGeneral ) );
    
    CActiveScheduler::Add( this );

    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineContainer

    Method: ~CUIEngineContainer

    Description: Destructor

    Parameters: None

    Return Values: None

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/    
CUIEngineContainer::~CUIEngineContainer()
    {
    
    __TRACE( KPrint, (  _L( "CUIEngineContainer::~CUIEngineContainer.") ) );

    delete iPrinter;
    delete iRunner;
    delete iRemote;
    
    // Close test case
    iTestCase.Close();
    
    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineContainer

    Method: PrintProgress

    Description: PrintProgress prints information from test case

    Parameters: TTestProgress& aProgress: in: Progress info

    Return Values: None

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/
void CUIEngineContainer::PrintProgress( TTestProgress& aProgress )
    {
    if( iState == ERunning )
        {
        // Only running cases may print
        iUIEngine->PrintProg( this, aProgress );
        }
    else
        {
        __TRACE( KPrint, 
            ( _L("%S: %S"), &aProgress.iDescription, &aProgress.iText ) );
        }
    }
Beispiel #27
0
/*
-------------------------------------------------------------------------------

    Class: CStifSectionParser

    Method: NewL

    Description: Two-phased constructor.

    Parameters: const TInt aLength: in: Parsed section length

    Return Values: CStifSectionParser* : pointer to CStifSectionParser object

    Errors/Exceptions:  Leaves if section length is negative
                        Leaves if construction fails

    Status: Approved

-------------------------------------------------------------------------------
*/
CStifSectionParser* CStifSectionParser::NewL( const TInt aLength )
    {
    __TRACE( KInfo, ( _L( "STIFPARSER: Create a section" ) ) );
    __ASSERT_ALWAYS( aLength > 0, User::Leave( KErrArgument ) );

    CStifSectionParser* item = new (ELeave) CStifSectionParser( aLength );

    CleanupStack::PushL( item );
    item->ConstructL();
    CleanupStack::Pop( item );

    return item;

    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineContainer

    Method: CancelTest

    Description: CancelTest cancels test case execution

    Parameters: None

    Return Values: TInt KErrNone: Always returned KErrNone

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/
EXPORT_C TInt CUIEngineContainer::CancelTest()
    {

    if ( iState == ERunning || iState == EPaused )
        {
        __TRACE( KPrint, ( _L( "CUIEngineContainer::CancelTest") ) );

        // Cancel test case execution
        iTestCase.CancelAsyncRequest( ETestCaseRunTestCase );
        
        }

    return KErrNone;
    }
/*
-------------------------------------------------------------------------------

    Class: CUIEngineContainer

    Method: RemoteSend

    Description: RemoteSend forwards remote protocol messages from master

    Parameters: 
    
    Return Values: None

    Errors/Exceptions: None

    Status: Draft

-------------------------------------------------------------------------------
*/
void CUIEngineContainer::RemoteSend( const TDesC& aRemoteMsg, 
                                     TInt /* aStatus */ )
    {

    __TRACE( KPrint, ( _L( "CUIEngineContainer::RemoteSend.") ) );

    // Save master id if doesn't exists already
    if( iMasterId == 0 )
        {
        CStifTFwIfProt* msg = NULL;
        TRAPD( err, 
            msg = CStifTFwIfProt::NewL(); 
            msg->SetL( aRemoteMsg );
            );
/*
-------------------------------------------------------------------------------

    Class: CStifFileParser

    Method: PushFileToStack

    Description: Opens file and pushes it to stack

    Parameters: TDesc& aFileName   in: name of file to open and add to stack

    Return Values: None

    Errors/Exceptions:  None

    Status: Proposal

-------------------------------------------------------------------------------
*/
void CStifFileParser::PushFileToStackL(const TDesC& aFileName)
	{

	//First check if file is not already included
	for(TInt i = 0; i < iFileNames.Count(); i++)
		{
		if(aFileName.CompareF(iFileNames[i]->Des()) == KErrNone)
			{
			__TRACE(KError, (_L("File [%S] was already included. Ignoring"), &aFileName));
			return;
			}
		}

	//Open and add file to stack
	RFile *nf = new RFile();

	__TRACE(KInfo, (_L("Including file [%S]"), &aFileName));
	TInt r = nf->Open(iFileServer, aFileName, EFileRead | EFileShareAny);
	if(r == KErrNone)
		{
		//Add to stack
		iFileStack->PushL(nf);

		//And add to file names array
		HBufC* newFile = aFileName.AllocLC();
		User::LeaveIfError(iFileNames.Append(newFile));
		CleanupStack::Pop(newFile);

		//Set valid pointer of current file
		iCurrentFile = nf;
		}
	else
		{
		__TRACE(KError, (_L("Could not open file [%S]. Error %d. Ignoring"), &aFileName, r));
		}
	}