コード例 #1
0
TVerdict CTestStepSDevSoundClientThreadNoCap::DoTestStepL( void )
{
    INFO_PRINTF1( _L("CTestStepSDevSoundClientThreadNoCap : DevSoundMP"));
    iVerdict = EFail;

    iServerMonitor = CServerMonitor::NewL(this);

    RTestServ server;
    User::LeaveIfError(server.Connect(_L("SDSCapTestServer")));
    CleanupClosePushL(server);

    RTestSession session2;
    User::LeaveIfError(session2.Open(server,_L("SecDevSndTS0036")));
    CleanupClosePushL(session2);
    TRequestStatus status2 = KRequestPending;
    session2.StartProcessing(status2);
    User::WaitForRequest(status2);
    TPckgBuf<TThreadId> serverTid;
    session2.EndProcessingAndReturnResult(serverTid);
    iServerTid = serverTid();

    RTestServ mmddServer;
    User::LeaveIfError(mmddServer.Connect(_L("SDSMMDDTestServer")));
    CleanupClosePushL(mmddServer);
    RTestSession session1;
    User::LeaveIfError(session1.Open(mmddServer,_L("SecDevSndTS0036")));
    CleanupClosePushL(session1);

    TInt err = DoPlaySimpleTone();
    if (err == KErrNone)
    {
        if (iAttemptInitialCI)
        {
            // assume DoPlaySimpleTone() terminated early prior to InitializeL()
            iVerdict = EPass;
        }
        else
        {
            // Start playing simple tone in this thread
            TRequestStatus status = KRequestPending;
            session1.StartProcessing(status);
            iAL->InitialiseActiveListener();
            CActiveScheduler::Start();
            // Simple tone in this thread finished, wait until the
            // simple tone playing in the other thread to finish
            User::WaitForRequest(status);
            iServerResult = status.Int();

            // Verify the results from both threads
            iVerdict = DoVerifyResult();
            TBuf8<256> message;
            session1.EndProcessingAndReturnResult(message);
        }
    }
    else
    {
        iVerdict = EInconclusive;
    }
    CleanupStack::PopAndDestroy(4, &server);	// session1, mmddServer, session2, server
    return iVerdict;
}
コード例 #2
0
void CTestStepESockSSA::KillC32Start()
	{
	// Start by looking for the running configurator and kill it if found. The caller
	// needs the appropriate capability to do this

	RDebug::Printf("Finding existing configurator process.");	
	_LIT(KC32StartName, "*");
	TInt result;
	TBool configuratorWasPresent;
	TInt count = 0;
	const TInt KMaxKillRetry = 10;
	do 
		{
		configuratorWasPresent = EFalse;
		TFullName fn;
		TFindProcess fp(KC32StartName);
		while(fp.Next(fn) == KErrNone)
			{
			RProcess proc;
			result = proc.Open(fn);
			if(result == KErrNone)
				{
				TUidType type = proc.Type();
				if(type[2] == TUid::Uid(KUidC32StartProcess) && proc.ExitType() == EExitPending) 
					{
					// Kill the existing configurator process.
					RDebug::Print(_L("Opened existing configurator process \"%S\""), &fn);
					TRequestStatus status;
					proc.Logon(status);
					proc.Kill(KErrNone);
					RDebug::Printf("Killed process.");
					User::WaitForRequest(status);
					TExitType exitType = proc.ExitType();
					
					// Create a timer in case some other entity holds an open handle on the
					// configurator which prevents the kernel from destroying it.  We timeout
					// after one second.
					TAutoClose<RTimer> timer;
					if(timer.iObj.CreateLocal() == KErrNone)
						{
						// Request destruction notification so we know when it is safe to start
						// the process again.
						TRequestStatus destructionStatus;
						proc.NotifyDestruction(destructionStatus);
						proc.Close();
					
						enum{ KProcessDestructionTimeout = 1000000 };
  					
						TRequestStatus timerStatus;
						timer.iObj.After(timerStatus, KProcessDestructionTimeout);
						
						// Wait for the process to be destroyed or for the timeout.
						User::WaitForRequest(destructionStatus, timerStatus);
						if(timerStatus.Int() == KRequestPending)
							{
							timer.iObj.Cancel();
							User::WaitForRequest(timerStatus);
							}
						else
							{
							User::CancelMiscNotifier(destructionStatus);
							User::WaitForRequest(destructionStatus);
			
							RDebug::Printf("Existing configurator process has still not been destroyed after %f.0s", KProcessDestructionTimeout / 1000000.0);
							}
						}
					else
						{
						proc.Close();
						}
						
					RDebug::Printf("Process logon completed with %d, exitType %d", status.Int(), exitType);
					configuratorWasPresent = ETrue;
					}
				else
					{
					proc.Close();	
					}
				}
			}
		} while(configuratorWasPresent && ++count < KMaxKillRetry);

		if (count >= KMaxKillRetry)
			{
			RDebug::Printf("KillC32Start - Cannot kill the configurator process, we will try continue and hope all is well");
			}
		
	// Restart the boot sequence from scratch - the configurator reads this.
	RProperty::Set(KUidSystemCategory, KUidC32StartPropertyKey.iUid, EReset);
	}
コード例 #3
0
GLDEF_C TInt E32Main()

    {
	__UHEAP_MARK;

	Test.Title();

	TInt r;
	Test.Start(_L("Load sound PDD"));
	r=User::LoadPhysicalDevice(KSndPddFileName);
	if (r==KErrNotFound)
		{
		Test.Printf(_L("Shared chunk sound driver not supported - test skipped\r\n"));
		Test.End();
		Test.Close();
		__UHEAP_MARKEND;
		return(KErrNone);
		}
	Test(r==KErrNone || r==KErrAlreadyExists);
	
	Test.Next(_L("Load sound LDD"));
	r=User::LoadLogicalDevice(KSndLddFileName);
	Test(r==KErrNone || r==KErrAlreadyExists);
	
	/**	@SYMTestCaseID 		PBASE-T_SOUNDMCHAN-224
	@SYMTestCaseDesc 		Opening the channel - more than one channel
	@SYMTestPriority 		Critical
	@SYMTestActions			1)	With the LDD and PDD installed and with all channels closed on the device, 
								open a channel for playback on the device. 
							2)	Without closing the first playback channel, attempt to open a second channel 
								for playback on the same device. 
	@SYMTestExpectedResults	1)	KErrNone - Channel opens successfully. 
							2)	Should fail with KErrInUse.
	@SYMREQ					PREQ1073.4 */	
	
	__KHEAP_MARK;

	Test.Next(_L("Open a channel on the play device"));
	RSoundSc snddev;
	r=snddev.Open(KSoundScTxUnit0);
	Test(r==KErrNone);
	
	Test.Next(_L("Try opening the same unit a second time."));
	RSoundSc snddev2;
	r=snddev2.Open(KSoundScTxUnit0);
	Test(r==KErrInUse);
	
	Test.Next(_L("Query play formats supported"));
	TSoundFormatsSupportedV02Buf capsBuf;
	snddev.Caps(capsBuf);
	TSoundFormatsSupportedV02& caps=capsBuf();
	PrintCaps(caps,Test);
	
	Test.Next(_L("Try playing without setting the buffer config"));
	TRequestStatus pStat;
	snddev.PlayData(pStat,0,0x2000);	// 8K
	User::WaitForRequest(pStat);
	Test(pStat.Int()==KErrNotReady);

	Test.Next(_L("Configure the channel from a 2nd thread"));
	RThread thread;
	TRequestStatus tStat;
	SSecondaryThreadInfo sti;
	
	sti.iTestId=ESecThreadConfigPlayback;
	sti.iThreadId=RThread().Id();	// Get the ID of this thread
	sti.iDrvHandle=snddev.Handle();	// Pass the channel handle
	
	/**	@SYMTestCaseID 		PBASE-T_SOUNDMCHAN-225
	@SYMTestCaseDesc 		Opening the channel - sharing the handle between threads
	@SYMTestPriority 		Critical
	@SYMTestActions			1)	With the LDD and PDD installed and with all channels closed on the device, open a 
								channel for playback on the device. Now create a second thread. Resume this 
								thread - passing the handle to the playback channel to it. Wait for the second 
								thread to terminate.
							2)	In the second thread, duplicate the playback channel handle.
							3)	In the second thread, using the duplicated handle, issue a request to set the audio configuration. 
							4)	In the second thread, using the duplicated handle, issue a request to set the volume. 
							5)	In the second thread, close the handle and exit the thread.
							6)	In the first thread, read back the audio configuration.
							7)	In the first thread, set the buffer configuration, and then issue a request to play 
								audio data. 
							8)	In the first thread, close the channel. 
	@SYMTestExpectedResults	1)	KErrNone - Channel opens successfully. 
							2)	KErrNone - Duplication of the handle succeeds.
							3)	KErrNone - Audio configured successfully.
							4)	KErrNone - Volume set successfully.
							5)	No errors occur closing the channel and exiting the thread.
							6)	The audio configuration should correspond to that set by the second thread.
							7)	KErrNone - Setting the buffer configuration and issuing a play request.
							8)	No errors occur closing the channel.
	@SYMREQ					PREQ1073.4 */	
	
	r=thread.Create(_L("Thread"),secondaryThread,KDefaultStackSize,KHeapSize,KHeapSize,&sti); // Create secondary thread
	Test(r==KErrNone);
	thread.Logon(tStat);
	thread.Resume();
	User::WaitForRequest(tStat);
	Test(tStat.Int()==KErrNone);
//	Test.Printf(_L("Thread exit info: Cat:%S, Reason:%x, Type:%d\r\n"),&thread.ExitCategory(),thread.ExitReason(),thread.ExitType());
	Test(thread.ExitType()==EExitKill);
	thread.Close();
	User::After(10000);	// Wait 10ms
	
	Test.Next(_L("Read back the play configuration"));
	TCurrentSoundFormatV02Buf formatBuf;
	snddev.AudioFormat(formatBuf);
	TCurrentSoundFormatV02& format=formatBuf();
	PrintConfig(format,Test);
	
	Test.Next(_L("Set the buffer configuration"));
	RChunk chunk;
	TInt bufSize=BytesPerSecond(formatBuf()); 	 							// Large enough to hold 1 second of data.
	bufSize=ValidBufferSize(bufSize,caps.iRequestMinSize,formatBuf());		// Keep the buffer length valid for driver.
	TTestSharedChunkBufConfig bufferConfig;
	bufferConfig.iNumBuffers=1;
	bufferConfig.iBufferSizeInBytes=bufSize;
	bufferConfig.iFlags=0;	
	TPckg<TTestSharedChunkBufConfig> bufferConfigBuf(bufferConfig);
	r=snddev.SetBufferChunkCreate(bufferConfigBuf,chunk);
	Test(r==KErrNone);
	snddev.GetBufferConfig(bufferConfigBuf);
	PrintBufferConf(bufferConfig,Test);
	Test(bufferConfig.iBufferSizeInBytes==bufSize);
	
	Test.Next(_L("Start playing"));
	r=MakeSineTable(format);
	Test(r==KErrNone);
	r=SetToneFrequency(660,format);
	Test(r==KErrNone); 
	TPtr8 ptr(chunk.Base()+bufferConfig.iBufferOffsetList[0],bufSize);
	WriteTone(ptr,format);
	snddev.PlayData(pStat,bufferConfig.iBufferOffsetList[0],bufSize,KSndFlagLastSample);
	User::WaitForRequest(pStat);
	Test(tStat.Int()==KErrNone);
	
	Test.Next(_L("Close the drivers and the chunk"));
	chunk.Close();
	snddev.Close();
	
	__KHEAP_MARKEND;

	Test.Next(_L("Unload the drivers"));
	
	r=User::FreeLogicalDevice(KDevSoundScName);
	Test.Printf(_L("Unloading %S.LDD - %d\r\n"),&KDevSoundScName,r);
	Test(r==KErrNone);
	
	TName pddName(KDevSoundScName);
	_LIT(KPddWildcardExtension,".*");
	pddName.Append(KPddWildcardExtension);
	TFindPhysicalDevice findPD(pddName);
	TFullName findResult;
	r=findPD.Next(findResult);
	while (r==KErrNone)
		{
		r=User::FreePhysicalDevice(findResult);
		Test.Printf(_L("Unloading %S.PDD - %d\r\n"),&findResult,r);
		Test(r==KErrNone);
		findPD.Find(pddName); // Reset the find handle now that we have deleted something from the container.
		r=findPD.Next(findResult);
		} 
	
	Test.End();
	Test.Close();
	
	Cleanup();
	
	__UHEAP_MARKEND;

	return(KErrNone);
    }
