コード例 #1
0
void CTestUtilClass::TestUtilClass_Step4L()
	{
	//
	// Test ParseRxResultsForCSCAResponse
	//
	// fill data with garbage
	RMobilePhone::TMobileAddress addr;
	addr.iTypeOfNumber=RMobilePhone::ESubscriberNumber;
	addr.iNumberPlan=RMobilePhone::EDataNumberPlan;
	addr.iTelNumber.Copy(_L("000111000111000111000111"));

	// setup a response to be parsed
	_LIT8(KAddressValue,"01632960000");
	_LIT8(KAddressType,"129");
	TPtrC8 addressValue(KAddressValue);
	TPtrC8 addressType(KAddressType);

	// Parse reponse and validate output
	INFO_PRINTF1(_L(".."));
	TESTL(KErrNone == CATSmsUtils::CopyAddressStringToAddressStruct(addressValue,addressType,addr));
	if(addr.iTypeOfNumber!=RMobilePhone::EUnknownNumber ||
	   addr.iNumberPlan!=RMobilePhone::EIsdnNumberPlan || 
	   addr.iTelNumber.Compare(_L("01632960000"))!=0)
		TESTL(KErrCorrupt);
	}
コード例 #2
0
// -----------------------------------------------------------------------------
// CSIPExSIPServerOfferingState::AcceptInviteL()
// (other items were commented in a header).
// -----------------------------------------------------------------------------
void CSIPExSIPServerOfferingState::AcceptInviteL( CSIPExSIPEngine& aEngine)
	{
	_LIT8( KMediaType, "application" );
	_LIT8( KMediaSubType, "sdp" );
	_LIT8( KLogEntry, "200 OK sent" );

	// Get the current transaction
	CSIPServerTransaction& tx = aEngine.ServerTx();
	// Create the Response Elements object
    CSIPResponseElements* respElem =
    	CSIPResponseElements::NewLC( 
    	    200, SIPStrings::StringF( SipStrConsts::EPhraseOk ) );
    
    // Set the message body - we need to communicate our IP Address
    CSIPMessageElements& msgElem = respElem->MessageElements();

	CSdpDocument* sdpDocument = aEngine.SdpDocumentLC();
	HBufC8* sdpBody = aEngine.SdpBodyL( sdpDocument );
	CleanupStack::PushL( sdpBody );

   	CSIPContentTypeHeader* ct =
   		CSIPContentTypeHeader::NewLC( KMediaType, KMediaSubType );
	msgElem.SetContentL( sdpBody, ct );

	// Use the transaction to send 200 (OK)
	tx.SendResponseL( respElem );

	CleanupStack::Pop( ct );
	CleanupStack::Pop( sdpBody );
	CleanupStack::PopAndDestroy( sdpDocument );
	CleanupStack::Pop( respElem );

	aEngine.SetCurrentState( iServerEstablishingState );
	aEngine.Observer()->WriteLog( KLogEntry );
	}
コード例 #3
0
// ----------------------------------------------------------------------------
// CSIPProfileSIMRecord::FindSIPSchema
// ----------------------------------------------------------------------------
//
TPtrC8 CSIPProfileSIMRecord::RemoveSIPSchemaL( const TDesC8& aValue )
    {
    __ASSERT_ALWAYS (aValue.Length() > 0, User::Leave(KErrArgument));

	_LIT8(KSIPAndColon, "sip:");
	_LIT8(KSIPSAndColon, "sips:");

	TPtrC8 schemeAndColon;
	TInt sipSchemePos = aValue.FindF(KSIPAndColon);
	if (sipSchemePos < 0)
		{
		TInt sipsSchemePos = aValue.FindF(KSIPSAndColon);
		if (sipsSchemePos != 0) 
            {
            User::Leave (KErrArgument);
            }
		schemeAndColon.Set(KSIPSAndColon);
		}
	else
		{
		if (sipSchemePos != 0) 
            {
            User::Leave (KErrArgument);
            }
		schemeAndColon.Set(KSIPAndColon);
		}
	TPtrC8 remainder(aValue.Mid(schemeAndColon.Length()));
	return remainder;
    }    
コード例 #4
0
/**
@SYMTestCaseID          SYSLIB-SQL-CT-3480
@SYMTestCaseDesc		Test for INC106788 - Cannot set SQLite page_size bigger than 4k (4096).
						The test attempts to create a database with page size 8K, 16K or 32K, which was not
						possible before (the default page size (1K) has been used).
@SYMTestPriority        High
@SYMTestActions			Test for INC106788 - Cannot set SQLite page_size bigger than 4k (4096).
@SYMTestExpectedResults The test should not fail or panic.
@SYMDEF INC106788
*/
void INC106788()
	{
	//Create a database with page size = 8192.
	(void)RSqlDatabase::Delete(KTestDbName);
	_LIT8(KCfgStr1, "page_size = 8192");
	TInt err = TheDb.Create(KTestDbName, &KCfgStr1);
	TEST2(err, KErrNone);
	AssertConfigPrmValues(TheDb, (TSqlSrvConfigParams::KDefaultSoftHeapLimitKb * 1024) / 8192, 8192, KDefaultEncoding);
	TheDb.Close();

	//Create a database with page size = 16384.
	(void)RSqlDatabase::Delete(KTestDbName);
	_LIT8(KCfgStr2, "page_size = 16384");
	err = TheDb.Create(KTestDbName, &KCfgStr2);
	TEST2(err, KErrNone);
	AssertConfigPrmValues(TheDb, (TSqlSrvConfigParams::KDefaultSoftHeapLimitKb * 1024) / 16384, 16384, KDefaultEncoding);
	TheDb.Close();
	
	//Create a database with page size = 32768.
	(void)RSqlDatabase::Delete(KTestDbName);
	_LIT8(KCfgStr3, "page_size = 32768");
	err = TheDb.Create(KTestDbName, &KCfgStr3);
	TEST2(err, KErrNone);
	AssertConfigPrmValues(TheDb, (TSqlSrvConfigParams::KDefaultSoftHeapLimitKb * 1024) / 32768, 32768, KDefaultEncoding);
	TheDb.Close();
	
	(void)RSqlDatabase::Delete(KTestDbName);
	}
