Ejemplo n.º 1
0
enum TVerdict CTestRelinquishCase1::doTestStepL()
//
// This test is used to check the objects are destroy in the right order
// make break points at CCallBase,CLineBase,CPhoneBase and CPhoneFactoryBase
// and ensure that to stop at the break point in order described above
//
    {
 	INFO_PRINTF1(_L("Test Call Relinquish Case 1"));
	RTelServer serverA;
	TInt ret = serverA.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);;

	RCall callA;
    ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME);
	TESTCHECK(ret, KErrNone);;

	RCall::TCallParams callParams;
	RCall::TCallParamsPckg callParamsPckg(callParams);

    ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL);
	TESTCHECK(ret, KErrNone);;


	callA.Close();
	ServerClose(serverA);

	return TestStepResult();
	}
enum TVerdict CTestSetPrClientMulCallFrDiffSubSes::doTestStepL()
//
// Test connecting Multiple call of setpriorityclient API from the different sub session
//
	{
	INFO_PRINTF1(_L("Test connecting Multiple call of setpriorityclient API on the different sub session"));
	RTelServer first;
	TInt ret=first.Connect();
	INFO_PRINTF2(_L("RTelServer::Connect returned %d."),ret);
	TESTCHECK(ret, KErrNone);
	RTelServer second;
	ret=second.Connect();
	INFO_PRINTF2(_L("RTelServer::Connect (second) returned %d."),ret);
	INFO_PRINTF1(_L("Multiple call of setpriorityclient API on the different session"));
	ret=first.SetPriorityClient();
	TESTCHECK(ret, KErrNone);
	INFO_PRINTF2(_L("first call of RTelServer::SetPriorityClient in different session %d."),ret);
	ret=second.SetPriorityClient();
	TESTCHECK(ret, KErrAlreadyExists);
	INFO_PRINTF2(_L("second call of RTelServer::SetPriorityClient in different session %d."),ret);
	second.Close();
	first.Close();
	
	return TestStepResult();
	}
Ejemplo n.º 3
0
enum TVerdict CTestRelinquishOwner::doTestStepL()
	{
 	INFO_PRINTF1(_L("Test Call Recover Port And Relinquish Ownership"));
	RTelServer serverA;
	TInt ret = serverA.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);
	RCall callA;
    ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME);
	TESTCHECK(ret, KErrNone);
	RCall::TCallParams callParams;
	RCall::TCallParamsPckg callParamsPckg(callParams);

    ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL);
	TESTCHECK(ret, KErrNone);

	RCall::TCommPort port;
	ret=callA.LoanDataPort(port);
    TESTCHECK(ret, KErrNone);
	callA.Close();

	ServerClose(serverA);

	return TestStepResult();
	}
