telephonyserverplugins/common_tsy/test/component/src/cctsycallwaitingfu.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 CallWaiting in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 
       
    22 #include "cctsycallwaitingfu.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 #include "cctsyactiveretriever.h"
       
    31 #include <mmretrieve.h>
       
    32 
       
    33 CTestSuite* CCTsyCallWaitingFU::CreateSuiteL(const TDesC& aName)
       
    34 	{
       
    35 	SUB_SUITE;
       
    36 
       
    37 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestStart0001L);
       
    38 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestStart0002L);
       
    39 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestStart0004L);
       
    40 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestStart0005L);
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestSetCallWaitingStatus0001L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestSetCallWaitingStatus0002L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestSetCallWaitingStatus0003L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestSetCallWaitingStatus0004L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestSetCallWaitingStatus0005L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestNotifyCallWaitingStatusChange0001L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestNotifyCallWaitingStatusChange0002L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestNotifyCallWaitingStatusChange0003L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyCallWaitingFU, TestNotifyCallWaitingStatusChange0004L);
       
    50 
       
    51 	END_SUITE;
       
    52 	}
       
    53 
       
    54 
       
    55 void CCTsyCallWaitingFU::GetNextUnsupportedServiceAction(RMobilePhone::TMobilePhoneServiceAction &aAction)
       
    56 	{
       
    57 	switch ( aAction )
       
    58 		{
       
    59 		case RMobilePhone::EServiceActionUnspecified:
       
    60 			aAction = RMobilePhone::EServiceActionRegister;
       
    61 			break;
       
    62 		case RMobilePhone::EServiceActionRegister:
       
    63 			aAction = RMobilePhone::EServiceActionInvoke;
       
    64 			break;
       
    65 		case RMobilePhone::EServiceActionInvoke:
       
    66 			aAction = RMobilePhone::EServiceActionErase;
       
    67 			break;
       
    68 		default:
       
    69 			aAction = RMobilePhone::EServiceActionUnspecified;
       
    70 			break;
       
    71 		}
       
    72 	}
       
    73 
       
    74 
       
    75 void CCTsyCallWaitingFU::FillInCWInfoEntry(
       
    76 		RMobilePhone::TMobilePhoneCWInfoEntryV1 &aCWInfoEntry,
       
    77 		RMobilePhone::TMobileService aServiceGroup,
       
    78 		RMobilePhone::TMobilePhoneServiceAction aAction)
       
    79 	{
       
    80 	aCWInfoEntry.iServiceGroup = aServiceGroup;
       
    81 	if ( aAction == RMobilePhone::EServiceActionActivate )
       
    82 		{
       
    83 		aCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusActive;
       
    84 		}
       
    85 	else
       
    86 		{
       
    87 		aCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusNotActive;
       
    88 		}
       
    89 	}
       
    90 
       
    91 
       
    92 //
       
    93 // Actual test cases
       
    94 //
       
    95 
       
    96 
       
    97 void CCTsyCallWaitingFU::AuxTestStart0001L(RMobilePhone::TMobileInfoLocation aLocation)
       
    98 	{
       
    99 	
       
   100 	RBuf8 data;
       
   101 	CleanupClosePushL(data);
       
   102 
       
   103 	CFilteringActiveScheduler scheduler;
       
   104 	CActiveScheduler::Install(&scheduler);
       
   105 
       
   106 	CRetrieveMobilePhoneCWList* asyncRetrieveMobilePhoneCWList =
       
   107 	                                       CRetrieveMobilePhoneCWList::NewL(iPhone);    
       
   108 	CleanupStack::PushL(asyncRetrieveMobilePhoneCWList);
       
   109 
       
   110 	CActiveRetriever::ResetRequestsNumber();
       
   111 	CActiveRetriever* activeRetriever = 
       
   112 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCWList);
       
   113 	CleanupStack::PushL(activeRetriever);
       
   114 	scheduler.AddRetrieverL(*activeRetriever);
       
   115 
       
   116 	//-------------------------------------------------------------------------
       
   117 	// TEST A: failure to dispatch request to LTSY
       
   118  	//-------------------------------------------------------------------------
       
   119 
       
   120     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1, KErrNotSupported);
       
   121 
       
   122 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, aLocation);
       
   123 	activeRetriever->Activate();
       
   124 	scheduler.StartScheduler();
       
   125 
       
   126 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   127 	ASSERT_EQUALS(KErrNotSupported, activeRetriever->iStatus.Int());
       
   128 	AssertMockLtsyStatusL();
       
   129 
       
   130 	//-------------------------------------------------------------------------
       
   131 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   132  	//-------------------------------------------------------------------------
       
   133 
       
   134 	CMobilePhoneCWList* completeCWList( NULL );
       
   135 	TMockLtsyData1<CMobilePhoneCWList*> completeData(completeCWList);
       
   136 	completeData.SerialiseL(data);
       
   137 	
       
   138 	iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   139     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrGeneral, data);
       
   140 
       
   141 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, aLocation);
       
   142 	activeRetriever->Activate();
       
   143 	scheduler.StartScheduler();
       
   144 
       
   145 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   146 	ASSERT_EQUALS(KErrGeneral, activeRetriever->iStatus.Int());
       
   147 	AssertMockLtsyStatusL();
       
   148 
       
   149 	//-------------------------------------------------------------------------
       
   150 	// TEST: increase coverage (completion with null pointer)
       
   151  	//-------------------------------------------------------------------------
       
   152 
       
   153     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   154     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrNone, data);
       
   155 
       
   156 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, aLocation);
       
   157 	activeRetriever->Activate();
       
   158 	scheduler.StartScheduler();
       
   159 
       
   160 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   161 	ASSERT_EQUALS(KErrNotFound, activeRetriever->iStatus.Int());
       
   162 	AssertMockLtsyStatusL();
       
   163 
       
   164 	//-------------------------------------------------------------------------
       
   165 	// TEST: Successful completion request of
       
   166 	// CRetrieveMobilePhoneCWList::Start when LTSY returns empty array
       
   167  	//-------------------------------------------------------------------------
       
   168 
       
   169     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   170 
       
   171 	completeCWList = CMobilePhoneCWList::NewL();
       
   172 	CleanupStack::PushL(completeCWList);
       
   173 	data.Close();
       
   174 	completeData.SerialiseL(data);
       
   175     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrNone, data);
       
   176 
       
   177 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, aLocation);
       
   178 	activeRetriever->Activate();
       
   179 	scheduler.StartScheduler();
       
   180 
       
   181 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());	
       
   182 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
   183 	CMobilePhoneCWList* list = asyncRetrieveMobilePhoneCWList->RetrieveListL();
       
   184 	CleanupStack::PushL( list );
       
   185 	ASSERT_TRUE( TComparator<CMobilePhoneCWList>::IsEqual(*completeCWList, *list) );
       
   186 	CleanupStack::PopAndDestroy( list );
       
   187 	AssertMockLtsyStatusL();
       
   188 
       
   189  	//-------------------------------------------------------------------------
       
   190 	// TEST C: Successful completion request of
       
   191 	// CRetrieveMobilePhoneCWList::Start.
       
   192  	//-------------------------------------------------------------------------
       
   193 
       
   194     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   195 
       
   196     RMobilePhone::TMobilePhoneCWInfoEntryV1	entryCWInfoEntry;
       
   197 	entryCWInfoEntry.iServiceGroup = RMobilePhone::EVoiceService;
       
   198 	entryCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusNotProvisioned;
       
   199 	completeCWList->AddEntryL(entryCWInfoEntry);
       
   200 	
       
   201 	data.Close();
       
   202 	completeData.SerialiseL(data);
       
   203     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrNone, data);
       
   204 
       
   205 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, aLocation);
       
   206 	activeRetriever->Activate();
       
   207 	scheduler.StartScheduler();
       
   208 
       
   209 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   210 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
   211 	list = asyncRetrieveMobilePhoneCWList->RetrieveListL();
       
   212 	CleanupStack::PushL( list );
       
   213 	ASSERT_TRUE( TComparator<CMobilePhoneCWList>::IsEqual(*completeCWList, *list) );
       
   214 	CleanupStack::PopAndDestroy( list );
       
   215 	AssertMockLtsyStatusL();
       
   216 
       
   217 	CleanupStack::PopAndDestroy(3); // completeCWList, activeRetriever, asyncRetrieveMobilePhoneCWList
       
   218 	CActiveScheduler::Install(NULL);
       
   219 	CleanupStack::PopAndDestroy(&data);
       
   220 
       
   221 	}
       
   222 
       
   223 
       
   224 /**
       
   225 @SYMTestCaseID BA-CTSY-CWAT-RMPCWLN-0001
       
   226 @SYMComponent  telephony_ctsy
       
   227 @SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneCWList::Start
       
   228 @SYMTestPriority High
       
   229 @SYMTestActions Invokes CRetrieveMobilePhoneCWList::Start
       
   230 @SYMTestExpectedResults Pass
       
   231 @SYMTestType CT
       
   232 */
       
   233 void CCTsyCallWaitingFU::TestStart0001L()
       
   234 	{
       
   235 
       
   236 	OpenEtelServerL(EUseExtendedError);
       
   237 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   238 	OpenPhoneL();
       
   239 
       
   240 	AuxTestStart0001L(RMobilePhone::EInfoLocationCachePreferred);
       
   241 
       
   242 	AuxTestStart0001L(RMobilePhone::EInfoLocationNetwork);
       
   243 
       
   244  	//-------------------------------------------------------------------------
       
   245 	// TEST: failure to dispatch request to CTSY
       
   246 	// when information is taken from cache
       
   247  	//-------------------------------------------------------------------------
       
   248 
       
   249 	CFilteringActiveScheduler scheduler;
       
   250 	CActiveScheduler::Install(&scheduler);
       
   251 
       
   252 	CRetrieveMobilePhoneCWList* asyncRetrieveMobilePhoneCWList =
       
   253 	                                       CRetrieveMobilePhoneCWList::NewL(iPhone);    
       
   254 	CleanupStack::PushL(asyncRetrieveMobilePhoneCWList);
       
   255 
       
   256 	CActiveRetriever::ResetRequestsNumber();
       
   257 	CActiveRetriever* activeRetriever = 
       
   258 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCWList);
       
   259 	CleanupStack::PushL(activeRetriever);
       
   260 	scheduler.AddRetrieverL(*activeRetriever);
       
   261 
       
   262 	// test
       
   263 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, RMobilePhone::EInfoLocationCache);
       
   264 	activeRetriever->Activate();
       
   265 	scheduler.StartScheduler();
       
   266 
       
   267 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   268 	// Request completes with KErrNotFound because
       
   269 	// CTSY does not have a cache for CWList
       
   270 	ASSERT_EQUALS(KErrNotFound, activeRetriever->iStatus.Int());
       
   271 	AssertMockLtsyStatusL();
       
   272 
       
   273  	//-------------------------------------------------------------------------
       
   274 	// TEST E: Unsolicited completion of CRetrieveMobilePhoneCWList::Start
       
   275 	// from LTSY.
       
   276  	//-------------------------------------------------------------------------
       
   277 
       
   278 	TRequestStatus mockLtsyStatus;
       
   279 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
   280 
       
   281 	RBuf8 data;
       
   282 	CleanupClosePushL(data);
       
   283 
       
   284 	CMobilePhoneCWList* completeCWList( NULL );
       
   285 	TMockLtsyData1<CMobilePhoneCWList*> completeData(completeCWList);
       
   286 	completeData.SerialiseL(data);
       
   287 
       
   288     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrNone, data);
       
   289 	
       
   290     User::WaitForRequest(mockLtsyStatus);
       
   291 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   292 	AssertMockLtsyStatusL();
       
   293 
       
   294 	CleanupStack::PopAndDestroy(3); // data, activeRetriever, asyncRetrieveMobilePhoneCWList
       
   295 	CActiveScheduler::Install(NULL);
       
   296 	CleanupStack::PopAndDestroy(this);
       
   297 	
       
   298 	}
       
   299 
       
   300 
       
   301 /**
       
   302 @SYMTestCaseID BA-CTSY-CWAT-RMPCWLN-0002
       
   303 @SYMComponent  telephony_ctsy
       
   304 @SYMTestCaseDesc Test support in CTSY for cancelling of CRetrieveMobilePhoneCWList::Start
       
   305 @SYMTestPriority High
       
   306 @SYMTestActions Invokes cancelling of CRetrieveMobilePhoneCWList::Start
       
   307 @SYMTestExpectedResults Pass
       
   308 @SYMTestType CT
       
   309 */
       
   310 void CCTsyCallWaitingFU::TestStart0002L()
       
   311 	{
       
   312 
       
   313 	OpenEtelServerL(EUseExtendedError);
       
   314 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   315 	OpenPhoneL();
       
   316 
       
   317 	TRequestStatus mockLtsyStatus;
       
   318 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   319 
       
   320 	RBuf8 data;
       
   321 	CleanupClosePushL(data);
       
   322 
       
   323 	CFilteringActiveScheduler scheduler;
       
   324 	CActiveScheduler::Install(&scheduler);
       
   325 
       
   326 	CRetrieveMobilePhoneCWList* asyncRetrieveMobilePhoneCWList =
       
   327 	                                       CRetrieveMobilePhoneCWList::NewL(iPhone);    
       
   328 	CleanupStack::PushL(asyncRetrieveMobilePhoneCWList);
       
   329 
       
   330 	CActiveRetriever::ResetRequestsNumber();
       
   331 	CActiveRetriever* activeRetriever = 
       
   332 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCWList);
       
   333 	CleanupStack::PushL(activeRetriever);
       
   334 	scheduler.AddRetrieverL(*activeRetriever);
       
   335 
       
   336  	//-------------------------------------------------------------------------
       
   337 	// Test cancelling of CRetrieveMobilePhoneCWList::Start
       
   338  	//-------------------------------------------------------------------------
       
   339  	
       
   340     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   341 
       
   342 	CMobilePhoneCWList* completeCWList = CMobilePhoneCWList::NewL();
       
   343 	CleanupStack::PushL(completeCWList);
       
   344 	RMobilePhone::TMobilePhoneCWInfoEntryV1	entryCWInfoEntry;
       
   345 	entryCWInfoEntry.iServiceGroup = RMobilePhone::EVoiceService;
       
   346 	entryCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusNotProvisioned;
       
   347 	completeCWList->AddEntryL(entryCWInfoEntry);
       
   348 
       
   349 	TMockLtsyData1<CMobilePhoneCWList*> completeData(completeCWList);
       
   350 	completeData.SerialiseL(data);
       
   351     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrNone, data, 10);
       
   352 
       
   353 	RMobilePhone::TMobileInfoLocation location(RMobilePhone::EInfoLocationCachePreferred);
       
   354 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, location);
       
   355 	activeRetriever->Activate(CActiveRetriever::ECaseGeneralCancelCase);
       
   356 	scheduler.StartScheduler();
       
   357 
       
   358 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   359 	ASSERT_EQUALS(KErrCancel, activeRetriever->iStatus.Int());
       
   360 
       
   361 	// Wait for completion of iMockLTSY.NotifyTerminated
       
   362 	User::WaitForRequest(mockLtsyStatus);
       
   363 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   364 	AssertMockLtsyStatusL();
       
   365 
       
   366  	//-------------------------------------------------------------------------
       
   367 	// Test cancelling of CRetrieveMobilePhoneCWList::Start
       
   368 	// this time cancel on 2nd phase
       
   369  	//-------------------------------------------------------------------------
       
   370 
       
   371     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   372     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrNone, data);
       
   373 
       
   374 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, location);
       
   375 	activeRetriever->Activate(CActiveRetriever::ECasePhase2Cancel);
       
   376 	scheduler.StartScheduler();
       
   377 
       
   378 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   379 	ASSERT_EQUALS(KErrCancel, activeRetriever->iStatus.Int());
       
   380 
       
   381 	AssertMockLtsyStatusL();
       
   382 
       
   383 	CleanupStack::PopAndDestroy(3); // completeCWList, activeRetriever, asyncRetrieveMobilePhoneCWList
       
   384 	CActiveScheduler::Install(NULL);
       
   385 	CleanupStack::PopAndDestroy(2); // data, this
       
   386 	
       
   387 	}
       
   388 
       
   389 
       
   390 /**
       
   391 @SYMTestCaseID BA-CTSY-CWAT-RMPCWLN-0004
       
   392 @SYMComponent  telephony_ctsy
       
   393 @SYMTestCaseDesc Test support in CTSY for multiple client requests to CRetrieveMobilePhoneCWList::Start
       
   394 @SYMTestPriority High
       
   395 @SYMTestActions Invokes multiple client requests to CRetrieveMobilePhoneCWList::Start
       
   396 @SYMTestExpectedResults Pass
       
   397 @SYMTestType CT
       
   398 */
       
   399 void CCTsyCallWaitingFU::TestStart0004L()
       
   400 	{
       
   401 
       
   402 					
       
   403 	OpenEtelServerL(EUseExtendedError);
       
   404 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   405 	OpenPhoneL();
       
   406 
       
   407 	RBuf8 data;
       
   408 	CleanupClosePushL(data);
       
   409 
       
   410 	CFilteringActiveScheduler scheduler;
       
   411 	CActiveScheduler::Install(&scheduler);
       
   412 
       
   413 	CRetrieveMobilePhoneCWList* asyncRetrieveMobilePhoneCWList =
       
   414 	                                       CRetrieveMobilePhoneCWList::NewL(iPhone);    
       
   415 	CleanupStack::PushL(asyncRetrieveMobilePhoneCWList);
       
   416 
       
   417 	CActiveRetriever::ResetRequestsNumber();
       
   418 	CActiveRetriever* activeRetriever = 
       
   419 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCWList);
       
   420 	CleanupStack::PushL(activeRetriever);
       
   421 	scheduler.AddRetrieverL(*activeRetriever);
       
   422  	
       
   423 	// Open second client
       
   424 	RTelServer telServer2;
       
   425 	TInt ret = telServer2.Connect();
       
   426 	ASSERT_EQUALS(KErrNone, ret);
       
   427 	CleanupClosePushL(telServer2);
       
   428 
       
   429 	RMobilePhone phone2;
       
   430 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
   431 	ASSERT_EQUALS(KErrNone, ret);
       
   432 	CleanupClosePushL(phone2);
       
   433 
       
   434 	CRetrieveMobilePhoneCWList* asyncRetrieveMobilePhoneCWList2 =
       
   435 	                                       CRetrieveMobilePhoneCWList::NewL(phone2);    
       
   436 	CleanupStack::PushL(asyncRetrieveMobilePhoneCWList2);
       
   437 
       
   438 	CActiveRetriever::ResetRequestsNumber();
       
   439 	CActiveRetriever* activeRetriever2 = 
       
   440 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCWList2);
       
   441 	CleanupStack::PushL(activeRetriever2);
       
   442 	scheduler.AddRetrieverL(*activeRetriever2);
       
   443  	
       
   444 	//-------------------------------------------------------------------------
       
   445 	// Test A: Test multiple clients requesting CRetrieveMobilePhoneCWList::Start
       
   446  	//-------------------------------------------------------------------------
       
   447 
       
   448     // setting and execute 1st request
       
   449     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   450 
       
   451 	CMobilePhoneCWList* completeCWList = CMobilePhoneCWList::NewL();
       
   452 	CleanupStack::PushL(completeCWList);
       
   453 	RMobilePhone::TMobilePhoneCWInfoEntryV1	entryCWInfoEntry;
       
   454 	entryCWInfoEntry.iServiceGroup = RMobilePhone::EVoiceService;
       
   455 	entryCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusNotProvisioned;
       
   456 	completeCWList->AddEntryL(entryCWInfoEntry);
       
   457 
       
   458 	TMockLtsyData1<CMobilePhoneCWList*> completeData(completeCWList);
       
   459 	completeData.SerialiseL(data);
       
   460     iMockLTSY.CompleteL(EMobilePhoneGetWaitingStatusPhase1, KErrNone, data);
       
   461 
       
   462 	RMobilePhone::TMobileInfoLocation location(RMobilePhone::EInfoLocationNetwork);
       
   463 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, location);
       
   464 	activeRetriever->Activate();
       
   465 
       
   466     // setting and execute 2nd request
       
   467 	RMobilePhone::TMobileInfoLocation location2(RMobilePhone::EInfoLocationCachePreferred);
       
   468 	asyncRetrieveMobilePhoneCWList2->Start(activeRetriever2->iStatus, location2);
       
   469 	activeRetriever2->Activate();
       
   470 
       
   471 	// invoke scheduler
       
   472 	scheduler.StartScheduler();
       
   473 
       
   474 	// check results
       
   475 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   476 	ASSERT_EQUALS(KErrServerBusy, activeRetriever2->iStatus.Int());
       
   477 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
   478 	CMobilePhoneCWList* list = asyncRetrieveMobilePhoneCWList->RetrieveListL();
       
   479 	CleanupStack::PushL( list );
       
   480 	ASSERT_TRUE( TComparator<CMobilePhoneCWList>::IsEqual(*completeCWList, *list) );
       
   481 	CleanupStack::PopAndDestroy( list );
       
   482 	AssertMockLtsyStatusL();
       
   483 
       
   484 	CleanupStack::PopAndDestroy(3); // completeCWList, activeRetriever2, asyncRetrieveMobilePhoneCWList2
       
   485 	CleanupStack::PopAndDestroy(2); // activeRetriever, asyncRetrieveMobilePhoneCWList
       
   486 	CActiveScheduler::Install(NULL);
       
   487 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
   488 
       
   489 	}
       
   490 
       
   491 
       
   492 /**
       
   493 @SYMTestCaseID BA-CTSY-CWAT-RMPCWLN-0005
       
   494 @SYMComponent  telephony_ctsy
       
   495 @SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneCWList::Start with timeout
       
   496 @SYMTestPriority High
       
   497 @SYMTestActions Invokes CRetrieveMobilePhoneCWList::Start and tests for timeout
       
   498 @SYMTestExpectedResults Pass
       
   499 @SYMTestType CT
       
   500 */
       
   501 void CCTsyCallWaitingFU::TestStart0005L()
       
   502 	{
       
   503 
       
   504 
       
   505 	OpenEtelServerL(EUseExtendedError);
       
   506 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   507 	OpenPhoneL();
       
   508 
       
   509 	CFilteringActiveScheduler scheduler;
       
   510 	CActiveScheduler::Install(&scheduler);
       
   511 
       
   512 	CRetrieveMobilePhoneCWList* asyncRetrieveMobilePhoneCWList =
       
   513 	                                       CRetrieveMobilePhoneCWList::NewL(iPhone);    
       
   514 	CleanupStack::PushL(asyncRetrieveMobilePhoneCWList);
       
   515 
       
   516 	CActiveRetriever::ResetRequestsNumber();
       
   517 	CActiveRetriever* activeRetriever = 
       
   518 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCWList);
       
   519 	CleanupStack::PushL(activeRetriever);
       
   520 	scheduler.AddRetrieverL(*activeRetriever);
       
   521 
       
   522 	//-------------------------------------------------------------------------
       
   523 	// Test A: Test timeout of CRetrieveMobilePhoneCWList::Start
       
   524  	//-------------------------------------------------------------------------
       
   525 
       
   526     iMockLTSY.ExpectL(EMobilePhoneGetWaitingStatusPhase1);
       
   527 
       
   528 	RMobilePhone::TMobileInfoLocation location(RMobilePhone::EInfoLocationCachePreferred);
       
   529 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus, location);
       
   530 	activeRetriever->Activate();
       
   531 	scheduler.StartScheduler();
       
   532 
       
   533 	ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber());
       
   534 	ASSERT_EQUALS(KErrTimedOut, activeRetriever->iStatus.Int());
       
   535 	AssertMockLtsyStatusL();
       
   536 
       
   537 	CleanupStack::PopAndDestroy(2); // activeRetriever, asyncRetrieveMobilePhoneCWList
       
   538 	CActiveScheduler::Install(NULL);
       
   539 	CleanupStack::PopAndDestroy(this);
       
   540 
       
   541 	}
       
   542 
       
   543 
       
   544 void CCTsyCallWaitingFU::AuxTestSetCallWaitingStatus0001L(
       
   545 		RMobilePhone::TMobileService aServiceGroup,
       
   546 		RMobilePhone::TMobilePhoneServiceAction aAction)
       
   547 	{
       
   548 	
       
   549 	RBuf8 data;
       
   550 	CleanupClosePushL(data);
       
   551 
       
   552 	//-------------------------------------------------------------------------
       
   553 	// TEST A: failure to dispatch request to LTSY
       
   554 	//-------------------------------------------------------------------------
       
   555 
       
   556 	RMobilePhone::TMobileService expServiceGroup = aServiceGroup;
       
   557     RMobilePhone::TMobilePhoneServiceAction expAction = aAction;
       
   558     TMockLtsyData2<RMobilePhone::TMobileService, RMobilePhone::TMobilePhoneServiceAction>
       
   559 	                  expLtsyData(expServiceGroup, expAction);
       
   560 	expLtsyData.SerialiseL(data);
       
   561     iMockLTSY.ExpectL(EMobilePhoneSetCallWaitingStatus, data, KErrNotSupported);
       
   562 
       
   563     TRequestStatus reqStatus;
       
   564 	iPhone.SetCallWaitingStatus(reqStatus, aServiceGroup, aAction);
       
   565 	User::WaitForRequest(reqStatus);
       
   566 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
   567 	AssertMockLtsyStatusL();
       
   568 
       
   569 	//-------------------------------------------------------------------------
       
   570 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   571 	//-------------------------------------------------------------------------
       
   572 
       
   573     iMockLTSY.ExpectL(EMobilePhoneSetCallWaitingStatus, data);
       
   574     iMockLTSY.CompleteL(EMobilePhoneSetCallWaitingStatus, KErrGeneral);
       
   575 
       
   576 	iPhone.SetCallWaitingStatus(reqStatus, aServiceGroup, aAction);
       
   577 	User::WaitForRequest(reqStatus);
       
   578 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
       
   579 	AssertMockLtsyStatusL();
       
   580 
       
   581 	//-------------------------------------------------------------------------
       
   582 	// TEST C: Successful completion request of
       
   583 	// RMobilePhone::SetCallWaitingStatus when result is not cached.
       
   584 	//-------------------------------------------------------------------------
       
   585 
       
   586     iMockLTSY.ExpectL(EMobilePhoneSetCallWaitingStatus, data);
       
   587 
       
   588 	RMobilePhone::TMobilePhoneCWInfoEntryV1 completeCWInfoEntry;
       
   589 	FillInCWInfoEntry(completeCWInfoEntry, aServiceGroup, aAction);
       
   590 	TMockLtsyData1<RMobilePhone::TMobilePhoneCWInfoEntryV1> completeLtsyData(completeCWInfoEntry);
       
   591 	data.Close();
       
   592 	completeLtsyData.SerialiseL(data);
       
   593     iMockLTSY.CompleteL(EMobilePhoneNotifyCallWaitingStatusChange, KErrNone, data);
       
   594 
       
   595     iMockLTSY.CompleteL(EMobilePhoneSetCallWaitingStatus, KErrNone);
       
   596 
       
   597     iPhone.SetCallWaitingStatus(reqStatus, aServiceGroup, aAction);
       
   598 	User::WaitForRequest(reqStatus);
       
   599 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   600 	AssertMockLtsyStatusL();
       
   601 
       
   602 	CleanupStack::PopAndDestroy(&data);
       
   603 	
       
   604 	}
       
   605 
       
   606 
       
   607 /**
       
   608 @SYMTestCaseID BA-CTSY-CWAT-MSCWS-0001
       
   609 @SYMComponent  telephony_ctsy
       
   610 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetCallWaitingStatus
       
   611 @SYMTestPriority High
       
   612 @SYMTestActions Invokes RMobilePhone::SetCallWaitingStatus
       
   613 @SYMTestExpectedResults Pass
       
   614 @SYMTestType CT
       
   615 */
       
   616 void CCTsyCallWaitingFU::TestSetCallWaitingStatus0001L()
       
   617 	{
       
   618 
       
   619 	OpenEtelServerL(EUseExtendedError);
       
   620 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   621 	OpenPhoneL();
       
   622 
       
   623 	RMobilePhone::TMobileService serviceGroup(RMobilePhone::EServiceUnspecified);
       
   624 	
       
   625 	while ( serviceGroup != RMobilePhone::EFaxService )
       
   626 		{
       
   627 		GetNextServiceGroup(serviceGroup);
       
   628 
       
   629 		AuxTestSetCallWaitingStatus0001L(serviceGroup, RMobilePhone::EServiceActionActivate);
       
   630 
       
   631 		AuxTestSetCallWaitingStatus0001L(serviceGroup, RMobilePhone::EServiceActionDeactivate);
       
   632 		}
       
   633 
       
   634 	//-------------------------------------------------------------------------
       
   635 	// TEST E: Unsolicited completion of RMobilePhone::SetCallWaitingStatus
       
   636 	// from LTSY.
       
   637 	//-------------------------------------------------------------------------
       
   638 
       
   639 	TRequestStatus mockLtsyStatus;
       
   640 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
   641     iMockLTSY.CompleteL(EMobilePhoneSetCallWaitingStatus, KErrNone);
       
   642 	User::WaitForRequest(mockLtsyStatus);
       
   643 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   644 	AssertMockLtsyStatusL();
       
   645 
       
   646 	CleanupStack::PopAndDestroy(this);
       
   647 
       
   648 	}
       
   649 
       
   650 
       
   651 void CCTsyCallWaitingFU::AuxTestSetCallWaitingStatus0002L(
       
   652 		RMobilePhone::TMobileService aServiceGroup,
       
   653 		RMobilePhone::TMobilePhoneServiceAction aAction)
       
   654 	{
       
   655 
       
   656 	RBuf8 data;
       
   657 	CleanupClosePushL(data);
       
   658 
       
   659 	TRequestStatus mockLtsyStatus;
       
   660 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   661 
       
   662  	//-------------------------------------------------------------------------
       
   663 	// Test cancelling of RMobilePhone::SetCallWaitingStatus
       
   664  	//-------------------------------------------------------------------------
       
   665  	
       
   666 	RMobilePhone::TMobileService expServiceGroup(aServiceGroup);
       
   667     RMobilePhone::TMobilePhoneServiceAction expAction(aAction);
       
   668     TMockLtsyData2<RMobilePhone::TMobileService, RMobilePhone::TMobilePhoneServiceAction>
       
   669 	                  expLtsyData(expServiceGroup, expAction);
       
   670 	expLtsyData.SerialiseL(data);
       
   671     iMockLTSY.ExpectL(EMobilePhoneSetCallWaitingStatus, data, KErrNone);
       
   672 
       
   673     RMobilePhone::TMobilePhoneCWInfoEntryV1 completeCWInfoEntry;
       
   674 	FillInCWInfoEntry(completeCWInfoEntry, aServiceGroup, aAction);
       
   675 	TMockLtsyData1<RMobilePhone::TMobilePhoneCWInfoEntryV1> completeLtsyData(completeCWInfoEntry);
       
   676 	data.Close();
       
   677 	completeLtsyData.SerialiseL(data);
       
   678     iMockLTSY.CompleteL(EMobilePhoneNotifyCallWaitingStatusChange, KErrNone, data, 10);
       
   679 
       
   680     iMockLTSY.CompleteL(EMobilePhoneSetCallWaitingStatus, KErrNone, 10);
       
   681 
       
   682     TRequestStatus reqStatus;
       
   683 	iPhone.SetCallWaitingStatus(reqStatus, aServiceGroup, aAction);
       
   684 
       
   685 	iPhone.CancelAsyncRequest(EMobilePhoneSetCallWaitingStatus);
       
   686 
       
   687 	User::WaitForRequest(reqStatus);
       
   688 	ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
   689 
       
   690 	// Wait for completion of iMockLTSY.NotifyTerminated
       
   691 	User::WaitForRequest(mockLtsyStatus);
       
   692 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   693 	AssertMockLtsyStatusL();
       
   694 
       
   695 	CleanupStack::PopAndDestroy(&data);
       
   696 
       
   697 	}
       
   698 
       
   699 
       
   700 /**
       
   701 @SYMTestCaseID BA-CTSY-CWAT-MSCWS-0002
       
   702 @SYMComponent  telephony_ctsy
       
   703 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::SetCallWaitingStatus
       
   704 @SYMTestPriority High
       
   705 @SYMTestActions Invokes cancelling of RMobilePhone::SetCallWaitingStatus
       
   706 @SYMTestExpectedResults Pass
       
   707 @SYMTestType CT
       
   708 */
       
   709 void CCTsyCallWaitingFU::TestSetCallWaitingStatus0002L()
       
   710 	{
       
   711 
       
   712 	OpenEtelServerL(EUseExtendedError);
       
   713 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   714 	OpenPhoneL();
       
   715 
       
   716 	RMobilePhone::TMobileService serviceGroup(RMobilePhone::EServiceUnspecified);
       
   717 	
       
   718 	while ( serviceGroup != RMobilePhone::EFaxService )
       
   719 		{
       
   720 		GetNextServiceGroup(serviceGroup);
       
   721 
       
   722 		AuxTestSetCallWaitingStatus0002L(serviceGroup, RMobilePhone::EServiceActionActivate);
       
   723 
       
   724 		AuxTestSetCallWaitingStatus0002L(serviceGroup, RMobilePhone::EServiceActionDeactivate);
       
   725 		}
       
   726 
       
   727 	CleanupStack::PopAndDestroy(this);
       
   728 	
       
   729 	}
       
   730 
       
   731 
       
   732 void CCTsyCallWaitingFU::AuxTestSetCallWaitingStatus0003L(
       
   733 		RMobilePhone::TMobileService aServiceGroup,
       
   734 		RMobilePhone::TMobilePhoneServiceAction aAction)
       
   735 	{
       
   736 	TRequestStatus reqStatus;
       
   737 	iPhone.SetCallWaitingStatus(reqStatus, aServiceGroup, aAction);
       
   738 	User::WaitForRequest(reqStatus);
       
   739 	ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
   740 	AssertMockLtsyStatusL();
       
   741 	}
       
   742 
       
   743 
       
   744 /**
       
   745 @SYMTestCaseID BA-CTSY-CWAT-MSCWS-0003
       
   746 @SYMComponent  telephony_ctsy
       
   747 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetCallWaitingStatus with bad parameter data
       
   748 @SYMTestPriority High
       
   749 @SYMTestActions Invokes RMobilePhone::SetCallWaitingStatus with bad parameter data
       
   750 @SYMTestExpectedResults Pass
       
   751 @SYMTestType CT
       
   752 */
       
   753 void CCTsyCallWaitingFU::TestSetCallWaitingStatus0003L()
       
   754 	{
       
   755 
       
   756 	OpenEtelServerL(EUseExtendedError);
       
   757 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   758 	OpenPhoneL();
       
   759 
       
   760 	//-------------------------------------------------------------------------
       
   761 	// Test C: Test passing out of bounds parameters to
       
   762 	// RMobilePhone::SetCallWaitingStatus
       
   763  	//-------------------------------------------------------------------------
       
   764  	
       
   765 	RMobilePhone::TMobileService serviceGroup(RMobilePhone::EServiceUnspecified);
       
   766 	
       
   767 	while ( serviceGroup != RMobilePhone::EFaxService )
       
   768 		{
       
   769 		GetNextServiceGroup(serviceGroup);
       
   770 		RMobilePhone::TMobilePhoneServiceAction action(RMobilePhone::EServiceActionActivate);
       
   771 
       
   772 		while ( action != RMobilePhone::EServiceActionErase )
       
   773 			{
       
   774 			GetNextUnsupportedServiceAction(action);
       
   775 			
       
   776 			// action parameter is error argument
       
   777 			AuxTestSetCallWaitingStatus0003L(serviceGroup, action);
       
   778 			}
       
   779 		}
       
   780 
       
   781 	CleanupStack::PopAndDestroy(this);
       
   782 
       
   783 	}
       
   784 
       
   785 
       
   786 /**
       
   787 @SYMTestCaseID BA-CTSY-CWAT-MSCWS-0004
       
   788 @SYMComponent  telephony_ctsy
       
   789 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::SetCallWaitingStatus
       
   790 @SYMTestPriority High
       
   791 @SYMTestActions Invokes multiple client requests to RMobilePhone::SetCallWaitingStatus
       
   792 @SYMTestExpectedResults Pass
       
   793 @SYMTestType CT
       
   794 */
       
   795 void CCTsyCallWaitingFU::TestSetCallWaitingStatus0004L()
       
   796 	{
       
   797 
       
   798 					
       
   799 	OpenEtelServerL(EUseExtendedError);
       
   800 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   801 	OpenPhoneL();
       
   802 
       
   803 	RBuf8 data;
       
   804 	CleanupClosePushL(data);
       
   805 
       
   806 	// Open second client
       
   807 	RTelServer telServer2;
       
   808 	TInt ret = telServer2.Connect();
       
   809 	ASSERT_EQUALS(KErrNone, ret);
       
   810 	CleanupClosePushL(telServer2);
       
   811 
       
   812 	RMobilePhone phone2;
       
   813 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
   814 	ASSERT_EQUALS(KErrNone, ret);
       
   815 	CleanupClosePushL(phone2);
       
   816 
       
   817 	RMobilePhone::TMobileService serviceGroup(RMobilePhone::EVoiceService);
       
   818     RMobilePhone::TMobilePhoneServiceAction action(RMobilePhone::EServiceActionDeactivate);
       
   819 
       
   820     //-------------------------------------------------------------------------
       
   821 	// Test A: Test multiple clients requesting RMobilePhone::SetCallWaitingStatus
       
   822  	//-------------------------------------------------------------------------
       
   823 
       
   824 	// setting and execute 1st request
       
   825 	RMobilePhone::TMobileService expServiceGroup(serviceGroup);
       
   826     RMobilePhone::TMobilePhoneServiceAction expAction(action);
       
   827     TMockLtsyData2<RMobilePhone::TMobileService, RMobilePhone::TMobilePhoneServiceAction>
       
   828 	                  expLtsyData(expServiceGroup, expAction);
       
   829 	expLtsyData.SerialiseL(data);
       
   830     iMockLTSY.ExpectL(EMobilePhoneSetCallWaitingStatus, data, KErrNone);
       
   831 
       
   832     RMobilePhone::TMobilePhoneCWInfoEntryV1 completeCWInfoEntry;
       
   833 	FillInCWInfoEntry(completeCWInfoEntry, serviceGroup, action);
       
   834 	TMockLtsyData1<RMobilePhone::TMobilePhoneCWInfoEntryV1> completeLtsyData(completeCWInfoEntry);
       
   835 	data.Close();
       
   836 	completeLtsyData.SerialiseL(data);
       
   837     iMockLTSY.CompleteL(EMobilePhoneNotifyCallWaitingStatusChange, KErrNone, data);
       
   838 
       
   839     iMockLTSY.CompleteL(EMobilePhoneSetCallWaitingStatus, KErrNone);
       
   840 
       
   841     TRequestStatus reqStatus;
       
   842 	iPhone.SetCallWaitingStatus(reqStatus, serviceGroup, action);
       
   843 
       
   844 	// setting and execute 2nd request
       
   845 	RMobilePhone::TMobileService serviceGroup2(RMobilePhone::EFaxService);
       
   846     RMobilePhone::TMobilePhoneServiceAction action2(RMobilePhone::EServiceActionActivate);
       
   847     TRequestStatus reqStatus2;
       
   848 	phone2.SetCallWaitingStatus(reqStatus2, serviceGroup2, action2);
       
   849 
       
   850 	// check results
       
   851 	User::WaitForRequest(reqStatus);
       
   852 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   853 
       
   854 	User::WaitForRequest(reqStatus2);
       
   855 	ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int());
       
   856 
       
   857 	AssertMockLtsyStatusL();
       
   858 
       
   859 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
   860 
       
   861 	}
       
   862 
       
   863 
       
   864 /**
       
   865 @SYMTestCaseID BA-CTSY-CWAT-MSCWS-0005
       
   866 @SYMComponent  telephony_ctsy
       
   867 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetCallWaitingStatus with timeout
       
   868 @SYMTestPriority High
       
   869 @SYMTestActions Invokes RMobilePhone::SetCallWaitingStatus and tests for timeout
       
   870 @SYMTestExpectedResults Pass
       
   871 @SYMTestType CT
       
   872 */
       
   873 void CCTsyCallWaitingFU::TestSetCallWaitingStatus0005L()
       
   874 	{
       
   875 
       
   876 
       
   877 	OpenEtelServerL(EUseExtendedError);
       
   878 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   879 	OpenPhoneL();
       
   880 
       
   881 	RBuf8 data;
       
   882 	CleanupClosePushL(data);
       
   883 
       
   884 	//-------------------------------------------------------------------------
       
   885 	// Test A: Test timeout of RMobilePhone::SetCallWaitingStatus
       
   886  	//-------------------------------------------------------------------------
       
   887 
       
   888 	RMobilePhone::TMobileService expServiceGroup(RMobilePhone::EVoiceService);
       
   889     RMobilePhone::TMobilePhoneServiceAction expAction(RMobilePhone::EServiceActionActivate);
       
   890     TMockLtsyData2<RMobilePhone::TMobileService, RMobilePhone::TMobilePhoneServiceAction>
       
   891 	                  expLtsyData(expServiceGroup, expAction);
       
   892 	expLtsyData.SerialiseL(data);
       
   893     iMockLTSY.ExpectL(EMobilePhoneSetCallWaitingStatus, data, KErrNone);
       
   894 
       
   895 	RMobilePhone::TMobileService serviceGroup(RMobilePhone::EVoiceService);
       
   896     RMobilePhone::TMobilePhoneServiceAction action(RMobilePhone::EServiceActionActivate);
       
   897     TRequestStatus reqStatus;
       
   898 	iPhone.SetCallWaitingStatus(reqStatus, serviceGroup, action);
       
   899 
       
   900 	// check results
       
   901 	User::WaitForRequest(reqStatus);
       
   902 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
   903 
       
   904 	AssertMockLtsyStatusL();
       
   905 
       
   906 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   907 
       
   908 	}
       
   909 
       
   910 
       
   911 /**
       
   912 @SYMTestCaseID BA-CTSY-CWAT-MCWSC-0001
       
   913 @SYMComponent  telephony_ctsy
       
   914 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyCallWaitingStatusChange
       
   915 @SYMTestPriority High
       
   916 @SYMTestActions Invokes RMobilePhone::NotifyCallWaitingStatusChange
       
   917 @SYMTestExpectedResults Pass
       
   918 @SYMTestType CT
       
   919 */
       
   920 void CCTsyCallWaitingFU::TestNotifyCallWaitingStatusChange0001L()
       
   921 	{
       
   922 
       
   923 	OpenEtelServerL(EUseExtendedError);
       
   924 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   925 	OpenPhoneL();
       
   926 
       
   927 	RBuf8 data;
       
   928 	CleanupClosePushL(data);
       
   929 
       
   930  	//-------------------------------------------------------------------------
       
   931 	// TEST C: Successful completion request of
       
   932 	// RMobilePhone::NotifyCallWaitingStatusChange when result is not cached.
       
   933  	//-------------------------------------------------------------------------
       
   934 
       
   935 	TRequestStatus reqStatus;
       
   936 	RMobilePhone::TMobilePhoneCWInfoEntryV1 cwInfoEntry;
       
   937 	RMobilePhone::TMobilePhoneCWInfoEntryV1Pckg cwStatus(cwInfoEntry);
       
   938 	iPhone.NotifyCallWaitingStatusChange(reqStatus, cwStatus);
       
   939 
       
   940 	TRequestStatus mockLtsyStatus;
       
   941 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
   942 	
       
   943 	RMobilePhone::TMobilePhoneCWInfoEntryV1 completeCWInfoEntry;
       
   944 	completeCWInfoEntry.iServiceGroup = RMobilePhone::EVoiceService;
       
   945 	completeCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusNotActive;
       
   946 	TMockLtsyData1<RMobilePhone::TMobilePhoneCWInfoEntryV1> completeLtsyData(completeCWInfoEntry);
       
   947 	completeLtsyData.SerialiseL(data);
       
   948     iMockLTSY.CompleteL(EMobilePhoneNotifyCallWaitingStatusChange, KErrNone, data);
       
   949 	User::WaitForRequest(mockLtsyStatus);
       
   950 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   951 	
       
   952 	User::WaitForRequest(reqStatus);
       
   953 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   954 	ASSERT_EQUALS(completeCWInfoEntry.iServiceGroup, cwInfoEntry.iServiceGroup);
       
   955 	ASSERT_EQUALS(completeCWInfoEntry.iStatus, cwInfoEntry.iStatus);
       
   956 	AssertMockLtsyStatusL();
       
   957 
       
   958  	//-------------------------------------------------------------------------
       
   959 	// TEST E: Unsolicited completion of RMobilePhone::NotifyCallWaitingStatusChange
       
   960 	// from LTSY.
       
   961  	//-------------------------------------------------------------------------
       
   962 
       
   963 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
   964     iMockLTSY.CompleteL(EMobilePhoneNotifyCallWaitingStatusChange, KErrNone, data);
       
   965 	User::WaitForRequest(mockLtsyStatus);
       
   966 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   967 	AssertMockLtsyStatusL();
       
   968 
       
   969 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   970 	
       
   971 	}
       
   972 
       
   973 
       
   974 /**
       
   975 @SYMTestCaseID BA-CTSY-CWAT-MCWSC-0002
       
   976 @SYMComponent  telephony_ctsy
       
   977 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifyCallWaitingStatusChange
       
   978 @SYMTestPriority High
       
   979 @SYMTestActions Invokes cancelling of RMobilePhone::NotifyCallWaitingStatusChange
       
   980 @SYMTestExpectedResults Pass
       
   981 @SYMTestType CT
       
   982 */
       
   983 void CCTsyCallWaitingFU::TestNotifyCallWaitingStatusChange0002L()
       
   984 	{
       
   985 
       
   986 	OpenEtelServerL(EUseExtendedError);
       
   987 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   988 	OpenPhoneL();
       
   989 
       
   990 	//-------------------------------------------------------------------------
       
   991 	// Test cancelling of RMobilePhone::NotifyCallWaitingStatusChange
       
   992 	//-------------------------------------------------------------------------
       
   993 
       
   994 	TRequestStatus reqStatus;
       
   995 	RMobilePhone::TMobilePhoneCWInfoEntryV1 cwInfoEntry;
       
   996 	RMobilePhone::TMobilePhoneCWInfoEntryV1Pckg cwStatus(cwInfoEntry);
       
   997 	iPhone.NotifyCallWaitingStatusChange(reqStatus, cwStatus);
       
   998 
       
   999 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyCallWaitingStatusChange);
       
  1000 
       
  1001 	User::WaitForRequest(reqStatus);
       
  1002 	ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
  1003 	AssertMockLtsyStatusL();
       
  1004 
       
  1005 	CleanupStack::PopAndDestroy(this);
       
  1006 
       
  1007 	}
       
  1008 
       
  1009 
       
  1010 /**
       
  1011 @SYMTestCaseID BA-CTSY-CWAT-MCWSC-0003
       
  1012 @SYMComponent  telephony_ctsy
       
  1013 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyCallWaitingStatusChange with bad parameter data
       
  1014 @SYMTestPriority High
       
  1015 @SYMTestActions Invokes RMobilePhone::NotifyCallWaitingStatusChange with bad parameter data
       
  1016 @SYMTestExpectedResults Pass
       
  1017 @SYMTestType CT
       
  1018 */
       
  1019 void CCTsyCallWaitingFU::TestNotifyCallWaitingStatusChange0003L()
       
  1020 	{
       
  1021 
       
  1022 	OpenEtelServerL(EUseExtendedError);
       
  1023 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1024 	OpenPhoneL();
       
  1025 	
       
  1026 	TRequestStatus reqStatus;
       
  1027 
       
  1028 	//-------------------------------------------------------------------------
       
  1029 	// Test A: Test passing wrong version of parameters to
       
  1030 	// RMobilePhone::NotifyCallWaitingStatusChange
       
  1031  	//-------------------------------------------------------------------------
       
  1032 
       
  1033 	// setting and execute 1st request
       
  1034 	RMobilePhone::TMobilePhoneCWInfoEntryV1* cwInfoEntryPtr(NULL);
       
  1035 	RMobilePhone::TMobilePhoneCWInfoEntryV1Pckg cwStatusPtr(*cwInfoEntryPtr);
       
  1036 	iPhone.NotifyCallWaitingStatusChange(reqStatus, cwStatusPtr);
       
  1037 
       
  1038 	// check results
       
  1039 	User::WaitForRequest(reqStatus);
       
  1040 	ASSERT_EQUALS(KErrBadDescriptor, reqStatus.Int());
       
  1041 
       
  1042 	AssertMockLtsyStatusL();
       
  1043 
       
  1044 	//-------------------------------------------------------------------------
       
  1045 	// Test B: Test passing wrong descriptor size to parameter in
       
  1046 	// RMobilePhone::NotifyCallWaitingStatusChange
       
  1047  	//-------------------------------------------------------------------------
       
  1048 
       
  1049 	TBuf8<1> wrongCWStatus;
       
  1050 	iPhone.NotifyCallWaitingStatusChange(reqStatus, wrongCWStatus);
       
  1051 	
       
  1052 	// check results
       
  1053 	User::WaitForRequest(reqStatus);
       
  1054 	ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  1055 
       
  1056 	AssertMockLtsyStatusL();
       
  1057 	
       
  1058 	CleanupStack::PopAndDestroy(this);
       
  1059 
       
  1060 	}
       
  1061 
       
  1062 
       
  1063 /**
       
  1064 @SYMTestCaseID BA-CTSY-CWAT-MCWSC-0004
       
  1065 @SYMComponent  telephony_ctsy
       
  1066 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifyCallWaitingStatusChange
       
  1067 @SYMTestPriority High
       
  1068 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifyCallWaitingStatusChange
       
  1069 @SYMTestExpectedResults Pass
       
  1070 @SYMTestType CT
       
  1071 */
       
  1072 void CCTsyCallWaitingFU::TestNotifyCallWaitingStatusChange0004L()
       
  1073 	{
       
  1074 
       
  1075 					
       
  1076 	OpenEtelServerL(EUseExtendedError);
       
  1077 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1078 	OpenPhoneL();
       
  1079 
       
  1080 	RBuf8 data;
       
  1081 	CleanupClosePushL(data);
       
  1082 
       
  1083 	// Open second client
       
  1084 	RTelServer telServer2;
       
  1085 	TInt ret = telServer2.Connect();
       
  1086 	ASSERT_EQUALS(KErrNone, ret);
       
  1087 	CleanupClosePushL(telServer2);
       
  1088 
       
  1089 	RMobilePhone phone2;
       
  1090 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
  1091 	ASSERT_EQUALS(KErrNone, ret);
       
  1092 	CleanupClosePushL(phone2);
       
  1093 
       
  1094 	//-------------------------------------------------------------------------
       
  1095 	// Test A: Test multiple clients requesting RMobilePhone::NotifyCallWaitingStatusChange
       
  1096  	//-------------------------------------------------------------------------
       
  1097 
       
  1098 	// setting and execute 1st request
       
  1099 	TRequestStatus reqStatus;
       
  1100 	RMobilePhone::TMobilePhoneCWInfoEntryV1 cwInfoEntry;
       
  1101 	RMobilePhone::TMobilePhoneCWInfoEntryV1Pckg cwStatus(cwInfoEntry);
       
  1102 	iPhone.NotifyCallWaitingStatusChange(reqStatus, cwStatus);
       
  1103 
       
  1104 	// setting and execute 2nd request
       
  1105 	TRequestStatus reqStatus2;
       
  1106 	RMobilePhone::TMobilePhoneCWInfoEntryV1 cwInfoEntry2;
       
  1107 	RMobilePhone::TMobilePhoneCWInfoEntryV1Pckg cwStatus2(cwInfoEntry2);
       
  1108 	phone2.NotifyCallWaitingStatusChange(reqStatus2, cwStatus2);
       
  1109 
       
  1110 	// invoke call waiting status change
       
  1111 	TRequestStatus mockLtsyStatus;
       
  1112 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	
       
  1113 	
       
  1114 	RMobilePhone::TMobilePhoneCWInfoEntryV1 completeCWInfoEntry;
       
  1115 	completeCWInfoEntry.iServiceGroup = RMobilePhone::EVoiceService;
       
  1116 	completeCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusNotActive;
       
  1117 	TMockLtsyData1<RMobilePhone::TMobilePhoneCWInfoEntryV1> completeLtsyData(completeCWInfoEntry);
       
  1118 	completeLtsyData.SerialiseL(data);
       
  1119     iMockLTSY.CompleteL(EMobilePhoneNotifyCallWaitingStatusChange, KErrNone, data);
       
  1120 	User::WaitForRequest(mockLtsyStatus);
       
  1121 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1122 	
       
  1123 	// check results
       
  1124 	User::WaitForRequest(reqStatus);
       
  1125 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1126 	ASSERT_EQUALS(completeCWInfoEntry.iServiceGroup, cwInfoEntry.iServiceGroup);
       
  1127 	ASSERT_EQUALS(completeCWInfoEntry.iStatus, cwInfoEntry.iStatus);
       
  1128 
       
  1129 	User::WaitForRequest(reqStatus2);
       
  1130 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  1131 	ASSERT_EQUALS(completeCWInfoEntry.iServiceGroup, cwInfoEntry2.iServiceGroup);
       
  1132 	ASSERT_EQUALS(completeCWInfoEntry.iStatus, cwInfoEntry2.iStatus);
       
  1133 
       
  1134 	AssertMockLtsyStatusL();
       
  1135 
       
  1136 	CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this
       
  1137 
       
  1138 	}