コード例 #5
0
TInt ThreadFunc(void* aData)
	{
	__UHEAP_MARK;
	
	CTrapCleanup* tc = CTrapCleanup::New();
	TTEST(tc != NULL);

	TThreadData* data = static_cast<TThreadData*> (aData);
	TTEST(data != NULL);

	RSqlDatabase db;
	TInt err = db.Open(KTestDbName1);
	TTEST2(err, KErrNone);
	
	err = db.SetIsolationLevel(data->iIsolationLevel);
	TTEST2(err, KErrNone);
		
	if(data->iTransType == 1)
		{
		_LIT8(KBeginTrans, "BEGIN");
		err = db.Exec(KBeginTrans);
		TTEST(err >= 0);
		}

	_LIT8(KInsertSql, "INSERT INTO A(Id) VALUES(");	
	for(TInt id=data->iLowRecNo;id<=data->iHighRecNo;++id)
		{
		TBuf8<128> sql(KInsertSql);
		sql.AppendNum((TInt64)id);
		sql.Append(_L(")"));
		err = KSqlErrBusy;
		const TInt KAttempts = 20;
		for(TInt i=0;i<KAttempts&&err==KSqlErrBusy;++i)
			{
			err = db.Exec(sql);
			if(err == KSqlErrBusy)
				{
				RThread th;
				TName name = th.Name();
				RDebug::Print(_L("!!!Database locked, Thread: %S, Attempt %d, column value %d\r\n"), &name, i + 1, id);
				User::After(1000000);
				}
			}
		TTEST2(err, 1);
		}

	if(data->iTransType == 1)
		{
		_LIT8(KCommitTrans, "COMMIT");
		err = db.Exec(KCommitTrans);
		TTEST(err >= 0);
		}

	db.Close();		
	delete tc;
	
	__UHEAP_MARKEND;
	
	return KErrNone;		
	}
コード例 #6
0
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfGenComponentProcessL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfGenComponentProcessL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfGenComponentProcessL, "TestAlfGenComponentProcessL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfGenComponentProcessL );
    // Print to log file
    iLog->Log( KTestAlfGenComponentProcessL );
    _LIT8( KTest, "test" );
    TBuf8<KBufSize> vBuf( KTest );
    CAlfGenComponent* vComponent = CAlfGenComponent::NewL( *iAlfEnv, 0, 0x0DDDDDDE,
            vBuf );
    CleanupStack::PushL( vComponent );
    vComponent->Identifier();
    _LIT8( KInput, "in" );
    TBuf8<KBufSize> vInputBuf( KInput );
    _LIT8( KOut, "out" );
    TBuf8<KBufSize> vOutBuf( KOut );
    vComponent->DoSynchronousCmd( 0, vInputBuf, vOutBuf );
    vComponent->CancelAsynchCmd( 0 );
    vComponent->DoAsynchronousCmdL( 0, vInputBuf, vOutBuf, NULL );
    vComponent->DoCmdNoReply( 0 , vInputBuf );
    
    CleanupStack::PopAndDestroy( vComponent );
    
    return KErrNone;
    }