Ejemplo n.º 4
0
enum TVerdict CTestErrGetTsyVersionNumberOk::doTestStepL()
/** 
Check that RTelServer::GetTsyVersionNumber and RTelServer::SendReceive( EEtelServerGetTsyVersionNo, ... )
	return no errors when there is a large enough valid buffer to hold the version number.

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	// Check that GetTsyVersionNumber still runs okay.
	TInt indexOfPhone=0;
	TName tsyName;
	ret = server.GetTsyName(indexOfPhone, tsyName);	
		// Get a name for us to use.
	TESTCHECK(ret, KErrNone);

	TVersion version;
	ret = server.GetTsyVersionNumber(tsyName, version);
	TESTCHECK(ret, KErrNone);

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
enum TVerdict CTestMemRelinquish::doTestStepL()
   	{
   	INFO_PRINTF1(_L("Test Call Relinquish Case 2"));
 
 	User::SetJustInTime(EFalse);	// switches off the WINS threadbreakpoints
 
 	RThread t;
 	TInt res=t.Create(_L("RelinquishCall"),RelinquishCall,KDefaultStackSize,KDefaultHeapSize,KDefaultHeapSize,NULL);
 	TESTCHECK(res, KErrNone);
 
 	TRequestStatus stat = KRequestPending;
 	t.Logon(stat);
 	t.Resume();
 	User::WaitForRequest(stat);
 
 	TESTCHECK(t.ExitType(), EExitKill);
 	//TESTCHECK(t.ExitCategory()==_L("Etel Client Faul"));
 	//TESTCHECK(t.ExitReason()==11);	// EEtelPanicHandleNotClosed is 11
 	//TESTCHECK(t.ExitType()==EExitPanic);
 	t.Close();
 
 	User::SetJustInTime(ETrue);
 	User::After(KETelThreadShutdownGuardPeriod);
 
 	return TestStepResult();
 	}
Ejemplo n.º 6
0
enum TVerdict CTestErrGetPhoneInfoOk::doTestStepL()
/** 
Check that RTelServer::GetPhoneInfo and RTelServer::SendReceive( EEtelServerPhoneInfoByIndex, ... )
 return no errors when there is a large enough valid buffer to hold the phone info.

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	TInt index=0;
	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo(index,phoneInfo);
	TESTCHECK(ret, KErrNone);

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
Ejemplo n.º 7
0
enum TVerdict CTestErrGetPhoneInfoSmallBuffer::doTestStepL()
/** 
Check that RTelServer::SendReceive( EEtelServerPhoneInfoByIndex, ... ) returns an error when a descriptor is too small 
 for the phone info.

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	// Now lets pass in a small data buffer 
	// This is possible if a programmer derives from RTelServer
	// and makes a mistake, or does it on purpose for some perverse reason.
	// Normally goes through server API.

	TInt index=0;
	TBuf8<1> phoneInfo;

	TPckg< TBuf8<1> > result(phoneInfo);

	TIpcArgs args(&result,index);
	ret = server.SendReceive(EEtelServerPhoneInfoByIndex,args);

	TESTCHECK(ret, KErrOverflow);

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
Ejemplo n.º 8
0
enum TVerdict CTestErrGetTsyOk::doTestStepL()
/** 
Check that RTelServer::GetTsyName and RTelServer::SendReceive( EEtelServerGetTsyName, ... ) 
	return no errors when they use a large enough valid buffer for returning the tsy name. 

@return EPass or EFail 
*/
	{

	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
		
	TInt indexOfPhone=0;
	TName tsyName;
	ret = server.GetTsyName(indexOfPhone, tsyName);
	  // Check that the original still  works okay.
	TESTCHECK(ret, KErrNone);

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();

	}