コード例 #4
0
/**
@SYMTestCaseID BA-CSAT-SUC-SNSUCPC-0001
@SYMPREQ 1780
@SYMComponent  telephony_csat
@SYMTestCaseDesc Test support in CSAT for RSat::NotifySetUpCallPCmd
@SYMTestPriority High
@SYMTestActions Invokes RSat::NotifySetUpCallPCmd
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCSatSetUpCallFU::TestNotifySetUpCallPCmd0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	OpenSatL();
	
	TRequestStatus requestStatus;
	
	const TUint8 KAddress = 0x91; //10010001
	RSat::TSetUpCallV6 setupCallData;
	TData data;
	data.iCommandNumber = 1;
	data.iCommandQualifier = KSetUpCallIfNotCurrentlyBusy;
	data.iSourceDevice = KSim;
	data.iDestinationDevice = KNetwork;
	data.iAddress = KAddress;
	data.iCommandType = KSetUpCall;

	_LIT8(KAlphaIdentifier1, "Not busy");
	_LIT16(KAlphaIdentifier1_16, "Not busy");
	
	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);
	
 	//-------------------------------------------------------------------------
	// TEST C: Successful completion request of
	// RSat::NotifySetUpCallPCmd 
 	//-------------------------------------------------------------------------

	// test C - implemented in 0001b-0001d functions

 	//-------------------------------------------------------------------------
	// TEST E: Coverage test(s) for RSat::NotifySetUpCallPCmd
 	//-------------------------------------------------------------------------

	iMockLTSY.NotifyTerminated(requestStatus);
	
	PrepareCompleteDataL ( data, KAlphaIdentifier1 );

	RSat::TAdditionalInfo additionalInfo;
	additionalInfo.Append(KNoCause);

	PrepareTerminalResponseMockDataL( data.iCommandNumber, data.iCommandType, 
			data.iCommandQualifier, additionalInfo, RSat::KMeUnableToProcessCmd, KNullDesC8 );

	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	//-------------------------------------------------------------------------
	// to increase CSatNotifySetUpCall::CompleteNotifyL coverage 
 	//-------------------------------------------------------------------------
	
	PrepareExpectDataL ( data.iCommandType );
	
	RSat::TSetUpCallV6Pckg setpPck(setupCallData);
	iSat.NotifySetUpCallPCmd(requestStatus, setpPck);
	
	RBuf8 bufData;
	CleanupClosePushL(bufData);	
	
	TTlv tlv;
	tlv.Begin(KBerTlvProactiveSimCommandTag);
	
	tlv.AddTag(KTlvCommandDetailsTag);         // Command details
	tlv.AddByte(data.iCommandNumber);               // Command number     
	tlv.AddByte(data.iCommandType);                   // Command type     
	tlv.AddByte(data.iCommandQualifier);            // Command qualifier  
	
	tlv.AddTag(KTlvDeviceIdentityTag);         // Device identities          
	tlv.AddByte(data.iSourceDevice);                // Source device     
	tlv.AddByte(data.iDestinationDevice);           // Destination device     

	tlv.AddTag(KTlvAlphaIdentifierTag);
	tlv.AddTag(KTlvAlphaIdentifierTag);
	tlv.AddTag(KTlvAddressTag);
	tlv.AddTag(KTlvSubaddressTag);

	TPtrC8 tlvDsc = tlv.End();
	TDesC8* tlvDscPtr = &tlvDsc;
	TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr);
	tlvDscPack.SerialiseL(bufData);
	iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, KErrNone, bufData, KDelay);

	PrepareTerminalResponseMockDataL( data.iCommandNumber, data.iCommandType, 
			data.iCommandQualifier, KNullDesC16, RSat::KCmdDataNotUnderstood, KNullDesC8 );

	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrCorrupt, requestStatus.Int());
	AssertMockLtsyStatusL();

	//-------------------------------------------------------------------------
	// to increase CSatNotifySetUpCall::CompleteNotifyL coverage 
	// in case of  "command qualifier"
 	//-------------------------------------------------------------------------

	const TUint8 KDefualtCommand = 0x7F;
	const TUint8 qualifierArray[] = { KHoldOtherCallsWithRedial, KDisconnectOtherCallsWithRedial, 
			                          KDefualtCommand };
	TUint8 sizeArray = sizeof(qualifierArray)/sizeof(qualifierArray[0]);
	RSat::TSetUpCallRspV2 resp;
	RSat::TSetUpCallRspV2Pckg respPck(resp);

	for ( TUint8 i = 0; i < sizeArray; i++ )
		{
		data.iCommandQualifier = qualifierArray[i];
		ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier1 );

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

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

	//-------------------------------------------------------------------------
	// TEST B: failure on completion of pending request from LTSY->CTSY
 	//-------------------------------------------------------------------------

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier1, KErrGeneral);

	CleanupStack::PopAndDestroy(2, this); // this, bufData

	}
コード例 #5
0
/**
 *  This test tests the retrieval of the signal strength.
 *
 *  @test GT83-SSW-Test01 Test retrieval of the Signal Strength setting.
 */	
enum TVerdict CTelWatchersIntTestRetrieveSignalStrengthWithPublishSubscribe::doTestStepL()
	{
	//
	// Make sure watchers are stopped and unloaded before running this test
	// This forces SIMTSY to be loaded again.
	//
	StopWatcher();
	SetSimTsyTestNumberL(0);
	StartWatcher();
	CheckSimTsyTestNumberL(0);

	TInt  state;
	TRequestStatus  localStatus;
	RProperty       localProperty;
		
	//-- attach and subscribe to KUidNetworkStrength property
	TESTCHECKL(localProperty.Attach(KUidSystemCategory,KUidNetworkStrength.iUid), KErrNone);    
	localProperty.Subscribe(localStatus);

	TInt ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Initial Signal Strength State is %d"), state);

	INFO_PRINTF1(_L("Commence Wait for Request local status..."));
	INFO_PRINTF2(_L("Prior to wait cycle, status is %d"), localStatus.Int());
	User::WaitForRequest(localStatus);			
	INFO_PRINTF1(_L("Complete Wait for Request local status."));
	localProperty.Subscribe(localStatus);
	ret = localProperty.Get(state);	
	TESTCHECKL(ret, KErrNone);
				
	INFO_PRINTF2(_L("Signal Strength State is %d"), state);
	TESTCHECK(state, ESANetworkStrengthNone);
		
	User::WaitForRequest(localStatus);		
	ret = localProperty.Get(state);
	localProperty.Subscribe(localStatus);
	TESTCHECKL(ret, KErrNone);
			
	INFO_PRINTF2(_L("Signal Strength State is %d"),state);
	TESTCHECK(state, ESANetworkStrengthLow);

	User::WaitForRequest(localStatus);		
	ret = localProperty.Get(state);
	localProperty.Subscribe(localStatus);
	TESTCHECKL(ret, KErrNone);

	INFO_PRINTF2(_L("Signal Strength State is %d"),state);
	TESTCHECK(state, ESANetworkStrengthMedium);

	User::WaitForRequest(localStatus);	
	ret = localProperty.Get(state);	
	localProperty.Subscribe(localStatus);
	TESTCHECKL(ret, KErrNone);

	INFO_PRINTF2(_L("Signal Strength State is %d"),state);
	TESTCHECK(state, ESANetworkStrengthHigh);

	User::WaitForRequest(localStatus);		
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);

	INFO_PRINTF2(_L("Signal Strength State is %d"),state);
	TESTCHECK(state, ESANetworkStrengthUnknown);

	return TestStepResult();
	} // CTelWatchersIntTestRetrieveSignalStrengthWithPublishSubscribe::doTestStepL
コード例 #6
0
TVerdict CBigSendRecvRtp::doTestStepL()
/**
 * @return - TVerdict code
 */
	{
	SetTestStepResult(EFail);
	if(KErrNone == InitSocketsL())
		{
		iIpAddrDest1.SetPort(9000);
		RBuf8 sendBuf;
		sendBuf.CreateMax(KBufferSize1);
		sendBuf.CleanupClosePushL();
		RBuf8 recvBuf;
		recvBuf.CreateMax(KBufferSize1);
		recvBuf.CleanupClosePushL();
		
		/* Fill the buffer with given character upto its length */
		sendBuf.Fill('Q');
		TRequestStatus status;
		/* do a Send of the data */
		iRtpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
		User::WaitForRequest(status);
		User::LeaveIfError(status.Int());
		/* Now do a Receive */
		recvBuf.FillZ();
		iRtpSocket.RecvFrom(recvBuf,iIpAddrDest1,NULL,status);
		User::WaitForRequest(status);
		User::LeaveIfError(status.Int());
		
		/* Obtain a TPtr of the data excluding the RTP header */
		TPtr8 sendBufPtr = sendBuf.MidTPtr(KRtpHeaderSize);
		TPtr8 recvBufPtr = recvBuf.MidTPtr(KRtpHeaderSize);
		/* Check if the data received is the same as the data sent */
		TInt ret = sendBufPtr.Compare(recvBufPtr);
		if(ret == 0)
			{
			/* Increase the buffer size and fill it up with given data */
			sendBuf.ReAlloc(KBufferSize2);
			recvBuf.ReAlloc(KBufferSize2);
			sendBuf.Fill('Q', KBufferSize2);
			
			/* Send the larger data */
			iRtpSocket.SendTo(sendBuf, iIpAddrDest1, NULL, status);
			User::WaitForRequest(status);
			User::LeaveIfError(status.Int());
			/* Now do a Receive */
			recvBuf.FillZ(KBufferSize2);
			iRtpSocket.RecvFrom(recvBuf,iIpAddrDest1,NULL,status);
			User::WaitForRequest(status);
			User::LeaveIfError(status.Int());
			/* Get pointer to data and compare both of them */
			TPtr8 sendBufPtr = sendBuf.MidTPtr(KRtpHeaderSize);
			TPtr8 recvBufPtr = recvBuf.MidTPtr(KRtpHeaderSize);
			TInt ret = sendBufPtr.Compare(recvBufPtr);
			if(ret == 0)
				{
				SetTestStepResult(EPass);
				}
			}
		CleanupStack::PopAndDestroy(2);
		}
	return TestStepResult();
	}
コード例 #7
0
enum TVerdict CEsockTest29_11::easyTestStepL( void )
	{
	TVerdict verdict = EFail;
	TInt ret;
	
	Logger().WriteFormat(_L("Send/ Recv on PDummy3 socket but no avail MBuf Memory, mBuf becomes avail after send"));
	RSocketServ ss;
	ret = ss.Connect();
	TESTL(KErrNone == ret);	
	CleanupClosePushL(ss);
    
    // open dummy prot 3
	Logger().WriteFormat(_L("Openning Dummy Protocol 3"));             
	RSocket sock;                                                  
	ret = sock.Open(ss,_L("Dummy Protocol 3"));
	TESTL(KErrNone == ret);
	
	// connecti socket
	TSockAddr addr;
	TRequestStatus stat;
	sock.Connect(addr, stat);
	User::WaitForRequest(stat);
	TESTL(KErrNone == stat.Int());	
	
	// drain MBuf Pool
	Logger().WriteFormat(_L("Attempting to set KDummyOptionSetGobbleMBufs Option in Protocol"));	
	ret = sock.SetOpt(KDummyOptionSetGobbleMBufs, 0, 0);
	Logger().WriteFormat(_L("Socket::SetOpt KDummyOptionSetFreeMBufs returned %d"), ret);
	
	// send data and wait for 1/10 seconds
	Logger().WriteFormat(_L("Sending Data"));     
	_LIT8( sendData, "bla bla bla bla");        
	sock.Send(sendData,0,stat);
	const TUint KTenMilliSecs = 10000; 
	User::After(KTenMilliSecs);
	
	// free all mbufs
	Logger().WriteFormat(_L("Attempting to set KDummyOptionSetFreeMBufs Option in Protocol"));	
	ret = sock.SetOpt(KDummyOptionSetFreeMBufs, 0, 0);
	TESTL(ret == KErrNone);
	Logger().WriteFormat(_L("Socket::SetOpt KDummyOptionSetFreeMBufs returned %d"), ret);

	// wait for send to return
	User::WaitForRequest(stat);
	Logger().WriteFormat(_L("Send has returned %d"), stat.Int());
	if(stat.Int() != KErrNone)
		{
		verdict = EFail;
		}
	
	// recieve data and verify that it is the same as send data
	TBuf8<20> recvBuf;
	TRequestStatus recvStatus;
	sock.Recv(recvBuf, 0, recvStatus);
	User::WaitForRequest(recvStatus);
	Logger().WriteFormat(_L("recieving data on PDummy3 has returned %d"), recvStatus.Int());
	if(recvStatus.Int() != KErrNone)
		{
		verdict = EFail;
		}
	Logger().WriteFormat(_L("Comparing Recieved data and Sent data"), recvStatus.Int());		
	if(recvBuf.Compare(sendData) == 0)
		{
		verdict = EPass; 
		}
	
	sock.Close();
	CleanupStack::PopAndDestroy(&ss);
    SetTestStepResult(verdict);
	return verdict;

	}
コード例 #8
0
TInt CNcmCommunicationInterface::WriteInterruptData(TInt aEndPoint,
        TDesC8& aDes,
        TInt aLength)

{
    OstTraceFunctionEntry1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_ENTRY, this );

    TInt ret;
    RTimer timer;
    ret = timer.CreateLocal();
    if ( ret )
    {
        OstTrace1( TRACE_FATAL, CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA, "\ttimer.CreateLocal = %d- returning", ret);
        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT, this );
        return ret;
    }
    TRequestStatus status;
    TRequestStatus timerStatus;

    TEndpointBuffer epBuffer;
    ret = iPort.OpenEndpoint(epBuffer, aEndPoint);
    if (ret != KErrNone)
    {
        timer.Close();
        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP1, this );
        return ret;
    }

    TAny *buf;
    TUint size;
    ret = epBuffer.GetInBufferRange(buf, size);
    if (ret != KErrNone)
    {
        timer.Close();
        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP2, this );
        return ret;
    }
    else if (size < aLength)
    {
        timer.Close();
        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP3, this );
        return KErrArgument;
    }

    TPtr8 writeBuf((TUint8 *)buf, size);
    writeBuf.Copy(aDes.Ptr(), aLength);
    ret = epBuffer.WriteBuffer(buf, writeBuf.Size(), ETrue, status);
    if (ret != KErrNone)
    {
        timer.Close();
        OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP4, this );
        return ret;
    }

    const TInt KWriteDataTimeout = 1000000;
    timer.After(timerStatus, KWriteDataTimeout);
    User::WaitForRequest(status, timerStatus);
    if ( timerStatus != KRequestPending )
    {
        // Timeout occurred, silently ignore error condition.
        // Assuming that the line has been disconnected
        OstTrace0( TRACE_ERROR, CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA1, "CNcmCommunicationInterface::WriteInterruptData() - Timeout occurred");
        iPort.WriteCancel(epBuffer.BufferNumber());
        User::WaitForRequest(status);
        ret = timerStatus.Int();
    }
    else
    {
        OstTrace0( TRACE_ERROR, CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA2, "CNcmCommunicationInterface::WriteInterruptData() - Write completed");
        timer.Cancel();
        User::WaitForRequest(timerStatus);
        ret = status.Int();
    }

    epBuffer.Close();
    timer.Close();
    OstTraceFunctionExit1( CNCMCOMMUNICATIONINTERFACE_WRITEINTERRUPTDATA_EXIT_DUP5, this );
    return ret;
}
コード例 #9
0
// ---------------------------------------------------------------------------
// CTestStartupListUpdater::RemoveL()
// ---------------------------------------------------------------------------
//
TInt CTestStartupListUpdater::RemoveL( CStifItemParser& aItem )
    {
    _LIT( KTestName, "Remove" );
    Print( 0, KTestStartFormat, &KTestName );
    TInt testResult = KErrNone;

    RSoftwareComponentRegistry registry;
    User::LeaveIfError( registry.Connect() );
    CleanupClosePushL( registry );

    // Get installed application TComponentIds and TUids
    RArray<TUid> uidList;
    CleanupClosePushL( uidList );
    RArray<TComponentId> componentIdList;
    CleanupClosePushL( componentIdList );

    registry.GetComponentIdsL( componentIdList );
    for( TInt i = 0; i < componentIdList.Count(); ++i ) {
        TComponentId compId = componentIdList[ i ];
        CComponentEntry *compEntry = CComponentEntry::NewLC();
        if( registry.GetComponentL( compId, *compEntry ) ) {
            if( compEntry->IsRemovable() && compEntry->SoftwareType() == KSoftwareTypeNative )
                {
                _LIT(KCompUid, "CompUid");
                CPropertyEntry *property = registry.GetComponentPropertyL( compId, KCompUid );
                CleanupStack::PushL( property );
                CIntPropertyEntry* intProperty = dynamic_cast<CIntPropertyEntry*>( property );
                uidList.AppendL( TUid::Uid( intProperty->IntValue() ) );
                CleanupStack::PopAndDestroy( property );
            } else {
                uidList.AppendL( KNullUid );
            }

        }
        CleanupStack::PopAndDestroy( compEntry );
    }
    if( uidList.Count() != componentIdList.Count() )
        {
        _LIT( KFailedToGetIds, "Failed to get IDs" );
        Print( 0, KTestStartFormat, &KFailedToGetIds );
        testResult = KErrGeneral;
        }

    // Uninstall TUid apps listed in parameters
    TPtrC param;
    while( aItem.GetNextString ( param ) == KErrNone && testResult == KErrNone )
        {
        const TUint KMaxLimit = 0xFFFFFFFF;
        TLex lex( param );
        TUint32 intVal = 0;

        _LIT( KHexPrefix, "0x" );
        if( param.Left( KHexPrefix().Length() ) == KHexPrefix )
            {
            lex.Inc( KHexPrefix().Length() );
            testResult = lex.BoundedVal( intVal, EHex, KMaxLimit );
            }
        else
            {
            testResult = lex.BoundedVal( intVal, EDecimal, KMaxLimit );
            }

        if( testResult == KErrNone )
            {
            TUid uid( TUid::Uid( intVal ) );
            if( uid != KNullUid )
                {
                TInt index = uidList.Find( uid );
                if( index >= 0 && index < componentIdList.Count() )
                    {
                    TComponentId componentId = componentIdList[ index ];

                    RSoftwareInstall installer;
                    User::LeaveIfError( installer.Connect() );
                    CleanupClosePushL( installer );

                    TRequestStatus status;
                    installer.Uninstall( componentId, status );
                    User::WaitForRequest( status );
                    testResult = status.Int();

                    CleanupStack::PopAndDestroy( &installer );
                    }
                else
                    {
                    testResult = KErrNotFound;
                    }
                }
            else
                {
                testResult = KErrUnknown;
                }
            }
        Print( 1, KTestParamFormatArg, &KTestName, &param, testResult );
        }

    CleanupStack::PopAndDestroy( 3, &registry );    // componentIdList, uidList, registry
    Print( 0, KTestDoneFormat, &KTestName );
    return testResult;
    }