コード例 #7
0
/**
This method is a callback that sends the content of the element.
Not all the content may be returned in one go. The data may be sent in chunks.
When an OnEndElementL is received this means there is no more content to be sent.
@param				aBytes is the raw content data for the element. 
					The client is responsible for converting the data to the 
					required character set if necessary.
					In some instances the content may be binary and must not be converted.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnContentL(const TDesC8& aBytes, TInt aErrorCode)
	 {
	_LIT8(KOnContentFuncName,"OnContent()\r\n");
	_LIT8(KInfoOnContent,"\tContent of element: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	iLog.Write(KOnContentFuncName);
	if (aErrorCode == KErrNone)
		{
		if(aBytes.Length() >= KShortInfoSize)
			{ 
			TPtrC8 bytes = aBytes.Ptr();
			HBufC8* buf1 = HBufC8::NewL(aBytes.Length() + 100);
			buf1->Des().Format(KInfoOnContent,&bytes);
			iLog.Write(*buf1);
			}
		info2.Copy(aBytes);
		info2.Trim();
		if (info2.Length())
			{
			info.Format(KInfoOnContent,&info2);
			iLog.Write(info);
			}
		}
		else
			{
			TBuf8<KShortInfoSize> info;
			info.Format(KInfoOnError,aErrorCode);
			iLog.Write(info);
			}
	  }
コード例 #8
0
ファイル: slogger.cpp プロジェクト: kuailexs/symbiandump-os2
// Very simple logging code. This will thrash the file server by
// creating a new session to it for every line. Create the file
// c:\logs\ct.txt to turn on logging.
EXPORT_C void SLogger::Log(const TDesC& aLogFileName, const TDesC& aString,
                           const TDesC8& aSourceFileName, TInt aLineNumber)
{
    // Open the file server and file
    RFs fs;
    fs.Connect();
    RFile file;
    TInt error = file.Open(fs, aLogFileName, EFileWrite|EFileShareAny);
    // If the file doesn't exist, exit
    if (error != KErrNone)
    {
        fs.Close();
        return;
    }
    // Seek to the end of the file
    TInt tmp = 0;
    file.Seek(ESeekEnd, tmp);

    // And do some logging
    // Name of the file where the Log function was called
    file.Write(aSourceFileName);
    // Number of the line where the Log function was called
    _LIT8(KLineNumber, ",%d:");
    TBuf8<80> buf;
    buf.Format(KLineNumber, aLineNumber);
    file.Write(buf);
    buf.Copy(aString);
    file.Write(buf);
    _LIT8(KEnd, "\r\n");
    file.Write(KEnd());

    // Close and tidy up
    file.Close();
    fs.Close();
}
コード例 #9
0
/**
Add intra contact properties when called by Cntmodel/Cntvcard, clients can use aContactId to 
collect any info about that contact and create a property for export.
All property parameters should be in form of name=value pair if exported as vCard3.0	
*/
void  CCntPBAPSupport::AddIntraContactPropertiesL(const TContactItemId& /*aContactId*/, CArrayPtr<CParserProperty>* aPropertyList)
	{
	_LIT8(KVersitIntraProp,"X-IRMC-CALL-DATETIME");
	_LIT8(KParam,"TYPE");
	_LIT8(KParamVal,"MISSED");

	if(iAddIntraProperties)
		{
	    CArrayPtr<CParserParam>* arrayOfParams = new(ELeave) CArrayPtrFlat<CParserParam>(5);
		CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy, arrayOfParams));

		CParserParam* param = CParserParam::NewL(KParam, KParamVal);
		CleanupStack::PushL(param);
		arrayOfParams->AppendL(param);
		CleanupStack::Pop(param);

		TDateTime missedTime(2006,EOctober,10,10,30,0,0);
		TVersitDateTime* dateTime = new(ELeave)TVersitDateTime(missedTime, TVersitDateTime::EIsUTC);
		CleanupStack::PushL(dateTime);
		CParserPropertyValueDateTime* dateTimeValue = new(ELeave) CParserPropertyValueDateTime(dateTime);
		CleanupStack::Pop(dateTime);

		CleanupStack::PushL(dateTimeValue);
		CParserProperty* property = CParserGroupedProperty::NewL(*dateTimeValue, KVersitIntraProp, NULL, arrayOfParams);
		CleanupStack::Pop(dateTimeValue);
		CleanupStack::PushL(property);	
		aPropertyList->AppendL(property);
		CleanupStack::Pop(property);
		CleanupStack::Pop(arrayOfParams);
		}
	}
