Exemplo n.º 1
0
// From MTest:
void CTestCase::ExecuteL (TTestResult& aResult)
    {
    TInt error = ExecuteImplL();
    aResult.iResult = error;
    // add the possible failure or error to the result
    
    if (error == KErrCppUnitAssertionFailed)
        {
        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
        CleanupStack::PushL(assertFailure);
        TBuf16 <0x80> convertBuf;
        TBuf16 <256> temporaryBuf;
        convertBuf.Copy(assertFailure->What());
        temporaryBuf.Append(convertBuf);
        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
        convertBuf.Copy(assertFailure->FileName());
        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
            {
            TBuf <0x80> printBuf;
            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
            convertBuf = _L("...");
            convertBuf.Append(printBuf);
            }
        temporaryBuf.Append(convertBuf);
        aResult.iResultDes = temporaryBuf;
        CleanupStack::PopAndDestroy(assertFailure); 
        }
    }
Exemplo n.º 2
0
TInt CSwiEngine::RunInNewThreadL(CSwiTask* aTask)
	{
	CPassiveLogger* logger = aTask->Logger();
	
	RThread installRunnerThread;       
	TInt status = installRunnerThread.Create(       
		KThreadName,       
		reinterpret_cast<TThreadFunction>(ThreadFunction),       
		KDefaultStackSize,       
		NULL,
		aTask     
		);       

	User::LeaveIfError(status);       

	TRequestStatus threadStat;
	threadStat=KRequestPending;       

	installRunnerThread.Resume();       
	installRunnerThread.Logon(threadStat);

	User::WaitForRequest(threadStat);
	installRunnerThread.Close();       

	TInt result = threadStat.Int();  
	//NOTE: if removal result==-14 (KErrInUse) it's because the VM didnt exit yet.
	// Security checks if the suite is in use in a very naive way, it simply
	// tries to open the Jar file..
	// However, in that case, it is undefined if the removal was successfull.
	if(result == KErrNone)
		{
		logger->AppendL(_L("Swi:Task complete"));
		}
	else
		{
	    _LIT(KErrorPattern, "Swi:Task failed: %d");
    	TBuf16<64> buf;
    	buf.AppendFormat(KErrorPattern, result);
    	logger->AppendL(buf);
    	//User::Leave(error);
		//not leaving to allow command response to be written back
		//to the SEI
		}
	logger->Flush();     
	delete logger;
	return result;
	}
void CBrCtlSampleAppCommandObserver::HandleCommandL(TBrCtlDefs::TBrCtlClientCommands aCommand, 
const CArrayFix<TPtrC>& /*aAttributesNames*/,
const CArrayFix<TPtrC>& /*aAttributeValues*/)
{
    
    // Here we are creating a text string to be displayed on the screen, but if 
    // you were implementing this method, you would most likely be displaying a
    // progress bar.

    TBuf16<256> tgt; 

    _LIT(KHandleCommandEvent, "Command event = %d");//, size = %d, trId = %d");
     
    tgt.AppendFormat(KHandleCommandEvent, aCommand); //, aSize, aTransactionId);

    iContainer->SetText(tgt);

    iContainer->DrawNow();    
}