telephonyserverplugins/common_tsy/test/integration/src/cctsyintegrationtestairtimeduration.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 31 8ab6687fb94c
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Test step definitions for the AirTimeDuration functional unit.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @internalTechnology
       
    20 */
       
    21 
       
    22 #include "cctsyintegrationtestairtimeduration.h"
       
    23 #include "cctsyinidata.h"
       
    24 
       
    25 
       
    26 
       
    27 	
       
    28 CCTSYIntegrationTestAirTimeDurationBase::CCTSYIntegrationTestAirTimeDurationBase(CEtelSessionMgr& aEtelSessionMgr)
       
    29 	: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr),iNetworkTestHelper(*this)
       
    30 /**
       
    31  * Constructor
       
    32  */
       
    33 	{
       
    34 	}
       
    35 
       
    36 CCTSYIntegrationTestAirTimeDurationBase::~CCTSYIntegrationTestAirTimeDurationBase()
       
    37 /*
       
    38  * Destructor
       
    39  */
       
    40 	{
       
    41 	}
       
    42 	
       
    43 
       
    44 CCTSYIntegrationTestAirTimeDuration0001::CCTSYIntegrationTestAirTimeDuration0001(CEtelSessionMgr& aEtelSessionMgr)
       
    45 	: CCTSYIntegrationTestAirTimeDurationBase(aEtelSessionMgr)
       
    46 /**
       
    47  * Constructor.
       
    48  */
       
    49 	{
       
    50 	SetTestStepName(CCTSYIntegrationTestAirTimeDuration0001::GetTestStepName());
       
    51 	}
       
    52 
       
    53 CCTSYIntegrationTestAirTimeDuration0001::~CCTSYIntegrationTestAirTimeDuration0001()
       
    54 /**
       
    55  * Destructor.
       
    56  */
       
    57 	{
       
    58 	}
       
    59 
       
    60 TVerdict CCTSYIntegrationTestAirTimeDuration0001::doTestStepL()
       
    61 /**
       
    62  * @SYMTestCaseID BA-CTSY-INT-ATD-0001
       
    63  * @SYMFssID BA/CTSY/ATD-0001
       
    64  * @SYMTestCaseDesc Make a call and get the air time duration.
       
    65  * @SYMTestPriority High
       
    66  * @SYMTestActions RMmCustomAPI::GetAirTimeDuration, RCall::Dial, RCall::HangUp
       
    67  * @SYMTestExpectedResults Pass - Air time duration received.
       
    68  * @SYMTestType CIT
       
    69  * @SYMTestCaseDependencies live/automatic
       
    70  *
       
    71  * Reason for test: Verify air time duration advances as call is connected.
       
    72  *
       
    73  * @return - TVerdict code
       
    74  */
       
    75 	{
       
    76 
       
    77 	//
       
    78 	// SET UP
       
    79 	//
       
    80 
       
    81 	RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
       
    82 	
       
    83 	// Get voice line 1. 
       
    84 	RMobileLine& mobileLine= iEtelSessionMgr.GetLineL(KMainServer, KMainPhone, KVoiceLine);
       
    85 
       
    86 	// Get call 1. 
       
    87 	RMobileCall& mobileCall= iEtelSessionMgr.GetCallL(KMainServer,KMainPhone, KVoiceLine, KCall1);
       
    88 	
       
    89 	// Get CustomApi 
       
    90 	// Note: RMobilePhone::GetAirTimeDuration is not supported by the CTSY
       
    91 	RMmCustomAPI& customApi= iEtelSessionMgr.GetCustomApiL(KMainServer,KMainPhone,KMainCustomApi);
       
    92 	
       
    93 	// Registered with the network
       
    94  	CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(mobilePhone), KErrNone, 
       
    95 			_L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
       
    96 
       
    97 	//
       
    98 	// SET UP END
       
    99 	//
       
   100 	
       
   101 	StartTest();
       
   102 	
       
   103 	//
       
   104 	// TEST START
       
   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 
       
   113 	// Dial a number that answers. 
       
   114 	TPtrC number; 
       
   115 	ASSERT_TRUE(GetStringFromConfig(KIniVoiceNumSection, KIniVoiceNumber1, number) != EFalse, _L("GetStringFromConfig did not complete as expected"));
       
   116 	DEBUG_PRINTF1(_L("Board Now Dialling: "));
       
   117 	TCoreEtelRequestStatus<RCall> dialStatus(mobileCall, &RCall::DialCancel);
       
   118 	CleanupStack::PushL(dialStatus);
       
   119 	mobileCall.Dial(dialStatus, number); 
       
   120 	ASSERT_EQUALS(WaitForRequestWithTimeOut(dialStatus, ETimeMedium), KErrNone, _L("RCall::Dial timed-out"))
       
   121 	ASSERT_EQUALS(dialStatus.Int(), KErrNone, _L("RCall::Dial returned with an error"))
       
   122 
       
   123 	// Wait for two second and check RMobilePhone::GetAirTimeDuration returns duration > previous duration. Repeat for 20 seconds. 
       
   124 	TInt count=1;
       
   125 	do
       
   126 		{
       
   127 		User::After(KOneSecond*2);
       
   128 		ASSERT_EQUALS(customApi.GetAirTimeDuration(timeAfterDial), 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"))
       
   130 		timeBeforeDial=timeAfterDial;
       
   131 		count++;
       
   132 		}while(count!=10);
       
   133 	
       
   134 	// Hang up the active call. 
       
   135 	ASSERT_EQUALS(mobileCall.HangUp(), KErrNone,_L("RMobileCall::HangUp returned with an error"))
       
   136 
       
   137 	//
       
   138 	// TEST END
       
   139 	//
       
   140 
       
   141     StartCleanup();
       
   142     // PopAndDestroy
       
   143     // dialStatus
       
   144    	CleanupStack::PopAndDestroy(&dialStatus);
       
   145 	
       
   146 	
       
   147 	return TestStepResult();
       
   148 	}
       
   149 
       
   150 TPtrC CCTSYIntegrationTestAirTimeDuration0001::GetTestStepName()
       
   151 /**
       
   152  * @return The test step name.
       
   153  */
       
   154 	{
       
   155 	return _L("CCTSYIntegrationTestAirTimeDuration0001");
       
   156 	}
       
   157 
       
   158 
       
   159 
       
   160 CCTSYIntegrationTestAirTimeDuration0002::CCTSYIntegrationTestAirTimeDuration0002(CEtelSessionMgr& aEtelSessionMgr)
       
   161 	: CCTSYIntegrationTestAirTimeDurationBase(aEtelSessionMgr)
       
   162 /**
       
   163  * Constructor.
       
   164  */
       
   165 	{
       
   166 	SetTestStepName(CCTSYIntegrationTestAirTimeDuration0002::GetTestStepName());
       
   167 	}
       
   168 
       
   169 CCTSYIntegrationTestAirTimeDuration0002::~CCTSYIntegrationTestAirTimeDuration0002()
       
   170 /**
       
   171  * Destructor.
       
   172  */
       
   173 	{
       
   174 	}
       
   175 
       
   176 TVerdict CCTSYIntegrationTestAirTimeDuration0002::doTestStepL()
       
   177 /**
       
   178  * @SYMTestCaseID BA-CTSY-INT-ATD-0002
       
   179  * @SYMFssID BA/CTSY/ATD-0002
       
   180  * @SYMTestCaseDesc Answer a call and get the air time duration.
       
   181  * @SYMTestPriority High
       
   182  * @SYMTestActions RMmCustomAPI::GetAirTimeDuration, RLine::NotifyIncomingCall, RCall::AnswerIncomingCall, RCall::HangUp
       
   183  * @SYMTestExpectedResults Pass - Air time duration received.
       
   184  * @SYMTestType CIT
       
   185  * @SYMTestCaseDependencies live/rps
       
   186  *
       
   187  * Reason for test: Verify air time duration advances as call is connected.
       
   188  *
       
   189  * @return - TVerdict code
       
   190  */
       
   191 	{
       
   192 
       
   193 	//
       
   194 	// SET UP
       
   195 	//
       
   196 	
       
   197 	// Get voice line 1. 
       
   198 	RMobileLine& mobileLine= iEtelSessionMgr.GetLineL(KMainServer, KMainPhone, KVoiceLine);
       
   199 	
       
   200 	// Get CustomApi 
       
   201 	// Note: RMobilePhone::GetAirTimeDuration is not supported by the CTSY
       
   202 	RMmCustomAPI& customApi= iEtelSessionMgr.GetCustomApiL(KMainServer,KMainPhone,KMainCustomApi);
       
   203 
       
   204 	// Get call 1. 
       
   205 	RMobileCall& mobileCall= iEtelSessionMgr.GetCallL(KMainServer,KMainPhone, KVoiceLine, KCall1);
       
   206 	//
       
   207 	// SET UP END
       
   208 	//
       
   209 	
       
   210 	StartTest();
       
   211 	
       
   212 	//
       
   213 	// TEST START
       
   214 	//
       
   215 	
       
   216 	// Check RMmCustomAPI::GetAirTimeDuration returns duration == 0.
       
   217 	TTimeIntervalSeconds timeBeforeDial;
       
   218 	TTimeIntervalSeconds timeAfterDial;
       
   219 	ASSERT_EQUALS(customApi.GetAirTimeDuration(timeBeforeDial), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error"))
       
   220 	ASSERT_EQUALS(timeBeforeDial.Int(),0,_L("RMmCustomAPI::GetAirTimeDuration did not return zero time duration as expected"))
       
   221 	
       
   222 	// Post notification for incoming call from RPS
       
   223 	TName name;
       
   224 	TCoreEtelRequestStatus<RLine> notifyIncomingCallStatus (mobileLine,&RLine::NotifyIncomingCallCancel);
       
   225 	CleanupStack::PushL(notifyIncomingCallStatus);
       
   226 	mobileLine.NotifyIncomingCall(notifyIncomingCallStatus,name);
       
   227 		
       
   228 	// Request incoming call from RPS. 
       
   229 	ASSERT_EQUALS (RPSRequestIncomingCallL( EVoiceLine ), KErrNone, _L("RPSRequestIncomingCallL returned an error"));
       
   230 	
       
   231 	// Check RLine::NotifyIncomingCall completes with call name.
       
   232 	ASSERT_EQUALS(WaitForRequestWithTimeOut(notifyIncomingCallStatus,ETimeMedium),KErrNone,_L("RLine::NotifyIncomingCall timed out"))
       
   233 	ASSERT_EQUALS(notifyIncomingCallStatus.Int(), KErrNone, _L("RLine::NotifyIncomingCall returned with an error"))
       
   234 	ASSERT_TRUE(name.Length()>0, _L("RLine::NotifyIncomingCall did not return a call name"))
       
   235 	
       
   236 	// Get Incoming Call. 
       
   237 	TCallId incomingCallId;
       
   238 	RMobileCall& incomingCall =iEtelSessionMgr.GetIncomingCallL(KMainServer, KMainPhone, KVoiceLine, name, incomingCallId);
       
   239 
       
   240 	// Answer the call. 
       
   241 	ASSERT_EQUALS(incomingCall.AnswerIncomingCall(), KErrNone,
       
   242 			_L("RCall::AnswerIncomingCall returned an error"));
       
   243 
       
   244 	// Wait for two second and check RMmCustomAPI::GetAirTimeDuration returns duration > previous duration. Repeat for 10 seconds. 
       
   245 	TInt count=1;
       
   246 	do
       
   247 		{
       
   248 		User::After(KOneSecond*2);
       
   249 		ASSERT_EQUALS(customApi.GetAirTimeDuration(timeAfterDial), KErrNone, _L("RMmCustomAPI::GetAirTimeDuration returned with an error"))
       
   250 		ASSERT_TRUE(timeAfterDial.Int()>timeBeforeDial.Int(),_L("RMmCustomAPI::GetAirTimeDuration did not return bigger time duration then the previous one"))
       
   251 		timeBeforeDial=timeAfterDial;
       
   252 		count++;
       
   253 		}while(count!=10);
       
   254 	
       
   255 	// Hang up. 
       
   256 	ASSERT_TRUE(incomingCall.HangUp()==KErrNone,_L("RMobileCall::HangUp returned with an error"))
       
   257 	
       
   258 	//
       
   259 	// TEST END
       
   260 	//
       
   261 
       
   262     StartCleanup();
       
   263     
       
   264 	// Pop
       
   265 	// notifyIncomingCallStatus
       
   266 			
       
   267 	CleanupStack::PopAndDestroy(&notifyIncomingCallStatus);
       
   268 		
       
   269 	return TestStepResult();
       
   270 	}
       
   271 
       
   272 TPtrC CCTSYIntegrationTestAirTimeDuration0002::GetTestStepName()
       
   273 /**
       
   274  * @return The test step name.
       
   275  */
       
   276 	{
       
   277 	return _L("CCTSYIntegrationTestAirTimeDuration0002");
       
   278 	}
       
   279 
       
   280 
       
   281 
       
   282 CCTSYIntegrationTestAirTimeDuration0003::CCTSYIntegrationTestAirTimeDuration0003(CEtelSessionMgr& aEtelSessionMgr)
       
   283 	: CCTSYIntegrationTestAirTimeDurationBase(aEtelSessionMgr)
       
   284 /**
       
   285  * Constructor.
       
   286  */
       
   287 	{
       
   288 	SetTestStepName(CCTSYIntegrationTestAirTimeDuration0003::GetTestStepName());
       
   289 	}
       
   290 
       
   291 CCTSYIntegrationTestAirTimeDuration0003::~CCTSYIntegrationTestAirTimeDuration0003()
       
   292 /**
       
   293  * Destructor.
       
   294  */
       
   295 	{
       
   296 	}
       
   297 
       
   298 TVerdict CCTSYIntegrationTestAirTimeDuration0003::doTestStepL()
       
   299 /**
       
   300  * @SYMTestCaseID BA-CTSY-INT-ATD-0003
       
   301  * @SYMFssID BA/CTSY/ATD-0003
       
   302  * @SYMTestCaseDesc Make a video call and get the air time duration.
       
   303  * @SYMTestPriority High
       
   304  * @SYMTestActions RMobilePhone::GetAirTimeDuration, RCall::Dial, RCall::HangUp
       
   305  * @SYMTestExpectedResults Pass - Air time duration received.
       
   306  * @SYMTestType CIT
       
   307  * @SYMTestCaseDependencies live/automatic
       
   308  *
       
   309  * Reason for test: 
       
   310  *
       
   311  * @return - TVerdict code
       
   312  */
       
   313 	{
       
   314 
       
   315 	//
       
   316 	// SET UP
       
   317 	//
       
   318 
       
   319 	
       
   320 	// Get data line 1. 
       
   321 
       
   322 	// Get call 1. 
       
   323 
       
   324 
       
   325 	//
       
   326 	// SET UP END
       
   327 	//
       
   328 	
       
   329 	StartTest();
       
   330 	
       
   331 	//
       
   332 	// TEST START
       
   333 	//
       
   334 	
       
   335 	
       
   336 	// Set up multimedia mobile data call parameters for a multimedia call. 
       
   337 
       
   338 	// Dial video call to a number that answers. 
       
   339 
       
   340 	// Wait for one second and check RMobilePhone::GetAirTimeDuration returns duration > previous duration. Repeat for 10 seconds. 
       
   341 
       
   342 	// Hang up. 
       
   343 
       
   344 	// Check RMobilePhone::NotifyAirTimeDurationChange completes with duration > 0.
       
   345 
       
   346 	
       
   347 	//
       
   348 	// TEST END
       
   349 	//
       
   350 
       
   351     StartCleanup();
       
   352 	
       
   353 	// Put any required test clean up here, then remove this comment
       
   354 	
       
   355 	return TestStepResult();
       
   356 	}
       
   357 
       
   358 TPtrC CCTSYIntegrationTestAirTimeDuration0003::GetTestStepName()
       
   359 /**
       
   360  * @return The test step name.
       
   361  */
       
   362 	{
       
   363 	return _L("CCTSYIntegrationTestAirTimeDuration0003");
       
   364 	}
       
   365 
       
   366 
       
   367 
       
   368 CCTSYIntegrationTestAirTimeDuration0004::CCTSYIntegrationTestAirTimeDuration0004(CEtelSessionMgr& aEtelSessionMgr)
       
   369 	: CCTSYIntegrationTestAirTimeDurationBase(aEtelSessionMgr)
       
   370 /**
       
   371  * Constructor.
       
   372  */
       
   373 	{
       
   374 	SetTestStepName(CCTSYIntegrationTestAirTimeDuration0004::GetTestStepName());
       
   375 	}
       
   376 
       
   377 CCTSYIntegrationTestAirTimeDuration0004::~CCTSYIntegrationTestAirTimeDuration0004()
       
   378 /**
       
   379  * Destructor.
       
   380  */
       
   381 	{
       
   382 	}
       
   383 
       
   384 TVerdict CCTSYIntegrationTestAirTimeDuration0004::doTestStepL()
       
   385 /**
       
   386  * @SYMTestCaseID BA-CTSY-INT-ATD-0004
       
   387  * @SYMFssID BA/CTSY/ATD-0004
       
   388  * @SYMTestCaseDesc Receive a video call and get the air time duration.
       
   389  * @SYMTestPriority High
       
   390  * @SYMTestActions RMobilePhone::GetAirTimeDuration, RLine::NotifyIncomingCall, RCall::AnswerIncomingCall, RCall::HangUp
       
   391  * @SYMTestExpectedResults Pass - Air time duration received.
       
   392  * @SYMTestType CIT
       
   393  * @SYMTestCaseDependencies live/automatic
       
   394  *
       
   395  * Reason for test: 
       
   396  *
       
   397  * @return - TVerdict code
       
   398  */
       
   399 	{
       
   400 
       
   401 	//
       
   402 	// SET UP
       
   403 	//
       
   404 
       
   405 	
       
   406 	// Get data line 1. 
       
   407 
       
   408 	// Get call 1. 
       
   409 
       
   410 
       
   411 	//
       
   412 	// SET UP END
       
   413 	//
       
   414 	
       
   415 	StartTest();
       
   416 	
       
   417 	//
       
   418 	// TEST START
       
   419 	//
       
   420 	
       
   421 	
       
   422 	// Get air time duration and verify result is as expected. 
       
   423 
       
   424 	// Receive video call from RPS. 
       
   425 
       
   426 	// Answer call. 
       
   427 
       
   428 	// Wait for one second and check RMobilePhone::GetAirTimeDuration returns duration > previous duration. Repeat for 10 seconds. 
       
   429 
       
   430 	// Hang up. 
       
   431 
       
   432 	// Check RMobilePhone::NotifyAirTimeDurationChange completes with duration > 0.
       
   433 
       
   434 	
       
   435 	//
       
   436 	// TEST END
       
   437 	//
       
   438 
       
   439     StartCleanup();
       
   440 	
       
   441 	// Put any required test clean up here, then remove this comment
       
   442 	
       
   443 	return TestStepResult();
       
   444 	}
       
   445 
       
   446 TPtrC CCTSYIntegrationTestAirTimeDuration0004::GetTestStepName()
       
   447 /**
       
   448  * @return The test step name.
       
   449  */
       
   450 	{
       
   451 	return _L("CCTSYIntegrationTestAirTimeDuration0004");
       
   452 	}
       
   453 
       
   454 
       
   455