コード例 #10
0
/**
This method is a callback to indicate the start of the document.
@param				aDocParam Specifies the various parameters of the document.
					aDocParam.iCharacterSetName The character encoding of the document.
@param				aErrorCode is the error code. 
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnStartDocumentL(const RDocumentParameters& aDocParam, TInt aErrorCode)
{
	_LIT8(KOnStartDocumentFuncName,"OnStartDocument()\r\n");
	_LIT8(KInfoOnStartDocP,"\tDocument start \tparameters: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
		
	iLog.Write(KOnStartDocumentFuncName);

	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aDocParam.CharacterSetName().DesC());		

		info.Format(KInfoOnStartDocP,&info2);
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
コード例 #11
0
/**
This method is a callback to indicate the end of the element has been reached.
@param				aElement is a handle to the element's details.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnEndElementL(const RTagInfo& aElement, TInt aErrorCode)
{
	_LIT8(KOnEndElementFuncName,"OnEndElement()\r\n");
	_LIT8(KInfoOnEndElePU,"\tElement end namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	TBuf8<KShortInfoSize> info3;
	TBuf8<KShortInfoSize> info4;
	
	iLog.Write(KOnEndElementFuncName);
	if (aErrorCode == KErrNone)
	{
		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnEndElePU,&info3,&info4,&info2);	
		iLog.Write(info);
	}
	else
	{
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}	
}
コード例 #12
0
/**
This method is a notification of a skipped entity. If the parser encounters an 
external entity it does not need to expand it - it can return the entity as aName 
for the client to deal with.
@param				aName is the name of the skipped entity.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnSkippedEntityL(const RString& aName, TInt aErrorCode)
{
	_LIT8(KOnSkipEntFuncName,"OnSkippedEntity()\r\n");	
	_LIT8(KInfoOnEndPref,"\tSkipped entity: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	iLog.Write(KOnSkipEntFuncName);

	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aName.DesC());		
		
		info.Format(KInfoOnEndPref,&info2);
	
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}	
}
コード例 #13
0
/**
This method is a notification of the end of the scope of a prefix-URI mapping.
This method is called after the corresponding DoEndElementL method.
@param				aPrefix is the Namespace prefix that was mapped.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode)
{
	_LIT8(KOnEndPrefMapFuncName,"OnEndPrefixMapping()\r\n");
	_LIT8(KInfoOnEndPref,"\tPrefix mapping end prefix: %S \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	iLog.Write(KOnEndPrefMapFuncName);
	
	if (aErrorCode == KErrNone)
	{
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		
		info2.Copy(aPrefix.DesC());		
		
		info.Format(KInfoOnEndPref,&info2);
	
		iLog.Write(info);
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
コード例 #14
0
/**
This method is a notification of ignorable whitespace in element content.
@param				aBytes are the ignored bytes from the document being parsed.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode)
{
	_LIT8(KOnIgnorWhiteFuncName,"OnIgnorableWhiteSpace()\r\n");	
	_LIT8(KInfoOnIgnorWhiteSpace,"\tIgnoring white space: %S length: %d \r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");
	
	TBuf8<KShortInfoSize> info;
	TBuf8<KShortInfoSize> info2;
	
	iLog.Write(KOnIgnorWhiteFuncName);
	
	if (aErrorCode == KErrNone)
	{
		info2.Copy(aBytes);
		info2.Trim();
		
		if (info2.Length())
		{
			info.Format(KInfoOnIgnorWhiteSpace,&info2,info2.Length());
			iLog.Write(info);
		}
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
コード例 #15
0
//Modify URI components
void CExampleInetProtUtil::ModifyUriComponentsL()
	{	
	TUriParser8 parser1;
	CUri8* aUri = CUri8::NewL(parser1);
	
	_LIT(KText3, "\n\n\nAdding Uri components one by one....");
	iConsole->Printf ( KText3 );

	// Adding components to the Uri
	
	//Setting and displaying SCHEME
	_LIT8(KScheme, "http");
	_LIT(KScheme1, "\nSCHEME : http");
	iConsole->Printf ( KScheme1 );
	aUri->SetComponentL(KScheme, EUriScheme);
	
	//Setting and displaying HOST
	_LIT8(KHost, "www.symbian.com");
	_LIT(KHost1, "\nHOST : www.symbian.com");
	iConsole->Printf ( KHost1 );
	aUri->SetComponentL(KHost, EUriHost);
	
	//Setting and displaying PORT
	_LIT8(KPort, "80");
	_LIT(KPort1, "\nPORT : 80");
	iConsole->Printf ( KPort1 );
	aUri->SetComponentL(KPort, EUriPort);
	
	//Setting and displaying PATH
	_LIT8(KPath, "/developer/techlib/turic8class.html");
	_LIT(KPath1, "\nPATH : /developer/techlib/turic8class.html");
	iConsole->Printf ( KPath1 );
	aUri->SetComponentL(KPath, EUriPath);
	
	//Display the constucted Uri
	_LIT(KText4, "\nThe fully constructed Uri....");
	iConsole->Printf ( KText4 );
	const TDesC8& desUriDisplay = aUri->Uri().UriDes();
	TBuf16<100> desFullUri;
	desFullUri.Copy (desUriDisplay);
	
	iConsole->Printf( KLeaveALine );
	iConsole->Printf ( desFullUri );
	
	// Removal of component from the Uri
	iConsole->Getch ();
	_LIT(KText5, "\n\nUri with the Port number removed....\n");
	iConsole->Printf ( KText5 );
	aUri->RemoveComponentL(EUriPort);

	//Display the modified Uri
	const TDesC8& desRemovedComponentDisplay =aUri->Uri().UriDes();
	TBuf16<100> desRemovedComponent;
	desRemovedComponent.Copy (desRemovedComponentDisplay);
	iConsole->Printf ( desRemovedComponent );
	
	delete aUri;
	
	iConsole->Getch ();
	}
コード例 #16
0
void ut_cphoneringingtonecontroller::T_PlayRingingtoneTTS()
{
    // Expected data
    _LIT(KTextToSay, "Mr. Brownstone");
    TBuf<30> texttosay (KTextToSay);
    TBuf<50> ringingtone(KNokiatune);
    CPhoneRingingTone* aAudioVideoRingingTone = CPhoneRingingTone::NewL(ringingtone);
    aAudioVideoRingingTone->SetRingingType(EProfileRingingTypeRinging);
    aAudioVideoRingingTone->SetTtsToneToBePlayed(ETrue);
    aAudioVideoRingingTone->SetVolume(5);
    _LIT8( KMethod, "CPhoneTTSPlayer::NewL" );
    iMockContext->ExpectCallL( KMethod() );
    _LIT8( KMethod2, "CPhoneTTSPlayer::PlayTtsTone" );
    iMockContext->ExpectCallL( KMethod2() ).WithL(KTextToSay(), aAudioVideoRingingTone);   
    _LIT8( KMethod3, "CPhoneRingingtonePlayer::PlayProfileBasedTone" );
    iMockContext->ExpectCallL( KMethod3() ).WithL(aAudioVideoRingingTone);

    TPhoneCmdParamRingTone ringToneParam;
    ringToneParam.SetVolume(5);
    ringToneParam.SetRingingType(EProfileRingingTypeRinging);
    ringToneParam.SetTextToSay(texttosay);
    // Set the profile ring tone
    ringToneParam.SetRingTone( ringingtone);
    ringToneParam.SetType( EPhoneRingToneProfile );

    iRingingtoneplayer->PlayRingToneL( &ringToneParam );
    
    EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
    delete aAudioVideoRingingTone;
}
コード例 #17
0
TVerdict CXmlEngXPathUtilsToBooleanTest::TestKXmlEngXPathUtilsToBoolean()
	{
	//Create the dom utils object
	TInt err = KErrNone; 
	_LIT8(KLit1, "asdfds");
	_LIT8(KLit2, "xzcvcv");
	_LIT8(KLit3, "lklklk");
	TBufC8<30> aLocalName(KLit1);
	TBufC8<30> aNamespaceUri(KLit2);
	TBufC8<30> aPrefix(KLit3);
	
	RXmlEngDOMImplementation domImpl;
	domImpl.OpenL(); 
		
	RXmlEngDocument doc;
	doc.OpenL(domImpl);

	doc.CreateDocumentElementL(aLocalName, aNamespaceUri, aPrefix);
	
	TXmlEngElement aElement;  
	
	//For code coverage
	TBool isEmpty = XmlEngXPathUtils::ToBoolean(aElement);
	
	doc.Close();               
	domImpl.Close();
		
	if (KErrNone != err)
	{
		return EFail;
	}
	
	return EPass;
	}
コード例 #18
0
TInt CSatNotifySendSs::CheckSsStringValidity
		(
    	TPtrC8 aSsString 
    	)
    {
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_1, "CSAT:: CSatNotifySendSs::CheckSsStringValidity");
    TInt ret( KErrNone );
    
    if ( !aSsString.Length() )
        {
        OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_2, "CSAT:: CSatNotifySendSs::CheckSsStringValidity, String length is NULL");
        // If length is zero
        ret = KErrCorrupt;
        }
    
    _LIT8( KDtmf,            "p");
    _LIT8( KWild,            "w");
    _LIT8( KExpansionDigit,  ".");

    // SS string can contain only digits, star '*' and dash '#' characters.
    if ( ( KErrNotFound != aSsString.Find( KDtmf ) )
        || ( KErrNotFound != aSsString.Find( KWild ) )
        || ( KErrNotFound != aSsString.Find( KExpansionDigit ) ) )
        {
        OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CHECKSSSTRINGVALIDITY_3, "CSAT:: CSatNotifySendSs::CheckSsStringValidity, Incompatible character found");
        ret = KErrCorrupt;
        }
    return ret;
    }
コード例 #19
0
int main()
{
    __UHEAP_MARK;
    _LIT8(Kname,"tlit8aaaaaaaaaaaaaaaaa");
    char *des=new char[10];
    int size=2;
    int retval=ESuccess;
    retval= Tlitc8ToChar(Kname,des,size);

    _LIT8(Kname2,*des);
    char *des2=new char[10];
    retval= Tlitc8ToChar(Kname2,des2,size);

    if(retval ==EDescriptorNoData)
    {
    printf("Test_tlit8tochar_recalling passed\n");
    }
    else
    {
    assert_failed = true;
    printf("Test_tlit8tochar_recalling FAILURE\n");
    }
    delete[] des;
    delete[] des2;
    des=NULL;
    des2 = NULL;
    __UHEAP_MARKEND;
    testResultXml("Test_tlit8tochar_recalling");
	return 0;
}
コード例 #20
0
void CCSatSetUpCallFU::TestNotifySetUpCallPCmd0001bL()
	{
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	OpenSatL();
	
	RSat::TSetUpCallRspV2 resp;
	RSat::TSetUpCallRspV2Pckg respPck(resp);
	RSat::TSetUpCallV6 setupCallData;

	const TUint8 KAddress = 0x91; //10010001

	TData data;
	data.iCommandNumber = 1;
	data.iCommandQualifier = KSetUpCallIfNotCurrentlyBusy;
	data.iSourceDevice = KSim;
	data.iDestinationDevice = KNetwork;
	data.iAddress = KAddress;
	data.iCommandType = KSetUpCall;

	//
	// Expected Sequence 2.1 (SET UP CALL, two alpha identifiers)
	//

	data.iCallNumber.Append(0x10);
	data.iCallNumber.Append(0x32);
	data.iCallNumber.Append(0x04);
	data.iCallNumber.Append(0x21);
	data.iCallNumber.Append(0x43);
	data.iCallNumber.Append(0x65);
	data.iCallNumber.Append(0x1C);
	data.iCallNumber.Append(0x2C);

	_LIT8(KAlphaIdentifier8_1, "CONFIRMATION");
	_LIT16(KAlphaIdentifier16, "CONFIRMATION");

	_LIT8(KAlphaIdentifier8_2, "CALL");

	data.iDuration.iIfUse = EFalse;
	data.iCommandQualifier = KSetUpCallIfNotCurrentlyBusy;
	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_1, KErrNone, KAlphaIdentifier8_2 );

	DataCompareL(setupCallData, 
			     data.iCommandQualifier,
			     KAlphaIdentifier16, 
			     RSat::EInternationalNumber, 
			     RSat::EIsdnNumberPlan);

	resp.iInfoType = RSat::KNoAdditionalInfo;
	resp.iAdditionalInfo.Zero();
	resp.iGeneralResult = RSat::KSuccess;
	CCSatComponentTestBase::GenerateTerminalResponseL( data.iCommandNumber, data.iCommandType, 
			data.iCommandQualifier, RSat::ESetUpCall, respPck, KNullDesC16, resp.iGeneralResult );
	AssertMockLtsyStatusL();

	CleanupStack::PopAndDestroy(1, this); // this
	}
コード例 #21
0
int main()
{
    __UHEAP_MARK;
    {
    int retval[10];
    _LIT8(KTxt, "HelloHello");
    HBufC8* buffer = HBufC8::NewL(10);
    *buffer = KTxt;
    wstring myWstring(L"gfsdfdufhuhfhfsfsfsdf");
    retval[0] = Hbufc8ToWstring(buffer,myWstring);

    TPtrC8 myTptr8(KTxt);
    char* temp = new char[30];
    retval[2] = WstringToTptrc8(myWstring,temp,myTptr8);

    char* myChar = new char[40];
    int size = 40;
    retval[3] = Tptrc8ToCharp(myTptr8,myChar,size);

    TBufC8<30> buf8;
    TPtr8 myTptr = buf8.Des();  
    retval[4] = CharpToTptr8(myChar,myTptr);

    wchar_t* Wstr_fin = new wchar_t[36];
    int size_char=36;
    retval[5] = Tptr8ToWcharp(myTptr,Wstr_fin,size_char);

    _LIT8(text_fin, "fgdsgfgdsg");
    HBufC8* finBuffer = HBufC8::NewL(10);
    *finBuffer = text_fin;
    retval[6] = WcharToHbufc8(Wstr_fin,finBuffer);
    
    for(int i=1; i<=6; i++)
        {
        if (retval[i]!= 0)
                printf("Conversion failed for retval\n",retval[i]);
        }

    if(!buffer->Compare(finBuffer->Des()))
    {
    printf("\n\nintegration_test_scenario26 case passed");
    }
    else
    {
    printf("\n\nintegration_test_scenario26 case failed");
    assert_failed = true;
    }
    delete buffer;
    delete[] temp;
    delete[] myChar;
    delete[] Wstr_fin;
    delete 	finBuffer;
    }
    __UHEAP_MARKEND;
    testResultXml("integration_test_scenario26");
    return 0;
}
コード例 #22
0
/** Setting of Time Zone using different Time Zone Servers
*/	
void CTestTZServer::MulitpleTZServerL()
	{
	_LIT8(KEuropeLondon, "Europe/London");
	CTzId* zoneId = CTzId::NewL(KEuropeLondon);
	CleanupStack::PushL(zoneId);
		
	_LIT8(KPacificPortMoresby, "Pacific/Port_Moresby");
	CTzId* zoneId1 = CTzId::NewL(KPacificPortMoresby);
	CleanupStack::PushL(zoneId1);
	
	_LIT8(KAfricaDar, "Africa/Dar_es_Salaam");
	CTzId* zoneId2 = CTzId::NewL(KAfricaDar);
	CleanupStack::PushL(zoneId2);
	
	RTz tz;
	CleanupClosePushL(tz);
	User::LeaveIfError(tz.Connect());
	
	RTz tz1;
	CleanupClosePushL(tz1);
	User::LeaveIfError(tz1.Connect());
	
	RTz tz2;
	CleanupClosePushL(tz2);
	User::LeaveIfError(tz2.Connect());
	
	CTzId* tzId = NULL;
	
	TRAPD(err,tz.SetTimeZoneL(*zoneId));
	TESTL(err == KErrNone);
	
	TRAP(err,tz1.SetTimeZoneL(*zoneId1));
	TESTL(err == KErrNone);
	
	TRAP(err,tz2.SetTimeZoneL(*zoneId2));
	TESTL(err == KErrNone);
	
	TRAP(err,tzId = tz.GetTimeZoneIdL());
	TESTL(err == KErrNone);
	TESTL(tzId != NULL);
	
	TRAP(err,tzId = tz1.GetTimeZoneIdL());
	TESTL(err == KErrNone);
	TESTL(tzId != NULL);
	
	TRAP(err,tzId = tz2.GetTimeZoneIdL());
	TESTL(err == KErrNone);
	TESTL(tzId != NULL);
	
	CleanupStack::PopAndDestroy(&tz2);
	CleanupStack::PopAndDestroy(&tz1);
	CleanupStack::PopAndDestroy(&tz);
	CleanupStack::PopAndDestroy(zoneId2);
	CleanupStack::PopAndDestroy(zoneId1);
	CleanupStack::PopAndDestroy(zoneId);
	}