コード例 #10
0
TInt CTestDriveRemoteHangupDial::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side "Data Call answer and remote 
 * hang-up closely followed by a dial" test code.  This method sets up to answer a 
 * call and receive a data transfer.  The call is then terminated from the remote end, 
 * and then must quickly respond by dialing the remote end back.  Data is then 
 * transfered and the call is terminated again from the remote end.
 *
 * @return KErrNone.
 */
	{
	_LIT(KMmPhoneName,"GsmPhone1");
	_LIT(KDataLineName,"Data");

	INFO_PRINTF1(_L("Opening Mobile Phone\n"));
	RMobilePhone mmPhone;
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);
//
// Initialization complete
//

// Now wait for an incoming call...
	INFO_PRINTF1(_L("Wait to Answer incoming Data Call\n"));
	TESTL(call.AnswerIncomingCall()==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	TRequestStatus stat;
	port.Write(stat,KWriteTestRemoteHangupData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);
    
   //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteHangupData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	// Now perform the user specified delay before making outgoing call...
	INFO_PRINTF2(_L("Start the %d sec delay before making outgoing call\n"), iVarDelay);
	User::After( (TTimeIntervalMicroSeconds32)(iVarDelay*1000000L) );
	INFO_PRINTF2(_L("End of the delay before making outgoing call\n"), iVarDelay);

	// Now perform the outgoing call...
	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	TESTL(cs.Connect()==KErrNone);

	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	port.Write(stat,KWriteTestRemoteHangupData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestRemoteHangupData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	TInt32 ss;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
コード例 #11
0
TVerdict CPsyDisabledStep::doTestStepL()
/**
 * @return - TVerdict code
 * Override of base class pure virtual
 * Our implementation only gets called if the base class doTestStepPreambleL() did
 * not leave. That being the case, the current test result value will be EPass.
 */
	{
    StandardPrepareL();
    InitPsySettingsL(3, KNetworkPsy1, 1, KIntGpsPsy1, 1, KNetworkPsy2, 1);

    ConfigPsyL(KNetworkPsy1, 1,
        KConfigLRNoError10s      //Step1. no error in 10s
        );
        
    ConfigPsyL(KIntGpsPsy1, 2, 
        KConfigLRNoError,       //Step 1. no error
        KConfigLRNoError10s     //Step 2. no error in 10s
        );

    ConfigPsyL(KNetworkPsy2, 1,
        KConfigLRNoError         //Step2. no error
        );
    
    User::After(KSecond*7);

    TRequestStatus status;
    TPositionInfo posInfo;
    TPositionUpdateOptions options;
    
    //1. Disable PSY1 while location request is on going. LR shall 
    //fallback to PSY2 and then fix from PSY2 is used.
    iPositioner.NotifyPositionUpdate(posInfo, status);
    User::After(KTinyDelay);
    SET_TIME
    ToggleModuleL(KNetworkPsy1, EFalse);
    User::WaitForRequest(status);
    //CHECK_TIME(1)
    CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest);
    CheckExpectedResult(posInfo.ModuleId(), KIntGpsPsy1, KWrongModuleIdReturned);
    
    ToggleModuleL(KNetworkPsy1, ETrue);
    //Config PSY1 again since it was unloaded when it was disabled.
    ConfigPsyL(KNetworkPsy1, 1,
        KConfigLRNoError20s      //Step2. no error in 20s
        );

    User::After(KSecond*7);
    
    //2. Disable PSY2 while location request ongoing, the request shall
    //fallbck to PSY3
    SET_TIME
    iPositioner.NotifyPositionUpdate(posInfo, status);
    User::After(KSecond*15); //after 15s disable PSY2
    ToggleModuleL(KIntGpsPsy1, EFalse);
    User::WaitForRequest(status);
    CHECK_TIME(16) //After PSY2 is disabled in 15 seconds, PSY3 is used. 
    CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest);
    CheckExpectedResult(posInfo.ModuleId(), KNetworkPsy2, KWrongModuleIdReturned);
    
    
    // cleanup
    StandardCleanup();
    return TestStepResult();
	}
コード例 #12
0
 // ---------------------------------------------------------
// CPosTp154::PrintParsedDataFromEncoderL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp154::PrintParsedDataFromEncoderL(
    const TDesC& aFile, 
    const TDesC8&  aBuffer, 
    TInt aExpectedStatusCode,
    const TDesC8& aMimeType)
    {
    iLog->Log(_L("===== PrintParsedDataFromEncoderL ======="));
    
    iLandmarkParser = CPosLandmarkParser::NewL(aMimeType);

    if (aFile != KNullDesC)
        {
        TFileName file( aFile );
        iLog->Log(_L("FILE (%S)"), &file );
        TraceL(_L("----->Using FILE<-------"));
        TraceL(file);
        iLandmarkParser->SetInputFileL(file);
        }
    else
        {
        iLog->Log(_L("BUFFER (size %d)"), aBuffer.Size() );
        TraceL(_L("----->Using BUFFER<-------"));
        iLandmarkParser->SetInputBuffer(aBuffer);
        }

    iOperation = iLandmarkParser->ParseContentL();
    TRequestStatus status = KPosLmOperationNotComplete;
    TReal32 progress;
    TInt number = 0;

    RArray<TPosLmItemId> array;
    CleanupClosePushL(array);

    while (status == KPosLmOperationNotComplete)
        {
        iLog->Log(_L("--- Parsing ---------------------------"));
        TraceL(_L("------------------------------"));
        iOperation->NextStep(status, progress);

        // Wait for NextStep to complete
        User::WaitForRequest(status);
        if (status != KPosLmOperationNotComplete && status != KErrNone)
            {
            iLog->Log(_L("Parsing Complete"));
            
            HBufC* buffer = HBufC::NewLC( 128);
            TPtr buf = buffer->Des();
            buf.Format(_L("\tStatus %d"), status.Int());
            iLog->Log(buf);
            TraceL(buf);
            
            CleanupStack::PopAndDestroy( buffer );
            buffer = NULL;              
            }
        else
            {
            iLog->Log(_L("Parsing element"));
            if ( iLandmarkParser->NumOfParsedLandmarks() )
                {
                // Get last parsed landmark
                CPosLandmark* lm = iLandmarkParser->LandmarkLC();
                TPtrC lmName;
                TPtrC catName;
                lm->GetLandmarkName(lmName);
                lm->GetCategoriesL(array);
                //iLog->Log(lmName);
                for (TInt i=0;i<array.Count();i++)
                    {
                    CPosLandmarkCategory* category = iLandmarkParser->LandmarkCategoryLC( array[i] );
                    category->GetCategoryName( catName );
                     
                    HBufC* buffer = HBufC::NewLC( 128 + catName.Length());
                    TPtr buf = buffer->Des();
                                            
                    if ( category->GlobalCategory()) 
                        {
                        buf.Append(_L("\tGlobal category: "));    
                        }
                    else 
                        {
                        buf.Append(_L("\tLocal category: "));    
                        }                        
                    buf.Append(catName);
                    iLog->Log(buf);
                    TraceL(buf);
                    CleanupStack::PopAndDestroy( buffer );
                    buffer = NULL;
                    CleanupStack::PopAndDestroy(category);
                    }
                    
               	PrintLandmarkFieldsWithDescriptionL(*lm, ETrue);	
               
                
                number++;
                CleanupStack::PopAndDestroy(lm);
                }
            }
        }

    iLog->Log(_L("--- Parsing end ---------------------------"));
    TraceL(_L("------------------------------"));
    CleanupStack::PopAndDestroy(&array);

    if (status.Int() != aExpectedStatusCode)
        {
        HBufC* buffer = HBufC::NewLC( 128 );
        TPtr buf = buffer->Des();
                    
        buf.Format(_L("\tERROR: Wrong status returned, was %d, should be %d"), status.Int(), aExpectedStatusCode);
        iLog->Log( buf );
        iErrorsFound++;
        
        CleanupStack::PopAndDestroy( buffer );
        buffer = NULL;        
        }

    TUint32 nr = iLandmarkParser->NumOfParsedLandmarks();
    HBufC* buffer = HBufC::NewLC( 256 );
    TPtr buf = buffer->Des();
    buf.Format(_L("\tNr of Parsed landmarks %d, should be %d"), nr, number);
    iLog->Log(buf);
    TraceL(buf);

    CleanupStack::PopAndDestroy( buffer );
    buffer = NULL;
    if (nr != (TUint32)number)
        {
        iLog->Log(_L("\tERROR: Wrong number of landmarks parsed returned!"));
        iErrorsFound++;
        }

    TPosLmCollectionDataId lmId = iLandmarkParser->FirstCollectionDataId();

    iLog->Log(_L("--- CollectionData ---"));
    TraceL(_L("--- CollectionData ---"));

    if (lmId != EPosLmCollDataNone)
        {
        TPtrC first = iLandmarkParser->CollectionData(lmId);
        HBufC* buffer = HBufC::NewLC( first.Length() + 256 );
        TPtr buf = buffer->Des();
        buf.Zero();
        buf.Format(_L("\t(1)Collection Id: %d CollectionData: "), lmId);
        buf.Append(first);
        iLog->Log(buf);
        TraceL(buf);
        CleanupStack::PopAndDestroy( buffer );
        buffer = NULL;      
        }
    else 
        {
        iLog->Log(_L("\tNo collection data found 1"));    
        }

    while (lmId != EPosLmCollDataNone)
        {
        lmId = iLandmarkParser->NextCollectionDataId(lmId);
        if (lmId != EPosLmCollDataNone)
        {
            TPtrC first = iLandmarkParser->CollectionData(lmId);
            
            HBufC* buffer = HBufC::NewLC( first.Length() + 256 );
            TPtr buf = buffer->Des();         
            buf.Zero();
            buf.Format(_L("\t(2)Collection Id: %d CollectionData: "), lmId);
            buf.Append(first);
            iLog->Log(buf);
            TraceL(buf);
            
            CleanupStack::PopAndDestroy( buffer );
            buffer = NULL;              
            }
        else 
            {
            iLog->Log(_L("\tNo collection data found 2"));   
            }
        }

    iLog->Log(_L("--- CollectionData ---"));
    TraceL(_L("--- CollectionData ---"));

    delete iOperation;
    iOperation = NULL;
    delete iLandmarkParser;
    iLandmarkParser = NULL;
    iLog->Log(_L("====== PrintParsedDataFromEncoderL Done ========\n"));
    }
コード例 #13
0
// ---------------------------------------------------------
// CT_LbsClientPosTp178::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp178::StartL()
    {
    _LIT(KServiceAccept, "SAAA");
    
    SetupPsyL(iUidTestPsy3);
    
    RPositioner positioner;
    TPositionInfo info = TPositionInfo();
    
    ConnectL();
    
    User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3));
    CleanupClosePushL(positioner);
    
    TInt Err = positioner.SetRequestor(CRequestor::ERequestorService,
        CRequestor::EFormatApplication, KServiceAccept);
    
    TPositionUpdateOptions updateOptionsLong, updateOptionsShort;
    
    TTimeIntervalMicroSeconds longInterval(7000000);
    
    updateOptionsLong.SetUpdateTimeOut(longInterval);
    Err = positioner.SetUpdateOptions(updateOptionsLong);
    
    TTimeIntervalMicroSeconds shortInterval(2000000);
    updateOptionsShort.SetUpdateTimeOut(shortInterval);
    
    TPositionUpdateOptions theUpdateOptions;
    Err = positioner.GetUpdateOptions(theUpdateOptions);
    
    if (theUpdateOptions.UpdateTimeOut() != updateOptionsLong.UpdateTimeOut() ||
        updateOptionsLong.UpdateTimeOut() != longInterval)
    {
        _LIT(KUpdateOptions, "The update option was not set correctly");
        LogErrorAndLeaveL(KUpdateOptions);
    }
    
    _LIT(KDelayMsg, "The successfull requests was completed within %d microsecs.");
    _LIT(KCancelMsg, "The canceled requests was completed within %d microsecs.");
    
    TRequestStatus status;
    
    for (TInt i = 0; i < 10; i++) // makes 10 test inorder to get some statistic
    {         
        
        positioner.SetUpdateOptions(updateOptionsLong);
        TTime requestStartTime;
        
        requestStartTime.UniversalTime();
        positioner.NotifyPositionUpdate(info, status);
        User::WaitForRequest(status);
        TTime requestStopTime;
        requestStopTime.UniversalTime();
        
        TTimeIntervalMicroSeconds durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime);
        
        TInt duration = durationMicro.Int64();
        
        TBuf<100> timeMsg;
        timeMsg.Format(KDelayMsg, duration);
        INFO_PRINTF1(timeMsg);
        
        //check error status
        if (status != KErrNone)
        {
            _LIT(KErrPositionRequest, "error code returned from NotifyPositionUpdate, error code = %d");
            TBuf<100> buf;
            buf.Format(KErrPositionRequest, status.Int());
            LogErrorAndLeaveL(buf);
        }
        
        
        TTimeIntervalMicroSeconds shortInterval(2000000);
        updateOptionsShort.SetUpdateTimeOut(shortInterval);
        
        positioner.SetUpdateOptions(updateOptionsShort);
        
        requestStartTime.UniversalTime();
        positioner.NotifyPositionUpdate(info, status);
        User::WaitForRequest(status);
        requestStopTime.UniversalTime();
        
        durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime);
        
        duration = durationMicro.Int64();
        