Ejemplo n.º 9
0
enum TVerdict CTestErrSetExtendedErrorGranularityPanic::doTestStepL()
/** 
Check that RTelServer::SendReceive( EEtelServerSetExtendedErrorGranularity, ... ) panics the client when the wrong size buffer is passed in.

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	// Send Fewer bytes required for enum TErrorGranularity. 
	RTelServer::TErrorGranularity granularity = RTelServer::EErrorExtended;
	TPtr8 ptr(REINTERPRET_CAST(TText8*,CONST_CAST(RTelServer::TErrorGranularity*,&granularity)),
		sizeof(RTelServer::TErrorGranularity)-1,sizeof(RTelServer::TErrorGranularity));
		// Do not have all the bytes required to make the enum.

	TIpcArgs args(&ptr);
	ret = server.SendReceive(EEtelServerSetExtendedErrorGranularity, args);
			// This will panic and will not continue.

	ServerClose(server);
	return TestStepResult();
	}
Ejemplo n.º 10
0
enum TVerdict CTestOpenCallFrPhone::doTestStepL()
	{
	INFO_PRINTF1(_L("Open Call from RPhone"));
    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RCall call;
	ret = call.OpenNewCall(phone,DSTD_OPEN_CALL_FROM_PHONE_NAME);
    TESTCHECK(ret, KErrNone);
	call.Close();

	phone.Close();
  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
	}
Ejemplo n.º 11
0
enum TVerdict CTestErrIsSupportedByModuleSmallBuffer::doTestStepL()
/** 
Check that RTelServer::SendReceive( EEtelServerQueryTsyFunctionality, ... ) returns an error when a small buffer is passed in. 

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	TInt indexOfPhone=0;
	TName tsyName;
	ret = server.GetTsyName(indexOfPhone, tsyName);	
		// Get a name for us to use.
	TESTCHECK(ret, KErrNone);

	char mixin = 0;
	TBool result = 0;
	TPtr8 ptr1(REINTERPRET_CAST(TText8*,&mixin),sizeof(mixin),sizeof(mixin));
	TPtr8 ptr2(REINTERPRET_CAST(TText8*,&result),sizeof(result),sizeof(result));
	TIpcArgs args(&tsyName,&ptr1,&ptr2);
	ret = server.SendReceive(EEtelServerQueryTsyFunctionality,args);

	TESTCHECK(ret, KErrOverflow);

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
Ejemplo n.º 12
0
bool 
TestAlgorithms( )
{
    bool ok = true;
    cout << "Testing Algorithms" << endl;

    int numbers[4] = { 0, 1, 2, 3 };
    string numberNames[4] = { "zero", "one", "two", "three" };
    TESTCHECK( *(MinIter( numbers, numbers + 4 )), 0, &ok );
    TESTCHECK( *(MaxIter( numbers, numbers + 4 )), 3, &ok );
    TESTCHECK( *(MinIter( numberNames, numberNames + 4 )), string( "one" ),
               &ok );
    TESTCHECK( *(MaxIter( numberNames, numberNames + 4 )), string( "zero" ),
               &ok );
    TESTCHECK( *(MaxIter( numberNames + 1, numberNames + 4 )), string( "two" ),
               &ok );
    TESTCHECK( MinIndex( numbers, numbers + 4 ), 0, &ok );
    TESTCHECK( MaxIndex( numbers, numbers + 4 ), 3, &ok );
    TESTCHECK( MinIndex( numberNames, numberNames + 4 ), 1, &ok );
    TESTCHECK( MaxIndex( numberNames, numberNames + 4 ), 0, &ok );
    TESTCHECK( MaxIndex( numberNames + 1, numberNames + 4 ), 1, &ok );

    if ( ok )
        cout << "Algorithms PASSED." << endl << endl;
    else
        cout << "Algorithms FAILED." << endl << endl;
    return ok;
}
Ejemplo n.º 13
0
enum TVerdict CTestErrGetTsySmallBuffer::doTestStepL()
/** 
Check that RTelServer::SendReceive( EEtelServerGetTsyName, ... ) returns an error when a descriptor is too small 
 for the tsy name.

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	// Now lets pass in a small data buffer.
	// This is possible if a programmer derives from RTelServer
	// and makes a mistake, or does it on purpose for some perverse reason.

	TInt indexOfPhone=0;
	TBuf<1> tsyName;
	TIpcArgs args(indexOfPhone,&tsyName);
	ret = server.SendReceive(EEtelServerGetTsyName,args);

	TESTCHECK(ret, KErrOverflow);

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
Ejemplo n.º 14
0
enum TVerdict CTestOpenFaxFrCall::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Open Fax From Call"));

    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RCall call;
	ret=call.OpenNewCall(server,DSTD_CALL_FULLNAME);
    TESTCHECK(ret, KErrNone);

	RFax fax;
	ret=fax.Open(call);
    TESTCHECK(ret, KErrNone);

	fax.Close();
	call.Close();
  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
	}
Ejemplo n.º 15
0
enum TVerdict CTestOpenLineFrPhone::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Open Line From Phone"));

    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RLine line;
    ret = line.Open(phone,DSTD_LINE_NAME);
	TESTCHECK(ret, KErrNone);

	line.Close();
	phone.Close();

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
    }
Ejemplo n.º 16
0
enum TVerdict CTestErrIsSupportedByModuleOk::doTestStepL()
/** 
Check that RTelServer::IsSupportedByModuleo and RTelServer::SendReceive( EEtelServerQueryTsyFunctionality, ... )
 return no errors when there is a large enough valid buffer to hold the result.

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	// Check IsSupportedByModule is ok,
	TInt indexOfPhone=0;
	TName tsyName;
	ret = server.GetTsyName(indexOfPhone, tsyName);	
		// Get a name for us to use.
	TESTCHECK(ret, KErrNone);

	TInt mixin = 0;
	TBool result = 0;
	ret = server.IsSupportedByModule(tsyName, mixin, result);

	TESTCHECK(ret, KErrNone);

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
/**
 *  This tests the retrieval of the charger Strength.  ESAChargerNotCharging
 *  does not appear to be used in the indicatorwatcher, apart from the
 *  #ifdef'ed test code that is not available to this "in situ" test.
 *
 *  @test GT83-SSW-Test02 Test retrieval of the Battery and Charger setting.
 */	
