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")) |
106 |
112 |
107 // Dial a number that answers. |
113 // Dial a number that answers. |
108 TPtrC number; |
114 TPtrC number; |
109 ASSERT_TRUE(GetStringFromConfig(KIniVoiceNumSection, KIniVoiceNumber1, number) != EFalse, _L("GetStringFromConfig did not complete as expected")); |
115 ASSERT_TRUE(GetStringFromConfig(KIniVoiceNumSection, KIniVoiceNumber1, number) != EFalse, _L("GetStringFromConfig did not complete as expected")); |
110 DEBUG_PRINTF1(_L("Board Now Dialling: ")); |
116 DEBUG_PRINTF1(_L("Board Now Dialling: ")); |
112 CleanupStack::PushL(dialStatus); |
118 CleanupStack::PushL(dialStatus); |
113 mobileCall.Dial(dialStatus, number); |
119 mobileCall.Dial(dialStatus, number); |
114 ASSERT_EQUALS(WaitForRequestWithTimeOut(dialStatus, ETimeMedium), KErrNone, _L("RCall::Dial timed-out")) |
120 ASSERT_EQUALS(WaitForRequestWithTimeOut(dialStatus, ETimeMedium), KErrNone, _L("RCall::Dial timed-out")) |
115 ASSERT_EQUALS(dialStatus.Int(), KErrNone, _L("RCall::Dial returned with an error")) |
121 ASSERT_EQUALS(dialStatus.Int(), KErrNone, _L("RCall::Dial returned with an error")) |
116 |
122 |
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 |
|
122 // Wait for two second and check RMobilePhone::GetAirTimeDuration returns duration > previous duration. Repeat for 20 seconds. |
123 // Wait for two second and check RMobilePhone::GetAirTimeDuration returns duration > previous duration. Repeat for 20 seconds. |
123 TInt count=1; |
124 TInt count=1; |
124 do |
125 do |
125 { |
126 { |
126 User::After(KOneSecond*2); |
127 User::After(KOneSecond*2); |
127 ASSERT_EQUALS(customApi.GetAirTimeDuration(timeTwo), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error")) |
128 ASSERT_EQUALS(customApi.GetAirTimeDuration(timeAfterDial), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error")) |
128 ASSERT_TRUE(timeTwo.Int()>timeOne.Int(),_L("RMmCustomAPI::GetAirTimeDuration did not return bigger time duration then the previous one")) |
129 ASSERT_TRUE(timeAfterDial.Int()>timeBeforeDial.Int(),_L("RMmCustomAPI::GetAirTimeDuration did not return bigger time duration then the previous one")) |
129 timeOne=timeTwo; |
130 timeBeforeDial=timeAfterDial; |
130 count++; |
131 count++; |
131 }while(count!=10); |
132 }while(count!=10); |
132 |
133 |
133 // Hang up the active call. |
134 // Hang up the active call. |
134 ASSERT_EQUALS(mobileCall.HangUp(), KErrNone,_L("RMobileCall::HangUp returned with an error")) |
135 ASSERT_EQUALS(mobileCall.HangUp(), KErrNone,_L("RMobileCall::HangUp returned with an error")) |