#ifdef __WINS__
        TTimeIntervalMicroSeconds winsFail(100000);
        durationMicro = TTimeIntervalMicroSeconds(durationMicro.Int64()+winsFail.Int64());
#endif
        
        timeMsg.Format(KCancelMsg, duration);
        INFO_PRINTF1(timeMsg);
        
        
        if (status != KErrTimedOut)
        {
            _LIT(KErrPositionRequest, "Request did not returned KErrTimedOut, status code = %d.");
            TBuf<100> buf;
            buf.Format(KErrPositionRequest, status.Int());
            LogErrorAndLeaveL(buf);
        }

        //Check that the request was not aborted before the Interval
        //Remove this condition if a lot of data is needed in test log.
        if (durationMicro < shortInterval)
        {
            _LIT(KErrInterval, " The request was aborted before the set timed out ");
            LogErrorAndLeaveL(KErrInterval);
        }
        
        
    } // end for loop
    CleanupStack::PopAndDestroy(1); //positioner
    Disconnect();

    // Do timeout test
    TestTimeoutL();

    // Do cancel test
    TestCancelL();

    // ESLI-5QRA7U just check that it is not possible to set a timeout that is less than
    // the update interval
    TestOptionL();
    }
コード例 #14
0
enum TVerdict CEsockTest10_1::easyTestStepL()
	{
	TESTL(EPass == TestStepResult());
	TPckgBuf<TUint> flags;
	
	// get select state of server socket
	TRequestStatus stat;
	flags() = KSockSelectRead | KSockSelectWrite | KSockSelectExcept;
	iEsockSuite->GetSocketHandle(iSockIndex3).Ioctl(KIOctlSelect, stat, &flags, KSOLSocket);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);
	TESTL(flags()==KSockSelectWrite);
	
	// send data from client to server (2 bytes, 1 urgent)
	TInt ret = iEsockSuite->GetSocketHandle(iSockIndex2).SetOpt(KSoTcpNextSendUrgentData, KSolInetTcp, 1);
	TESTEL(KErrNone == ret, ret);
	iEsockSuite->GetSocketHandle(iSockIndex2).Write(_L8("12"), stat);
	User::WaitForRequest(stat);
	TESTEL(stat==KErrNone, stat.Int());
	
	// delay for 1 second
	User::After(1000000);
	
	// get select state of the server socket
	flags() = KSockSelectRead | KSockSelectWrite | KSockSelectExcept;
	iEsockSuite->GetSocketHandle(iSockIndex3).Ioctl(KIOctlSelect, stat, &flags, KSOLSocket);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);
	TESTL(flags()==(KSockSelectRead | KSockSelectWrite | KSockSelectExcept));
	
	// read data (server)
	TBuf8<20> rbuf2;
	iEsockSuite->GetSocketHandle(iSockIndex3).Read(rbuf2, stat);
	User::WaitForRequest(stat);
	TESTEL(stat==KErrUrgentData, stat.Int());
	
	// get select state of the server socket
	flags() = KSockSelectRead | KSockSelectWrite | KSockSelectExcept;
	iEsockSuite->GetSocketHandle(iSockIndex3).Ioctl(KIOctlSelect, stat, &flags, KSOLSocket);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);
	
	TESTL(flags()==(KSockSelectWrite | KSockSelectExcept));
	
	// read the urgent data byte
	TInt nRet;
	ret = iEsockSuite->GetSocketHandle(iSockIndex3).GetOpt(KSoTcpReadUrgentData, KSolInetTcp, nRet);
	TESTEL(KErrNone == ret, ret);
	TESTL(nRet=='2');
	ret = iEsockSuite->GetSocketHandle(iSockIndex3).GetOpt(KSoTcpReadUrgentData, KSolInetTcp, nRet);
	TESTEL(KErrNotFound == ret, ret);
	
	// get select state of the server socket
	flags() = KSockSelectRead | KSockSelectWrite | KSockSelectExcept;
	iEsockSuite->GetSocketHandle(iSockIndex3).Ioctl(KIOctlSelect, stat, &flags, KSOLSocket);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);
	TESTL(flags()==KSockSelectWrite);
	
	return EPass;
	}
コード例 #15
0
void CCTsyPrivacyFU::DoNotifyPrivacyConfirmationL(const TDesC& aLineName)
	{
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RLine line;
	RMobileCall mobileCall;

	TInt err = line.Open(iPhone, aLineName);
	ASSERT_EQUALS(KErrNone, err)
	CleanupClosePushL(line);
	
	err = mobileCall.OpenNewCall(line);
	ASSERT_EQUALS(KErrNone, err)
	CleanupClosePushL(mobileCall);

 	//-------------------------------------------------------------------------
	// TEST C: Successful completion request of
	// RMobileCall::NotifyPrivacyConfirmation when result is not cached.
 	//-------------------------------------------------------------------------

	// invoke RMobilePhone::NotifyPrivacyConfirmation
	TRequestStatus notifyStatus;

	// initialize the variable to be set by CTSY with the value other than passed to MockLTSY
	RMobilePhone::TMobilePhonePrivacy privacy = RMobilePhone::EPrivacyOn;
	mobileCall.NotifyPrivacyConfirmation(notifyStatus,privacy);

	// prepare the data to be returned from MockLTSY
	RMobilePhone::TMobilePhonePrivacy privacySetting = RMobilePhone::EPrivacyUnspecified;
	TMockLtsyCallData1<RMobilePhone::TMobilePhonePrivacy> privacySettingData(privacySetting);

	RBuf8 data;
	CleanupClosePushL(data);
	privacySettingData.SerialiseL(data);

	// trigger EMobileCallNotifyPrivacyConfirmation completion via MockLTSY 
	TRequestStatus mockLtsyStatus;
	iMockLTSY.NotifyTerminated(mockLtsyStatus); 
	iMockLTSY.CompleteL(EMobileCallNotifyPrivacyConfirmation, KErrNone,data);
	User::WaitForRequest(mockLtsyStatus);
	ASSERT_EQUALS(KErrNone,mockLtsyStatus.Int());

	// wait for RMobilePhone::NotifyPrivacyConfirmation completion
	User::WaitForRequest(notifyStatus);

	ASSERT_EQUALS(KErrNone,notifyStatus.Int());
	ASSERT_EQUALS(RMobilePhone::EPrivacyUnspecified, privacy);
	AssertMockLtsyStatusL();
	
 	//-------------------------------------------------------------------------
	// TEST E: Unsolicited completion of RMobileCall::NotifyPrivacyConfirmation
	// from LTSY.
 	//-------------------------------------------------------------------------

	iMockLTSY.NotifyTerminated(mockLtsyStatus); 
	iMockLTSY.CompleteL(EMobileCallNotifyPrivacyConfirmation, KErrNone,data);
	User::WaitForRequest(mockLtsyStatus);
	ASSERT_EQUALS(KErrNone,mockLtsyStatus.Int());
	AssertMockLtsyStatusL();

	CleanupStack::PopAndDestroy(4, this); // data, mobileCall, line, this
	}
コード例 #16
0
TVerdict CTestDevVideoPlayClock::DoTestStepL()
	{
	TVerdict ret = EPass;
	TTimeIntervalMicroSeconds testTime(0);
	TUint timeUint = 0;

	iClockSource = CSystemClockSource::NewL();

	// Construct a new thread to constantly probe the clock - to test that it'll work from multiple threads
	RThread thread;
	
	TInt error = thread.Create(_L("ClockSourceTestThread"), 
								&CTestDevVideoPlayClock::StartThread,
								KDefaultStackSize, 
								&User::Heap(),
								static_cast<TAny*>(this), 
								EOwnerThread);

	if (error)
		{
		ERR_PRINTF1(_L("Error - Couldn't create periodic utility object"));
		delete iClockSource;
		return EInconclusive;
		}

	TRequestStatus stat;
	thread.Logon(stat);
	if (stat!=KRequestPending)
		{
		delete iClockSource;
		ERR_PRINTF2(_L("Error - Couldn't logon to the thread err=%d"), stat.Int());
		thread.LogonCancel(stat);
		User::WaitForRequest(stat);
		return EInconclusive;
		}
	thread.SetPriority(EPriorityLess);

	// wait for system to calm down
	User::After(KTestClock2Seconds);

	// reset the clock
	iClockSource->Reset();

	thread.Resume();

	// wait for 2 seconds and then check the time == 2 seconds
	User::After(KTestClock2Seconds);
	testTime = iClockSource->Time();
	timeUint = I64LOW(testTime.Int64());

	if (!TimeComparison(timeUint, KTestClock2Seconds, KTestClockDeviationMS))
		{
		ERR_PRINTF3(_L("Error - time comparison failed:  Got %u;  Expected %u"), timeUint, KTestClock2Seconds);
		ret = EFail;
		}
	else 
		{
		INFO_PRINTF3(_L("Time comparison passed:  Got %u;  Expected %u"), timeUint, KTestClock2Seconds);
		}

	// reset the clock back to 2 seconds
	//testTime = KTestClock2Seconds;
	//iClockSource->Reset(testTime);

	// suspend timer for 2 seconds then resume for 2 seconds
	iClockSource->Suspend();
	User::After(KTestClock2Seconds);
	iClockSource->Resume();
	User::After(KTestClock2Seconds);
	testTime = iClockSource->Time();
	timeUint = I64LOW(testTime.Int64());

	if (!TimeComparison(timeUint, KTestClock4Seconds, KTestClockDeviationMS))
		{
		ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed:  Got %u;  Expected %u"), timeUint, KTestClock4Seconds);
		ret = EFail;
		}
	else
		{
		INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed:  Got %u;  Expected %u"), timeUint, KTestClock4Seconds);
		}

	// reset clock to 18 seconds
	testTime = KTestClock18Seconds;
	iClockSource->Reset(testTime);

	// wait for 2 seconds and then check the time == 20 seconds
	User::After(KTestClock2Seconds);
	testTime = iClockSource->Time();
	timeUint = I64LOW(testTime.Int64());

	if (!TimeComparison(timeUint, KTestClock20Seconds, KTestClockDeviationMS))
		{
		ERR_PRINTF3(_L("Error - Reset() time comparison failed:  Got %u;  Expected %u"), timeUint, KTestClock20Seconds);
		ret = EFail;
		}
	else
		{
		INFO_PRINTF3(_L("Reset() time comparison passed:  Got %u;  Expected %u"), timeUint, KTestClock20Seconds);
		}

	// suspend for 2 seconds then resume for 2 seconds
	iClockSource->Suspend();
	User::After(KTestClock2Seconds);
	iClockSource->Resume();
	User::After(KTestClock2Seconds);
	
	testTime = iClockSource->Time();
	timeUint = I64LOW(testTime.Int64());

	if (!TimeComparison(timeUint, KTestClock22Seconds, KTestClockDeviationMS))
		{
		ERR_PRINTF3(_L("Error - Suspend() + Resume() time comparison failed:  Got %u;  Expected %u"), timeUint, KTestClock22Seconds);
		ret = EFail;
		}
	else
		{
		INFO_PRINTF3(_L("Suspend() + Resume() time comparison passed:  Got %u;  Expected %u"), timeUint, KTestClock22Seconds);
		}

	// Now test the periodic utility
	TRAPD(perError, iPeriodicUtility = CMMFClockSourcePeriodicUtility::NewL(*iClockSource, *this));
	if (perError)
		{
		ERR_PRINTF1(_L("Error - Couldn't create periodic utility object"));
		ret = EInconclusive;
		}
	else
		{
		iPeriodicUtilityTestVerdict = EPass;
		TTimeIntervalMicroSeconds32 period = KTestClock2Seconds;
		iClockSource->Reset();
		iPeriodicUtility->Start(period);
		CActiveScheduler::Start();
		ret = iPeriodicUtilityTestVerdict;
		}
	delete iPeriodicUtility;
	iPeriodicUtility = NULL;

	// Clean up the thread
	iShutdownSubthread = ETrue;
	User::WaitForRequest(stat);
	thread.Close();

	delete iClockSource;

	return ret;
	}