コード例 #23
0
/**
This method indicates an error has occurred.
@param				aError is the error code
*/
void CTestHandler::OnError(TInt aErrorCode)
{
	_LIT8(KOnErrorFuncName,"OnError()\r\n");
	_LIT8(KInfoOnErrorFunc,"\tError function - error occurs %d \r\n");
	
	iLog.Write(KOnErrorFuncName);	
	TBuf8<KShortInfoSize> info;
	info.Format(KInfoOnErrorFunc,aErrorCode);
	iLog.Write(info);
}
コード例 #24
0
void CNSmlDummyDataProvider_Test::TestStoreSupportMimeTypeL()
    {
    _LIT8( KNSmlvCard21Name, "text/x-vcard" );
    _LIT8( KNSmlvCard21Ver, "2.1" );

    const CSmlDataStoreFormat& storeFormat = iCNSmlDummyDataProvider->DoStoreFormatL();
    EUNIT_ASSERT_EQUALS( storeFormat.MimeFormatCount() ,1 );
    EUNIT_ASSERT_EQUALS( storeFormat.MimeFormat(0).MimeType().DesC(), KNSmlvCard21Name() );
    EUNIT_ASSERT_EQUALS( storeFormat.MimeFormat(0).MimeVersion().DesC(), KNSmlvCard21Ver() );
    }
