telephonyserverplugins/common_tsy/test/component/src/cctsycallemergencyfu.cpp
branchRCL_3
changeset 14 7ef16719d8cb
parent 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
9:962e6306d9d2 14:7ef16719d8cb
   280 
   280 
   281 	// turn back a heap allocation possibility
   281 	// turn back a heap allocation possibility
   282 	User::__DbgSetAllocFail(EFalse, RAllocator::ENone, 1);
   282 	User::__DbgSetAllocFail(EFalse, RAllocator::ENone, 1);
   283 	User::__DbgSetAllocFail(ETrue, RAllocator::ENone, 1);
   283 	User::__DbgSetAllocFail(ETrue, RAllocator::ENone, 1);
   284 
   284 
   285 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: Dependent on Symbian System State Manager.  DEF141353 </font>"), 210106);
   285    
   286 	    // Symbian SSM allocates memory in call to Connect() in ActivateRfForEmergencyCall
       
   287 	   
       
   288 	// check results
   286 	// check results
   289 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
   287 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
   290 	AssertMockLtsyStatusL();
   288 	AssertMockLtsyStatusL();
   291 
   289 
   292 	//-------------------------------------------------------------------------
   290 	//-------------------------------------------------------------------------
   675 	RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusIdle;
   673 	RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusIdle;
   676 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> completeCallStatusData(KCallId, KMobileService, mobileCallStatus);
   674 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> completeCallStatusData(KCallId, KMobileService, mobileCallStatus);
   677 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> completeCallStatusData2(KCallId2, KMobileService, mobileCallStatus);
   675 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> completeCallStatusData2(KCallId2, KMobileService, mobileCallStatus);
   678 
   676 
   679 	//-------------------------------------------------------------------------
   677 	//-------------------------------------------------------------------------
   680 	// Test requesting RMobileCall::DialEmergencyCall 
       
   681 	// when pending RCall::Dial
       
   682  	//-------------------------------------------------------------------------
       
   683 
       
   684 	// create pending dial request
       
   685 	RMobileCall::TMobileCallParamsV1 expDialCallParams;
       
   686 	expDialCallParams.iInterval = 0;
       
   687 	expDialCallParams.iCug.iCugIndex = 0xFFFF;
       
   688 	expDialCallParams.iSpeakerControl = 
       
   689         RCall::EMonitorSpeakerControlOnUntilCarrier;
       
   690 	expDialCallParams.iSpeakerVolume = RCall::EMonitorSpeakerVolumeLow;
       
   691 	expDialCallParams.iWaitForDialTone = RCall::EDialToneWait;
       
   692 	expDialCallParams.iIdRestrict = RMobileCall::EIdRestrictDefault;
       
   693 	expDialCallParams.iCug.iExplicitInvoke = EFalse;
       
   694 	expDialCallParams.iCug.iSuppressPrefCug = EFalse;
       
   695 	expDialCallParams.iCug.iSuppressOA = EFalse;
       
   696 	expDialCallParams.iAutoRedial = EFalse;
       
   697 	
       
   698     
       
   699 	RMobileCall::TMobileCallInfoV8 expDialCallInfo;
       
   700 	_LIT(KPhoneNumber, "101632960000");   	
       
   701 	expDialCallInfo.iDialledParty.iTelNumber.Copy(KPhoneNumber);
       
   702 	expDialCallInfo.iService = KMobileService;
       
   703 	expDialCallInfo.iValid = RMobileCall::KCallDialledParty|RMobileCall::KCallAlternating;
       
   704 	expDialCallInfo.iDialledParty.iNumberPlan = 
       
   705             RMobilePhone::EUnknownNumberingPlan;
       
   706 	expDialCallInfo.iDialledParty.iTypeOfNumber = 
       
   707 	        RMobilePhone::EUnknownNumber;
       
   708 	expDialCallInfo.iAlternatingCall = 
       
   709 	        RMobilePhone::EAlternatingModeUnspecified;
       
   710 
       
   711 	
       
   712 	TMockLtsyCallData2<RMobileCall::TMobileCallParamsV1, RMobileCall::TMobileCallInfoV1> 
       
   713 		dialExpectData(0, KMobileService, expDialCallParams, expDialCallInfo);
       
   714 
       
   715     data.Close();
       
   716     dialExpectData.SerialiseL(data);
       
   717 	iMockLTSY.ExpectL(EEtelCallDial, data);
       
   718 
       
   719     data.Close();
       
   720     completeDialCallInfoData.SerialiseL(data);
       
   721     iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data, 10);
       
   722 
       
   723     data.Close();
       
   724     mobileCallStatus = RMobileCall::EStatusDialling;
       
   725     completeCallStatusData.SerialiseL(data);
       
   726     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, data, 10);
       
   727 
       
   728 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 210106);
       
   729 	// Test fails, TEF aborts the test and all the following
       
   730 	// Actually DialEmergencyCall completes with KErrServerBusy
       
   731 	
       
   732 	// following assert is added to prevent test abortions
       
   733 	ASSERT_TRUE( EFalse );
       
   734 
       
   735 	TRequestStatus dialStatus;
       
   736 	mobileCall.Dial(dialStatus, KPhoneNumber);
       
   737 
       
   738 	// prepare test
       
   739 
       
   740 	// prepare canceling dial request
       
   741     data.Close();
       
   742 	TInt hangUpCause = KErrGsmReleaseByUser;
       
   743 	TBool autoStChangeDisable = ETrue;
       
   744     TMockLtsyCallData2<TInt, TBool> expHangupData(KCallId, KMobileService, 
       
   745                                              hangUpCause, 
       
   746                                              autoStChangeDisable);
       
   747     expHangupData.SerialiseL(data);
       
   748     iMockLTSY.ExpectL(EEtelCallHangUp, data);
       
   749 
       
   750     data.Close();
       
   751     mobileCallStatus = RMobileCall::EStatusIdle;
       
   752     completeCallStatusData.SerialiseL(data);
       
   753     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, hangUpCause, data, 10);
       
   754 
       
   755 	// prepare dialling emergency call
       
   756     data.Close();
       
   757 	numberLtsyData.SerialiseL(data);
       
   758 	iMockLTSY.ExpectL(EMobileCallDialEmergencyCall, data, KErrNone);
       
   759 
       
   760     data.Close();
       
   761     completeCallInfoData.SerialiseL(data);
       
   762     iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data);
       
   763 
       
   764     data.Close();
       
   765     mobileCallStatus = RMobileCall::EStatusDialling;
       
   766     completeCallStatusData.SerialiseL(data);
       
   767     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, data);
       
   768 
       
   769     data.Close();
       
   770     mobileCallStatus = RMobileCall::EStatusConnecting;
       
   771     completeCallStatusData.SerialiseL(data);
       
   772     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, data);
       
   773 
       
   774     data.Close();
       
   775     mobileCallStatus = RMobileCall::EStatusConnected;
       
   776     completeCallStatusData.SerialiseL(data);
       
   777     iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, data);
       
   778 
       
   779 	// actual test
       
   780 	mobileCall.DialEmergencyCall(reqStatus, number);
       
   781 
       
   782 	User::WaitForRequest(dialStatus);
       
   783 	ASSERT_EQUALS(KErrCancel, dialStatus.Int());
       
   784 
       
   785 	User::WaitForRequest(reqStatus);
       
   786 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   787 
       
   788 	PrepareCallCloseL(KCallId, KMobileService);
       
   789 	CleanupStack::PopAndDestroy(&mobileCall);
       
   790 	AssertMockLtsyStatusL();
       
   791 
       
   792 	//-------------------------------------------------------------------------
       
   793 	// Test A: Test multiple clients requesting RMobileCall::DialEmergencyCall
   678 	// Test A: Test multiple clients requesting RMobileCall::DialEmergencyCall
   794  	//-------------------------------------------------------------------------
   679  	//-------------------------------------------------------------------------
   795 
       
   796 	err = mobileCall.OpenNewCall(line, callName);
       
   797 	ASSERT_EQUALS(KErrNone, err);
       
   798 	CleanupClosePushL(mobileCall);
       
   799 
   680 
   800 	// Open second client
   681 	// Open second client
   801 	RTelServer telServer2;
   682 	RTelServer telServer2;
   802 	err = telServer2.Connect();
   683 	err = telServer2.Connect();
   803 	ASSERT_EQUALS(KErrNone, err);
   684 	ASSERT_EQUALS(KErrNone, err);
   869 
   750 
   870 	User::WaitForRequest(reqStatus);
   751 	User::WaitForRequest(reqStatus);
   871 	User::WaitForRequest(reqStatus2);
   752 	User::WaitForRequest(reqStatus2);
   872 	AssertMockLtsyStatusL();
   753 	AssertMockLtsyStatusL();
   873 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
   754 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
   874 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 210104);
   755 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
   875 	// Second completion with EMobileCallGetMobileCallInfo ipc
       
   876 	// changes callid of 1st call from 1 to 2
       
   877 	// can not invoke completions for 2nd call 
       
   878 	ASSERT_EQUALS(KErrNone, reqStatus2.Int()); // KErrTimedOut
       
   879 
   756 
   880 	// Done !
   757 	// Done !
   881 	CleanupStack::PopAndDestroy(8, this); // mobileCall2, line2, phone2, telServer2, mobileCall, line, data, this
   758 	CleanupStack::PopAndDestroy(8, this); // mobileCall2, line2, phone2, telServer2, mobileCall, line, data, this
   882 
   759 
   883 	}
   760 	}
   944 	FillInEmergencyCallInfo(callInfo, KCallId, callName, KMobileService);
   821 	FillInEmergencyCallInfo(callInfo, KCallId, callName, KMobileService);
   945 	TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> completeCallInfoData(KCallId, KMobileService, callInfo);
   822 	TMockLtsyCallData1<RMobileCall::TMobileCallInfoV1> completeCallInfoData(KCallId, KMobileService, callInfo);
   946 	data.Close();
   823 	data.Close();
   947 	completeCallInfoData.SerialiseL(data);
   824 	completeCallInfoData.SerialiseL(data);
   948 	iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data);
   825 	iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data);
   949 
       
   950 	mobileCall.DialEmergencyCall(reqStatus, number);
       
   951 	User::WaitForRequest(reqStatus);
       
   952 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
   953 
       
   954 	AssertMockLtsyStatusL();
       
   955 
       
   956 	//-------------------------------------------------------------------------
       
   957 	// Test: Test timeout of RMobileCall::DialEmergencyCall
       
   958 	// when call status is changed to RMobileCall::EStatusDialling
       
   959  	//-------------------------------------------------------------------------
       
   960 
       
   961 	data.Close();
       
   962 	numberLtsyData.SerialiseL(data);
       
   963 	iMockLTSY.ExpectL(EMobileCallDialEmergencyCall, data, KErrNone);
       
   964 
       
   965 	data.Close();
       
   966 	completeCallInfoData.SerialiseL(data);
       
   967 	iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data);
       
   968 
       
   969 	RMobileCall::TMobileCallStatus mobileCallStatus = RMobileCall::EStatusDialling;
       
   970 	TMockLtsyCallData1<RMobileCall::TMobileCallStatus> completeCallStatusData(KCallId, KMobileService, mobileCallStatus);
       
   971 	data.Close();
       
   972 	completeCallStatusData.SerialiseL(data);
       
   973 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, data);
       
   974 
       
   975 	mobileCall.DialEmergencyCall(reqStatus, number);
       
   976 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 210107);
       
   977 	// TEF aborts the test
       
   978 	User::WaitForRequest(reqStatus);
       
   979 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
   980 
       
   981 	AssertMockLtsyStatusL();
       
   982 
       
   983 	//-------------------------------------------------------------------------
       
   984 	// Test: Test timeout of RMobileCall::DialEmergencyCall
       
   985 	// when call status is changed to RMobileCall::EStatusConnecting
       
   986  	//-------------------------------------------------------------------------
       
   987 
       
   988 	data.Close();
       
   989 	numberLtsyData.SerialiseL(data);
       
   990 	iMockLTSY.ExpectL(EMobileCallDialEmergencyCall, data, KErrNone);
       
   991 
       
   992 	data.Close();
       
   993 	completeCallInfoData.SerialiseL(data);
       
   994 	iMockLTSY.CompleteL(EMobileCallGetMobileCallInfo, KErrNone, data);
       
   995 
       
   996 	data.Close();
       
   997 	mobileCallStatus = RMobileCall::EStatusDialling;
       
   998 	completeCallStatusData.SerialiseL(data);
       
   999 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, data);
       
  1000 
       
  1001 	data.Close();
       
  1002 	mobileCallStatus = RMobileCall::EStatusConnecting;
       
  1003 	completeCallStatusData.SerialiseL(data);
       
  1004 	iMockLTSY.CompleteL(EMobileCallNotifyMobileCallStatusChange, KErrNone, data);
       
  1005 
   826 
  1006 	mobileCall.DialEmergencyCall(reqStatus, number);
   827 	mobileCall.DialEmergencyCall(reqStatus, number);
  1007 	User::WaitForRequest(reqStatus);
   828 	User::WaitForRequest(reqStatus);
  1008 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
   829 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
  1009 
   830