コード例 #17
0
ファイル: test.cpp プロジェクト: cdaffara/symbiandump-os1
enum TVerdict CZCDriverTestStep::doTestStepL()
	{
	CActiveScheduler* activeScheduler = new(ELeave) CActiveScheduler;
	CleanupStack::PushL(activeScheduler);
	CActiveScheduler::Install(activeScheduler);

	SetTestStepResult(EFail);

	// Start of testing
	INFO_PRINTF1(_L("Load Physical Device"));
	TInt r;
	r=User::LoadPhysicalDevice(KZeroCopyLoopbackPddFileName);
	TEST_VERDICT(r==KErrNone || r==KErrAlreadyExists);

	INFO_PRINTF1(_L("Load Logical Device"));
	r=User::LoadLogicalDevice(KZeroCopyLoopbackLddFileName);
	TEST_VERDICT(r==KErrNone || r==KErrAlreadyExists);

    // Initialize a commsbuf pond
    RCommsBufPondOp commsBufPond;
    RArray<TCommsBufPoolCreateInfo> createInfos;
    TCommsBufPoolCreateInfo poolInfoForLargeBufs;
    poolInfoForLargeBufs.iBufSize = KMBuf_MBufSizeBig;
    poolInfoForLargeBufs.iInitialBufs = KMBuf_InitialAllocation;
    poolInfoForLargeBufs.iGrowByBufs = KMBuf_MinGrowth;
    poolInfoForLargeBufs.iMinFreeBufs = KMBuf_GrowthThreshold;
    poolInfoForLargeBufs.iCeiling = (KMBuf_MaxAvail/2) / KMBuf_MBufSize;    
    createInfos.AppendL(poolInfoForLargeBufs);
    TCommsBufPoolCreateInfo poolInfoForSmallBufs;
    poolInfoForSmallBufs.iBufSize = KMBuf_MBufSize;
    poolInfoForSmallBufs.iInitialBufs = KMBuf_InitialAllocation;
    poolInfoForSmallBufs.iGrowByBufs = KMBuf_MinGrowth;
    poolInfoForSmallBufs.iMinFreeBufs = KMBuf_GrowthThreshold;
    poolInfoForSmallBufs.iCeiling = (KMBuf_MaxAvail/2) / KMBuf_MBufSize;
    createInfos.AppendL(poolInfoForSmallBufs);
	User::LeaveIfError(commsBufPond.Open(createInfos));
	createInfos.Close();
	
	__KHEAP_MARK;

	INFO_PRINTF1(_L("Open Device"));
	RDevice device;
	r=device.Open(RZeroCopyLoopbackDriver::Name());
	TEST_VERDICT(r==KErrNone);

	INFO_PRINTF1(_L("Get Device Capabilities"));
	RZeroCopyLoopbackDriver::TCaps caps;
	TPckg<RZeroCopyLoopbackDriver::TCaps>capsPckg(caps);
	capsPckg.FillZ(); // Zero 'caps' so we can tell if GetCaps has really filled it
	device.GetCaps(capsPckg);
	TVersion expectedVer(RZeroCopyLoopbackDriver::VersionRequired());
	TEST_VERDICT(caps.iVersion.iMajor==expectedVer.iMajor);
	TEST_VERDICT(caps.iVersion.iMinor==expectedVer.iMinor);
	TEST_VERDICT(caps.iVersion.iBuild==expectedVer.iBuild);

	INFO_PRINTF1(_L("Close Device"));
	device.Close();

	INFO_PRINTF1(_L("Open Logical Channel"));
	RZeroCopyLoopbackDriver ldd;
	r=ldd.Open();
	TEST_VERDICT(r==KErrNone);

	INFO_PRINTF1(_L("GetConfig"));
	RZeroCopyLoopbackDriver::TConfigBuf configBuf;
	configBuf.FillZ();   // Zero 'config' so we can tell if GetConfig has really filled it
	r=ldd.GetConfig(configBuf);
	TEST_VERDICT(r==KErrNone);

	RZeroCopyLoopbackDriver::TConfig& config=configBuf();
	TEST_VERDICT(config.iPddBufferSize!=0);
	TEST_VERDICT(config.iMaxSendDataSize!=0);
	TEST_VERDICT(config.iMaxReceiveDataSize!=0);

	INFO_PRINTF1(_L("SetConfig"));
	TInt speed = configBuf().iSpeed+1;
	configBuf().iSpeed = speed;
	r=ldd.SetConfig(configBuf); // Use SetConfig to change speed
	TEST_VERDICT(r==KErrNone);

	configBuf.FillZ();
	r=ldd.GetConfig(configBuf);
	TEST_VERDICT(r==KErrNone);
	TEST_VERDICT(configBuf().iSpeed==speed);
	TRequestStatus status;

	INFO_PRINTF1(_L("Check access by wrong client"));
	RZeroCopyLoopbackDriver ldd2=ldd;
	r=ldd2.Duplicate(RThread(),EOwnerProcess);
	TEST_VERDICT(r==KErrAccessDenied);

	INFO_PRINTF1(_L("Check handle duplication"));
	ldd2=ldd;
	r=ldd2.Duplicate(RThread(),EOwnerThread);
	TEST_VERDICT(r==KErrNone);
	ldd2.Close();

	INFO_PRINTF1(_L("Load pond"));
	r = ldd.LoadPond(commsBufPond);
	TEST_VERDICT(r == KErrNone);

	INFO_PRINTF1(_L("Unload pond"));
	r = ldd.UnloadPond();
	TEST_VERDICT(r == KErrNone);
	
	INFO_PRINTF1(_L("Reload pond"));
	r = ldd.LoadPond(commsBufPond);
	TEST_VERDICT(r == KErrNone);

	INFO_PRINTF1(_L("SendData"));
	TCommsBufAllocator allocator = commsBufPond.Allocator();
	RCommsBuf* buf = RCommsBuf::Alloc(KTestSendData().Length(), allocator);
	TEST_VERDICT(buf != NULL);
	buf->Reset();
	buf->Append(KTestSendData);
	ldd.SendData(status, *buf);
	User::WaitForRequest(status);
	r = status.Int();
	TEST_VERDICT(r == KErrNone);
	buf = NULL;

	INFO_PRINTF1(_L("SendData"));
	buf = RCommsBuf::Alloc(KTestSendData().Length(), allocator);
	TEST_VERDICT(buf != NULL);
	buf->Reset();
	buf->Append(KTestSendData);
	ldd.SendData(status, *buf);
	User::WaitForRequest(status);
	r=status.Int();
	TEST_VERDICT(r == KErrNone);
	buf = NULL;

	INFO_PRINTF1(_L("ReceiveData"));
	RCommsBuf* rxbuf;
	ldd.ReceiveData(status);
	User::WaitForRequest(status);
	r=status.Int();
	TEST_VERDICT(r > 0);
	rxbuf = commsBufPond.FromHandle(r);
	TEST_VERDICT(rxbuf != 0);
	TEST_VERDICT(rxbuf->Length() == KTestSendData().Size());
	TEST_VERDICT(rxbuf->DesC8() == KTestSendData);
	TBuf8<256> bufdata;
	rxbuf->Read(bufdata);
	TEST_VERDICT(bufdata == KTestSendData);
	rxbuf->Free();
	rxbuf = NULL;

	INFO_PRINTF1(_L("ReceiveData"));
	ldd.ReceiveData(status);
	User::WaitForRequest(status);
	r=status.Int();
	TEST_VERDICT(r > 0);
	rxbuf = commsBufPond.FromHandle(r);
	TEST_VERDICT(rxbuf != 0);
	TEST_VERDICT(rxbuf->Length() == KTestSendData().Size());
	TEST_VERDICT(rxbuf->DesC8() == KTestSendData);
	rxbuf->Read(bufdata);
	TEST_VERDICT(bufdata == KTestSendData);
	rxbuf->Free();
	rxbuf = NULL;

	INFO_PRINTF1(_L("ReceiveDataCancel"));
	ldd.ReceiveData(status);
	User::After(KOneSecond);
	ldd.ReceiveDataCancel();
	User::WaitForRequest(status);
	r=status.Int();
	TEST_VERDICT(r == KErrCancel);

#if 0
	INFO_PRINTF1(_L("SendDataCancel"));
	ldd.SendDataCancel();
	User::WaitForRequest(status);
	r=status.Int();
	TEST_VERDICT(r == KErrNone);
	buf = NULL;
#endif
	
	INFO_PRINTF1(_L("Unload pond"));
	r = ldd.UnloadPond();
	TEST_VERDICT(r == KErrNone);
	
	INFO_PRINTF1(_L("Close Logical Channel"));
	ldd.Close();

	__KHEAP_MARKEND;

	INFO_PRINTF1(_L("Unload Logical Device"));
	r=User::FreeLogicalDevice(RZeroCopyLoopbackDriver::Name());
	TEST_VERDICT(r==KErrNone);

	INFO_PRINTF1(_L("Unload Physical Device"));
	TName pddName(RZeroCopyLoopbackDriver::Name());
	_LIT(KVariantExtension,".template");
	pddName.Append(KVariantExtension);
	r=User::FreePhysicalDevice(pddName);
	TEST_VERDICT(r==KErrNone);

	// Close the pond
	commsBufPond.Close();
	
	// End of testing
	CleanupStack::PopAndDestroy(activeScheduler);
	
	SetTestStepResult(EPass);
	return TestStepResult();
	}
コード例 #18
0
TInt CSenBaseIdentityManager::AuthenticationForL(
                            CSenIdentityProvider& aProvider, 
                            TPckgBuf<TSenAuthentication>& aResponse)
    {
    TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"CSenBaseIdentityManager::AuthenticationForL");

    TPtrC8 user = aProvider.AuthzID();
    if (user == KNullDesC8)
        {
        user.Set(aProvider.AdvisoryAuthnID());
        }


    if (!iShowPasswordDialog)
        {
        TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"Not allowed to show password dialog");
        HBufC8* pDecodedPassword = SenXmlUtils::DecodeHttpCharactersLC(aProvider.Password());
        TPtrC8 decodedPassword = pDecodedPassword->Des();

        aResponse().iUsername.Append((const TUint8*)user.Ptr(), user.Size());
        aResponse().iPassword.Append((const TUint8*)decodedPassword.Ptr(), 
                                        decodedPassword.Size());
        CleanupStack::PopAndDestroy(); // delete pDecodedPassword
        return KErrNone;
        }


    RNotifier notifier;
    User::LeaveIfError(notifier.Connect());
    CleanupClosePushL(notifier);

    TPckgBuf<TAuthenticationDlgRequest>* request = 
                            new(ELeave)TPckgBuf<TAuthenticationDlgRequest>();
    CleanupStack::PushL(request);

    // convert username to unicode
    HBufC* pUserAsUnicode = SenXmlUtils::ToUnicodeLC(user); // push
    TPtrC username = pUserAsUnicode->Des();

    // decode password
    HBufC8* pDecodedPassword = SenXmlUtils::DecodeHttpCharactersLC(aProvider.Password());
    TPtrC8 decodedPassword = pDecodedPassword->Des();
    // convert decoded password to unicode
    HBufC* pPasswordAsUnicode = 
                SenXmlUtils::ToUnicodeLC(decodedPassword); // push
    TPtrC password = pPasswordAsUnicode->Des();

    // set data to request
    (*request)().SetData(username, password);

    CleanupStack::PopAndDestroy(3); // delete pPasswordAsUnicode, pDecodedPassword, pUserAsUnicode


    TPckgBuf<TAuthenticationDlgResponse>* response = 
                        new(ELeave)TPckgBuf<TAuthenticationDlgResponse>();
    CleanupStack::PushL(response);

    TRequestStatus reqStatus;
    notifier.StartNotifierAndGetResponse(reqStatus, 
                            KSenNotifierPluginUID, *request, *response);

    TBool illegalUsername = EFalse;

    HBufC8* pUsernameUtf8 = NULL;
    HBufC8* pPasswordUtf8 = NULL;
    User::WaitForRequest(reqStatus);

    notifier.Close();

    if(reqStatus.Int() == KErrNone)
        {
        if((*response)().OkButtonPressed())
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("User pressed OK Button in Password dialog")));
            pUsernameUtf8 = SenXmlUtils::ToUtf8LC((*response)().Username());
            pPasswordUtf8 = SenXmlUtils::ToUtf8LC((*response)().Password());
            TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("Username: %S"), pUsernameUtf8));
            TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("Password: %S"), pPasswordUtf8 ));
            HBufC8* pEncodedUsername = NULL;
            illegalUsername = 
                SenXmlUtils::EncodeHttpCharactersL(*pUsernameUtf8,
                                                    pEncodedUsername);
            if (illegalUsername) 
                {
                TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("Username included illegal characters.")));
                delete pEncodedUsername;
                pEncodedUsername = NULL;
                }
#ifdef _SENDEBUG
            else
                {
                TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"Username did NOT include illegal characters.");
                }
#endif
       		
       		//Check if iilegal chars are there then return
            if (!illegalUsername)
                {
                
                if(user != *pUsernameUtf8)
                {
                	
	                // User modified the username in the dialog prompt(!)
	                // We have to save it right away, because there is
	                // no in-memory/session based member variables in
	                // components calling identity manager (sec mechs and
	                // in ID-WSF AS client!
	                TLSLOG_L(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,"Username changed. Saving new username.");

	                // Use Advisory only if AuthzID is not available
	                if (aProvider.AuthzID() == KNullDesC8 
	                    && aProvider.AdvisoryAuthnID() != KNullDesC8)
	                    {
	                    aProvider.SetUserInfoL(aProvider.AuthzID(),
	                                            *pUsernameUtf8, 
	                                            aProvider.Password());
	                    }
	                else 
	                    {
	                    // There was at least AuthzID available, and possibly
	                    // also advisory value. Any way, if 

	                    
	                    // We have to NULL advisory value (set it to KNullDesC8), 
	                    // because if both were available, then user was
	                    // prompted to allow modification of AuthzID AND 
	                    // if advisory was changed in service (is no longer
	                    // valid), there would NOT be any way for end-user
	                    // to change (remove) it(!)

	                    CSenElement& element = aProvider.AsElement();
	                    delete element.RemoveElement(KSenIdpAdvisoryAuthnIdLocalname);

	                    aProvider.SetUserInfoL(*pUsernameUtf8, 
	                                            KNullDesC8,
	                                            aProvider.Password());
	                    }
	                // serialize changed username into sensessions.xml database immediately
	                WriteDatabase();
                }
                
	            if (AllowSavePasswordL())
	                {
	                HBufC8* pEncodedPassword = SenXmlUtils::EncodeHttpCharactersLC(*pPasswordUtf8);
#ifdef _SENDEBUG
                if(pEncodedPassword)
                    {
                    TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8("Encoded password: %S"), pEncodedPassword));
                    }
#endif
					if(pEncodedPassword)
						{
							aProvider.SetUserInfoL(aProvider.AuthzID(),
	                                        aProvider.AdvisoryAuthnID(),
	                                        *pEncodedPassword);
						}
	                WriteDatabase();
	                CleanupStack::PopAndDestroy(1); // pEncodedPassword
	                }
                
                }

            aResponse().iUsername.Zero();
            aResponse().iPassword.Zero();
            if (!illegalUsername) 
            {
	            aResponse().iUsername.Copy(pUsernameUtf8->Des());
	            aResponse().iPassword.Copy(pPasswordUtf8->Des());
            }

            CleanupStack::PopAndDestroy(2); // pPasswordUtf8, pUsernameUtf8
            }
        else
            {
            TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("User pressed Cancel Button in Password dialog")));
            }
        }
    else if(reqStatus.Int() == KErrNotFound)
        {
        TLSLOG(KSenCoreServiceManagerLogChannelBase  , KMinLogLevel,(_L("Password dialog plugin notifier impl. was not found")));
        }
    else
        {
        TLSLOG_FORMAT((KSenCoreServiceManagerLogChannelBase  , KMinLogLevel, _L8(" Notifier plugin for 'Password' dialog returned an error: %d"), 
                                                        reqStatus.Int()));
        }

    CleanupStack::PopAndDestroy(2); // request, response;
    CleanupStack::Pop(); // notifier

    if (illegalUsername) return KErrArgument;
    return reqStatus.Int();
    }