コード例 #25
0
// -----------------------------------------------------------------------------
// Ctreemoduleapi::ExampleL
// Example test method function.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt Ctreemoduleapi::UpdateObjectL()
{
    CNSmlDmCallbackTest *callBack =CNSmlDmCallbackTest::NewL(); 
	CleanupStack::PushL(callBack);
	CNSmlDmModule *dmModule = NULL;
	dmModule = CNSmlDmModule::NewL(callBack);
	CleanupStack::PushL(dmModule);
	
  	_LIT8(KaURI,"./DMAcc/MyNode901");
  	TBufC8<40> aURI( KaURI );

	_LIT8(KaObject,"Software");
  	TBufC8<25> aObject( KaObject );

	_LIT8(KaType,"text/plain");
  	TBufC8<25> aType( KaType );
  	
  	TInt aStatusRef = 1;
  	TBool aLargeItem = EFalse;
  	
  	_LIT8(KserverId,"funambool1");
  	TBufC8<25> serverId( KserverId );

	dmModule->SetServerL(serverId);
	dmModule->AddObjectL(aURI,aObject,aType,aStatusRef, aLargeItem);

 	TInt status = callBack->iStatuscode;
	if( status != 200)
	{	
		dmModule->DisconnectFromOtherServers();
		CleanupStack::PopAndDestroy(dmModule);
		CleanupStack::PopAndDestroy(callBack);
		return KErrGeneral;
	}

 //	_LIT8(KaURI1,"./DMAcc/MyNode72/PkgName");
 	_LIT8(KaURI1,"./DMAcc/MyNode901/Name");
  	TBufC8<40> aURI1( KaURI1 );
	
	dmModule->UpdateObjectL(aURI1,aObject,aType,aStatusRef, aLargeItem);
	status = callBack->iStatuscode;
	if( status != 200)
	{	
		dmModule->DisconnectFromOtherServers();
		CleanupStack::PopAndDestroy(dmModule);
		CleanupStack::PopAndDestroy(callBack);
		return KErrGeneral;
	}
	dmModule->DisconnectFromOtherServers();
	CleanupStack::PopAndDestroy(dmModule);
	CleanupStack::PopAndDestroy(callBack);

	return KErrNone;

}
コード例 #26
0
void UT_CMccRtcpReceiver::UT_CMccRtcpReceiver_SdesReceivedL()
    {
    iExpectedPackets++;
    iTmpSsrc = KSsrcSdes;
    TRtpSdesParams params;
    _LIT8(KCName, "foofoo");
    params.iCName.Set( KCName() );
    _LIT8(KLocation, "foo2foo2");
    params.iLocation.Set( KLocation() );
    iRtcpReceiver->SdesReceived( iTmpSsrc, params );
    }