enum TVerdict CTelWatchersIntTestRetrieveChargerStatusWithPublishSubscribe::doTestStepL()
	{
	//
	// Make sure watchers are stopped and unloaded before running this test.
	// This forces SIMTSY to be loaded again.
	//
	StopWatcher();
	SetSimTsyTestNumberL(1);
	StartWatcher();

	TInt  state;
	TRequestStatus  localStatus;
	RProperty       localProperty;

	//-- attach and subscribe to KUidChargerStatus property
	TInt ret = localProperty.Attach(KUidSystemCategory,KUidChargerStatus.iUid);
	TESTCHECKL(ret, KErrNone);
	localProperty.Subscribe(localStatus);  

	//
	// Get initial battery charge state
	//
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Initial Battery Charger State is %d"), state);

	
	User::WaitForRequest(localStatus);		
	localProperty.Subscribe(localStatus);
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Battery Charger State is %d"), state);
	TESTCHECK(state, ESAChargerConnected);

	User::WaitForRequest(localStatus);		
	localProperty.Subscribe(localStatus);
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Battery Charger State is %d"), state);
	TESTCHECK(state, ESAChargerDisconnected);

	User::WaitForRequest(localStatus);		
	localProperty.Subscribe(localStatus);
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Battery Charger State is %d"), state);
	TESTCHECK(state, KErrUnknown);

	User::WaitForRequest(localStatus);
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Battery Charger State is %d"), state);
	TESTCHECK(state, ESAChargerConnected);

	CheckSimTsyTestNumberL(1);

	return TestStepResult();
	} // CTelWatchersIntTestRetrieveChargerStatusWithPublishSubscribe::doTestStepL
enum TVerdict CTestSetPrClientV2MulCallFrDiffClt::doTestStepL()
//
// Test connecting Multiple call of setpriorityclientV2 API from the different threads
//	
	{
	RThread thread1;
	RThread thread2;
	TRequestStatus reqStatus1;
	TRequestStatus reqStatus2;
	Logger().ShareAuto();
	INFO_PRINTF1(_L("Test connecting Multiple call of setpriorityclientV2 API from the different threads"));
	const TInt KStackSize=0x8000;
	const TInt KHeapSize=0x8000;
	const TInt KMaxHeapSize=0x80000;
	_LIT(KFirstThreadName,"FirstThread");
	_LIT(KSecondThreadName,"SecondThread");
	TInt res1=thread1.Create(KFirstThreadName, FirstThreadFunctiona,KStackSize,KHeapSize,KMaxHeapSize,(void*)this, EOwnerThread);
	TESTCHECK(res1, KErrNone);
	if(res1!=KErrNone)
		{
		ERR_PRINTF1(_L("CTestSetPriorityClientc:thread1.Create Failed to create a thread1"));
		SetTestStepResult(EFail);
		}
	thread1.Logon(reqStatus1);	//Request 1
	TInt resu1=(reqStatus1.Int(), KRequestPending);
	TInt res2=thread2.Create(KSecondThreadName,SecondThreadFunctiona,KStackSize,KHeapSize,KMaxHeapSize,(void*)this, EOwnerThread);
	TESTCHECK(res2, KErrNone);
	if(res2!=KErrNone)
		{
		ERR_PRINTF1(_L("CTestSetPriorityClientc:thread2.Create Failed to create a thread2"));
		SetTestStepResult(EFail);
		}
	thread2.Logon(reqStatus2);	//Request 2
	TInt resu2=(reqStatus2.Int(), KRequestPending);
	thread1.Resume();
	User::After(1);
	thread2.Resume();
	User::WaitForRequest(reqStatus1);
	User::WaitForRequest(reqStatus2);
	TEST( ((reqStatus1==KErrNone) && (reqStatus2==KErrAlreadyExists)) ||
		  ((reqStatus2==KErrNone) && (reqStatus1==KErrAlreadyExists)));
	if (thread1.ExitType() != EExitKill && thread1.ExitReason() != 0)
		{
		User::Leave(thread1.ExitReason());
		}//end of if (iThread1.ExitType() != EExitKill && iThread1.ExitReason() != 0)
	thread1.Close();
	INFO_PRINTF2(_L("First thread opened ETel session and returned %d"), res1);
	if (thread2.ExitType() != EExitKill && thread2.ExitReason() != 0)
		{
		User::Leave(thread2.ExitReason());
		}//end of if (iThread2.ExitType() != EExitKill && iThread2.ExitReason() != 0)
	thread2.Close();
	INFO_PRINTF2(_L("Second thread opened ETel session and returned %d"), res2);
	return TestStepResult();
	}
