telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestairtimeduration.cpp
changeset 31 8ab6687fb94c
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
26:8767c6acf334 31:8ab6687fb94c
   101 	StartTest();
   101 	StartTest();
   102 	
   102 	
   103 	//
   103 	//
   104 	// TEST START
   104 	// TEST START
   105 	//
   105 	//
   106 		
       
   107 	// Check RMobilePhone::GetAirTimeDuration returns duration == 0.
       
   108 	TTimeIntervalSeconds timeBeforeDial;
       
   109 	TTimeIntervalSeconds timeAfterDial;
       
   110 	ASSERT_EQUALS(customApi.GetAirTimeDuration(timeBeforeDial), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error"))
       
   111 	ASSERT_EQUALS(timeBeforeDial.Int(),0,_L("RMmCustomAPI::GetAirTimeDuration did not return zero time duration as expected"))
       
   112 
   106 
   113 	// Dial a number that answers. 
   107 	// Dial a number that answers. 
   114 	TPtrC number; 
   108 	TPtrC number; 
   115 	ASSERT_TRUE(GetStringFromConfig(KIniVoiceNumSection, KIniVoiceNumber1, number) != EFalse, _L("GetStringFromConfig did not complete as expected"));
   109 	ASSERT_TRUE(GetStringFromConfig(KIniVoiceNumSection, KIniVoiceNumber1, number) != EFalse, _L("GetStringFromConfig did not complete as expected"));
   116 	DEBUG_PRINTF1(_L("Board Now Dialling: "));
   110 	DEBUG_PRINTF1(_L("Board Now Dialling: "));
   118 	CleanupStack::PushL(dialStatus);
   112 	CleanupStack::PushL(dialStatus);
   119 	mobileCall.Dial(dialStatus, number); 
   113 	mobileCall.Dial(dialStatus, number); 
   120 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dialStatus, ETimeMedium), KErrNone, _L("RCall::Dial timed-out"))
   114 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dialStatus, ETimeMedium), KErrNone, _L("RCall::Dial timed-out"))
   121 	ASSERT_EQUALS(dialStatus.Int(), KErrNone, _L("RCall::Dial returned with an error"))
   115 	ASSERT_EQUALS(dialStatus.Int(), KErrNone, _L("RCall::Dial returned with an error"))
   122 
   116 
       
   117 	// Note that the air time reported before dialing a call is the last call airtime
       
   118 	TTimeIntervalSeconds timeOne;
       
   119 	TTimeIntervalSeconds timeTwo;
       
   120 	ASSERT_EQUALS(customApi.GetAirTimeDuration(timeOne), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error"))
       
   121 
   123 	// Wait for two second and check RMobilePhone::GetAirTimeDuration returns duration > previous duration. Repeat for 20 seconds. 
   122 	// Wait for two second and check RMobilePhone::GetAirTimeDuration returns duration > previous duration. Repeat for 20 seconds. 
   124 	TInt count=1;
   123 	TInt count=1;
   125 	do
   124 	do
   126 		{
   125 		{
   127 		User::After(KOneSecond*2);
   126 		User::After(KOneSecond*2);
   128 		ASSERT_EQUALS(customApi.GetAirTimeDuration(timeAfterDial), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error"))
   127 		ASSERT_EQUALS(customApi.GetAirTimeDuration(timeTwo), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error"))
   129 		ASSERT_TRUE(timeAfterDial.Int()>timeBeforeDial.Int(),_L("RMmCustomAPI::GetAirTimeDuration did not return bigger time duration then the previous one"))
   128 		ASSERT_TRUE(timeTwo.Int()>timeOne.Int(),_L("RMmCustomAPI::GetAirTimeDuration did not return bigger time duration then the previous one"))
   130 		timeBeforeDial=timeAfterDial;
   129 		timeOne=timeTwo;
   131 		count++;
   130 		count++;
   132 		}while(count!=10);
   131 		}while(count!=10);
   133 	
   132 	
   134 	// Hang up the active call. 
   133 	// Hang up the active call. 
   135 	ASSERT_EQUALS(mobileCall.HangUp(), KErrNone,_L("RMobileCall::HangUp returned with an error"))
   134 	ASSERT_EQUALS(mobileCall.HangUp(), KErrNone,_L("RMobileCall::HangUp returned with an error"))