コード例 #27
0
/**
This method is a callback to indicate an element has been parsed.
@param				aElement is a handle to the element's details.
@param				aAttributes contains the attributes for the element.
@param				aErrorCode is the error code.
					If this is not KErrNone then special action may be required.
*/
void CTestHandler::OnStartElementL(const RTagInfo& aElement, const RAttributeArray& aAttributes, 
								 TInt aErrorCode)
{
	_LIT8(KOnStartElementFuncName,"OnStartElement()\r\n");
	_LIT8(KInfoOnStartElePU,"\tElement start namespace: %S \t prefix: %S \tname: %S\r\n");
	_LIT8(KInfoOnAttributePU,"\t\tAttribute namaspace: %S \t prefix: %S \tname: %S \t value: %S\r\n");
	_LIT8(KInfoOnError,"Error occurs %d \r\n");

	iLog.Write(KOnStartElementFuncName);
	
	if (aErrorCode == KErrNone)
	{
		
		TBuf8<KShortInfoSize> info;
		TBuf8<KShortInfoSize> info2;
		TBuf8<KShortInfoSize> info3;
		TBuf8<KShortInfoSize> info4;
		TBuf8<KShortInfoSize> info5;

		info2.Copy(aElement.LocalName().DesC());		
		info3.Copy(aElement.Uri().DesC());		
		info4.Copy(aElement.Prefix().DesC());
		
		info.Format(KInfoOnStartElePU,&info3,&info4,&info2);	
		iLog.Write(info);
		
		RArray <RAttribute> array = aAttributes;
		TInt size = array.Count();
		
		RAttribute attr;
		
		if ( size > 0 )
		{
			for ( TInt i = 0; i < size; i++)
			{
				attr = array[i];
				
				info2.Copy(attr.Attribute().LocalName().DesC());
				info3.Copy(attr.Attribute().Uri().DesC());		
				info4.Copy(attr.Attribute().Prefix().DesC());		
				info5.Copy(attr.Value().DesC());		
				
				info.Format(KInfoOnAttributePU,&info3,&info4,&info2,&info5);
				iLog.Write(info);
			}
		}
	}
	else
	{
		TBuf8<KShortInfoSize> info;
		info.Format(KInfoOnError,aErrorCode);
		iLog.Write(info);
	}
}
コード例 #28
0
// ----------------------------------------------------------------------------
// CSIPProfileSIMRecord::FindSIPSchema
// ----------------------------------------------------------------------------
//
TBool CSIPProfileSIMRecord::FindSIPSchema( const TDesC8& aValue )
    {
    _LIT8(KSIP, "sip:");
    _LIT8(KSIPS, "sips:");
    TPtrC8 value(aValue);
    if(value.FindF(KSIP) == 0 ||
       value.FindF(KSIPS) == 0)
        {
        return ETrue;
        }
    return EFalse;
    }