Ejemplo n.º 19
0
/** 
 * Check the synchronisation mode is the same as aMode
 * @param aMode RPhoneBookSession::TPhonebookSyncMode enumeration
 */
void CCntSyncTestStep::CheckSyncModeL(RPhoneBookSession::TPhonebookSyncMode aMode)
	{
	RPhoneBookSession::TPhonebookSyncMode mode;
	User::LeaveIfError(iSession.GetSyncMode(mode));
	TESTCHECK(mode, aMode);
	User::LeaveIfError(iSession.GetSyncMode(mode, KUidIccGlobalSdnPhonebook));
	TESTCHECK(mode, aMode);
	User::LeaveIfError(iSession.GetSyncMode(mode, KUidIccGlobalLndPhonebook));
	TESTCHECK(mode, aMode);
	User::LeaveIfError(iSession.GetSyncMode(mode, KUidUsimAppAdnPhonebook));
	TESTCHECK(mode, aMode);
	User::LeaveIfError(iSession.GetSyncMode(mode, KUidIccGlobalFdnPhonebook));
	TESTCHECK(mode, aMode);
	}
enum TVerdict CTestMemZeroLength::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Zero Length Dials"));
    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RLine line;
    ret = line.Open(phone,DSTD_LINE_NAME);
	TESTCHECK(ret, KErrNone);

	RCall call;
	TName name;
    ret = call.OpenNewCall(line,name);
	TESTCHECK(ret, KErrNone);

	RCall::TTelNumberC number(_L(""));
	TPtrC8 callParams(_L8(""));
	ret=call.Dial(number);
    TESTCHECK(ret, KErrArgument);

	ret=call.Dial(callParams,number);
    TESTCHECK(ret, KErrArgument);

	TRequestStatus status;
	call.Dial(status,number);
	User::WaitForRequest(status);
    TESTCHECK(status.Int(), KErrArgument);

	call.Dial(status,callParams,number);
	User::WaitForRequest(status);
    TESTCHECK(status.Int(), KErrArgument);

	call.Close();
	line.Close();

	INFO_PRINTF1(_L("Passed illegal Cancel Test"));
	INFO_PRINTF1(_L("Test an illegal Cancel"));

// This shouldn't panic
	phone.NotifyModemDetectedCancel();

	phone.Close();
    ServerClose(server);

	INFO_PRINTF1(_L("Passed illegal Cancel Test"));

	return TestStepResult();
	}
TVerdict CPhbkSyncDoSynchronisationTest_25::doTestStepL( )
	{
	// 1. load the dummy ICC which contains all phonebooks
	//    server will be re-connected after loading the ICC
	//    using the default .ini.
	SetSimTsyTestNumberL(0); // see [test0] in configuration file

	// 2. set mode as EManual and do initial synchronisation
	TInt i(0);
	for (i=0; i<KTotalNumberOfPhoneBook; i++) 
		{ 
		User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, iPhoneBook[i]));
		CheckSyncModeL(RPhoneBookSession::EManual, iPhoneBook[i]);
		DoSyncL(iPhoneBook[i], KErrNone);
		}

	// 3. consecutively do sync according to the test purpose
	RPhoneBookSession session;  // a NEW session handle
	User::LeaveIfError(session.Connect()); // Second connection to the Server
	TRequestStatus status1, status2, status3, status4;
	for (i=0; i<KTotalNumberOfPhoneBook; i++) 
		{ 
		iSession.DoSynchronisation(status1, iPhoneBook[i]); // Start first sync
		iSession.DoSynchronisation(status2, iPhoneBook[i]); // Start second sync
		iSession.DoSynchronisation(status3, iPhoneBook[i]); // Start third sync
		iSession.DoSynchronisation(status4, iPhoneBook[i]); // Start fourth sync
		User::WaitForRequest(status1);
		User::WaitForRequest(status2);
		User::WaitForRequest(status3);
		User::WaitForRequest(status4);
		TESTCHECK(status1.Int(), KErrNone);
		TESTCHECK(status2.Int(), KErrInUse);
		TESTCHECK(status3.Int(), KErrInUse);
		TESTCHECK(status4.Int(), KErrInUse);
		}

	// 4. do another sync and it should be successful this time
	TRequestStatus status5;
	for (i=0; i<KTotalNumberOfPhoneBook; i++) 
		{ 
		session.DoSynchronisation(status5, iPhoneBook[i]);
		User::WaitForRequest(status5);
		TESTCHECK(status5.Int(), KErrNone);
		}

	// 5. Close second connection to the server
	session.Close(); // Not the iSession used by every test step

	return TestStepResult();
	}
