telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/cctsysupplementaryservicesfu.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-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 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file The TEFUnit test suite for SupplementaryServicesControl in the Common TSY.
       
    20 */
       
    21 
       
    22 #include "cctsysupplementaryservicesfu.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 <test/tmockltsydata.h>
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 #include <ctsy/ltsy/mltsydispatchsupplementaryservicesinterface.h>
       
    31 #include "mockltsyindicatorids.h"
       
    32 #include <mmretrieve.h>
       
    33 #include <ctsy/rmmcustomapi.h>
       
    34 #include "cctsyactiveretriever.h"
       
    35 #include <ctsy/ltsy/mltsydispatchcallcontrolinterface.h>
       
    36 
       
    37 CTestSuite* CCTsySupplementaryServicesFU::CreateSuiteL(const TDesC& aName)
       
    38 	{
       
    39 	SUB_SUITE;
       
    40 
       
    41 	//add use-case tests
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUseCase0001L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUseCase0002L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUseCase0003L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUseCase0004L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUseCase0005L);
       
    47   
       
    48 	//add other unit tests
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0001L);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0002L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0003L);
       
    52 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0004L);
       
    53 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0005L);
       
    54 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0006L);
       
    55 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0007L);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsySupplementaryServicesFU, TestUnit0008L);
       
    57 
       
    58 	END_SUITE;
       
    59 	}
       
    60 
       
    61 
       
    62 //
       
    63 // Use-case tests
       
    64 //
       
    65 
       
    66 /**
       
    67  * Compare two RMobilePhone::TMobileAddress objects.
       
    68  * 
       
    69  * @param aAddr1 the first object.
       
    70  * @param aAddr2 the second object.
       
    71  * @return ETrue iff the two object are the same.
       
    72  * 
       
    73  * */ 
       
    74 TBool operator ==(const RMobilePhone::TMobileAddress& aAddr1, 
       
    75 		const RMobilePhone::TMobileAddress& aAddr2)
       
    76 	{
       
    77 	if(aAddr1.iTypeOfNumber != aAddr2.iTypeOfNumber)
       
    78 		{
       
    79 		return EFalse;
       
    80 		}
       
    81 	if(aAddr1.iNumberPlan != aAddr2.iNumberPlan)
       
    82 		{
       
    83 		return EFalse;
       
    84 		}
       
    85 	if(aAddr1.iTelNumber != aAddr2.iTelNumber)
       
    86 		{
       
    87 		return EFalse;
       
    88 		}
       
    89 	return ETrue;
       
    90 	}
       
    91 
       
    92 /**
       
    93  * Compare two RMobilePhone::TMobilePhoneCFInfoEntryV1 objects.
       
    94  * 
       
    95  * @param aEntry1 the first object.
       
    96  * @param aEntry2 the second object.
       
    97  * @return ETrue iff the two object are the same.
       
    98  * 
       
    99  * */ 
       
   100 TBool operator ==(const RMobilePhone::TMobilePhoneCFInfoEntryV1& aEntry1, 
       
   101 		const RMobilePhone::TMobilePhoneCFInfoEntryV1& aEntry2)
       
   102 	{
       
   103 	if(aEntry1.iCondition!=aEntry2.iCondition)
       
   104 		{
       
   105 		return EFalse;
       
   106 		}
       
   107 	if(aEntry1.iServiceGroup!=aEntry2.iServiceGroup)
       
   108 		{
       
   109 		return EFalse;
       
   110 		}
       
   111 	if(aEntry1.iStatus!=aEntry2.iStatus)
       
   112 		{
       
   113 		return EFalse;
       
   114 		}
       
   115 	if(!(aEntry1.iNumber==aEntry2.iNumber))
       
   116 		{
       
   117 		return EFalse;
       
   118 		}
       
   119 	if(aEntry1.iTimeout!=aEntry2.iTimeout)
       
   120 		{
       
   121 		return EFalse;
       
   122 		}
       
   123 	
       
   124 	return ETrue;
       
   125 	}
       
   126 
       
   127 /**
       
   128  * Compare two RMobilePhone::TMobilePhoneCWInfoEntryV1 objects.
       
   129  * 
       
   130  * @param aEntry1 the first object.
       
   131  * @param aEntry2 the second object.
       
   132  * @return ETrue iff the two object are the same.
       
   133  * 
       
   134  * */ 
       
   135 TBool operator ==(const RMobilePhone::TMobilePhoneCWInfoEntryV1& aEntry1, 
       
   136 		const RMobilePhone::TMobilePhoneCWInfoEntryV1& aEntry2)
       
   137 	{
       
   138 	if(aEntry1.iStatus!=aEntry2.iStatus)
       
   139 		{
       
   140 		return EFalse;
       
   141 		}
       
   142 	if(aEntry1.iServiceGroup!=aEntry2.iServiceGroup)
       
   143 		{
       
   144 		return EFalse;
       
   145 		}
       
   146 	return ETrue;
       
   147 	}
       
   148 
       
   149 /**
       
   150  * Compare two RMobilePhone::TMobilePhoneCWInfoEntryV1 objects.
       
   151  * 
       
   152  * @param aEntry1 the first object.
       
   153  * @param aEntry2 the second object.
       
   154  * @return ETrue iff the two object are the same.
       
   155  * 
       
   156  * */ 
       
   157 TBool operator ==(const RMobilePhone::TMobilePhoneCBInfoEntryV1& aEntry1, 
       
   158 		const RMobilePhone::TMobilePhoneCBInfoEntryV1& aEntry2)
       
   159 	{
       
   160 	if(aEntry1.iStatus!=aEntry2.iStatus)
       
   161 		{
       
   162 		return EFalse;
       
   163 		}
       
   164 	if(aEntry1.iCondition!=aEntry2.iCondition)
       
   165 		{
       
   166 		return EFalse;
       
   167 		}
       
   168 	if(aEntry1.iServiceGroup!=aEntry2.iServiceGroup)
       
   169 		{
       
   170 		return EFalse;
       
   171 		}
       
   172 	return ETrue;
       
   173 	}
       
   174 
       
   175 /**
       
   176  * Compare two CMobilePhoneReadOnlyList objects.
       
   177  * 
       
   178  * @param aList1 the first object.
       
   179  * @param aList2 the second object.
       
   180  * @return ETrue iff the two object are the same.
       
   181  * 
       
   182  * */ 
       
   183 template<class T>
       
   184 TBool operator ==(const CMobilePhoneReadOnlyList<T>& aList1, 
       
   185 		const CMobilePhoneReadOnlyList<T>& aList2)
       
   186 	{
       
   187 	TInt size1 = aList1.Enumerate();
       
   188 	TInt size2 = aList2.Enumerate();
       
   189 	if(size1 != size2)
       
   190 		{
       
   191 		return EFalse;
       
   192 		}
       
   193 	for(TInt i = 0; i < size1; ++i)
       
   194 		{
       
   195 		if(!(aList1.GetEntryL(i) == aList2.GetEntryL(i)))
       
   196 			{
       
   197 			return EFalse;
       
   198 			}
       
   199 		}
       
   200 	return ETrue;
       
   201 	}
       
   202 
       
   203 /**
       
   204 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UC0001
       
   205 @SYMComponent telephony_ctsy
       
   206 @SYMTestCaseDesc Test support in CTSY for notify, set and get the call forwarding
       
   207 @SYMTestPriority High
       
   208 @SYMTestActions Invokes RMobilePhone::NotifyCallForwardingActive, RMobilePhone::NotifyCallForwardingStatusChange, RMobilePhone::SetCallForwardingStatus, CRetrieveMobilePhoneCFList::Start
       
   209 @SYMTestExpectedResults Pass
       
   210 @SYMTestType CT
       
   211  */
       
   212 void CCTsySupplementaryServicesFU::TestUseCase0001L()
       
   213 	{
       
   214 	OpenEtelServerL(EUseExtendedError);
       
   215 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   216 	OpenPhoneL();
       
   217 
       
   218 	RBuf8 data;
       
   219 	CleanupClosePushL(data);	
       
   220 
       
   221 	 
       
   222 	// post NotifyCallForwardingActive and NotifyCallForwardingStatusChange 
       
   223 	TRequestStatus notifyCallForwardingActiveStatus;
       
   224 	RMobilePhone::TMobileService service;
       
   225 	RMobilePhone::TMobilePhoneCFActive active;
       
   226 	iPhone.NotifyCallForwardingActive(notifyCallForwardingActiveStatus,service,active);
       
   227 	
       
   228 	TRequestStatus notifyCallForwardingStatusChangeStatus;
       
   229 	RMobilePhone::TMobilePhoneCFCondition notifyCondition;
       
   230 	iPhone.NotifyCallForwardingStatusChange(notifyCallForwardingStatusChangeStatus,notifyCondition);
       
   231 
       
   232 	// prepare ltsy to accept and answer the SetCallForwardingStatus
       
   233 	RMobilePhone::TMobilePhoneCFCondition setCondition = RMobilePhone::ECallForwardingNoReply;
       
   234 	RMobilePhone::TMobilePhoneCFChangeV1  callForwardinginfo;
       
   235 	callForwardinginfo.iAction = RMobilePhone::EServiceActionRegister;
       
   236 	callForwardinginfo.iNumber.iTypeOfNumber = RMobilePhone::EInternationalNumber;
       
   237 	callForwardinginfo.iNumber.iNumberPlan   = RMobilePhone::EIsdnNumberPlan;
       
   238 	_LIT(KTelNumber,"+74951000000");
       
   239 	callForwardinginfo.iNumber.iTelNumber.Copy(KTelNumber);
       
   240 	callForwardinginfo.iServiceGroup = RMobilePhone::EVoiceService;
       
   241 	callForwardinginfo.iTimeout = 20;
       
   242 	TMockLtsyData5<RMobilePhone::TMobilePhoneCFCondition, 
       
   243 	               RMobilePhone::TMobileService,
       
   244 	               RMobilePhone::TMobilePhoneServiceAction,
       
   245 	               TInt,
       
   246 	               TBuf<RMobilePhone::KMaxMobileTelNumberSize> > mockCompleteSetData(setCondition,
       
   247 	            		   callForwardinginfo.iServiceGroup,
       
   248 	            		   callForwardinginfo.iAction,
       
   249 	            		   callForwardinginfo.iTimeout,
       
   250 	            		   callForwardinginfo.iNumber.iTelNumber);
       
   251 	data.Close();
       
   252 	mockCompleteSetData.SerialiseL(data);
       
   253 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSetCallForwardingStatus::KLtsyDispatchSupplementaryServicesSetCallForwardingStatusApiId, data, KErrNone);
       
   254 	
       
   255 	// call to RMobilePhone::SetCallForwardingStatus
       
   256 	TRequestStatus requestStatusSet;
       
   257 	iPhone.SetCallForwardingStatus(requestStatusSet, setCondition, callForwardinginfo);
       
   258 	ASSERT_EQUALS(KRequestPending, notifyCallForwardingActiveStatus.Int());
       
   259 	ASSERT_EQUALS(KRequestPending, notifyCallForwardingStatusChangeStatus.Int());
       
   260 	ASSERT_EQUALS(KRequestPending, requestStatusSet.Int());
       
   261 
       
   262 	// complete NotifyCallForwardingStatusChange
       
   263 	RMobilePhone::TMobilePhoneCFCondition completeCondition = RMobilePhone::ECallForwardingNoReply;
       
   264 	TMockLtsyData1<RMobilePhone::TMobilePhoneCFCondition> mockCompleteNotifyCFStatusChangeData(completeCondition);
       
   265 	data.Close();
       
   266 	mockCompleteNotifyCFStatusChangeData.SerialiseL(data);
       
   267 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyCallForwardingStatusChangeIndId, KErrNone, data);
       
   268 	
       
   269 	//Wait for NotifyCallForwardingStatusChange
       
   270 	User::WaitForRequest(notifyCallForwardingStatusChangeStatus);
       
   271 	ASSERT_EQUALS(KErrNone, notifyCallForwardingStatusChangeStatus.Int());
       
   272 	ASSERT_EQUALS(KRequestPending, requestStatusSet.Int());
       
   273 	ASSERT_EQUALS(notifyCondition, completeCondition);
       
   274 	
       
   275 	// complete SetCallForwardingStatus
       
   276 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSetCallForwardingStatus::KLtsyDispatchSupplementaryServicesSetCallForwardingStatusApiId, KErrNone);
       
   277 	
       
   278 	//Wait for SetCallForwardingStatus
       
   279 	User::WaitForRequest(requestStatusSet);
       
   280 	ASSERT_EQUALS(KErrNone, requestStatusSet.Int());
       
   281 	
       
   282 	// complete notify NotifyCallForwardingActive
       
   283 	RMobilePhone::TMobileService completeService = callForwardinginfo.iServiceGroup;
       
   284 	RMobilePhone::TMobilePhoneCFActive completeActive = RMobilePhone::ECFConditionalActive;
       
   285 	TMockLtsyData2<RMobilePhone::TMobileService, RMobilePhone::TMobilePhoneCFActive> mockCompleteNotifyCFAData(completeService,completeActive);
       
   286 	data.Close();
       
   287 	mockCompleteNotifyCFAData.SerialiseL(data);
       
   288 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyCallForwardingActiveIndId, KErrNone, data);
       
   289 	
       
   290 	//Wait for NotifyCallForwardingActive
       
   291 	User::WaitForRequest(notifyCallForwardingActiveStatus);
       
   292 	ASSERT_EQUALS(KErrNone, notifyCallForwardingActiveStatus.Int());
       
   293 	ASSERT_EQUALS(service, completeService);
       
   294 	ASSERT_EQUALS(active, completeActive);
       
   295 	
       
   296 	// prepare ltsy to accept the CRetrieveMobilePhoneCFList::Start
       
   297 	
       
   298 	//CFilteringActiveScheduler does not need to be used, this should be changed
       
   299 	//to a listretrieverao type class
       
   300 	CFilteringActiveScheduler* scheduler = new (ELeave) CFilteringActiveScheduler();
       
   301 	CleanupStack::PushL(scheduler);
       
   302 	CActiveScheduler::Install(scheduler);
       
   303 	RMobilePhone::TMobilePhoneCFCondition getCondition = RMobilePhone::ECallForwardingBusy;
       
   304 	RMobilePhone::TMobileService getServiceGroup = RMobilePhone::EVoiceService;
       
   305 	TMockLtsyData2<RMobilePhone::TMobilePhoneCFCondition, RMobilePhone::TMobileService> mockCompleteGetData(getCondition,getServiceGroup);
       
   306 	data.Close();
       
   307 	mockCompleteGetData.SerialiseL(data);
       
   308 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesGetCallForwardingStatus::KLtsyDispatchSupplementaryServicesGetCallForwardingStatusApiId, data, KErrNone);	
       
   309 
       
   310 	// Get the call forwarding list
       
   311 	TRequestStatus requestStatusGet;
       
   312 	RMobilePhone::TMobilePhoneCFCondition condition = getCondition;
       
   313 	RMobilePhone::TMobileService serviceGroup = getServiceGroup;
       
   314 	CRetrieveMobilePhoneCFList* asyncRetrieveMobilePhoneCFList =
       
   315 	                                       CRetrieveMobilePhoneCFList::NewL(iPhone);    
       
   316 	CleanupStack::PushL(asyncRetrieveMobilePhoneCFList);
       
   317 	CActiveRetriever::ResetRequestsNumber();
       
   318 	CActiveRetriever* activeRetriever = 
       
   319 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCFList);
       
   320 	CleanupStack::PushL(activeRetriever);
       
   321 	scheduler->AddRetrieverL(*activeRetriever);
       
   322 	asyncRetrieveMobilePhoneCFList->Start(activeRetriever->iStatus, condition, serviceGroup);
       
   323 	activeRetriever->Activate();
       
   324 	
       
   325 	// Complete get call forwarding list
       
   326 	CMobilePhoneCFList* completeCFList = CMobilePhoneCFList::NewL();
       
   327 	CleanupStack::PushL(completeCFList);
       
   328 	RMobilePhone::TMobilePhoneCFInfoEntryV1	entryCFInfoEntry;
       
   329 	entryCFInfoEntry.iTimeout              = 20;
       
   330 	entryCFInfoEntry.iCondition            = RMobilePhone::ECallForwardingUnconditional;
       
   331 	entryCFInfoEntry.iServiceGroup         = RMobilePhone::EVoiceService;
       
   332 	entryCFInfoEntry.iStatus               = RMobilePhone::ECallForwardingStatusNotProvisioned;
       
   333 	entryCFInfoEntry.iNumber.iTypeOfNumber = RMobilePhone::EInternationalNumber;
       
   334 	entryCFInfoEntry.iNumber.iNumberPlan   = RMobilePhone::EIsdnNumberPlan;
       
   335 	entryCFInfoEntry.iNumber.iTelNumber.Copy(KTelNumber);
       
   336 	completeCFList->AddEntryL(entryCFInfoEntry);
       
   337 	entryCFInfoEntry.iTimeout              = 15;
       
   338 	entryCFInfoEntry.iCondition            = RMobilePhone::ECallForwardingNoReply;
       
   339 	entryCFInfoEntry.iServiceGroup         = RMobilePhone::EServiceUnspecified;
       
   340 	entryCFInfoEntry.iStatus               = RMobilePhone::ECallForwardingStatusActive;
       
   341 	entryCFInfoEntry.iNumber.iTypeOfNumber = RMobilePhone::ENationalNumber;
       
   342 	entryCFInfoEntry.iNumber.iNumberPlan   = RMobilePhone::ENationalNumberPlan;
       
   343 	_LIT(KTelNumber2,"123456789");
       
   344 	entryCFInfoEntry.iNumber.iTelNumber.Copy(KTelNumber2);
       
   345 	completeCFList->AddEntryL(entryCFInfoEntry);
       
   346 	CBufBase* completeCFListBuf = completeCFList->StoreLC();
       
   347 	data.Create(completeCFListBuf->Ptr(0));
       
   348     iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesGetCallForwardingStatus::KLtsyDispatchSupplementaryServicesGetCallForwardingStatusApiId, KErrNone, data);
       
   349 
       
   350 	//Wait for CRetrieveMobilePhoneCFList::Start
       
   351 	scheduler->StartScheduler();
       
   352 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
   353 	CMobilePhoneCFList *list = asyncRetrieveMobilePhoneCFList->RetrieveListL();
       
   354 	ASSERT_EQUALS(*completeCFList,*list);
       
   355 	AssertMockLtsyStatusL();
       
   356 	CleanupStack::PopAndDestroy(7, this); // completeCFListBuf, completeCFList, activeRetriever, asyncRetrieveMobilePhoneCFList, scheduler, data, this
       
   357 	}
       
   358 
       
   359 /**
       
   360 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UC0002
       
   361 @SYMComponent telephony_ctsy
       
   362 @SYMTestCaseDesc Test support in CTSY for send a network service request string (with and without FDN check)
       
   363 @SYMTestPriority High
       
   364 @SYMTestActions Invokes RMobilePhone::SendNetworkServiceRequest, RMobilePhone::SendNetworkServiceRequestNoFdnCheck
       
   365 @SYMTestExpectedResults Pass
       
   366 @SYMTestType CT
       
   367  */
       
   368 void CCTsySupplementaryServicesFU::TestUseCase0002L()
       
   369 	{
       
   370 	OpenEtelServerL(EUseExtendedError);
       
   371 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   372 	OpenPhoneL();
       
   373 
       
   374 	RBuf8 data;
       
   375 	CleanupClosePushL(data);	
       
   376 
       
   377 	// prepare ltsy to accept and answer the SendNetworkServiceRequest
       
   378 	_LIT(KMsg1,"SendNetworkServiceRequest1.1");
       
   379 	TName expServiceString(KMsg1);
       
   380  	TMockLtsyData1<TName > expLtsyData(expServiceString);
       
   381     expLtsyData.SerialiseL(data);
       
   382 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSendNetworkServiceRequest::KLtsyDispatchSupplementaryServicesSendNetworkServiceRequestApiId, data, KErrNone);
       
   383 	
       
   384 	// Send Network Service Request
       
   385 	TRequestStatus sendNetworkServiceRequestStatus;
       
   386 	iPhone.SendNetworkServiceRequest(sendNetworkServiceRequestStatus,expServiceString);
       
   387 	ASSERT_EQUALS(KRequestPending, sendNetworkServiceRequestStatus.Int());
       
   388 
       
   389 	// complete notify SendNetworkServiceRequest
       
   390 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSendNetworkServiceRequest::KLtsyDispatchSupplementaryServicesSendNetworkServiceRequestApiId, KErrNone);
       
   391 	
       
   392 	//Wait for NotifyCallForwardingActive
       
   393 	User::WaitForRequest(sendNetworkServiceRequestStatus);
       
   394 	ASSERT_EQUALS(KErrNone, sendNetworkServiceRequestStatus.Int());
       
   395 
       
   396 	// prepare ltsy to accept and answer the SendNetworkServiceRequestNoFdnCheck
       
   397 	_LIT(KMsg2,"SendNetworkServiceRequest1.2");
       
   398 	TName expServiceStringNoFDN(KMsg2);
       
   399  	TMockLtsyData1<TName > expLtsyDataNoFDN(expServiceStringNoFDN);
       
   400  	expLtsyDataNoFDN.SerialiseL(data);
       
   401 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSendNetworkServiceRequestNoFdnCheck::KLtsyDispatchSupplementaryServicesSendNetworkServiceRequestNoFdnCheckApiId, data, KErrNone);
       
   402 	
       
   403 	// Send Network Service Request
       
   404 	TRequestStatus sendNetworkServiceRequestNoFDNStatus;
       
   405 	iPhone.SendNetworkServiceRequestNoFdnCheck(sendNetworkServiceRequestNoFDNStatus,expServiceStringNoFDN);
       
   406 	ASSERT_EQUALS(KRequestPending, sendNetworkServiceRequestNoFDNStatus.Int());
       
   407 
       
   408 	// complete notify SendNetworkServiceRequestNoFDNCheck
       
   409 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSendNetworkServiceRequestNoFdnCheck::KLtsyDispatchSupplementaryServicesSendNetworkServiceRequestNoFdnCheckApiId, KErrNone);
       
   410 
       
   411 	//Wait for SendNetworkServiceRequestNoFDNCheck
       
   412 	User::WaitForRequest(sendNetworkServiceRequestNoFDNStatus);
       
   413 	ASSERT_EQUALS(KErrNone, sendNetworkServiceRequestNoFDNStatus.Int());
       
   414 	AssertMockLtsyStatusL();
       
   415 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   416 	}
       
   417 
       
   418 /**
       
   419 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UC0003
       
   420 @SYMComponent telephony_ctsy
       
   421 @SYMTestCaseDesc Test support in CTSY for send a USSD request to the network
       
   422 @SYMTestPriority High
       
   423 @SYMTestActions Invokes RMobileUssdMessaging::ReceiveMessage, RMobileUssdMessaging::SendMessage, RMobileUssdMessaging::SendRelease
       
   424 @SYMTestExpectedResults Pass
       
   425 @SYMTestType CT
       
   426  */
       
   427 void CCTsySupplementaryServicesFU::TestUseCase0003L()
       
   428 	{
       
   429 	OpenEtelServerL(EUseExtendedError);
       
   430 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   431 	OpenPhoneL();
       
   432 
       
   433 	RBuf8 data;
       
   434 	CleanupClosePushL(data);	
       
   435 	RMobileUssdMessaging ussdMessaging;
       
   436 	ASSERT_EQUALS(KErrNone, ussdMessaging.Open(iPhone));
       
   437 	CleanupClosePushL(ussdMessaging);
       
   438 
       
   439 	// Request CTSY to notify for USSD message
       
   440 	RMobileUssdMessaging::TGsmUssdMessageData recvData;
       
   441 	RMobileUssdMessaging::TMobileUssdAttributesV1 recvAttr; 
       
   442 	RMobileUssdMessaging::TMobileUssdAttributesV1Pckg recvAttrPckg(recvAttr);
       
   443 	TRequestStatus receiveMessageStatus;
       
   444 	ussdMessaging.ReceiveMessage(receiveMessageStatus,recvData,recvAttrPckg);
       
   445 	ASSERT_EQUALS(KRequestPending, receiveMessageStatus.Int());
       
   446 	
       
   447 	
       
   448 	// prepare ltsy to accept the SendMessage
       
   449 	_LIT8(KMsg1,"SendMessage1.1");
       
   450 	RMobileUssdMessaging::TGsmUssdMessageData expSendData(KMsg1);
       
   451 	RMobileUssdMessaging::TMobileUssdAttributesV1 expSendAttr;
       
   452 	expSendAttr.iDcs = 50;
       
   453 	expSendAttr.iFormat = RMobileUssdMessaging::EFormatUnspecified;
       
   454 	expSendAttr.iType = RMobileUssdMessaging::EUssdMORequest;
       
   455 	expSendAttr.iFlags = RMobileUssdMessaging::KUssdDataFormat | RMobileUssdMessaging::KUssdMessageType | RMobileUssdMessaging::KUssdMessageDcs;
       
   456  	TMockLtsyData2<RMobileUssdMessaging::TGsmUssdMessageData, RMobileUssdMessaging::TMobileUssdAttributesV1> expLtsySendData(expSendData, expSendAttr);
       
   457  	expLtsySendData.SerialiseL(data);
       
   458 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSendUssdMessage::KLtsyDispatchSupplementaryServicesSendUssdMessageApiId, data, KErrNone);
       
   459 	
       
   460 	// Send USSD Message
       
   461 	TRequestStatus sendMessageStatus;
       
   462 	RMobileUssdMessaging::TMobileUssdAttributesV1Pckg sendAttrPckg(expSendAttr);
       
   463 	ussdMessaging.SendMessage(sendMessageStatus,expSendData,sendAttrPckg);
       
   464 	ASSERT_EQUALS(KRequestPending, sendMessageStatus.Int());
       
   465 	ASSERT_EQUALS(KRequestPending, receiveMessageStatus.Int());
       
   466 
       
   467 	// complete SendMessage
       
   468 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSendUssdMessage::KLtsyDispatchSupplementaryServicesSendUssdMessageApiId, KErrNone);
       
   469 	
       
   470 	//Wait for SendMessage
       
   471 	User::WaitForRequest(sendMessageStatus);
       
   472 	ASSERT_EQUALS(KErrNone, sendMessageStatus.Int());
       
   473 	ASSERT_EQUALS(KRequestPending, receiveMessageStatus.Int());
       
   474 
       
   475 	// complete ReceiveMessage
       
   476 	_LIT8(KMsg2,"ReceiveMessage1.2");
       
   477 	TDesC8* messagePtr = const_cast<TDesC8*>(&KMsg2);
       
   478 	RMobileUssdMessaging::TMobileUssdAttributesV1 compRecvAttr;
       
   479 	compRecvAttr.iDcs = 16;
       
   480 	compRecvAttr.iFormat = RMobileUssdMessaging::EFormatUnspecified;
       
   481 	compRecvAttr.iType = RMobileUssdMessaging::EUssdMTReply;
       
   482 	compRecvAttr.iFlags = RMobileUssdMessaging::KUssdDataFormat | RMobileUssdMessaging::KUssdMessageType | RMobileUssdMessaging::KUssdMessageDcs;
       
   483 	TMockLtsyData2<TDesC8*, RMobileUssdMessaging::TMobileUssdAttributesV1> mockCompleteReceiveMessageData(messagePtr,compRecvAttr);
       
   484 	data.Close();
       
   485 	mockCompleteReceiveMessageData.SerialiseL(data);
       
   486 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesReceiveUssdMessageIndId, KErrNone, data);
       
   487 
       
   488 	//Wait for ReceiveMessage
       
   489 	User::WaitForRequest(receiveMessageStatus);
       
   490 	ASSERT_EQUALS(KErrNone, receiveMessageStatus.Int());
       
   491 	ASSERT_TRUE(recvData == *messagePtr);
       
   492 	ASSERT_EQUALS(recvAttr.iDcs, compRecvAttr.iDcs);
       
   493 	ASSERT_EQUALS(recvAttr.iFormat, compRecvAttr.iFormat);
       
   494 	ASSERT_EQUALS(recvAttr.iType, compRecvAttr.iType);
       
   495 	ASSERT_EQUALS(recvAttr.iFlags, compRecvAttr.iFlags);
       
   496 
       
   497 	// prepare ltsy to accept the SendRelease
       
   498 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSendUssdRelease::KLtsyDispatchSupplementaryServicesSendUssdReleaseApiId, KErrNone);
       
   499 	
       
   500 	// Send USSD Release
       
   501 	TRequestStatus sendReleaseStatus;
       
   502 	RMobilePhone::TMobilePhoneSendSSRequestV3 sendSSRequest;
       
   503 	RMobilePhone::TMobilePhoneSendSSRequestV3Pckg sendSSRequestPckg(sendSSRequest);
       
   504 	ussdMessaging.SendRelease(sendReleaseStatus,sendSSRequestPckg);
       
   505 	ASSERT_EQUALS(KRequestPending, sendReleaseStatus.Int());
       
   506 
       
   507 	// complete SendRelease
       
   508 	RMobilePhone::TMobilePhoneSendSSRequestV3 compSendSSRequest;
       
   509 	_LIT(KMsg3,"SendRelease1.3");
       
   510 	compSendSSRequest.iAdditionalInfo = KMsg3;
       
   511 	compSendSSRequest.iOpCode = 14;
       
   512  	TMockLtsyData1<RMobilePhone::TMobilePhoneSendSSRequestV3> expLtsySendRelease(compSendSSRequest);
       
   513 	data.Close();
       
   514  	expLtsySendRelease.SerialiseL(data);
       
   515 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSendUssdRelease::KLtsyDispatchSupplementaryServicesSendUssdReleaseApiId, KErrNone, data);
       
   516 	
       
   517 	//Wait for SendRelease
       
   518 	User::WaitForRequest(sendReleaseStatus);
       
   519 	ASSERT_EQUALS(KErrNone, sendReleaseStatus.Int());
       
   520 	// CTSY defect:  defect id 380202 in the component tests. SendRelease does not propogate the return values into ETEL  
       
   521 	//ASSERT_EQUALS(compSendSSRequest.iAdditionalInfo, sendSSRequest.iAdditionalInfo);
       
   522 	//ASSERT_EQUALS(compSendSSRequest.iOpCode, sendSSRequest.iOpCode);
       
   523 	AssertMockLtsyStatusL();
       
   524 	CleanupStack::PopAndDestroy(3, this); // ussdMessaging, data, this
       
   525 	}
       
   526 
       
   527 /**
       
   528 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UC0004
       
   529 @SYMComponent telephony_ctsy
       
   530 @SYMTestCaseDesc Test support in CTSY for notify, set and get the call barring
       
   531 @SYMTestPriority High
       
   532 @SYMTestActions Invokes RMobilePhone::SetCallBarringStatus, RMobilePhone::NotifyCallBarringStatusChange, CRetrieveMobilePhoneCBList::Start
       
   533 @SYMTestExpectedResults Pass
       
   534 @SYMTestType CT
       
   535  */
       
   536 void CCTsySupplementaryServicesFU::TestUseCase0004L()
       
   537 	{
       
   538 	OpenEtelServerL(EUseExtendedError);
       
   539 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   540 	OpenPhoneL();
       
   541 
       
   542 	RBuf8 data;
       
   543 	CleanupClosePushL(data);	
       
   544 
       
   545 	// prepare ltsy to accept the CRetrieveMobilePhoneCBList::Start
       
   546 	
       
   547 	//CFilteringActiveScheduler does not need to be used, this should be changed
       
   548 	//to a listretrieverao type class
       
   549 	CFilteringActiveScheduler* scheduler = new (ELeave) CFilteringActiveScheduler();
       
   550 	CleanupStack::PushL(scheduler);
       
   551 	CActiveScheduler::Install(scheduler);
       
   552 	RMobilePhone::TMobilePhoneCBCondition getCondition = RMobilePhone::EBarOutgoingInternational;
       
   553 	TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> mockCompleteGetData(getCondition);
       
   554 	data.Close();
       
   555 	mockCompleteGetData.SerialiseL(data);
       
   556 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesGetCallBarringStatus::KLtsyDispatchSupplementaryServicesGetCallBarringStatusApiId, data, KErrNone);	
       
   557 
       
   558 	// Get the call barring list
       
   559 	TRequestStatus requestStatusGet;
       
   560 	RMobilePhone::TMobilePhoneCBCondition condition = getCondition;
       
   561 	CRetrieveMobilePhoneCBList* asyncRetrieveMobilePhoneCBList = CRetrieveMobilePhoneCBList::NewL(iPhone);    
       
   562 	CleanupStack::PushL(asyncRetrieveMobilePhoneCBList);
       
   563 	CActiveRetriever::ResetRequestsNumber();
       
   564 	CActiveRetriever* activeRetriever = 
       
   565 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCBList);
       
   566 	CleanupStack::PushL(activeRetriever);
       
   567 	scheduler->AddRetrieverL(*activeRetriever);
       
   568 	asyncRetrieveMobilePhoneCBList->Start(activeRetriever->iStatus, condition);
       
   569 	activeRetriever->Activate();
       
   570 	
       
   571 	// Complete get call barring list
       
   572 	CMobilePhoneCBList* completeCBList = CMobilePhoneCBList::NewL();
       
   573 	CleanupStack::PushL(completeCBList);
       
   574 	RMobilePhone::TMobilePhoneCBInfoEntryV1	entryCBInfoEntry;
       
   575 	entryCBInfoEntry.iCondition = RMobilePhone::EBarOutgoingInternational;
       
   576 	entryCBInfoEntry.iStatus = RMobilePhone::ECallBarringStatusActive;
       
   577 	entryCBInfoEntry.iServiceGroup = RMobilePhone::EFaxService;
       
   578 	completeCBList->AddEntryL(entryCBInfoEntry);
       
   579 	entryCBInfoEntry.iCondition = RMobilePhone::EBarIncomingRoaming;
       
   580 	entryCBInfoEntry.iStatus = RMobilePhone::ECallBarringStatusNotProvisioned;
       
   581 	entryCBInfoEntry.iServiceGroup = RMobilePhone::EAllDataTele;
       
   582 	completeCBList->AddEntryL(entryCBInfoEntry);
       
   583 	CBufBase* completeCBListBuf = completeCBList->StoreLC();
       
   584 	data.Create(completeCBListBuf->Ptr(0));
       
   585     iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesGetCallBarringStatus::KLtsyDispatchSupplementaryServicesGetCallBarringStatusApiId, KErrNone, data);
       
   586 
       
   587 	//Wait for CRetrieveMobilePhoneCBList::Start
       
   588 	scheduler->StartScheduler();
       
   589 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
   590 	CMobilePhoneCBList *list = asyncRetrieveMobilePhoneCBList->RetrieveListL();
       
   591 	ASSERT_EQUALS(*completeCBList,*list);
       
   592 
       
   593 	// post NotifyCallBarringStatusChange 
       
   594 	TRequestStatus notifyCallBarringStatusChangeStatus;
       
   595 	RMobilePhone::TMobilePhoneCBCondition notifyCondition; 
       
   596 	iPhone.NotifyCallBarringStatusChange(notifyCallBarringStatusChangeStatus, notifyCondition);
       
   597 	ASSERT_EQUALS(KRequestPending, notifyCallBarringStatusChangeStatus.Int());
       
   598 
       
   599 	// prepare ltsy to accept and answer the SetCallBarringStatus
       
   600 	RMobilePhone::TMobilePhoneCBCondition setCondition = RMobilePhone::EBarIncomingRoaming;
       
   601 	RMobilePhone::TMobilePhoneCBChangeV1 setInfo;
       
   602 	setInfo.iAction = RMobilePhone::EServiceActionDeactivate;
       
   603 	setInfo.iServiceGroup = RMobilePhone::EPadAccess;
       
   604 	_LIT(KPassword,"1234");
       
   605 	setInfo.iPassword = KPassword;
       
   606 	TMockLtsyData2<RMobilePhone::TMobilePhoneCBCondition, RMobilePhone::TMobilePhoneCBChangeV1> mockCompleteSetData(setCondition,setInfo);
       
   607 	data.Close();
       
   608 	mockCompleteSetData.SerialiseL(data);
       
   609 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSetCallBarringStatus::KLtsyDispatchSupplementaryServicesSetCallBarringStatusApiId, data, KErrNone);
       
   610 	
       
   611 	// call to RMobilePhone::SetCallBarringStatus
       
   612 	TRequestStatus requestStatusSet;
       
   613 	iPhone.SetCallBarringStatus(requestStatusSet, setCondition, setInfo);
       
   614 	ASSERT_EQUALS(KRequestPending, notifyCallBarringStatusChangeStatus.Int());
       
   615 	ASSERT_EQUALS(KRequestPending, requestStatusSet.Int());
       
   616 
       
   617 	// complete SetCallBarringStatus
       
   618 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSetCallBarringStatus::KLtsyDispatchSupplementaryServicesSetCallBarringStatusApiId, KErrNone);
       
   619 	
       
   620 	//Wait for SetCallBarringStatus
       
   621 	User::WaitForRequest(requestStatusSet);
       
   622 	ASSERT_EQUALS(KRequestPending, notifyCallBarringStatusChangeStatus.Int());
       
   623 	ASSERT_EQUALS(KErrNone, requestStatusSet.Int());
       
   624 	
       
   625 	// complete NotifyCallBarringStatusChange
       
   626 	RMobilePhone::TMobilePhoneCBCondition completeCondition = RMobilePhone::EBarIncomingRoaming;
       
   627 	TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> mockCompleteNotifyCallBarringStatusChangeData(completeCondition);
       
   628 	data.Close();
       
   629 	mockCompleteNotifyCallBarringStatusChangeData.SerialiseL(data);
       
   630 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyCallBarringStatusChangeIndId, KErrNone, data);
       
   631 	
       
   632 	//Wait for NotifyCallBarringStatusChange
       
   633 	User::WaitForRequest(notifyCallBarringStatusChangeStatus);
       
   634 	ASSERT_EQUALS(KErrNone, notifyCallBarringStatusChangeStatus.Int());
       
   635 	ASSERT_EQUALS(notifyCondition, completeCondition);
       
   636 	AssertMockLtsyStatusL();
       
   637 	CleanupStack::PopAndDestroy(7, this); // completeCBListBuf, completeCBList, activeRetriever, asyncRetrieveMobilePhoneCBList, scheduler, data, this
       
   638 	}
       
   639 
       
   640 /**
       
   641 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UC0005
       
   642 @SYMComponent telephony_ctsy
       
   643 @SYMTestCaseDesc Test support in CTSY for notify, set and get the call waiting
       
   644 @SYMTestPriority High
       
   645 @SYMTestActions Invokes RMobilePhone::SetCallWaitingStatus, RMobilePhone::NotifyCallWaitingStatusChange, CRetrieveMobilePhoneCWList::Start
       
   646 @SYMTestExpectedResults Pass
       
   647 @SYMTestType CT
       
   648  */
       
   649 void CCTsySupplementaryServicesFU::TestUseCase0005L()
       
   650 	{
       
   651 	OpenEtelServerL(EUseExtendedError);
       
   652 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   653 	OpenPhoneL();
       
   654 
       
   655 	RBuf8 data;
       
   656 	CleanupClosePushL(data);	
       
   657 
       
   658 	// prepare ltsy to accept the CRetrieveMobilePhoneCWList::Start
       
   659 	
       
   660 	//CFilteringActiveScheduler does not need to be used, this should be changed
       
   661 	//to a listretrieverao type class
       
   662 	CFilteringActiveScheduler* scheduler = new (ELeave) CFilteringActiveScheduler();
       
   663 	CleanupStack::PushL(scheduler);
       
   664 	CActiveScheduler::Install(scheduler);
       
   665 	
       
   666 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesGetCallWaitingStatus::KLtsyDispatchSupplementaryServicesGetCallWaitingStatusApiId, KErrNone);	
       
   667 
       
   668 	// Get the call waiting list
       
   669 	TRequestStatus requestStatusGet;
       
   670 	CRetrieveMobilePhoneCWList* asyncRetrieveMobilePhoneCWList = CRetrieveMobilePhoneCWList::NewL(iPhone);    
       
   671 	CleanupStack::PushL(asyncRetrieveMobilePhoneCWList);
       
   672 	CActiveRetriever::ResetRequestsNumber();
       
   673 	CActiveRetriever* activeRetriever = 
       
   674 						CActiveRetriever::NewL(*asyncRetrieveMobilePhoneCWList);
       
   675 	CleanupStack::PushL(activeRetriever);
       
   676 	scheduler->AddRetrieverL(*activeRetriever);
       
   677 	asyncRetrieveMobilePhoneCWList->Start(activeRetriever->iStatus);
       
   678 	activeRetriever->Activate();
       
   679 	
       
   680 	// Complete get call waiting list
       
   681 	CMobilePhoneCWList* completeCWList = CMobilePhoneCWList::NewL();
       
   682 	CleanupStack::PushL(completeCWList);
       
   683 	RMobilePhone::TMobilePhoneCWInfoEntryV1	entryCWInfoEntry;
       
   684 	entryCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusActive;
       
   685 	entryCWInfoEntry.iServiceGroup = RMobilePhone::EFaxService;
       
   686 	completeCWList->AddEntryL(entryCWInfoEntry);
       
   687 	entryCWInfoEntry.iStatus = RMobilePhone::ECallWaitingStatusNotProvisioned;
       
   688 	entryCWInfoEntry.iServiceGroup = RMobilePhone::EAllDataTele;
       
   689 	completeCWList->AddEntryL(entryCWInfoEntry);
       
   690 	CBufBase* completeCWListBuf = completeCWList->StoreLC();
       
   691 	data.Create(completeCWListBuf->Ptr(0));
       
   692     iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesGetCallWaitingStatus::KLtsyDispatchSupplementaryServicesGetCallWaitingStatusApiId, KErrNone, data);
       
   693 
       
   694 	//Wait for CRetrieveMobilePhoneCWList::Start
       
   695 	scheduler->StartScheduler();
       
   696 	ASSERT_EQUALS(KErrNone, activeRetriever->iStatus.Int());
       
   697 	CMobilePhoneCWList *list = asyncRetrieveMobilePhoneCWList->RetrieveListL();
       
   698 	ASSERT_EQUALS(*completeCWList,*list);
       
   699 
       
   700 	// post NotifyCallWaitingStatusChange
       
   701 	TRequestStatus notifyCallWaitingStatusChangeStatus;
       
   702     RMobilePhone::TMobilePhoneCWInfoEntryV1 notifyResult;
       
   703     RMobilePhone::TMobilePhoneCWInfoEntryV1Pckg notifyResultPckg(notifyResult);
       
   704 	iPhone.NotifyCallWaitingStatusChange(notifyCallWaitingStatusChangeStatus, notifyResultPckg);
       
   705 	ASSERT_EQUALS(KRequestPending, notifyCallWaitingStatusChangeStatus.Int());
       
   706 
       
   707 	// prepare ltsy to accept and answer the SetCallWaitingStatus
       
   708     RMobilePhone::TMobileService setService = RMobilePhone::EPadAccess;
       
   709     RMobilePhone::TMobilePhoneServiceAction setAction = RMobilePhone::EServiceActionActivate;
       
   710 	TMockLtsyData2<RMobilePhone::TMobileService, RMobilePhone::TMobilePhoneServiceAction> mockCompleteSetData(setService,setAction );
       
   711 	data.Close();
       
   712 	mockCompleteSetData.SerialiseL(data);
       
   713 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSetCallWaitingStatus::KLtsyDispatchSupplementaryServicesSetCallWaitingStatusApiId, data, KErrNone);
       
   714 	
       
   715 	// call to RMobilePhone::SetCallWaitingStatus
       
   716 	TRequestStatus requestStatusSet;
       
   717 	iPhone.SetCallWaitingStatus(requestStatusSet, setService, setAction);
       
   718 	ASSERT_EQUALS(KRequestPending, notifyCallWaitingStatusChangeStatus.Int());
       
   719 	ASSERT_EQUALS(KRequestPending, requestStatusSet.Int());
       
   720 
       
   721 	// complete SetCallWaitingStatus
       
   722 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSetCallWaitingStatus::KLtsyDispatchSupplementaryServicesSetCallWaitingStatusApiId, KErrNone);
       
   723 	
       
   724 	//Wait for SetCallWaitingStatus
       
   725 	User::WaitForRequest(requestStatusSet);
       
   726 	ASSERT_EQUALS(KRequestPending, notifyCallWaitingStatusChangeStatus.Int());
       
   727 	ASSERT_EQUALS(KErrNone, requestStatusSet.Int());
       
   728 	
       
   729 	// complete NotifyCallWaitingStatusChange
       
   730 	RMobilePhone::TMobileService completeService = RMobilePhone::EAllTele;
       
   731     RMobilePhone::TMobilePhoneCWStatus completeStatus = RMobilePhone::ECallWaitingStatusNotAvailable;
       
   732 	TMockLtsyData2<RMobilePhone::TMobileService, RMobilePhone::TMobilePhoneCWStatus> mockCompleteNotifyCallWaitingStatusChangeData(completeService, completeStatus);
       
   733 	data.Close();
       
   734 	mockCompleteNotifyCallWaitingStatusChangeData.SerialiseL(data);
       
   735 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyCallWaitingStatusChangeIndId, KErrNone, data);
       
   736 	
       
   737 	//Wait for NotifyCallWaitingStatusChange
       
   738 	User::WaitForRequest(notifyCallWaitingStatusChangeStatus);
       
   739 	ASSERT_EQUALS(KErrNone, notifyCallWaitingStatusChangeStatus.Int());
       
   740 	ASSERT_EQUALS(notifyResult.iStatus, completeStatus);
       
   741 	ASSERT_EQUALS(notifyResult.iServiceGroup, completeService);
       
   742 	AssertMockLtsyStatusL();
       
   743 	CleanupStack::PopAndDestroy(7, this); // completeCBListBuf, completeCBList, activeRetriever, asyncRetrieveMobilePhoneCBList, scheduler, data, this
       
   744 	}
       
   745 
       
   746 //
       
   747 // Other unit tests
       
   748 //
       
   749 
       
   750 /**
       
   751 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0001
       
   752 @SYMComponent telephony_ctsy
       
   753 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetSSPassword
       
   754 @SYMTestPriority High
       
   755 @SYMTestActions Invokes RMobilePhone::SetSSPassword
       
   756 @SYMTestExpectedResults Pass
       
   757 @SYMTestType UT
       
   758  */
       
   759 void CCTsySupplementaryServicesFU::TestUnit0001L()
       
   760 	{
       
   761 	OpenEtelServerL(EUseExtendedError);
       
   762 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   763 	OpenPhoneL();
       
   764 
       
   765 	RBuf8 data;
       
   766 	CleanupClosePushL(data);
       
   767 	
       
   768 	// Prepare LTSY to answer RMobilePhone::SetSSPassword
       
   769 	_LIT(KOldPassword,"oldPswd");
       
   770 	_LIT(KNewPassword,"newPswd");
       
   771 	RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange;
       
   772 	pwdChange.iOldPassword.Copy(KOldPassword);
       
   773 	pwdChange.iNewPassword.Copy(KNewPassword);
       
   774 	pwdChange.iVerifiedPassword.Copy(KNewPassword);
       
   775 	TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange);
       
   776 	MLtsyDispatchSupplementaryServicesSetSsPassword::TServiceType service = MLtsyDispatchSupplementaryServicesSetSsPassword::ECallBarring;
       
   777 	TMockLtsyData2<RMobilePhone::TMobilePhonePasswordChangeV2, MLtsyDispatchSupplementaryServicesSetSsPassword::TServiceType> ssData(pwdChange, service);
       
   778 	ssData.SerialiseL(data);
       
   779 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSetSsPassword::KLtsyDispatchSupplementaryServicesSetSsPasswordApiId, data, KErrNone);
       
   780 
       
   781 	// complete notify SetSSPassword
       
   782 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSetSsPassword::KLtsyDispatchSupplementaryServicesSetSsPasswordApiId, KErrNone);
       
   783 
       
   784 	// Send Network Service Request
       
   785 	TRequestStatus setSSPasswordStatus;
       
   786 	iPhone.SetSSPassword(setSSPasswordStatus,password,service);
       
   787 	ASSERT_EQUALS(KRequestPending, setSSPasswordStatus.Int());
       
   788 	
       
   789 	//Wait for SetSSPassword
       
   790 	User::WaitForRequest(setSSPasswordStatus);
       
   791 	ASSERT_EQUALS(KErrNone, setSSPasswordStatus.Int());
       
   792 
       
   793 	AssertMockLtsyStatusL();
       
   794 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   795 	
       
   796 	}
       
   797 	
       
   798 	
       
   799 	
       
   800 /**
       
   801 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0002
       
   802 @SYMComponent telephony_ctsy
       
   803 @SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::ClearCallBlackList
       
   804 @SYMTestPriority High
       
   805 @SYMTestActions Invokes RMmCustomAPI::ClearCallBlackList
       
   806 @SYMTestExpectedResults Pass
       
   807 @SYMTestType UT
       
   808  */
       
   809 void CCTsySupplementaryServicesFU::TestUnit0002L()
       
   810 	{
       
   811 	OpenEtelServerL(EUseExtendedError);
       
   812 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   813 	OpenPhoneL();
       
   814 
       
   815 	RBuf8 data;
       
   816 	CleanupClosePushL(data);
       
   817 
       
   818 	RMmCustomAPI customApi;
       
   819 	OpenCustomApiLC(customApi);
       
   820 	
       
   821 	// Prepare LTSY to answer RMmCustomAPI::ClearCallBlackList
       
   822 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesClearBlacklist::KLtsyDispatchSupplementaryServicesClearBlacklistApiId, KErrNone);
       
   823 
       
   824 	// complete ClearCallBlackList request
       
   825 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesClearBlacklist::KLtsyDispatchSupplementaryServicesClearBlacklistApiId, KErrNone);
       
   826 
       
   827 	// Send Network Service Request
       
   828 	TRequestStatus clearBlacklistStatus;
       
   829 	customApi.ClearCallBlackList(clearBlacklistStatus);
       
   830 	ASSERT_EQUALS(KRequestPending, clearBlacklistStatus.Int());
       
   831 	
       
   832 	//Wait for ClearCallBlackList
       
   833 	User::WaitForRequest(clearBlacklistStatus);
       
   834 	ASSERT_EQUALS(KErrNone, clearBlacklistStatus.Int());
       
   835 
       
   836 	AssertMockLtsyStatusL();
       
   837 	CleanupStack::PopAndDestroy(3, this); // customApi, data, this
       
   838 	
       
   839 	}
       
   840 	
       
   841 	
       
   842 
       
   843 
       
   844 
       
   845 /**
       
   846 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0003
       
   847 @SYMComponent telephony_ctsy
       
   848 @SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::GetDiagnosticInfo
       
   849 @SYMTestPriority High
       
   850 @SYMTestActions Invokes RMmCustomAPI::GetDiagnosticInfo
       
   851 @SYMTestExpectedResults Pass
       
   852 @SYMTestType UT
       
   853  */
       
   854 void CCTsySupplementaryServicesFU::TestUnit0003L()
       
   855 	{
       
   856 	// available causes, details in 3gpp 24.008 
       
   857 	static const TUint8 KDiagnosticInfoBarredWithCUG = 0x81;
       
   858 	static const TUint8 KDiagnosticInfoBarredNoCUG = 0x82;
       
   859 	static const TUint8 KDiagnosticInfoBarredUnknownCUG = 0x83;
       
   860 	static const TUint8 KDiagnosticInfoBarredIncompatibleCUG = 0x84;
       
   861 	static const TUint8 KDiagnosticInfoBarredFailureCUG = 0x85;
       
   862 	static const TUint8 KDiagnosticInfoBarredClirNotSubscribed = 0x86;
       
   863 	static const TUint8 KDiagnosticInfoBarredCCBSPossible = 0x87;
       
   864 	static const TUint8 KDiagnosticInfoBarredCCBSNotPossible = 0x88;
       
   865 	static const TUint8 KDiagnosticInfoBarredWrong = 0x89;
       
   866 	
       
   867 	OpenEtelServerL(EUseExtendedError);
       
   868 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   869 	OpenPhoneL();
       
   870 
       
   871 	RBuf8 data;
       
   872 	CleanupClosePushL(data);
       
   873 
       
   874 	RMmCustomAPI customApi;
       
   875 	OpenCustomApiLC(customApi);
       
   876 	
       
   877 	TInt callId = 1;
       
   878 	DriverDialCallL(callId, RMobilePhone::EVoiceService);
       
   879 
       
   880 	RMobileLine mobileLine;
       
   881 	CleanupClosePushL(mobileLine);
       
   882 	RMobileCall mobileCall;
       
   883 	CleanupClosePushL(mobileCall);
       
   884 	ClientDialCallL(mobileLine, mobileCall, RMobilePhone::EVoiceService);
       
   885 
       
   886 	// Getting the call information
       
   887 	RMobileCall::TMobileCallInfoV1 callInfo;
       
   888 	RMobileCall::TMobileCallInfoV1Pckg callInfoPckg(callInfo);
       
   889 	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallInfo(callInfoPckg));
       
   890 	ASSERT_EQUALS(callId , callInfo.iCallId);
       
   891 	
       
   892 	// Check GetDiagnosticInfo when no set was invoke
       
   893 	ASSERT_EQUALS(KErrNone, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   894 	
       
   895 	// Set the diagnostic octet to "Outgoing calls barred within CUG"
       
   896 	TRequestStatus terminatedStatus;
       
   897 	TUint8 cause = KDiagnosticInfoBarredWithCUG;
       
   898 	TMockLtsyData2<TInt, TUint8> diagData(callInfo.iCallId, cause);
       
   899 	diagData.SerialiseL(data);
       
   900 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   901 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   902 	User::WaitForRequest(terminatedStatus);
       
   903 
       
   904 	// Check GetDiagnosticInfo 
       
   905 	ASSERT_EQUALS(KErrDiagnosticInfoBarredWithCUG, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   906 
       
   907 	// Set the diagnostic octet to "No CUG selected"
       
   908 	cause = KDiagnosticInfoBarredNoCUG;
       
   909 	diagData.SerialiseL(data);
       
   910 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   911 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   912 	User::WaitForRequest(terminatedStatus);
       
   913 
       
   914 	// Check GetDiagnosticInfo 
       
   915 	ASSERT_EQUALS(KErrDiagnosticInfoBarredNoCUG, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   916 
       
   917 	// Set the diagnostic octet to "Unknown CUG index"
       
   918 	cause = KDiagnosticInfoBarredUnknownCUG;
       
   919 	diagData.SerialiseL(data);
       
   920 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   921 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   922 	User::WaitForRequest(terminatedStatus);
       
   923 
       
   924 	// Check GetDiagnosticInfo 
       
   925 	ASSERT_EQUALS(KErrDiagnosticInfoBarredUnknownCUG, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   926 
       
   927 	// Set the diagnostic octet to "CUG index incompatible with requested basic service"
       
   928 	cause = KDiagnosticInfoBarredIncompatibleCUG;
       
   929 	diagData.SerialiseL(data);
       
   930 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   931 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   932 	User::WaitForRequest(terminatedStatus);
       
   933 
       
   934 	// Check GetDiagnosticInfo 
       
   935 	ASSERT_EQUALS(KErrDiagnosticInfoBarredIncompatibleCUG, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   936 
       
   937 	// Set the diagnostic octet to "CUG call failure, unspecified"
       
   938 	cause = KDiagnosticInfoBarredFailureCUG;
       
   939 	diagData.SerialiseL(data);
       
   940 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   941 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   942 	User::WaitForRequest(terminatedStatus);
       
   943 
       
   944 	// Check GetDiagnosticInfo 
       
   945 	ASSERT_EQUALS(KErrDiagnosticInfoBarredFailureCUG, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   946 
       
   947 	// Set the diagnostic octet to "CLIR not subscribed"
       
   948 	cause = KDiagnosticInfoBarredClirNotSubscribed;
       
   949 	diagData.SerialiseL(data);
       
   950 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   951 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   952 	User::WaitForRequest(terminatedStatus);
       
   953 
       
   954 	// Check GetDiagnosticInfo 
       
   955 	ASSERT_EQUALS(KErrDiagnosticInfoBarredClirNotSubscribed, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   956 
       
   957 	// Set the diagnostic octet to "CCBS possible"
       
   958 	cause = KDiagnosticInfoBarredCCBSPossible;
       
   959 	diagData.SerialiseL(data);
       
   960 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   961 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   962 	User::WaitForRequest(terminatedStatus);
       
   963 
       
   964 	// Check GetDiagnosticInfo 
       
   965 	ASSERT_EQUALS(KErrDiagnosticInfoBarredCCBSPossible, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   966 
       
   967 	// Set the diagnostic octet to "CCBS not possible"
       
   968 	cause = KDiagnosticInfoBarredCCBSNotPossible;
       
   969 	diagData.SerialiseL(data);
       
   970 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   971 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   972 	User::WaitForRequest(terminatedStatus);
       
   973 
       
   974 	// Check GetDiagnosticInfo 
       
   975 	ASSERT_EQUALS(KErrDiagnosticInfoBarredCCBSNotPossible, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   976 
       
   977 	// Set the diagnostic octet to wrong value
       
   978 	cause = KDiagnosticInfoBarredWrong;
       
   979 	diagData.SerialiseL(data);
       
   980 	iMockLTSY.NotifyTerminated(terminatedStatus);
       
   981 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesGetDiagnosticOctetsIndId, KErrNone, data);
       
   982 	User::WaitForRequest(terminatedStatus);
       
   983 
       
   984 	// Check GetDiagnosticInfo 
       
   985 	ASSERT_EQUALS(KErrNone, customApi.GetDiagnosticInfo(callInfo.iCallName));
       
   986 
       
   987 	AssertMockLtsyStatusL();
       
   988 	
       
   989 	TInt hangUpCause = KErrGsmCCNormalCallClearing;
       
   990 	TMockLtsyData2<TInt, TInt> mockData2(callId, hangUpCause);
       
   991 	data.Close();
       
   992 	mockData2.SerialiseL(data);
       
   993 	iMockLTSY.ExpectL(MLtsyDispatchCallControlHangUp::KLtsyDispatchCallControlHangUpApiId, data);
       
   994 	
       
   995 	CleanupStack::PopAndDestroy(5, this); // mobileCall, mobileLine, customApi, data, this
       
   996 	
       
   997 	}
       
   998 	
       
   999 
       
  1000 
       
  1001 /**
       
  1002 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0004
       
  1003 @SYMComponent telephony_ctsy
       
  1004 @SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::NotifySsNetworkEvent
       
  1005 @SYMTestPriority High
       
  1006 @SYMTestActions Invokes RMmCustomAPI::NotifySsNetworkEvent
       
  1007 @SYMTestExpectedResults Pass
       
  1008 @SYMTestType UT
       
  1009  */
       
  1010 void CCTsySupplementaryServicesFU::TestUnit0004L()
       
  1011 	{
       
  1012 	OpenEtelServerL(EUseExtendedError);
       
  1013 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1014 	OpenPhoneL();
       
  1015 
       
  1016 	RBuf8 data;
       
  1017 	CleanupClosePushL(data);
       
  1018 
       
  1019 	RMmCustomAPI customApi;
       
  1020 	OpenCustomApiLC(customApi);
       
  1021 	
       
  1022 	// A. forward mode notification 
       
  1023 	// register the notification
       
  1024 	TRequestStatus requestStatus;
       
  1025 	RMmCustomAPI::TSsTypeAndMode typeAndMode;
       
  1026 	RMmCustomAPI::TSsInfo info;
       
  1027 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1028 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1029 
       
  1030 	// complete NotifySsNetworkEvent
       
  1031 	RMmCustomAPI::TSsForwMode compForwardInfo = RMmCustomAPI::ESsIncCallForwToC;
       
  1032 	RMmCustomAPI::TSsTypeAndMode compTypeAndMode;
       
  1033 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeNotProvisioned;
       
  1034 	compTypeAndMode.iSsType = RMmCustomAPI::ESsForwNoReach; 
       
  1035 	
       
  1036 	data.Close();
       
  1037 	TMockLtsyData2<RMmCustomAPI::TSsTypeAndMode, RMmCustomAPI::TSsForwMode> compData1(compTypeAndMode, compForwardInfo);
       
  1038 	compData1.SerialiseL(data);
       
  1039 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventForwardModeIndId, KErrNone, data);
       
  1040 
       
  1041 	// Check Notification
       
  1042 	User::WaitForRequest(requestStatus);
       
  1043 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1044 	ASSERT_EQUALS(compForwardInfo, info.iForwMode);
       
  1045 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1046 	ASSERT_EQUALS(compTypeAndMode.iSsType, typeAndMode.iSsType);
       
  1047 	
       
  1048 	// B. call waiting notification 
       
  1049 	// register the notification
       
  1050 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1051 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1052 
       
  1053 	// complete NotifySsNetworkEvent
       
  1054 	TBool compCallWaitingInfo = ETrue;
       
  1055 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeNotRegistered;
       
  1056 	
       
  1057 	data.Close();
       
  1058 	TMockLtsyData2<RMmCustomAPI::TSsMode, TBool> compData2(compTypeAndMode.iSsMode, compCallWaitingInfo);
       
  1059 	compData2.SerialiseL(data);
       
  1060 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventCallWaitingIndId, KErrNone, data);
       
  1061 
       
  1062 	// Check Notification
       
  1063 	User::WaitForRequest(requestStatus);
       
  1064 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1065 	ASSERT_EQUALS(compCallWaitingInfo, info.iCallWait);
       
  1066 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1067 	ASSERT_EQUALS(RMmCustomAPI::ESsCallWaiting, typeAndMode.iSsType);
       
  1068 	
       
  1069 	// C. hold mode notification 
       
  1070 	// register the notification
       
  1071 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1072 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1073 
       
  1074 	// complete NotifySsNetworkEvent
       
  1075 	RMmCustomAPI::TSsHoldMode compHoldMode = RMmCustomAPI::ESsHoldResume;
       
  1076 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeNotAvailable;
       
  1077 	compTypeAndMode.iSsType = RMmCustomAPI::ESsBarrOutInterExcHome; 
       
  1078 	
       
  1079 	data.Close();
       
  1080 	TMockLtsyData2<RMmCustomAPI::TSsTypeAndMode, RMmCustomAPI::TSsHoldMode> compData3(compTypeAndMode, compHoldMode);
       
  1081 	compData3.SerialiseL(data);
       
  1082 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventHoldModeIndId, KErrNone, data);
       
  1083 
       
  1084 	// Check Notification
       
  1085 	User::WaitForRequest(requestStatus);
       
  1086 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1087 	ASSERT_EQUALS(compHoldMode, info.iCallHold);
       
  1088 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1089 	ASSERT_EQUALS(compTypeAndMode.iSsType, typeAndMode.iSsType);
       
  1090 	
       
  1091 	// D. Confrence notification 
       
  1092 	// register the notification
       
  1093 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1094 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1095 
       
  1096 	// complete NotifySsNetworkEvent
       
  1097 	TBool compConf = EFalse;
       
  1098 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeNotAvailable;
       
  1099 	compTypeAndMode.iSsType = RMmCustomAPI::ESsBarrOutInterExcHome; 
       
  1100 	
       
  1101 	data.Close();
       
  1102 	TMockLtsyData2<RMmCustomAPI::TSsTypeAndMode, TBool> compData4(compTypeAndMode, compConf);
       
  1103 	compData4.SerialiseL(data);
       
  1104 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventConfrenceIndId, KErrNone, data);
       
  1105 
       
  1106 	// Check Notification
       
  1107 	User::WaitForRequest(requestStatus);
       
  1108 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1109 	ASSERT_EQUALS(compConf, info.iConfInd);
       
  1110 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1111 	ASSERT_EQUALS(compTypeAndMode.iSsType, typeAndMode.iSsType);
       
  1112 	
       
  1113 	// E. Cug notification 
       
  1114 	// register the notification
       
  1115 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1116 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1117 
       
  1118 	// complete NotifySsNetworkEvent
       
  1119 	TUint16 compCugIndex = 181;
       
  1120 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeActive;
       
  1121 	compTypeAndMode.iSsType = RMmCustomAPI::ESsIncomingBarrServ; 
       
  1122 	
       
  1123 	data.Close();
       
  1124 	TMockLtsyData2<RMmCustomAPI::TSsTypeAndMode, TUint16> compData5(compTypeAndMode, compCugIndex);
       
  1125 	compData5.SerialiseL(data);
       
  1126 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventCugIndId, KErrNone, data);
       
  1127 
       
  1128 	// Check Notification
       
  1129 	User::WaitForRequest(requestStatus);
       
  1130 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1131 	ASSERT_EQUALS(compCugIndex, info.iCugIndex);
       
  1132 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1133 	ASSERT_EQUALS(compTypeAndMode.iSsType, typeAndMode.iSsType);
       
  1134 	
       
  1135 	// F. Clir Suppression notification 
       
  1136 	// register the notification
       
  1137 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1138 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1139 
       
  1140 	// complete NotifySsNetworkEvent
       
  1141 	TBool compClir = EFalse;
       
  1142 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeNotProvisioned;
       
  1143 	
       
  1144 	data.Close();
       
  1145 	TMockLtsyData2<RMmCustomAPI::TSsMode, TBool> compData6(compTypeAndMode.iSsMode, compClir);
       
  1146 	compData6.SerialiseL(data);
       
  1147 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventClirSuppressionIndId, KErrNone, data);
       
  1148 
       
  1149 	// Check Notification
       
  1150 	User::WaitForRequest(requestStatus);
       
  1151 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1152 	ASSERT_EQUALS(compClir, info.iClirSuppReject);
       
  1153 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1154 	ASSERT_EQUALS(RMmCustomAPI::ESsClir, typeAndMode.iSsType);
       
  1155 	
       
  1156 	// G. Ect notification 
       
  1157 	// register the notification
       
  1158 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1159 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1160 
       
  1161 	// complete NotifySsNetworkEvent
       
  1162 	RMmCustomAPI::TSsEctState compEctState = RMmCustomAPI::ESsEctAlerting;
       
  1163 	RMmCustomAPI::TSsChoice compEctChoice = RMmCustomAPI::ESsPresRestrictedAddress;
       
  1164 	_LIT(KRemoteAddress,"74951000123");
       
  1165 	TBuf<RMmCustomAPI::KRemoteAddressSize> compRemoteAddress(KRemoteAddress); 
       
  1166 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeActive;
       
  1167 	compTypeAndMode.iSsType = RMmCustomAPI::ESsIncomingBarrServ; 
       
  1168 	
       
  1169 	data.Close();
       
  1170 	TMockLtsyData4<RMmCustomAPI::TSsTypeAndMode, RMmCustomAPI::TSsEctState, 
       
  1171 	                  RMmCustomAPI::TSsChoice, TBuf<RMmCustomAPI::KRemoteAddressSize> > compData7(compTypeAndMode, compEctState, compEctChoice, compRemoteAddress);
       
  1172 	compData7.SerialiseL(data);
       
  1173 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventEctCallStateIndId, KErrNone, data);
       
  1174 
       
  1175 	// Check Notification
       
  1176 	User::WaitForRequest(requestStatus);
       
  1177 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1178 	ASSERT_EQUALS(compEctState, info.iEctCallState);
       
  1179 	ASSERT_EQUALS(compEctChoice, info.iChoice);
       
  1180 	ASSERT_EQUALS(compRemoteAddress, info.iRemoteAddress);
       
  1181 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1182 	ASSERT_EQUALS(compTypeAndMode.iSsType, typeAndMode.iSsType);
       
  1183 	
       
  1184 	// H. General notification 
       
  1185 	// register the notification
       
  1186 	customApi.NotifySsNetworkEvent(requestStatus, typeAndMode, info);
       
  1187 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1188 
       
  1189 	// complete NotifySsNetworkEvent
       
  1190 	compTypeAndMode.iSsMode = RMmCustomAPI::ESsModeNotActive;
       
  1191 	compTypeAndMode.iSsType = RMmCustomAPI::ESsColr; 
       
  1192 	
       
  1193 	data.Close();
       
  1194 	TMockLtsyData1<RMmCustomAPI::TSsTypeAndMode> compData8(compTypeAndMode);
       
  1195 	compData8.SerialiseL(data);
       
  1196 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyNetworkEventIndId, KErrNone, data);
       
  1197 
       
  1198 	// Check Notification
       
  1199 	User::WaitForRequest(requestStatus);
       
  1200 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1201 	ASSERT_EQUALS(compTypeAndMode.iSsMode, typeAndMode.iSsMode);
       
  1202 	ASSERT_EQUALS(compTypeAndMode.iSsType, typeAndMode.iSsType);
       
  1203 	
       
  1204 	AssertMockLtsyStatusL();
       
  1205 	CleanupStack::PopAndDestroy(3, this); // customApi, data, this
       
  1206 	
       
  1207 	}
       
  1208 	
       
  1209 
       
  1210 /**
       
  1211 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0005
       
  1212 @SYMComponent telephony_ctsy
       
  1213 @SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::SsAdditionalInfoNotification
       
  1214 @SYMTestPriority High
       
  1215 @SYMTestActions Invokes RMmCustomAPI::SsAdditionalInfoNotification
       
  1216 @SYMTestExpectedResults Pass
       
  1217 @SYMTestType UT
       
  1218  */
       
  1219 void CCTsySupplementaryServicesFU::TestUnit0005L()
       
  1220 	{
       
  1221 	OpenEtelServerL(EUseExtendedError);
       
  1222 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1223 	OpenPhoneL();
       
  1224 
       
  1225 	RBuf8 data;
       
  1226 	CleanupClosePushL(data);
       
  1227 
       
  1228 	RMmCustomAPI customApi;
       
  1229 	OpenCustomApiLC(customApi);
       
  1230 	
       
  1231 	// register the notification
       
  1232 	TRequestStatus requestStatus;
       
  1233 	RMmCustomAPI::TSsAdditionalInfo additionalInfo;
       
  1234 	customApi.SsAdditionalInfoNotification(requestStatus, additionalInfo);
       
  1235 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1236 
       
  1237 	// complete SsAdditionalInfoNotification
       
  1238 	RMmCustomAPI::TSsAdditionalInfo compAdditionalInfo;
       
  1239 	compAdditionalInfo.iOperationCode = 74;
       
  1240 	_LIT8(KAdditionalInfo, "Additional Info");
       
  1241 	compAdditionalInfo.iAdditionalInfo = KAdditionalInfo;
       
  1242 	TMockLtsyData1<RMmCustomAPI::TSsAdditionalInfo> compData(compAdditionalInfo);
       
  1243 	compData.SerialiseL(data);
       
  1244 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyAdditionalInfoIndId, KErrNone, data);
       
  1245 
       
  1246 	// Check Notification
       
  1247 	User::WaitForRequest(requestStatus);
       
  1248 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1249 	ASSERT_EQUALS(compAdditionalInfo.iOperationCode, additionalInfo.iOperationCode);
       
  1250 	ASSERT_EQUALS(compAdditionalInfo.iAdditionalInfo, additionalInfo.iAdditionalInfo);
       
  1251 	
       
  1252 	AssertMockLtsyStatusL();
       
  1253 	CleanupStack::PopAndDestroy(3, this); // customApi, data, this
       
  1254 	
       
  1255 	}
       
  1256 
       
  1257 
       
  1258 /**
       
  1259 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0006
       
  1260 @SYMComponent telephony_ctsy
       
  1261 @SYMTestCaseDesc Test support in CTSY for RMmCustomAPI::SsRequestCompleteNotification
       
  1262 @SYMTestPriority High
       
  1263 @SYMTestActions Invokes RMmCustomAPI::SsRequestCompleteNotification
       
  1264 @SYMTestExpectedResults Pass
       
  1265 @SYMTestType UT
       
  1266  */
       
  1267 void CCTsySupplementaryServicesFU::TestUnit0006L()
       
  1268 	{
       
  1269 	OpenEtelServerL(EUseExtendedError);
       
  1270 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1271 	OpenPhoneL();
       
  1272 
       
  1273 	RBuf8 data;
       
  1274 	CleanupClosePushL(data);
       
  1275 
       
  1276 	RMmCustomAPI customApi;
       
  1277 	OpenCustomApiLC(customApi);
       
  1278 	
       
  1279 	// register the notification
       
  1280 	TRequestStatus requestStatus;
       
  1281 	TInt status;
       
  1282 	customApi.SsRequestCompleteNotification(requestStatus, status);
       
  1283 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1284 
       
  1285 	// complete SsAdditionalInfoNotification with an arbitrary status value (6812)
       
  1286 	TInt compStatus = 6812;
       
  1287 	TMockLtsyData1<TInt> compData(compStatus);
       
  1288 	compData.SerialiseL(data);
       
  1289 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifyRequestCompleteIndId, KErrNone, data);
       
  1290 
       
  1291 	// Check Notification
       
  1292 	User::WaitForRequest(requestStatus);
       
  1293 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1294 	ASSERT_EQUALS(compStatus, status);
       
  1295 	
       
  1296 	AssertMockLtsyStatusL();
       
  1297 	CleanupStack::PopAndDestroy(3, this); // customApi, data, this
       
  1298 	}
       
  1299 
       
  1300 /**
       
  1301 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0007
       
  1302 @SYMComponent telephony_ctsy
       
  1303 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifySendNetworkServiceRequest()
       
  1304 @SYMTestPriority High
       
  1305 @SYMTestActions Invokes RMobilePhone::NotifySendNetworkServiceRequest()
       
  1306 @SYMTestExpectedResults Pass
       
  1307 @SYMTestType UT
       
  1308  */
       
  1309 void CCTsySupplementaryServicesFU::TestUnit0007L()
       
  1310 	{
       
  1311 	
       
  1312 	OpenEtelServerL(EUseExtendedError);
       
  1313 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1314 
       
  1315 	RBuf8 data;
       
  1316 	CleanupClosePushL(data);
       
  1317 	
       
  1318 	OpenPhoneL();
       
  1319 	
       
  1320 	TRequestStatus reqStatus;
       
  1321 	
       
  1322 	//test the Notify in the KErrNone case
       
  1323 	
       
  1324 	RMobilePhone::TMobilePhoneNotifySendSSOperation operation = RMobilePhone::ESendSSReturnResult;
       
  1325 	_LIT(KAddInfo,"ADDINFO");
       
  1326 	
       
  1327 
       
  1328 	TDesC* additionalInfoPtr = const_cast<TDesC*>(&KAddInfo);
       
  1329 	TMockLtsyData2<RMobilePhone::TMobilePhoneNotifySendSSOperation, TDesC*> notifySendNetworkServiceRequestCompData(operation,additionalInfoPtr);
       
  1330 	notifySendNetworkServiceRequestCompData.SerialiseL(data);
       
  1331 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifySendNetworkServiceRequestIndId, KErrNone, data);
       
  1332 	data.Close();
       
  1333 	
       
  1334 	RMobilePhone::TMobilePhoneSendSSRequestV3 sendSsRequest;
       
  1335 	RMobilePhone::TMobilePhoneSendSSRequestV3Pckg sendSsRequestPckg(sendSsRequest);
       
  1336 	iPhone.NotifySendNetworkServiceRequest(reqStatus, operation, sendSsRequestPckg);
       
  1337 	User::WaitForRequest(reqStatus);
       
  1338 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
  1339 	ASSERT_EQUALS(operation, static_cast<RMobilePhone::TMobilePhoneNotifySendSSOperation>(sendSsRequest.iOpCode));
       
  1340 	ASSERT_TRUE(KAddInfo() == sendSsRequest.iAdditionalInfo);
       
  1341 		
       
  1342 	AssertMockLtsyStatusL();
       
  1343 
       
  1344 	//test the Notify in the KErrGeneral case
       
  1345 	notifySendNetworkServiceRequestCompData.SerialiseL(data);
       
  1346 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifySendNetworkServiceRequestIndId, KErrGeneral, data);
       
  1347 	data.Close();
       
  1348 
       
  1349 	iPhone.NotifySendNetworkServiceRequest(reqStatus, operation, sendSsRequestPckg);
       
  1350 	User::WaitForRequest(reqStatus);
       
  1351 	ASSERT_EQUALS(reqStatus.Int(), KErrGeneral);
       
  1352 
       
  1353 	AssertMockLtsyStatusL();
       
  1354 
       
  1355 	//test the case where a indicator is sent up on an operation not being notified of.
       
  1356 
       
  1357 	//send up a indicator on a Operation we are not waiting on. 
       
  1358 	operation = RMobilePhone::ESendSSInvoke;
       
  1359 	notifySendNetworkServiceRequestCompData.SerialiseL(data);
       
  1360 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifySendNetworkServiceRequestIndId, KErrNone, data);
       
  1361 	data.Close();
       
  1362 
       
  1363 	//send up a indicator on a Operation we are waiting on. 
       
  1364 	operation = RMobilePhone::ESendSSReturnResult;
       
  1365 	notifySendNetworkServiceRequestCompData.SerialiseL(data);
       
  1366 	iMockLTSY.CompleteL(KMockLtsyDispatchSupplementaryServicesNotifySendNetworkServiceRequestIndId, KErrNone, data);
       
  1367 	data.Close();
       
  1368 
       
  1369 	RMobilePhone::TMobilePhoneSendSSRequestV3 sendSsRequest2;
       
  1370 	RMobilePhone::TMobilePhoneSendSSRequestV3Pckg sendSsRequestPckg2(sendSsRequest2);
       
  1371 	iPhone.NotifySendNetworkServiceRequest(reqStatus, operation, sendSsRequestPckg2);
       
  1372 	User::WaitForRequest(reqStatus);
       
  1373 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
  1374 	ASSERT_EQUALS(operation, static_cast<RMobilePhone::TMobilePhoneNotifySendSSOperation>(sendSsRequest2.iOpCode));
       
  1375 	ASSERT_TRUE(KAddInfo() == sendSsRequest2.iAdditionalInfo);
       
  1376 	
       
  1377 	AssertMockLtsyStatusL();
       
  1378 		
       
  1379 	CleanupStack::PopAndDestroy(&data);
       
  1380 	CleanupStack::PopAndDestroy(this);
       
  1381 	}
       
  1382 
       
  1383 
       
  1384 /**
       
  1385 @SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-UN0008
       
  1386 @SYMComponent telephony_ctsy
       
  1387 @SYMTestCaseDesc Test support in CTSY for send a USSD request to the network without FDN check
       
  1388 @SYMTestPriority High
       
  1389 @SYMTestActions Invokes RMobileUssdMessaging::SendMessage
       
  1390 @SYMTestExpectedResults Pass
       
  1391 @SYMTestType CT
       
  1392  */
       
  1393 void CCTsySupplementaryServicesFU::TestUnit0008L()
       
  1394 	{
       
  1395 	OpenEtelServerL(EUseExtendedError);
       
  1396 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1397 	OpenPhoneL();
       
  1398 
       
  1399 	RBuf8 data;
       
  1400 	CleanupClosePushL(data);	
       
  1401 	RMobileUssdMessaging ussdMessaging;
       
  1402 	ASSERT_EQUALS(KErrNone, ussdMessaging.Open(iPhone));
       
  1403 	CleanupClosePushL(ussdMessaging);
       
  1404 
       
  1405 	
       
  1406 	// prepare ltsy to accept the SendMessage
       
  1407 	_LIT8(KMsg1,"SendMessage1.1");
       
  1408 	RMobileUssdMessaging::TGsmUssdMessageData expSendData(KMsg1);
       
  1409 	RMobileUssdMessaging::TMobileUssdAttributesV1 expSendAttr;
       
  1410 	expSendAttr.iDcs = 50;
       
  1411 	expSendAttr.iFormat = RMobileUssdMessaging::EFormatUnspecified;
       
  1412 	expSendAttr.iType = RMobileUssdMessaging::EUssdMORequest;
       
  1413 	expSendAttr.iFlags = RMobileUssdMessaging::KUssdDataFormat | RMobileUssdMessaging::KUssdMessageType | RMobileUssdMessaging::KUssdMessageDcs;
       
  1414  	TMockLtsyData2<RMobileUssdMessaging::TGsmUssdMessageData, RMobileUssdMessaging::TMobileUssdAttributesV1> expLtsySendData(expSendData, expSendAttr);
       
  1415  	expLtsySendData.SerialiseL(data);
       
  1416 	iMockLTSY.ExpectL(MLtsyDispatchSupplementaryServicesSendUssdMessageNoFdnCheck::KLtsyDispatchSupplementaryServicesSendUssdMessageNoFdnCheckApiId, data, KErrNone);
       
  1417 	
       
  1418 	// Send USSD Message
       
  1419 	TRequestStatus sendMessageStatus;
       
  1420 	RMobileUssdMessaging::TMobileUssdAttributesV1Pckg sendAttrPckg(expSendAttr);
       
  1421 	ussdMessaging.SendMessageNoFdnCheck(sendMessageStatus,expSendData,sendAttrPckg);
       
  1422 	ASSERT_EQUALS(KRequestPending, sendMessageStatus.Int());
       
  1423 
       
  1424 	// complete SendMessage
       
  1425 	iMockLTSY.CompleteL(MLtsyDispatchSupplementaryServicesSendUssdMessageNoFdnCheck::KLtsyDispatchSupplementaryServicesSendUssdMessageNoFdnCheckApiId, KErrNone);
       
  1426 	
       
  1427 	//Wait for SendMessage
       
  1428 	User::WaitForRequest(sendMessageStatus);
       
  1429 	ASSERT_EQUALS(KErrNone, sendMessageStatus.Int());
       
  1430 
       
  1431 
       
  1432 	AssertMockLtsyStatusL();
       
  1433 	CleanupStack::PopAndDestroy(3, this); // ussdMessaging, data, this
       
  1434 	}