コード例 #19
0
enum TVerdict CEsockTest29_10::easyTestStepL( void )
	{
	SetTestStepResult(EFail);
	TInt ret;
	const TUint KOneSecond = 1000000;
	
	Logger().WriteFormat(_L("Send/ Recv on PDummy3 socket but no avail MBuf Memory, mBuf becomes avail after send"));
	RSocketServ ss;
	ret = ss.Connect();
	TESTL(KErrNone == ret);	
    
    // open dummy prot 3
	Logger().WriteFormat(_L("Openning Dummy Protocol 3"));             
	RSocket sock;                                                  
	ret = sock.Open(ss,_L("Dummy Protocol 3"));
	TESTL(KErrNone == ret);
	
	// connect socket
	TSockAddr addr;
	TRequestStatus connStat;
	sock.Connect(addr, connStat);
	User::WaitForRequest(connStat);
	TESTL(KErrNone == connStat.Int());
	
	// send packet 1
	TRequestStatus stat;
	Logger().WriteFormat(_L("Attempting to create a packet to receive later"));	
	_LIT8(sendDataOne, "First Send");
	sock.Send(sendDataOne,0,stat);
	User::WaitForRequest(stat);
	TESTL(KErrNone == stat.Int());	
	// wait for packets to go through esock
	User::After(KOneSecond * 2);
	// gobble mBufs
	TInt nFree = 0;
	sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
	Logger().WriteFormat(_L("Attempting to set KDummyOptionSetGobbleMBufs Option in Protocol"));
	while (nFree > 0)
		{
		ret = sock.SetOpt(KDummyOptionSetGobbleMBufs, 0, 0);
		sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
		}
	Logger().WriteFormat(_L("Socket::SetOpt KDummyOptionSetGobbleMBufs returned %d"), ret);
	
	// we are running in high priority and allocating in a loop.
	// so kernel may not be able to enlarge the pools.
	// wait for kernel to enlarge the pool
	// We have to come out from the loop as well.
    User::After(KOneSecond * 2);
	
    sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
    Logger().WriteFormat(_L("Attempting to set KDummyOptionSetGobbleMBufs Option in Protocol"));
    while (nFree > 0)
        {
        ret = sock.SetOpt(KDummyOptionSetGobbleMBufs, 0, 0);
        sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
        }
    Logger().WriteFormat(_L("Socket::SetOpt KDummyOptionSetGobbleMBufs returned %d"), ret);
    // Once again
    User::After(KOneSecond * 2);
    sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
    Logger().WriteFormat(_L("Attempting to set KDummyOptionSetGobbleMBufs Option in Protocol"));
    while (nFree > 0)
        {
        ret = sock.SetOpt(KDummyOptionSetGobbleMBufs, 0, 0);
        sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
        }
    Logger().WriteFormat(_L("Socket::SetOpt KDummyOptionSetGobbleMBufs returned %d"), ret);
    // Once again
    User::After(KOneSecond * 2);
    sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
    Logger().WriteFormat(_L("Attempting to set KDummyOptionSetGobbleMBufs Option in Protocol"));
    while (nFree > 0)
        {
        ret = sock.SetOpt(KDummyOptionSetGobbleMBufs, 0, 0);
        sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
        }
    // Once again
    User::After(KOneSecond * 2);
    sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
    Logger().WriteFormat(_L("Attempting to set KDummyOptionSetGobbleMBufs Option in Protocol"));
    while (nFree > 0)
        {
        ret = sock.SetOpt(KDummyOptionSetGobbleMBufs, 0, 0);
        sock.GetOpt(KDummyOptionGetMBufFreeSpace, 0, nFree);
        }

	
	// send packet 2
	User::After(KOneSecond);
	TRequestStatus stat2;
	_LIT8(sendDataTwo, "Second Send");
	Logger().WriteFormat(_L("Sending Data - Should never complete"));             
	sock.Send(sendDataTwo,0,stat2);

	User::After(KOneSecond);
	Logger().WriteFormat(_L("Now cancel the Send"));     
	sock.CancelSend();
	User::WaitForRequest(stat2);
	TESTL(stat2 == KErrCancel);
	
	Logger().WriteFormat(_L("Receiving Data -- expected to pick up sendDataOne"));
	TBuf8<100> buf;          
	TRequestStatus stat3;
	sock.Recv(buf, 0, stat3);
	User::After(KOneSecond);
	User::WaitForRequest(stat3);
	TESTL(buf.Compare(sendDataOne) == 0);
		
	// send packet 3
	_LIT8(sendDataThree, "Third Send");
	Logger().WriteFormat(_L("Sending Data ... again"));             
	TRequestStatus stat4;
	sock.Send(sendDataThree,0,stat4);
	User::After(1000);
			
	// free memory
	Logger().WriteFormat(_L("Now free memory - should get send and receive completion"));	
	Logger().WriteFormat(_L("Attempting to set KDummyOptionSetFreeMBufs Option in Protocol"));	
	ret = sock.SetOpt(KDummyOptionSetFreeMBufs, 0, 0);
	Logger().WriteFormat(_L("Socket::SetOpt KDummyOptionSetFreeMBufs returned %d"), ret);
	TESTL(KErrNone == ret);	

	Logger().WriteFormat(_L("Sending Data - Should now complete"));             
	User::WaitForRequest(stat4);
	TESTL(stat4.Int() == KErrNone);

	// recieve data and compare contents to sent data
	Logger().WriteFormat(_L("Receiving Data"));
	sock.Recv(buf, 0, stat);
	User::WaitForRequest(stat);
	Logger().WriteFormat(_L("Recv has returned %d"), stat.Int());
	TBuf<100> buf16;
	buf16.Copy(buf);
	if(buf.Compare(sendDataThree) == 0)
		{
		SetTestStepResult(EPass);
		}
		
	Logger().WriteFormat(_L("Data Recv'ed is '%S'"), &buf16);
	sock.Close();
	ss.Close();
	return TestStepResult();
	}
コード例 #20
0
ファイル: t_frqchg.cpp プロジェクト: kuailexs/symbiandump-os1
TBool CTimesliceTestThread::Finished()
	{
	return (KRequestPending!=iExitStatus.Int());
	}
コード例 #21
0
TVerdict CEsockTest29::easyTestStepL()
	{

	// Open Sockets, one to manipulate mBufPool and one to send/revieve with tcp or udp
	TESTL( OpenSockets() == KErrNone );

	// Bind Test Socket To local Address
	TInetAddr local;
	SetPort( local, KPort, KLocal );
	iTestSocket.Bind( local );
	
	// Connect Test Socket to LoopBack Address
	TInetAddr loopBack;
	SetPort( loopBack, KPort, KLoopback );
	ConnectSocketL( iTestSocket, loopBack );
	
	// Gobble all the Buf's in the MBuf Pool return the number of mBufs in Use
	TInt totalUsedBufs = iDummySocket.SetOpt( KDummyOptionSetGobbleMBufs, 0, 0 );
	TInt bufsToBeFreed = 0;
	
	// Data to be used during socket Send
	GetIntFromConfig(KSection29, KBufSize, iBufSize);
	TBool keepSending = ETrue;
	TBuf8<4500> recvBuf;
	TBuf8<4500> sendData;
	sendData.Fill(TChar('z'), iBufSize );
	TRequestStatus sendStatus;
	TRequestStatus recvStatus;
	const TInt KOneSecond = 1000000;
	
	
	
	for( TInt freeBufCounter = 0; freeBufCounter < totalUsedBufs && keepSending; freeBufCounter += bufsToBeFreed )
	// OOB loop that will gradually release more MBufs
		{
		
		// release some mBufs and send
		iDummySocket.SetOpt( KDummyOptionSetFreeSomeMBufs, bufsToBeFreed , 0);
		iTestSocket.Send( sendData, 0, sendStatus );
		
		// Wait for a second to allow time for server/protocol to send
		User::After( KOneSecond );
		
		// Cancel the send and start to recv
		iTestSocket.CancelSend();
		User::WaitForRequest(sendStatus);
		
		iTestSocket.Recv(recvBuf, 0, recvStatus);
		
		// Wait for a second to allow time for server/protocol to recieve
		User::After( KOneSecond );
		iTestSocket.CancelRecv();
		User::WaitForRequest( recvStatus );
		
		if( freeBufCounter % 5 == 0 )
			{
			INFO_PRINTF2( _L("freeBufs now >= %d "),  freeBufCounter );
			}
		
		if( recvBuf.Compare(sendData) == 0 )
		// if we have recieved data then exit the loop
			{
			keepSending = EFalse;
			}
			
		bufsToBeFreed = 2;
		
		}
	
	// Now do a regular send for good measure to make sure everything is ok
	sendData.Fill(TChar('c'), iBufSize );
	INFO_PRINTF1( _L("End of Loop, Now sending....") );
	iTestSocket.Send( sendData, 0, sendStatus );
	User::WaitForRequest( sendStatus );
	INFO_PRINTF2( _L("Send Returned %d, now recieving...."), sendStatus.Int() );
	iTestSocket.Recv( recvBuf, 0, recvStatus );
	User::After( KOneSecond ); 
	iTestSocket.CancelRecv();
	User::WaitForRequest( recvStatus );
	
	INFO_PRINTF2( _L("Recieve returned %d ") , recvStatus.Int() );
	if( recvBuf.Compare(sendData) != 0 )
		{
		return EFail;
		}
	
	return EPass;
	
	}
コード例 #22
0
/**
@SYMTestCaseID BA-CTSY-ALLS-MSL-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetALSLine
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::SetALSLine
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAlternateLineServiceFU::TestSetALSLine0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);

	TInt ret(-1);
	TRequestStatus requestStatus;

	//-------------------------------------------------------------------------
	// TEST B: failure on completion of pending request from LTSY->CTSY
 	//-------------------------------------------------------------------------

	// create centRep to change repository 
	CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine );
	CleanupStack::PushL(centRep);

	// setting environment (set KCtsyMEAlsSupported in repository to ETrue)
	ret = centRep->Set( KCtsyMEAlsSupported, ETrue );
	ASSERT_EQUALS(KErrNone, ret);

	// test setting and execute
	RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLinePrimary);
	TMockLtsyData1< RMobilePhone::TMobilePhoneALSLine >
			alsLineData( alsLine );
	alsLineData.SerialiseL(data);
	iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data);
	iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrGeneral);

	iPhone.SetALSLine(requestStatus, alsLine);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
	AssertMockLtsyStatusL();

 	//-------------------------------------------------------------------------
	// TEST C: Successful completion request of
	// RMobilePhone::SetALSLine when result is not cached.
	// Case CtsyMEAlsSupported ETrue
 	//-------------------------------------------------------------------------

	iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data);
	iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone);
	iPhone.SetALSLine(requestStatus, alsLine);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

 	//-------------------------------------------------------------------------
	// TEST C: Successful completion request of
	// RMobilePhone::SetALSLine when result is not cached.
	// Case ÑtsyMEAlsSupported EFalse
 	//-------------------------------------------------------------------------

	// setting environment (set KCtsyMEAlsSupported in repository to EFalse)
	ret = centRep->Set( KCtsyMEAlsSupported, EFalse );
	ASSERT_EQUALS(KErrNone, ret);

	// test setting and execute
	alsLine = RMobilePhone::EAlternateLinePrimary;
	iPhone.SetALSLine(requestStatus, alsLine);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	// check test results
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary); //check
	AssertMockLtsyStatusL();

	//-------------------------------------------------------------------------
	// TESTs for coverage increasing with different values of alsLine
 	//-------------------------------------------------------------------------

	// test execute
	alsLine = RMobilePhone::EAlternateLineAuxiliary;
	iPhone.SetALSLine(requestStatus, alsLine);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	// check test results
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineAuxiliary); //check
	AssertMockLtsyStatusL();

	// test execute
	alsLine = RMobilePhone::EAlternateLineUnknown;
	iPhone.SetALSLine(requestStatus, alsLine);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	// check test results
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineUnknown); //check
	AssertMockLtsyStatusL();

	// test execute
	alsLine = RMobilePhone::EAlternateLineNotAvailable;
	iPhone.SetALSLine(requestStatus, alsLine);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	// check test results
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineNotAvailable); //check
	AssertMockLtsyStatusL();

 	//-------------------------------------------------------------------------
	// TEST E: Unsolicited completion of RMobilePhone::SetALSLine
	// from LTSY.
 	//-------------------------------------------------------------------------

	iMockLTSY.NotifyTerminated(requestStatus);	
	iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

 	//-------------------------------------------------------------------------
	// TEST A: failure to dispatch request to LTSY
 	//-------------------------------------------------------------------------

	// setting environment (set KCtsyMEAlsSupported in repository to ETrue)
	ret = centRep->Set( KCtsyMEAlsSupported, ETrue );
	ASSERT_EQUALS(KErrNone, ret);

	// test setting and execute
	data.Close();
	alsLineData.SerialiseL(data); // serialise data here because alsLine variable is changed
	iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data, KErrNotSupported);
	iPhone.SetALSLine(requestStatus, alsLine);

	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
	AssertMockLtsyStatusL();

	// Done !
	// return repository KCtsyMEAlsSupported to EFalse (initial state)
	ret = centRep->Set( KCtsyMEAlsSupported, EFalse );
	ASSERT_EQUALS(KErrNone, ret);

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(1); // iCentRep
	CleanupStack::PopAndDestroy(2, this); // data, this
	
	}
コード例 #23
0
void CCSatSetUpCallFU::TestNotifySetUpCallPCmd0001cL()
	{
	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 3.1A (SET UP CALL, display of basic icon during confirmation phase, 
	// not selfexplanatory, successful)
	//

	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);

	const TUint8 KIconNotSelfExplanatory = 0x01;

	_LIT8(KAlphaIdentifier8_9, "Set up call Icon 3.1.1");
	_LIT16(KAlphaIdentifier16_9, "Set up call Icon 3.1.1");
	data.iIcon1.iIfUse = ETrue;
	data.iIcon1.iIdentifier = 0x01;
	data.iIcon1.iQualifier = KIconNotSelfExplanatory;

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_9 );

	DataCompareL(setupCallData, 
			     data.iCommandQualifier,
			     KAlphaIdentifier16_9, 
			     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();

	//
	// Expected Sequence 3.2A (SET UP CALL, display of basic icon during confirmation phase, 
	// selfexplanatory, successful)
	//

	const TUint8 KIconSelfExplanatory = 0x00;

	_LIT8(KAlphaIdentifier8_10, "Set up call Icon 3.2.1");
	_LIT16(KAlphaIdentifier16_10, "Set up call Icon 3.2.1");
	data.iIcon1.iQualifier = KIconSelfExplanatory;
	data.iIcon1.iIdentifier = 0x02;

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_10 );

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

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

	//
	// Expected Sequence 3.3A (SET UP CALL, display of colour icon during confirmation phase, 
	// not self-explanatory, successful)
	//

	_LIT8(KAlphaIdentifier8_11, "Set up call Icon 3.3.1");
	_LIT16(KAlphaIdentifier16_11, "Set up call Icon 3.3.1");
	data.iIcon1.iQualifier = KIconNotSelfExplanatory;
	data.iIcon1.iIdentifier = 0x02;

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_11 );

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

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

	//
	// Expected Sequence 3.4A (display of self explanatory basic icon during set up call,
	// successful)
	//

	_LIT8(KAlphaIdentifier8_12_1, "Set up call Icon 3.4.1");
	_LIT8(KAlphaIdentifier8_12_2, "Set up call Icon 3.4.2");
	_LIT16(KAlphaIdentifier16_12, "Set up call Icon 3.4.1");
	data.iIcon1.iQualifier = KIconSelfExplanatory;
	data.iIcon1.iIdentifier = 0x01;
	data.iIcon2.iIfUse = ETrue;
	data.iIcon2.iIdentifier = 0x01;
	data.iIcon2.iQualifier = KIconSelfExplanatory;

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_12_1, 
			               KErrNone, KAlphaIdentifier8_12_2 );

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

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

	//
	// Expected Sequence 3.1B (SET UP CALL, display of basic icon during confirmation phase, 
	// not selfexplanatory, requested icon could not be displayed)
	//

	// Parameters call for Expected Sequence 3.1A
	data.iIcon1.iQualifier = KIconNotSelfExplanatory;
	data.iIcon1.iIdentifier = 0x01;

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_9 );

	
	/*
	 * The Expected Sequence 3.1B does not correspond to code. 
	 * CSatNotifySetUpCall::TerminalResponseL function returns KErrCorrupt code error
	 * in case of "resp.iGeneralResult = RSat::KSuccessRequestedIconNotDisplayed".
	 * But 3GPP TS 31.124 ( Section 27.22.4.13.3.4.2 ) document says that in case of 
	 * "resp.iGeneralResult = RSat::KSuccessRequestedIconNotDisplayed" 
	 * CSatNotifySetUpCall::TerminalResponseL function should return KErrNone.
	 */

	resp.iGeneralResult = RSat::KSuccessRequestedIconNotDisplayed;

	CCSatComponentTestBase::PrepareTerminalResponseMockDataL(
			data.iCommandNumber,
			data.iCommandType,
			data.iCommandQualifier,
			KNullDesC16,
			resp.iGeneralResult,
			KNullDesC8);

	TRequestStatus reqStatus;
	iSat.TerminalRsp(reqStatus, RSat::ESetUpCall, respPck);	
	User::WaitForRequest(reqStatus);
	ASSERT_EQUALS(KErrNone, reqStatus.Int());
	AssertMockLtsyStatusL();

	//
	// Expected Sequence 3.2B (SET UP CALL, display of basic icon during confirmation phase, 
	// selfexplanatory, requested icon could not be displayed)
	//

	data.iIcon1.iIdentifier = 0x02;

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_10 );

	CCSatComponentTestBase::GenerateTerminalResponseL( data.iCommandNumber, data.iCommandType, 
			data.iCommandQualifier, RSat::ESetUpCall, respPck, KNullDesC16, resp.iGeneralResult );
	AssertMockLtsyStatusL();

	//
	// Expected Sequence 3.3B (SET UP CALL, display of colour icon during confirmation phase, 
	// not self-explanatory, requested icon could not be displayed)
	//

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_11 );

	CCSatComponentTestBase::GenerateTerminalResponseL( data.iCommandNumber, data.iCommandType, 
			data.iCommandQualifier, RSat::ESetUpCall, respPck, KNullDesC16, resp.iGeneralResult );
	AssertMockLtsyStatusL();

	//
	// Expected Sequence 3.4B (SET UP CALL, display of self explanatory basic icon during 
	// set up call, requested icon could not be displayed)
	//

	data.iIcon1.iQualifier = KIconSelfExplanatory;
	data.iIcon1.iIdentifier = 0x01;

	ProactiveCommandCallL( setupCallData, data, KAlphaIdentifier8_12_1, 
			               KErrNone, KAlphaIdentifier8_12_2 );

	CCSatComponentTestBase::GenerateTerminalResponseL( data.iCommandNumber, data.iCommandType, 
			data.iCommandQualifier, RSat::ESetUpCall, respPck, KNullDesC16, resp.iGeneralResult );
	AssertMockLtsyStatusL();

	CleanupStack::PopAndDestroy(1, this); // this
	}