TVerdict CPhbkSyncValidateContactTest_14::doTestStepL( )
	{
	TInt result;
	TUid  validGlobalADNUid, validUsimAppADNUid;

	SetSimTsyTestNumberL(0); 

	// set mode as EAutoCurrentIcc for Global/GSM ADN and USim App ADN
	User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EAutoCurrentIcc, KUidIccGlobalAdnPhonebook));
	User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EAutoCurrentIcc, KUidUsimAppAdnPhonebook));
	User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalSdnPhonebook));
	User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalLndPhonebook));
	User::LeaveIfError(iSession.SetSyncMode(RPhoneBookSession::EManual, KUidIccGlobalFdnPhonebook));

	// load Global/GSM ADN and USim App ADN phonebooks
	SetSimTsyTestNumberL(50);	// both phonebooks should be synchronised after this

	CheckCacheStateValidL(KUidUsimAppAdnPhonebook);
	CheckCacheStateValidL(KUidIccGlobalAdnPhonebook);
	CheckCacheStateInvalidL(KUidIccGlobalSdnPhonebook);
	CheckCacheStateInvalidL(KUidIccGlobalLndPhonebook);
	CheckCacheStateInvalidL(KUidIccGlobalFdnPhonebook);

	// at this stage, it should be possible to access "App1" phonebooks
	validGlobalADNUid.iUid = GetValidUIDFromContactsDbL(KUidIccGlobalAdnPhonebook);
	result = iSession.ValidateContact(MContactSynchroniser::EEdit, validGlobalADNUid.iUid);
	TESTCHECKL(result, KErrNone);    

	validUsimAppADNUid.iUid = GetValidUIDFromContactsDbL(KUidUsimAppAdnPhonebook);
	result = iSession.ValidateContact(MContactSynchroniser::EEdit, validUsimAppADNUid.iUid);
	TESTCHECKL(result, KErrNone);

	SignalSimTsyToReduceTimersL();

	// Wait for USIM App switching to occur - App1 is closed and App2 becomes active 
	// by using the valid UIDs obtained to do ValidateContact
	while (result == KErrNotReady  ||  result == KErrNone) 
		{
		result = iSession.ValidateContact(MContactSynchroniser::EEdit, validUsimAppADNUid.iUid);
		User::After(1000000);
		}
	TESTCHECK(result, KErrNotFound);

	// Even though USIM App1 is no longer active, access to Global/GSM ADN phonebook 
	// should NOT be affected 
	result = iSession.ValidateContact(MContactSynchroniser::EEdit, validGlobalADNUid.iUid);
	TESTCHECK(result, KErrNone);    

	return TestStepResult();
	}
enum TVerdict CTestSetPrClientCapNsidNegCheck::doTestStepL()
//
// Test connecting Negative check of Capability and SID check for SetPriorityClient API
//
	{
	INFO_PRINTF1(_L("Test connecting Capability and SID check for SetPriorityClient API"));
	RTelServer first;
	TInt ret=first.Connect();
	INFO_PRINTF2(_L("RTelServer::Connect returned %d."),ret);
	TESTCHECK(ret, KErrNone);
	INFO_PRINTF1(_L("Capability and SID check of setpriorityclient API"));
	ret=first.SetPriorityClient();
	TESTCHECK(ret,KErrPermissionDenied);
	INFO_PRINTF2(_L("first call of RTelServer::SetPriorityClient %d."),ret);
	return TestStepResult();
	}	
