示例#1
0
void HandleStart()
{
	RDebug::Print(_L("TrkLauncher::HandleStart()"));
	
	if (!IsAlreadyRunning())
	{		
		TInt result;		
		RProcess p;
		
		//start TrkConsole	process
		result = p.Create(KTrkConsoleExe, TPtr(NULL, 0), TUidType(KNullUid, KNullUid, KTrkConsoleExeUid));
		if (result == KErrNone)
		{
			RDebug::Print(_L("TrkLauncher - Trk process resume"));
			p.Resume();
			RDebug::Print(_L("TrkLauncher - After Trk process resume"));
			p.Close();
			RDebug::Print(_L("TrkLauncher - After Trk process close"));
		}
		else
		{
			RDebug::Print(_L("TrkLauncher - Trk process not created with %d \n"),result);
			RDebug::Print(_L("TrkLauncher - Returning without process creation"));
		}
			
	}
}
void CListCertificates::ConstructL(	Output& aOut,
									const TTestActionSpec& aTestActionSpec)
	{
	CCertStoreTestAction::ConstructL(aTestActionSpec);
	
	iFilter = CFilter::NewL(aOut, Input::ParseElement(aTestActionSpec.iActionBody, KFilterStart, KFilterEnd));

	// Set expected result
	HBufC* result = HBufC::NewLC(aTestActionSpec.iActionResult.Length());
	TPtr(result->Des()).Copy(aTestActionSpec.iActionResult);
	Input::GetExpectedResultL(Input::ParseElement(*result, KReturnStart, KReturnEnd), iExpectedResult);
	CleanupStack::PopAndDestroy(result);

	// Set expected cert labels
	TInt pos = 0;
	TInt err = KErrNone;
	while(err == KErrNone)
		{
		TPtrC8 pExpCALabel = Input::ParseElement(aTestActionSpec.iActionResult, KCCTCertInfoStart, KCCTCertInfoEnd, pos, err);
		if (err == KErrNone)
			{
			AppendCCTCertInfoL(pExpCALabel);
			}
		}

	// Set allowed issuer DNs
	err = KErrNone;
	pos = 0;
	while (err == KErrNone)
		{
		TPtrC8 dn = Input::ParseElement(aTestActionSpec.iActionBody, KIssuerDNStart, KIssuerDNEnd, pos, err);
		if (err == KErrNone)
			AddDNL(dn);	
		}
	}
void CDeleteCertificate::ConstructL(const TTestActionSpec& aTestActionSpec)
	{
	CSubscriberAction::ConstructL(aTestActionSpec);

	iFilter = CCertAttributeFilter::NewL();
	TInt pos = 0;
	TInt err1 = KErrNone;
	
	TPtrC8 pLabel1 = Input::ParseElement(aTestActionSpec.iActionBody, KCertTypeStart, KCertTypeEnd, pos, err1);
	
	if(err1 == KErrNone)
		{
		iCertDeleteType = HBufC8::NewL(pLabel1.Size());
		*iCertDeleteType = pLabel1;
		}
		
	pos=0;
	TInt err2 = KErrNone;
	TPtrC8 pLabel2 = Input::ParseElement(aTestActionSpec.iActionBody, KCertLabelStart, KCertLabelEnd, pos, err2);
	if (err2 != KErrNone)
		{
		User::Leave(err2);
		}
	
	iCertLabel.Copy(pLabel2);
	if (iCertLabel.Compare(_L("*.*"))==0)	//	delete all certs
	{//	Check that the flag has been set
		TPtrC8 pDeleteAll = Input::ParseElement(aTestActionSpec.iActionBody, KDeleteAllStart, KDeleteAllEnd, pos, err1);
		if (pDeleteAll!=KNullDesC8)
		{
			TLex8 lexer(pDeleteAll);
			TInt boolVal = 0;
			lexer.Val(boolVal);
			iDeleteAllCerts = (boolVal > 0) ? ETrue : EFalse;
		}
	}
	else if( err1 != KErrNone && err1 != KErrNotFound)
		{
		User::Leave(err1);
		}

	// Set expected result
	HBufC* result = HBufC::NewLC(aTestActionSpec.iActionResult.Length());
	TPtr(result->Des()).Copy(aTestActionSpec.iActionResult);
	Input::GetExpectedResultL(Input::ParseElement(*result, KReturnStart, KReturnEnd), iExpectedResult);
	CleanupStack::PopAndDestroy(result);
	}
void CCreateFileCertStore::ConstructL(const TTestActionSpec& aTestActionSpec)
	{
	CCertStoreTestAction::ConstructL(aTestActionSpec);
	TInt err = KErrNone;
	TInt pos = 0;
	TPtrC8 fileName = Input::ParseElement(aTestActionSpec.iActionBody, KFileNameStart, 
		KFileNameEnd, pos, err);
	iFileName = HBufC::NewL(fileName.Length());
	iFileName->Des().Copy(fileName);
	
	// Set expected result
	pos = 0;
	
	HBufC* result = HBufC::NewLC(aTestActionSpec.iActionResult.Length());
	TPtr(result->Des()).Copy(aTestActionSpec.iActionResult);
	Input::GetExpectedResultL(Input::ParseElement(*result, KReturnStart, KReturnEnd), iExpectedResult);
	CleanupStack::PopAndDestroy(result);
	}
void CDeleteRetrieveUserCertificate::ConstructL(const TTestActionSpec& aTestActionSpec)
	{
	CSubscriberAction::ConstructL(aTestActionSpec);
	iCertlisted = new(ELeave) RPointerArray<HBufC8>;
	iFilter = CCertAttributeFilter::NewL();
	TInt pos = 0;
	TInt err = KErrNone;
	TPtrC8 pLabel = Input::ParseElement(aTestActionSpec.iActionBody, KCertLabelStart, KCertLabelEnd, pos, err);
	if (err != KErrNone)
		{
		User::Leave(err);
		}
	iCertLabel.Copy(pLabel);

	// Set expected result
	HBufC* result = HBufC::NewLC(aTestActionSpec.iActionResult.Length());
	TPtr(result->Des()).Copy(aTestActionSpec.iActionResult);
	Input::GetExpectedResultL(Input::ParseElement(*result, KReturnStart, KReturnEnd), iExpectedResult);
	CleanupStack::PopAndDestroy(result);
	}
TPtr CAknTextControl::Text() const
	{
	if (iText) 
		return iText->Get();
	return TPtr(0,0);
	}