コード例 #24
0
/**
@SYMTestCaseID BA-CTSY-ALLS-MSL-0004
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::SetALSLine
@SYMTestPriority High
@SYMTestActions Invokes multiple client requests to RMobilePhone::SetALSLine
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAlternateLineServiceFU::TestSetALSLine0004L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);

	// Open second client
	RTelServer telServer2;
	TInt ret = telServer2.Connect();
	ASSERT_EQUALS(KErrNone, ret);
	CleanupClosePushL(telServer2);

	RMobilePhone phone2;
	ret = phone2.Open(telServer2,KMmTsyPhoneName);
	ASSERT_EQUALS(KErrNone, ret);
	CleanupClosePushL(phone2);

	// create centRep to change repository 
	CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine );
	CleanupStack::PushL(centRep);

	// setting environment (set KCtsyMEAlsSupported in repository to ETrue)
	ret = centRep->Set( KCtsyMEAlsSupported, ETrue );
	ASSERT_EQUALS(KErrNone, ret);

	TRequestStatus requestStatus;
	TRequestStatus requestStatus2;

	//-------------------------------------------------------------------------
	// Test A: Test multiple clients requesting RMobilePhone::SetALSLine
 	//-------------------------------------------------------------------------

	// setting and execute 1st request
	RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLinePrimary);
	TMockLtsyData1< RMobilePhone::TMobilePhoneALSLine >
			alsLineData( alsLine );
	alsLineData.SerialiseL(data);
	iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data);
	iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone);
	iPhone.SetALSLine(requestStatus, alsLine);
	
	// setting and execute 2nd request
	RMobilePhone::TMobilePhoneALSLine alsLine2(RMobilePhone::EAlternateLineAuxiliary);
	phone2.SetALSLine(requestStatus2, alsLine2);
	
	// wait for completion and check results
	User::WaitForRequest(requestStatus2);
	ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int());
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());

	AssertMockLtsyStatusL();

	// setting environment (set KCtsyMEAlsSupported in repository to ETrue)
	ret = centRep->Set( KCtsyMEAlsSupported, EFalse );
	ASSERT_EQUALS(KErrNone, ret);

	// setting and execute the test for the case when 
	// KCtsyMEAlsSupported in repository is set to ETrue
	alsLine = RMobilePhone::EAlternateLinePrimary;
	iPhone.SetALSLine(requestStatus, alsLine);
	
	alsLine2 = RMobilePhone::EAlternateLineAuxiliary;
	phone2.SetALSLine(requestStatus2, alsLine2);
	
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	User::WaitForRequest(requestStatus2);
	ASSERT_EQUALS(KErrNone, requestStatus2.Int());

	AssertMockLtsyStatusL();

	//Done!
	CleanupStack::PopAndDestroy(1); // iCentRep
	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this

	}
コード例 #25
0
ファイル: upstest.cpp プロジェクト: cdaffara/symbiandump-os2
static void TestRUpsManagementL()
/**
	Attempt to delete database
 */
	{
	test.Start(_L("Testing RUpsManagement"));
	RThread thd;
	TRequestStatus rs;

	// Create filter
	TServiceId serviceId = {43};
	CDecisionFilter *filter = CDecisionFilter::NewLC();
	filter->SetClientSid(thd.SecureId(), EEqual);
	filter->SetServerSid(thd.SecureId(), EEqual);
	filter->SetServiceId(serviceId, EEqual);

	RUpsSubsession clientSubsession;
	TInt r = clientSubsession.Initialise(sTestSession, thd);
	test(r == KErrNone);

	test.Next(_L("Open management session"));
	RUpsManagement mngmnt;
	r = mngmnt.Connect();
	test(r == KErrNone);
	User::LeaveIfError(r);

	test.Next(_L("View create - then delete DB"));
	mngmnt.CreateView(*filter, rs);

	test.Next(_L("Delete database"));
	TRAP(r, mngmnt.DeleteDatabaseL());
	test(r == KErrNone);

	test.Next(_L("Now see what view create completed with...."));
	User::WaitForRequest(rs);
	test(rs.Int() == KErrAbort);

	test.Next(_L("Add entry to new database"));
	TUpsDecision dec = EUpsDecYes;
	clientSubsession.Authorise(EFalse, serviceId, _L("DB delete 1"), _L8("Opaque data"), dec, rs);
	User::WaitForRequest(rs);
	test(rs == KErrNone);
	test(dec == EUpsDecNo);

	dec = EUpsDecYes;
	clientSubsession.Authorise(EFalse, serviceId, _L("DB delete 2"), _L8("Opaque data"), dec, rs);
	User::WaitForRequest(rs);
	test(rs == KErrNone);
	test(dec == EUpsDecNo);


	test.Next(_L("View create - immediate cancel"));
	mngmnt.CreateView(*filter, rs);
	mngmnt.CancelAndCloseView();
	User::WaitForRequest(rs);
	test(rs.Int() == KErrCancel);

	mngmnt.UpdateDecision(TUint32(-23), ETrue, rs);
	mngmnt.CancelUpdateDecision();
	User::WaitForRequest(rs);
	test(rs.Int() == KErrCancel);

	mngmnt.UpdateDecision(TUint32(-23), ETrue, rs);
	User::WaitForRequest(rs);
	test(rs.Int() == KErrNotFound);

	test.Next(_L("View create - when busy"));
	TRequestStatus rs2;
	mngmnt.CreateView(*filter, rs);
	mngmnt.CreateView(*filter, rs2);
	User::WaitForRequest(rs2);
	test(rs2.Int() == KErrServerBusy);
	User::WaitForRequest(rs);
	test(rs.Int() == KErrNone);
	mngmnt.CancelAndCloseView();

	test.Next(_L("View create - iterate through it"));
	mngmnt.CreateView(*filter, rs);

	User::WaitForRequest(rs);
	test(rs.Int() == KErrNone);
	
	CleanupStack::PopAndDestroy(filter);

	CDecisionRecord *record = 0;
	r = KErrNone;
	TInt recordCount = 0;
	while(r == KErrNone)
		{
		TRAP(r, record = mngmnt.NextMatchL());
		if(record == 0)
			{
			break;
			}
		test(r == KErrNone);
		if(r == KErrNone)
			{
			++recordCount;
			CleanupStack::PushL(record);
			CDecisionFilter *exactFilter = CDecisionFilter::NewLC(record->iClientSid,
																  record->iEvaluatorId,
																  record->iServiceId,
																  record->iServerSid,
																  record->iFingerprint,
																  record->iClientEntity,
																  record->iMajorPolicyVersion);
				
			
			mngmnt.UpdateDecision(record->iRecordId, ETrue, rs);
			User::WaitForRequest(rs);
			test(rs.Int() == KErrNone);
			TRAP(r, mngmnt.RemoveDecisionsL(*exactFilter));
			test(r == KErrNone);

			CleanupStack::PopAndDestroy(exactFilter);
			CleanupStack::PopAndDestroy(record);
			}
		
		};
	test(recordCount == 2);
	
	TRAP(r, record = mngmnt.NextMatchL());
	test((r == KErrNone) && (record == 0));

	mngmnt.CancelAndCloseView();

	test.Next(_L("Close management session and clientSubsession"));
	mngmnt.Close();
	clientSubsession.Close();

	test.End();
	}
コード例 #26
0
/**
@SYMTestCaseID BA-CTSY-ALLS-MGAL-0001
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetALSLine
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::GetALSLine
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAlternateLineServiceFU::TestGetALSLine0001L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);
	
	TInt ret(KErrGeneral);
	
	TRequestStatus requestStatus;
	
	// dont change the tests order in order to preserve the environment state
	// at the beginig of every test
 	//-------------------------------------------------------------------------
	// TEST E: Unsolicited completion of RMobilePhone::GetALSLine
	// from LTSY.
 	//-------------------------------------------------------------------------

	// create centRep to change repository 
	CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine );
	CleanupStack::PushL(centRep);

	// setting environment (set KCtsyMEAlsSupported in repository to EFalse)
	ret = centRep->Set( KCtsyMEAlsSupported, EFalse );
	ASSERT_EQUALS(KErrNone, ret);

	// Unsolicited completion with new value EAlternateLineAuxiliary that is not yet cached in CTSY
	iMockLTSY.NotifyTerminated(requestStatus);	    
	RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLineAuxiliary);
	TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine);
	alsLineData.SerialiseL(data);
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data);
	User::WaitForRequest(requestStatus);
	AssertMockLtsyStatusL();
	ASSERT_EQUALS(KErrNone, requestStatus.Int());

    // Unsolicited completion with the same value EAlternateLineAuxiliary that is cached in CTSY
	iMockLTSY.NotifyTerminated(requestStatus);	
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();
	
 	//-------------------------------------------------------------------------
	// TEST C: Successful completion request of
	// RMobilePhone::GetALSLine when result is not cached.
 	//-------------------------------------------------------------------------

	// test setting and execute
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	AssertMockLtsyStatusL();
		
	//-------------------------------------------------------------------------
	// TESTs for coverage increasing with different values of alsLine and 
	// of KCtsyMEAlsSupported from repository
 	//-------------------------------------------------------------------------
 	// setting environment (set alsLine to EAlternateLineUnknown)
	iMockLTSY.NotifyTerminated(requestStatus);
	alsLine = RMobilePhone::EAlternateLineUnknown;
	data.Close();
	alsLineData.SerialiseL(data);
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	// test setting and execute
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	AssertMockLtsyStatusL();

	// setting environment (set KCtsyMEAlsSupported in repository to ETrue)
	ret = centRep->Set( KCtsyMEAlsSupported, ETrue );
	ASSERT_EQUALS(KErrNone, ret);
    
	// test setting and execute
	alsLine = RMobilePhone::EAlternateLinePrimary;
	data.Close();
	alsLineData.SerialiseL(data);
	iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone);
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data);

	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary);
	AssertMockLtsyStatusL();

 	//-------------------------------------------------------------------------
	// TEST D: RMobilePhone::GetALSLine again, this time CTSY
	// will get result from the cache.
 	//-------------------------------------------------------------------------
	
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNone, ret);
	ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary);
	AssertMockLtsyStatusL();

	//-------------------------------------------------------------------------
	// TEST B: failure on completion of pending request from LTSY->CTSY
 	//-------------------------------------------------------------------------

	// change alsLine to EAlternateLineUnknown again
	iMockLTSY.NotifyTerminated(requestStatus);
	alsLine = RMobilePhone::EAlternateLineUnknown;
	data.Close();
	alsLineData.SerialiseL(data);
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	// test setting and execute
	iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone);
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrGeneral, data);

	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrGeneral, ret);
	AssertMockLtsyStatusL();

 	//-------------------------------------------------------------------------
	// TEST A: failure to dispatch request to LTSY
 	//-------------------------------------------------------------------------
	
	//change alsLine to EAlternateLineUnknown again
	iMockLTSY.NotifyTerminated(requestStatus);	
	alsLine = RMobilePhone::EAlternateLineUnknown;
	data.Close();
	alsLineData.SerialiseL(data);
	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data);
	User::WaitForRequest(requestStatus);
	ASSERT_EQUALS(KErrNone, requestStatus.Int());
	AssertMockLtsyStatusL();

	// test setting and execute
	iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNotSupported);
	ret = iPhone.GetALSLine(alsLine);
	ASSERT_EQUALS(KErrNotSupported, ret);
	AssertMockLtsyStatusL();

	//Done!
	// return repository KCtsyMEAlsSupported to EFalse (initial state)
	ret = centRep->Set( KCtsyMEAlsSupported, EFalse );
	ASSERT_EQUALS(KErrNone, ret);

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(1); // iCentRep
	CleanupStack::PopAndDestroy(2, this); // data, this
	
	}
コード例 #27
0
/**
@SYMTestCaseID          SYSLIB-ECOM-CT-1808
@SYMTestCaseDesc	    Tests the uninstallation of an active plugin
@SYMTestPriority 	    High
@SYMTestActions  	    Creates a plugin implementation and then uninstalls the
                        plugin's files from the C: Drive and waits for an ECOM
                        notification completion, upon which it deletes the
                        plugin.
@SYMTestExpectedResults The test must not fail.
@SYMREQ                 REQ0000
*/
void TestUninstallL()
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-1808 TestUninstallL "));

	// Set up for heap leak checking and leaking thread handles
	__UHEAP_MARK;
	TInt startProcessHandleCount;
	TInt startThreadHandleCount;
	TInt endProcessHandleCount;
	TInt endThreadHandleCount;
	RThread thisThread;
	thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount);

    // Step 1: Setup the session to ECOM
    TInt err = KErrNone;
    REComSession& ecomSession = REComSession::OpenL();
	CleanupClosePushL(ecomSession);

    // Step 2: Register for ECOM Server notification.
	TRequestStatus notifyStatus;
    ecomSession.NotifyOnChange(notifyStatus);
	TEST2(notifyStatus.Int(), KRequestPending);

    // Step 3. Create the plugin implementation we will uninstall
    TheTest.Printf(_L("CHeapTestInterface::NewL()\n"));
    CHeapTestInterface* implPtr = 0;
    TRAP(err, implPtr = CHeapTestInterface::NewL());
	TEST2(err, KErrNone);

    // Step 4. Simulate the uninstall of the plugin files
    TheTest.Printf(_L("Deleting HTI plugin - attempt 1, wait 5s...\n"));
  	//TRAP(err, EComTestUtils::FileManDeleteFileL(KHTI_PluginInstalledOnC));
  	TRAP(err, EComTestUtils::RLoaderDeleteFileL(KHTI_PluginInstalledOnC));