コード例 #29
0
// -----------------------------------------------------------------------------
// LocalHostCheckL
// If the host is a local host, then remove the proxy property. Returns ETrue
// if the transaction request URI was for a localhost.
// -----------------------------------------------------------------------------
//
TBool LocalHostCheckL(RHTTPTransaction& aTransaction, RStringPool& aStringPool)
    {
    _LIT8(KLoopbackIPv4Url, "http://127.0.0.1"); 
    
    RHTTPRequest request = aTransaction.Request();
    TUriC8 uri = request.URI();

    TUriParser8 parserLoopBack;
    parserLoopBack.Parse(KLoopbackIPv4Url());
    TInt match = parserLoopBack.Compare(uri, EUriHost);

    if (KErrNone != match)
        {
        _LIT8(KLocalHostUrl, "http://localhost"); 

        // try another compare - compare against the "localhost".
        TUriParser8 parserLocalHost;
        parserLocalHost.Parse(KLocalHostUrl());
        match = parserLocalHost.Compare(uri, EUriHost);

        if (KErrNone == match) 
            {
            _LIT8(KLoopbackIPv4, "127.0.0.1"); 

            // "localhost" resolves to "::1", manually, replace with "127.0.0.1"
            CUri8* newUri = CUri8::NewLC(uri);
            newUri->SetComponentL(KLoopbackIPv4(), EUriHost);
            request.SetURIL(newUri->Uri());
            CleanupStack::PopAndDestroy(newUri);
            }
        }
              
    if (KErrNone == match)
        {
        // request is for localhost, explicitly state that this transaction
        // must not be sent to proxy.
    	RStringF proxyUsageStrF = aStringPool.StringF(HTTP::EProxyUsage, 
                                                      RHTTPSession::GetTable());
        
    	RStringF dontUseProxyStrF = aStringPool.StringF(HTTP::EDoNotUseProxy, 
                                                        RHTTPSession::GetTable());	

        aTransaction.PropertySet().RemoveProperty(proxyUsageStrF);
        aTransaction.PropertySet().SetPropertyL(proxyUsageStrF, dontUseProxyStrF);

    	//RStringF proxyAddrStrF = aStringPool.StringF(HTTP::EProxyAddress, 
        //                                             RHTTPSession::GetTable());

        //aTransaction.PropertySet().RemoveProperty(proxyAddrStrF);
        return ETrue;                                                          
        }
    return EFalse;
    }
コード例 #30
0
// ----------------------------------------------------------------------------
// CNetworkInfo::DetermineAccessInfoL
// Valid LAC and CellId are included also when iInfo.iAreaKnown is EFalse.
// ----------------------------------------------------------------------------
//
void CNetworkInfo::DetermineAccessInfoL()
	{
	iAccessInfoValue.Close();

	if ( iAccessType == i3gppGeran ||
	     iAccessType == i3gppUtranFdd ||
		 iAccessType == i3gppUtranTdd ||
		 iAccessType == i3gppCdma2000 )
		{
		//Long enough to hold:
		//	MCC: 3 digits
		//  MNC: 2 or 3 digits (depending on MCC value)
		//  LAC: 4 hex digits (16 bits)
		//  Cell Identity: 4 or 7 hex digits (16 or 28 bits)
		const TInt KAccessInfoStringLength = 18;
		HBufC8* accessInfo = HBufC8::NewLC( KAccessInfoStringLength );		
		TPtr8 ptr = accessInfo->Des();		

		//MCC = TBuf<4> RMobilePhone::TMobilePhoneNetworkCountryCode;
		//MNC = TBuf<8> RMobilePhone::TMobilePhoneNetworkIdentity;

		ptr.Append( iInfo.iMobileCountryCode.Left( 3 ) );		
		ptr.Append( iInfo.iMobileNetworkCode.Left( 3 ) );

		//LAC is a 16 bit value
		const TUint KLacMask = 0xffff;
		//Include leading zeros
		_LIT8( K16BitFormat, "%04x" );
		ptr.AppendFormat( K16BitFormat, iInfo.iLocationAreaCode & KLacMask );

		if ( iAccessType == i3gppGeran )
			{
			//CI (Cell Identity) is a 16 bit value
			const TUint KCellIdMask = 0xffff;
			ptr.AppendFormat( K16BitFormat, iInfo.iCellId & KCellIdMask );
			}
		else
			{
			//UMTS Cell Identity is a 28 bit value
			const TUint KUmtsCellIdMask = 0xfffffff;
			_LIT8( KUmtsCellIdFormat, "%07x" );
			ptr.AppendFormat( KUmtsCellIdFormat,
							  iInfo.iCellId & KUmtsCellIdMask );
			}

		iAccessInfoValue = SIPStrings::Pool().OpenFStringL( *accessInfo );		
		CleanupStack::PopAndDestroy( accessInfo );
		}
	else
		{		
		iAccessInfoValue = SIPStrings::StringF( SipStrConsts::EEmpty );
		}
	}