telephonyserverplugins/common_tsy/test/component/src/cctsyalternatingcallfu.cpp
changeset 0 3553901f7fa8
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 // The TEFUnit test suite for AlternatingCall in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsyalternatingcallfu.h"
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    28 #include "tmockltsydata.h"
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 
       
    31 CTestSuite* CCTsyAlternatingCallFU::CreateSuiteL(const TDesC& aName)
       
    32 	{
       
    33 	SUB_SUITE;
       
    34 
       
    35 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestSwitchAlternatingCall0001L);
       
    36 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestSwitchAlternatingCall0002L);
       
    37 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestSwitchAlternatingCall0003L);
       
    38 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestNotifyAlternatingCallSwitch0001L);
       
    39 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestNotifyAlternatingCallSwitch0002L);
       
    40 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestNotifyAlternatingCallSwitch0003L);
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestGetAlternatingCallCaps0001L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestGetAlternatingCallMode0001L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestSetAlternatingCallMode0001L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestNotifyAlternatingCallCapsChange0001L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsyAlternatingCallFU, TestNotifyAlternatingCallModeChange0001L);
       
    46 
       
    47 	END_SUITE;
       
    48 	}
       
    49 
       
    50 
       
    51 //
       
    52 // Actual test cases
       
    53 //
       
    54 
       
    55 
       
    56 /**
       
    57 @SYMTestCaseID BA-CTSY-ALTC-CSAC-0001
       
    58 @SYMComponent  telephony_ctsy
       
    59 @SYMTestCaseDesc Test support in CTSY for RMobileCall::SwitchAlternatingCall for voice calls
       
    60 @SYMTestPriority High
       
    61 @SYMTestActions Invokes RMobileCall::SwitchAlternatingCall for voice calls
       
    62 @SYMTestExpectedResults Pass
       
    63 @SYMTestType CT
       
    64 */
       
    65 void CCTsyAlternatingCallFU::TestSwitchAlternatingCall0001L()
       
    66 	{
       
    67 
       
    68 	OpenEtelServerL(EUseExtendedError);
       
    69 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
    70 	OpenPhoneL();
       
    71 
       
    72 	RMobileCall mobileCall;
       
    73 	RLine line;
       
    74 
       
    75 	TInt err = line.Open(iPhone, KMmTsyVoice1LineName);
       
    76 	ASSERT_EQUALS(KErrNone, err)
       
    77     CleanupClosePushL(line);
       
    78 	
       
    79 	err = OpenNewCall(line, mobileCall, KMmTsyVoice1LineName);
       
    80 	ASSERT_EQUALS(KErrNone, err)
       
    81     CleanupClosePushL(mobileCall);
       
    82 
       
    83 	TRequestStatus reqStatus;
       
    84 	mobileCall.SwitchAlternatingCall(reqStatus);
       
    85 	User::WaitForRequest(reqStatus);
       
    86 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
    87 
       
    88 	AssertMockLtsyStatusL();
       
    89 	CleanupStack::PopAndDestroy(2); // mobileCall, line
       
    90 
       
    91 	err = line.Open(iPhone, KMmTsyVoice2LineName);
       
    92 	ASSERT_EQUALS(KErrNone, err)
       
    93     CleanupClosePushL(line);
       
    94 	
       
    95 	err = OpenNewCall(line, mobileCall, KMmTsyVoice2LineName);
       
    96 	ASSERT_EQUALS(KErrNone, err)
       
    97     CleanupClosePushL(mobileCall);
       
    98 
       
    99 	mobileCall.SwitchAlternatingCall(reqStatus);
       
   100 	User::WaitForRequest(reqStatus);
       
   101 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   102 
       
   103 	AssertMockLtsyStatusL();
       
   104 	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this
       
   105 		
       
   106 	}
       
   107 
       
   108 
       
   109 /**
       
   110 @SYMTestCaseID BA-CTSY-ALTC-CSAC-0002
       
   111 @SYMComponent  telephony_ctsy
       
   112 @SYMTestCaseDesc Test support in CTSY for RMobileCall::SwitchAlternatingCall for data calls
       
   113 @SYMTestPriority High
       
   114 @SYMTestActions Invokes RMobileCall::SwitchAlternatingCall for data calls
       
   115 @SYMTestExpectedResults Pass
       
   116 @SYMTestType CT
       
   117 */
       
   118 void CCTsyAlternatingCallFU::TestSwitchAlternatingCall0002L()
       
   119 	{
       
   120 
       
   121 	OpenEtelServerL(EUseExtendedError);
       
   122 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   123 	OpenPhoneL();
       
   124 
       
   125 	RMobileCall mobileCall;
       
   126 	RLine line;
       
   127 
       
   128 	TInt err = line.Open(iPhone, KMmTsyDataLineName);
       
   129 	ASSERT_EQUALS(KErrNone, err)
       
   130     CleanupClosePushL(line);
       
   131 	
       
   132 	err = OpenNewCall(line, mobileCall, KMmTsyDataLineName);
       
   133 	ASSERT_EQUALS(KErrNone, err)
       
   134     CleanupClosePushL(mobileCall);
       
   135 
       
   136 	TRequestStatus reqStatus;
       
   137 	mobileCall.SwitchAlternatingCall(reqStatus);
       
   138 	User::WaitForRequest(reqStatus);
       
   139 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   140 
       
   141 	AssertMockLtsyStatusL();
       
   142 	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this
       
   143 	
       
   144 	}
       
   145 
       
   146 
       
   147 /**
       
   148 @SYMTestCaseID BA-CTSY-ALTC-CSAC-0003
       
   149 @SYMComponent  telephony_ctsy
       
   150 @SYMTestCaseDesc Test support in CTSY for RMobileCall::SwitchAlternatingCall for fax calls
       
   151 @SYMTestPriority High
       
   152 @SYMTestActions Invokes RMobileCall::SwitchAlternatingCall for fax calls
       
   153 @SYMTestExpectedResults Pass
       
   154 @SYMTestType CT
       
   155 */
       
   156 void CCTsyAlternatingCallFU::TestSwitchAlternatingCall0003L()
       
   157 	{
       
   158 
       
   159 	OpenEtelServerL(EUseExtendedError);
       
   160 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   161 	OpenPhoneL();
       
   162 
       
   163 	RMobileCall mobileCall;
       
   164 	RLine line;
       
   165 
       
   166 	TInt err = line.Open(iPhone, KMmTsyFaxLineName);
       
   167 	ASSERT_EQUALS(KErrNone, err)
       
   168     CleanupClosePushL(line);
       
   169 	
       
   170 	err = OpenNewCall(line, mobileCall, KMmTsyFaxLineName);
       
   171 	ASSERT_EQUALS(KErrNone, err)
       
   172     CleanupClosePushL(mobileCall);
       
   173 
       
   174 	TRequestStatus reqStatus;
       
   175 	mobileCall.SwitchAlternatingCall(reqStatus);
       
   176 	User::WaitForRequest(reqStatus);
       
   177 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   178 
       
   179 	AssertMockLtsyStatusL();
       
   180 	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this
       
   181 	
       
   182 	}
       
   183 
       
   184 
       
   185 /**
       
   186 @SYMTestCaseID BA-CTSY-ALTC-CNACS-0001
       
   187 @SYMComponent  telephony_ctsy
       
   188 @SYMTestCaseDesc Test support in CTSY for RMobileCall::NotifyAlternatingCallSwitch for voice calls
       
   189 @SYMTestPriority High
       
   190 @SYMTestActions Invokes RMobileCall::NotifyAlternatingCallSwitch for voice calls
       
   191 @SYMTestExpectedResults Pass
       
   192 @SYMTestType CT
       
   193 */
       
   194 void CCTsyAlternatingCallFU::TestNotifyAlternatingCallSwitch0001L()
       
   195 	{
       
   196 
       
   197 	OpenEtelServerL(EUseExtendedError);
       
   198 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   199 	OpenPhoneL();
       
   200 
       
   201 	RMobileCall mobileCall;
       
   202 	RLine line;
       
   203 
       
   204 	TInt err = line.Open(iPhone, KMmTsyVoice1LineName);
       
   205 	ASSERT_EQUALS(KErrNone, err)
       
   206     CleanupClosePushL(line);
       
   207 	
       
   208 	err = OpenNewCall(line, mobileCall, KMmTsyVoice1LineName);
       
   209 	ASSERT_EQUALS(KErrNone, err)
       
   210     CleanupClosePushL(mobileCall);
       
   211 
       
   212 	TRequestStatus reqStatus;
       
   213 	mobileCall.NotifyAlternatingCallSwitch(reqStatus);
       
   214 	User::WaitForRequest(reqStatus);
       
   215 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   216 
       
   217 	AssertMockLtsyStatusL();
       
   218 	CleanupStack::PopAndDestroy(2); // mobileCall, line
       
   219 	
       
   220 	err = line.Open(iPhone, KMmTsyVoice2LineName);
       
   221 	ASSERT_EQUALS(KErrNone, err)
       
   222     CleanupClosePushL(line);
       
   223 	
       
   224 	err = OpenNewCall(line, mobileCall, KMmTsyVoice2LineName);
       
   225 	ASSERT_EQUALS(KErrNone, err)
       
   226     CleanupClosePushL(mobileCall);
       
   227 
       
   228 	mobileCall.NotifyAlternatingCallSwitch(reqStatus);
       
   229 	User::WaitForRequest(reqStatus);
       
   230 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   231 
       
   232 	AssertMockLtsyStatusL();
       
   233 	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this
       
   234 	
       
   235 	}
       
   236 
       
   237 
       
   238 /**
       
   239 @SYMTestCaseID BA-CTSY-ALTC-CNACS-0002
       
   240 @SYMComponent  telephony_ctsy
       
   241 @SYMTestCaseDesc Test support in CTSY for RMobileCall::NotifyAlternatingCallSwitch for data calls
       
   242 @SYMTestPriority High
       
   243 @SYMTestActions Invokes RMobileCall::NotifyAlternatingCallSwitch for data calls
       
   244 @SYMTestExpectedResults Pass
       
   245 @SYMTestType CT
       
   246 */
       
   247 void CCTsyAlternatingCallFU::TestNotifyAlternatingCallSwitch0002L()
       
   248 	{
       
   249 
       
   250 	OpenEtelServerL(EUseExtendedError);
       
   251 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   252 	OpenPhoneL();
       
   253 
       
   254 	RMobileCall mobileCall;
       
   255 	RLine line;
       
   256 
       
   257 	TInt err = line.Open(iPhone, KMmTsyDataLineName);
       
   258 	ASSERT_EQUALS(KErrNone, err)
       
   259     CleanupClosePushL(line);
       
   260 	
       
   261 	err = OpenNewCall(line, mobileCall, KMmTsyDataLineName);
       
   262 	ASSERT_EQUALS(KErrNone, err)
       
   263     CleanupClosePushL(mobileCall);
       
   264 
       
   265 	TRequestStatus reqStatus;
       
   266 	mobileCall.NotifyAlternatingCallSwitch(reqStatus);
       
   267 	User::WaitForRequest(reqStatus);
       
   268 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   269 
       
   270 	AssertMockLtsyStatusL();
       
   271 	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this
       
   272 	
       
   273 	}
       
   274 
       
   275 
       
   276 /**
       
   277 @SYMTestCaseID BA-CTSY-ALTC-CNACS-0003
       
   278 @SYMComponent  telephony_ctsy
       
   279 @SYMTestCaseDesc Test support in CTSY for RMobileCall::NotifyAlternatingCallSwitch for fax calls
       
   280 @SYMTestPriority High
       
   281 @SYMTestActions Invokes RMobileCall::NotifyAlternatingCallSwitch for fax calls
       
   282 @SYMTestExpectedResults Pass
       
   283 @SYMTestType CT
       
   284 */
       
   285 void CCTsyAlternatingCallFU::TestNotifyAlternatingCallSwitch0003L()
       
   286 	{
       
   287 
       
   288 	OpenEtelServerL(EUseExtendedError);
       
   289 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   290 	OpenPhoneL();
       
   291 
       
   292 	RMobileCall mobileCall;
       
   293 	RLine line;
       
   294 
       
   295 	TInt err = line.Open(iPhone, KMmTsyFaxLineName);
       
   296 	ASSERT_EQUALS(KErrNone, err)
       
   297     CleanupClosePushL(line);
       
   298 	
       
   299 	err = OpenNewCall(line, mobileCall, KMmTsyFaxLineName);
       
   300 	ASSERT_EQUALS(KErrNone, err)
       
   301     CleanupClosePushL(mobileCall);
       
   302 
       
   303 	TRequestStatus reqStatus;
       
   304 	mobileCall.NotifyAlternatingCallSwitch(reqStatus);
       
   305 	User::WaitForRequest(reqStatus);
       
   306 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())
       
   307 
       
   308 	AssertMockLtsyStatusL();
       
   309 	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this
       
   310 	
       
   311 	}
       
   312 
       
   313 
       
   314 /**
       
   315 @SYMTestCaseID BA-CTSY-ALTC-MGACC-0001
       
   316 @SYMComponent  telephony_ctsy
       
   317 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetAlternatingCallCaps
       
   318 @SYMTestPriority High
       
   319 @SYMTestActions Invokes RMobilePhone::GetAlternatingCallCaps
       
   320 @SYMTestExpectedResults Pass
       
   321 @SYMTestType CT
       
   322 */
       
   323 void CCTsyAlternatingCallFU::TestGetAlternatingCallCaps0001L()
       
   324 	{
       
   325 
       
   326 	OpenEtelServerL(EUseExtendedError);
       
   327 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   328 	OpenPhoneL();
       
   329 
       
   330 	TUint32 caps(0);
       
   331 	TInt ret = iPhone.GetAlternatingCallCaps(caps);
       
   332 	ASSERT_EQUALS(KErrNotSupported, ret);
       
   333 
       
   334 	AssertMockLtsyStatusL();
       
   335 	CleanupStack::PopAndDestroy(this); // this
       
   336 	
       
   337 	}
       
   338 
       
   339 
       
   340 /**
       
   341 @SYMTestCaseID BA-CTSY-ALTC-MCALCM-0001
       
   342 @SYMComponent  telephony_ctsy
       
   343 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetAlternatingCallMode
       
   344 @SYMTestPriority High
       
   345 @SYMTestActions Invokes RMobilePhone::GetAlternatingCallMode
       
   346 @SYMTestExpectedResults Pass
       
   347 @SYMTestType CT
       
   348 */
       
   349 void CCTsyAlternatingCallFU::TestGetAlternatingCallMode0001L()
       
   350 	{
       
   351 
       
   352 	OpenEtelServerL(EUseExtendedError);
       
   353 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   354 	OpenPhoneL();
       
   355 
       
   356 	RMobilePhone::TMobilePhoneAlternatingCallMode mode(RMobilePhone::EAlternatingModeUnspecified);
       
   357 	RMobilePhone::TMobileService firstService(RMobilePhone::EServiceUnspecified);
       
   358 	
       
   359 	TInt ret = iPhone.GetAlternatingCallMode(mode, firstService);
       
   360 	ASSERT_EQUALS(KErrNotSupported, ret);
       
   361 
       
   362 	AssertMockLtsyStatusL();
       
   363 	CleanupStack::PopAndDestroy(this); // this
       
   364 	
       
   365 	}
       
   366 
       
   367 
       
   368 /**
       
   369 @SYMTestCaseID BA-CTSY-ALTC-MSACM-0001
       
   370 @SYMComponent  telephony_ctsy
       
   371 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetAlternatingCallMode
       
   372 @SYMTestPriority High
       
   373 @SYMTestActions Invokes RMobilePhone::SetAlternatingCallMode
       
   374 @SYMTestExpectedResults Pass
       
   375 @SYMTestType CT
       
   376 */
       
   377 void CCTsyAlternatingCallFU::TestSetAlternatingCallMode0001L()
       
   378 	{
       
   379 
       
   380 	OpenEtelServerL(EUseExtendedError);
       
   381 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   382 	OpenPhoneL();
       
   383 
       
   384 	RMobilePhone::TMobilePhoneAlternatingCallMode mode(RMobilePhone::EAlternatingModeUnspecified);
       
   385 	RMobilePhone::TMobileService firstService(RMobilePhone::EServiceUnspecified);
       
   386 
       
   387 	TRequestStatus reqStatus;
       
   388 	iPhone.SetAlternatingCallMode(reqStatus, mode, firstService);
       
   389 	User::WaitForRequest(reqStatus);
       
   390 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
   391 
       
   392 	AssertMockLtsyStatusL();
       
   393 	CleanupStack::PopAndDestroy(this); // this
       
   394 	
       
   395 	}
       
   396 
       
   397 
       
   398 /**
       
   399 @SYMTestCaseID BA-CTSY-ALTC-MNACCC-0001
       
   400 @SYMComponent  telephony_ctsy
       
   401 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyAlternatingCallCapsChange
       
   402 @SYMTestPriority High
       
   403 @SYMTestActions Invokes RMobilePhone::NotifyAlternatingCallCapsChange
       
   404 @SYMTestExpectedResults Pass
       
   405 @SYMTestType CT
       
   406 */
       
   407 void CCTsyAlternatingCallFU::TestNotifyAlternatingCallCapsChange0001L()
       
   408 	{
       
   409 
       
   410 	OpenEtelServerL(EUseExtendedError);
       
   411 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   412 	OpenPhoneL();
       
   413 
       
   414 	TUint32 caps(0);
       
   415 
       
   416 	TRequestStatus reqStatus;
       
   417 	iPhone.NotifyAlternatingCallCapsChange(reqStatus, caps);
       
   418 	User::WaitForRequest(reqStatus);
       
   419 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
   420 
       
   421 	AssertMockLtsyStatusL();
       
   422 	CleanupStack::PopAndDestroy(this); // this
       
   423 	
       
   424 	}
       
   425 
       
   426 
       
   427 /**
       
   428 @SYMTestCaseID BA-CTSY-ALTC-MNACMC-0001
       
   429 @SYMComponent  telephony_ctsy
       
   430 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyAlternatingCallModeChange
       
   431 @SYMTestPriority High
       
   432 @SYMTestActions Invokes RMobilePhone::NotifyAlternatingCallModeChange
       
   433 @SYMTestExpectedResults Pass
       
   434 @SYMTestType CT
       
   435 */
       
   436 void CCTsyAlternatingCallFU::TestNotifyAlternatingCallModeChange0001L()
       
   437 	{
       
   438 
       
   439 	OpenEtelServerL(EUseExtendedError);
       
   440 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   441 	OpenPhoneL();
       
   442 
       
   443 	RMobilePhone::TMobilePhoneAlternatingCallMode mode(RMobilePhone::EAlternatingModeUnspecified);
       
   444 	RMobilePhone::TMobileService firstService(RMobilePhone::EServiceUnspecified);
       
   445 
       
   446 	TRequestStatus reqStatus;
       
   447 	iPhone.NotifyAlternatingCallModeChange(reqStatus, mode, firstService);
       
   448 	User::WaitForRequest(reqStatus);
       
   449 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
   450 
       
   451 	AssertMockLtsyStatusL();
       
   452 	CleanupStack::PopAndDestroy(this); // this
       
   453 	
       
   454 	}
       
   455 
       
   456 
       
   457 
       
   458 TInt CCTsyAlternatingCallFU::OpenNewCall(RLine& aLine, RMobileCall& aMobileCall, const TDesC& aLineName)
       
   459     {
       
   460     _LIT(KDoubleColon, "::");
       
   461 
       
   462     TBuf<256> name;
       
   463     name = KMmTsyPhoneName;
       
   464     name.Append(KDoubleColon);
       
   465     name.Append(aLineName);
       
   466     name.Append(KDoubleColon);
       
   467 
       
   468    	return aMobileCall.OpenNewCall(aLine, name);
       
   469     }