#if defined(__WINS__) || defined (__WINSCW__)
   	TEST2(err, KErrAccessDenied); // DLL File locked under Windows emulator due to it being demand paged
   	TheTest.Printf(_L("Error -21 (KErrAccessDenied) expected due to Windows keeping the DLL mapped in the emulator process adress space due to Windows demand paging/virtual memory system\n"));
#elif defined(__EPOC32__)
   	TEST2(err, KErrNone); // DLL File not locked on target hardware under SOS
//#else Do no test at all as its an unexpected platform.
#endif

 	TRAP(err, EComTestUtils::FileManDeleteFileL(KHTIr_PluginInstalledOnC));
   	TEST2(err, KErrNone);

    // Step 5. Wait for ECOM Server notification to arrive, with precautionary hang timer.
	RTimer timer;
	CleanupClosePushL(timer);
	User::LeaveIfError(timer.CreateLocal());
	TRequestStatus timerStatus;
	timer.After(timerStatus, KWaitDuration);
	TEST2(timerStatus.Int(), KRequestPending);

    TheTest.Printf(_L("Before calling WaitForAnyRequest(): Timer Status: %d; ECOM Notif Status: %d\n"), timerStatus.Int(), notifyStatus.Int());
    TheTest.Printf(_L("Checking notification recieved for ECOM Server...\n"));
    User::WaitForRequest(timerStatus, notifyStatus);

	TEST2(timerStatus.Int(), KRequestPending);
	TEST2(notifyStatus.Int(), KErrNone);
	timer.Cancel();

    // Step 6. Destroy the plugin
    TheTest.Printf(_L("DELETE implPtr\n"));
    delete implPtr;


	//CleanupStack::PopAndDestroy(&timer);
    TheTest.Printf(_L("Test over, cleanup...\n"));
   	CleanupStack::PopAndDestroy(&timer);
	CleanupStack::PopAndDestroy(&ecomSession);
	REComSession::FinalClose();

	// Check for open handles
	thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount);
	TEST(startThreadHandleCount == endThreadHandleCount);

	// Test Ends...
	__UHEAP_MARKEND;

	}
コード例 #28
0
void CCTsyPrivacyFU::DoMultiNotifyPrivacyConfirmationL(const TDesC& aLineName)
	{
	//-------------------------------------------------------------------------
	// Test A: Test multiple clients requesting RMobileCall::NotifyPrivacyConfirmation
 	//-------------------------------------------------------------------------

	// Open first client					
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RLine line1;
	TInt err = line1.Open(iPhone, aLineName);
	ASSERT_EQUALS(KErrNone, err)
    CleanupClosePushL(line1);
	
	RMobileCall mobileCall1;
	err = mobileCall1.OpenNewCall(line1);
	ASSERT_EQUALS(KErrNone, err)
    CleanupClosePushL(mobileCall1);

	// Open second client
	RTelServer telServer2;
	TInt ret = telServer2.Connect();
	ASSERT_EQUALS(KErrNone, ret);
	CleanupClosePushL(telServer2);

	RMobilePhone phone2;
	ret = phone2.Open(telServer2,KMmTsyPhoneName);
	ASSERT_EQUALS(KErrNone, ret);
	CleanupClosePushL(phone2);

	RLine line2;
	err = line2.Open(phone2, aLineName);
	ASSERT_EQUALS(KErrNone, err)
    CleanupClosePushL(line2);
	
	RMobileCall mobileCall2;
	err = mobileCall2.OpenNewCall(line2);
	ASSERT_EQUALS(KErrNone, err)
    CleanupClosePushL(mobileCall2);

	// initialize variables with values other than passed to MockLTSY
	RMobilePhone::TMobilePhonePrivacy privacy1 = RMobilePhone::EPrivacyOn;
	RMobilePhone::TMobilePhonePrivacy privacy2 = RMobilePhone::EPrivacyOff;

	// request notifications
	TRequestStatus notifyStatus1;
	TRequestStatus notifyStatus2;

	mobileCall1.NotifyPrivacyConfirmation(notifyStatus1,privacy1);
	mobileCall2.NotifyPrivacyConfirmation(notifyStatus2,privacy2);

	// trigger EMobileCallNotifyPrivacyConfirmation completion via MockLTSY 
	RMobilePhone::TMobilePhonePrivacy privacySetting = RMobilePhone::EPrivacyUnspecified;
	TMockLtsyCallData1<RMobilePhone::TMobilePhonePrivacy> privacySettingData(privacySetting);

	RBuf8 data;
	CleanupClosePushL(data);
	privacySettingData.SerialiseL(data);

	TRequestStatus mockLtsyStatus;
	iMockLTSY.NotifyTerminated(mockLtsyStatus); 
	iMockLTSY.CompleteL(EMobileCallNotifyPrivacyConfirmation, KErrNone,data);
	User::WaitForRequest(mockLtsyStatus);
	CleanupStack::PopAndDestroy(1,&data); // data
	ASSERT_EQUALS(KErrNone,mockLtsyStatus.Int());

	
	// wait for both notifications
	User::WaitForRequest(notifyStatus1);
	ASSERT_EQUALS(KErrNone,notifyStatus1.Int());
    ASSERT_EQUALS(RMobilePhone::EPrivacyUnspecified, privacy1);

	User::WaitForRequest(notifyStatus2);
	ASSERT_EQUALS(KErrNone,notifyStatus2.Int());
    ASSERT_EQUALS(RMobilePhone::EPrivacyUnspecified, privacy2);

	// cleanup second client
	CleanupStack::PopAndDestroy(4,&telServer2); // mobileCall2, line2, phone2, telServer2

	AssertMockLtsyStatusL();
	
	// cleanup first client
	CleanupStack::PopAndDestroy(3, this); // mobileCall1, line1, this
	}
コード例 #29
0
TVerdict CPPPMinMaxMMU::doTestStepL()
	{
	const TInt KMaxMMU = 4000;
	const TInt KMinMMU = 1;

	TBuf8<KMaxMMU> *sendBuf = new(ELeave) TBuf8<KMaxMMU>();
	CleanupStack::PushL(sendBuf);
	
	TBuf8<KMaxMMU> *recvBuf = new(ELeave) TBuf8<KMaxMMU>();
	CleanupStack::PushL(recvBuf);
	
	TBuf8<KMaxMMU> *recvBuf2 = new(ELeave) TBuf8<KMaxMMU>();
	CleanupStack::PushL(recvBuf2);

    //initialize COMM
    //CommInitL(EFalse);
    
	//Start Comms server
// 	_LIT(KPhbkSyncCMI, "phbsync.cmi");
//    (void)StartC32WithCMISuppressions(KPhbkSyncCMI);
	
	SetTestStepResult(EPass);
    INFO_PRINTF1(_L("Starting: Socket Server\n"));
    
    RSocketServ ss;

    // Start the socket server
    TEST(KErrNone == ss.Connect());
    RSocket sock;
    TRequestStatus sta;
	INFO_PRINTF1(_L("Open a socket\n"));
    
    // Get the test address
    TInetAddr RemAddr(7);
    TPtrC testAddr;
	TEST(GetStringFromConfig(_L("AddressInfo"), _L("TestPPPIPAddr"), testAddr));
	
    if(testAddr.Length())
		{
		RemAddr.Input(testAddr); 
		}
    else
		{
		INFO_PRINTF1(_L("Test FAILED\nMissing address information in config file: "));
		return EFail;
		}
    
    // Open a socket
    TEST(KErrNone == sock.Open(ss, KAfInet, KSockStream, KProtocolInetTcp)); 
    INFO_PRINTF1(_L("Connecting Socket to:"));
	
    TBuf<30> printAddr;
    RemAddr.Output(printAddr);
	
    INFO_PRINTF1(printAddr);
	
    // Connect a socket
    sock.Connect(RemAddr,sta);
	
    // Wait for Connect to complete
    User::WaitForRequest(sta);
    TEST(sta.Int() == 0);
    
    TInt iterEnd;
	GetIntFromConfig(_L("MMUInfo"), _L("TestPPPmaxMMU"), iterEnd);
    if (iterEnd > KMaxMMU)
		iterEnd = KMaxMMU;
	
    TInt iterStart;
	GetIntFromConfig(_L("MMUInfo"), _L("TestPPPminMMU"), iterStart);
    if (iterStart < KMinMMU)
		iterStart = KMinMMU;
	
    TInt i,j;
    TSockXfrLength recvLen;
    INFO_PRINTF1(_L("Send/Recv frames"));
    for(j=iterStart;j<=iterEnd;j++)
		{
		sendBuf->Zero();
		
		for (i=0;i<j;i++)
			sendBuf->Append(Math::Random() & 0x7f);
		
		INFO_PRINTF2(_L("Sending Packet of Size: %d"),j);
		// Send data to echo port
		sock.Write(*sendBuf,sta);
		User::WaitForRequest(sta);
		TEST(sta.Int() == 0);
		i=0;
		recvBuf->Zero();
		
		while(i<j)
			{
			// Receive data from echo port
			sock.RecvOneOrMore(*recvBuf2,0,sta,recvLen); 
			User::WaitForRequest(sta);
			TEST(sta.Int() == 0);
			i += recvBuf2->Length();
			recvBuf->Append(*recvBuf2);
			}
		
		TEST(KErrNone == recvBuf->Compare(*sendBuf));
		INFO_PRINTF1(_L("   Received echoed Packet"));
		}
    
    sock.Shutdown(RSocket::EStopOutput,sta);
    User::WaitForRequest(sta);
    TEST(sta.Int() == 0);
    sock.Close();
    ss.Close();

	CleanupStack::PopAndDestroy(3);

	return TestStepResult();
	}
コード例 #30
0
//
// Performes the test by connecting to MLFW  
// (and makes a number of Location requests if aFullTest is true
//
void DoTestL(TBool aFullTest, TInt aNumberOfRuns, TInt *aResult)
    {
    RPositionServer	posServer;
	TInt errorCode = errorCode = posServer.Connect();

    if (errorCode != KErrNone)
        {
        *aResult = KErrCouldNotConnect;
        return;
        }
    CleanupClosePushL(posServer);

    RPositioner positioner;


    // Full test means requesting position updates
    if (aFullTest)
        {
        TPositionInfo positionInfo = TPositionInfo();
        const TInt32 KUidMultiPsy = 0x01010176;
        TUid uidMultiPsy;
        uidMultiPsy.iUid = KUidMultiPsy;
        errorCode = positioner.Open(posServer, uidMultiPsy);
        
        if (errorCode != KErrNone) 
        {
            *aResult = errorCode;
            return;
        }
        CleanupClosePushL(positioner);
        
        _LIT(KService ,"Service");
        errorCode = positioner.SetRequestor(CRequestor::ERequestorService,
            CRequestor::EFormatApplication, KService);
        
        if (errorCode != KErrNone)
        {
            *aResult = 1001;
            return;
        }
        
        TRequestStatus status;
        TLocality loca(TCoordinate(0,0,0),0);
        TPosition pos(loca, TTime(0));

        for (TInt i = 0; i < aNumberOfRuns; i++)
        {
            positionInfo.SetPosition(pos);
            positioner.NotifyPositionUpdate(positionInfo, status);
            User::WaitForRequest(status);
            TInt err = status.Int();
            if (err != KErrNone)
            {
                *aResult = err;
            }
            TPosition result;
            positionInfo.GetPosition(result);
            
            //sanity check
            if (result.Latitude() == pos.Latitude() ||
                result.Longitude() == pos.Longitude() ||
                result.Altitude() == pos.Altitude())
            {
                //_LIT(KErrorPositon, "ERROR:: The postion was not updated");
                errorCode = 1005;
            }   
        }
        positioner.Close();
        CleanupStack::PopAndDestroy(&positioner);
    }
    
    posServer.Close();
    CleanupStack::PopAndDestroy(&posServer);
    }