Ejemplo n.º 24
0
bool 
TestShift( )
{
    bool ok = true;
    cout << "Testing Shift" << endl;

    TESTCHECK( (ShiftLeft< uint32_t, 8 >( 0xA )), 0xA00, &ok );
    TESTCHECK( (ShiftLeft< uint32_t, -4 >( 0xA0 )), 0xA, &ok );
    TESTCHECK( (ShiftRight< uint16_t, 4 >( 0xC0 )), (uint16_t)0xC, &ok );
    TESTCHECK( (ShiftRight< uint16_t, -8 >( 0xC )), (uint16_t)0xC00, &ok );

    if ( ok )
        cout << "Shift PASSED." << endl << endl;
    else
        cout << "Shift FAILED." << endl << endl;
    return ok;
}
Ejemplo n.º 25
0
bool 
DataBuffer::Test( )
{
    bool ok = true;
    cout << "Testing DataBuffer" << endl;

    DataBuffer buff;
    TESTCHECK( buff.Data() == 0, true, &ok );
    TESTCHECK( buff.Size(), 0, &ok );
    char sIn[ 10 ] = "123456789";
    Foo fIn = { 127, 2.5f };
    cout << "Add( char *, 10 )" << endl;
    buff.Add( sIn, 10 );
    TESTCHECK( *buff.Data(), '1', &ok );
    TESTCHECK( buff.Size(), 10, &ok );
    cout << "Add( Foo )" << endl;
    buff.Add( fIn );
    cout << "Read( 10 )" << endl;
    const char * sOut = buff.Read( 10 );
    TESTCHECK( (string( sIn ) == string( sOut )), true, &ok );
    cout << "Read< Foo >()" << endl;
    const Foo * pFoo = buff.Read< Foo >( );
    TESTCHECK( pFoo->i, 127, &ok );
    TESTCHECK( pFoo->f, 2.5f, &ok );
    
    if ( ok )
        cout << "DataBuffer PASSED." << endl << endl;
    else
        cout << "DataBuffer FAILED." << endl << endl;
    return ok;
}
Ejemplo n.º 26
0
enum TVerdict CTestErrNewTelObjectIllegalBuffer::doTestStepL()
/** 
Check that CTelSession::NewTelObject fails when an illegal buffer is passed to it for the name of the call.
 (Uses similar code to that in RTelServer::OpenNewCall().)

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo( 0, phoneInfo );
	TESTCHECK(ret, KErrNone);

	RPhone phone;
	ret = phone.Open( server, phoneInfo.iName );
	TESTCHECK(ret, KErrNone);


	RPhone::TLineInfo lineInfo;
	ret = phone.GetLineInfo( 0, lineInfo );
	TESTCHECK(ret, KErrNone);


	RLine line;
	ret = line.Open( phone, lineInfo.iName );

	char retName;  
		// Illegal buffer.

	RCall1 call;

	// Taken from OpenNewCall(line , retName); 
	RSessionBase* session=&line.SessionHandle();
	call.ConstructL();
	TInt subSessionHandle=line.SubSessionHandle();

	TPtrC name(_L("::"));	// necessary so that server knows to ask TSY for new name

	TIpcArgs args(&name,REINTERPRET_CAST(TDes*,&retName),subSessionHandle);
	call.SetSessionHandle(*session);
	ret = call.CreateSubSession(*session,EEtelOpenFromSubSession,args);
	call.Destruct();

	TESTCHECK(ret, KErrBadDescriptor);

	line.Close();
	phone.Close();

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
/**
 *  This tests the retrieval of the Network Status.
 *
 *  @test GT83-SSW-Test03 Test retrieval of the Network status information.
 */	
enum TVerdict CTelWatchersIntTestNetworkStatusWithPublishSubscribe::doTestStepL()
	{
	//
	// Make sure watchers are stopped and unloaded before running this test.
	// This forces SIMTSY to be loaded again.
	//
	StopWatcher();
	SetSimTsyTestNumberL(2);
	StartWatcher();

	TInt  state;
	TRequestStatus  localStatus;
	RProperty       localProperty;

	//
	// Get initial network available status...
	//
	TInt ret = RProperty::Get(KUidSystemCategory, KUidChargerStatus.iUid, state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Initial Network Available Status is %d"), state);
		
	//-- attach and subscribe to KUidNetworkStatus property
	ret = localProperty.Attach(KUidSystemCategory,KUidNetworkStatus.iUid);
	TESTCHECKL(ret, KErrNone);
	localProperty.Subscribe(localStatus);
	
	User::WaitForRequest(localStatus);		
	localProperty.Subscribe(localStatus);
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Network Available Status is %d"), state);
	TESTCHECK(state, ESANetworkAvailable);

	User::WaitForRequest(localStatus);		
	ret = localProperty.Get(state);
	TESTCHECKL(ret, KErrNone);
	INFO_PRINTF2(_L("Network Available Status is %d"), state);
	TESTCHECK(state, ESANetworkUnAvailable);

	CheckSimTsyTestNumberL(2);

	return TestStepResult();
	} // CTelWatchersIntTestNetworkStatusWithPublishSubscribe::doTestStepL
Ejemplo n.º 28
0
bool 
TestFactorial( )
{
    bool ok = true;
    cout << "Testing Factorial" << endl;

    TESTCHECK( Factorial( 12 ), 479001600, &ok );
    TESTCHECK( Factorial( 20LL ), 2432902008176640000LL, &ok );
    TESTCHECK( Factorial( 20. ), 2432902008176640000., &ok );
    TESTCHECKF( Factorial( 50. ), 3.0414093203509456e64, &ok );
    TESTCHECKFE( Factorial( 100. ), 9.3326e157, &ok, 1.e-5 );
    TESTCHECK( BinomialCoefficient( 19, 7 ), 50388., &ok );
    TESTCHECK( BinomialCoefficient( 20, 10 ), 184756., &ok );

    if ( ok )
        cout << "Factorial PASSED." << endl << endl;
    else
        cout << "Factorial FAILED." << endl << endl;
    return ok;
}
enum TVerdict CTestSetPrClientV2MulCallFrSameSes::doTestStepL()
//
// Test connecting Multiple call of setpriorityclientV2 API from the same session
//	
	{
	INFO_PRINTF1(_L("Test connecting Multiple call of setpriorityclientV2 API from the same session"));
	RTelServer first;
	TInt ret=first.Connect();
	INFO_PRINTF2(_L("RTelServer::Connect returned %d."),ret);
	TESTCHECK(ret, KErrNone);
	INFO_PRINTF1(_L("Multiple call of setpriorityclientV2 API on the same session"));
	ret=first.SetPriorityClientV2();
	TESTCHECK(ret, KErrNone);
	INFO_PRINTF2(_L("first call of RTelServer::SetPriorityClientV2 in same session  %d."),ret);
	ret=first.SetPriorityClientV2();
	TESTCHECK(ret, KErrAlreadyExists);
	INFO_PRINTF2(_L("Second call of RTelServer::SetPriorityClientV2 in same session %d."),ret);
	first.Close();
	
	return TestStepResult();
	}
Ejemplo n.º 30
0
/** 
 *  Check the synchronisation state is aStat
 *
 *  @param aState  An expected sync state enumeration value.
 */
void CCntSyncTestStep::CheckCacheStateL(RPhoneBookSession::TSyncState aState)
	{
	RPhoneBookSession::TSyncState state;
	TInt ret;
	
	ret = iSession.GetPhoneBookCacheState(state, KUidIccGlobalAdnPhonebook);
	if (ret != KErrNone  &&  ret != KErrNotReady)
		{
		User::Leave(ret);
		}
	TESTCHECK(state, aState);

	ret = iSession.GetPhoneBookCacheState(state, KUidIccGlobalSdnPhonebook);
	if (ret != KErrNone  &&  ret != KErrNotReady)
		{
		User::Leave(ret);
		}
	TESTCHECK(state, aState);

	ret = iSession.GetPhoneBookCacheState(state, KUidIccGlobalLndPhonebook);
	if (ret != KErrNone  &&  ret != KErrNotReady)
		{
		User::Leave(ret);
		}
	TESTCHECK(state, aState);

	ret = iSession.GetPhoneBookCacheState(state, KUidUsimAppAdnPhonebook);
	if (ret != KErrNone  &&  ret != KErrNotReady)
		{
		User::Leave(ret);
		}
	TESTCHECK(state, aState);

	ret = iSession.GetPhoneBookCacheState(state, KUidIccGlobalFdnPhonebook);
	if (ret != KErrNone  &&  ret != KErrNotReady)
		{
		User::Leave(ret);
		}
	TESTCHECK(state, aState);
	}