telephonyserverplugins/ctsydispatchlayer/test/dispatchertests/dispatchsrc/cctsyphonefu.cpp
changeset 0 3553901f7fa8
child 17 3f227a47ad75
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 PhoneControl in the Common TSY.
       
    20 */
       
    21 
       
    22 #include "cctsyphonefu.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/serviceapi/cmmutility.h>
       
    31 #include <ctsy/ltsy/mltsydispatchcallcontrolinterface.h>
       
    32 #include <ctsy/ltsy/mltsydispatchsiminterface.h>
       
    33 #include <ctsy/ltsy/mltsydispatchphoneinterface.h>
       
    34 #include <ctsy/ltsy/mltsydispatchpacketservicesinterface.h>
       
    35 #include <etelmmerr.h>
       
    36 #include "listretrieverao.h"
       
    37 #include "mockltsyindicatorids.h"
       
    38 #include <ctsy/rmmcustomapi.h>
       
    39 #include <ctsy/ltsy/mltsydispatchpacketservicesinterface.h>
       
    40 
       
    41 #include "cctsyactiveretriever.h"
       
    42 
       
    43 CTestSuite* CCTsyPhoneFU::CreateSuiteL(const TDesC& aName)
       
    44 	{
       
    45 	SUB_SUITE;
       
    46 
       
    47 	//add use-case tests
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUseCase0001L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUseCase0002L);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUseCase0003L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUseCase0004L);
       
    52   
       
    53 	//add other unit tests
       
    54 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0001L);
       
    55 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0002L);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0003L);
       
    57 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0004L);
       
    58 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0005L);
       
    59 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0006L);
       
    60 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0007L);
       
    61 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0008L);
       
    62 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0009L);
       
    63 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0010L);
       
    64 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0011L);
       
    65 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0012L);
       
    66 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0013L);
       
    67 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0014L);
       
    68 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0015L);
       
    69 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0016L);
       
    70 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0017L);
       
    71 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0018L);
       
    72 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0019L);
       
    73 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0020L);
       
    74 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0021L);
       
    75 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0022L);
       
    76 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0023L);
       
    77 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0024L);
       
    78 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0025L);
       
    79 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0026L);
       
    80 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0027L);
       
    81 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0028L);
       
    82 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0029L);
       
    83 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0030L);
       
    84 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0031L);
       
    85 	ADD_TEST_STEP_ISO_CPP(CCTsyPhoneFU, TestUnit0032L);
       
    86 
       
    87 	END_SUITE;
       
    88 	}
       
    89 
       
    90 //
       
    91 // Use-case tests
       
    92 //
       
    93 
       
    94 /**
       
    95 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UC0001
       
    96 @SYMComponent telephony_ctsy
       
    97 @SYMTestCaseDesc Use-case: boot phone.  
       
    98 @SYMTestPriority High
       
    99 @SYMTestActions Invokes APIs to go through booting phone.
       
   100 @SYMTestExpectedResults Pass
       
   101 @SYMTestType CT
       
   102  */
       
   103 void CCTsyPhoneFU::TestUseCase0001L()
       
   104 	{
       
   105 	OpenEtelServerL(EUseExtendedError);
       
   106 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   107 	//simple boot phone use-case is actually incorporated as the OpenPhoneL() function.
       
   108 	OpenPhoneL();
       
   109 	AssertMockLtsyStatusL();
       
   110 
       
   111 	CleanupStack::PopAndDestroy(this);
       
   112 	}
       
   113 
       
   114 /**
       
   115 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UC0002
       
   116 @SYMComponent telephony_ctsy
       
   117 @SYMTestCaseDesc Use-case:  manual network detection and selection
       
   118 @SYMTestPriority High
       
   119 @SYMTestActions Invokes APIs to go through detecting and selecting a network to register onto.
       
   120 @SYMTestExpectedResults Pass
       
   121 @SYMTestType CT
       
   122  */
       
   123 void CCTsyPhoneFU::TestUseCase0002L()
       
   124 	{
       
   125 	OpenEtelServerL(EUseExtendedError);
       
   126 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   127 	OpenPhoneL();
       
   128 	
       
   129 	TRequestStatus status;
       
   130 	
       
   131 	RBuf8 data;
       
   132 	CleanupClosePushL(data);
       
   133 	
       
   134 	
       
   135 	/********************************Set network selection to manual***********************************/
       
   136 	
       
   137 	//set up the notified data
       
   138 	RMobilePhone::TMobilePhoneNetworkSelectionV1 notifiedPhoneNetworkSelection;
       
   139 	RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg notifiedPckg(notifiedPhoneNetworkSelection);
       
   140 
       
   141 	//set up the set data
       
   142 	RMobilePhone::TMobilePhoneNetworkSelectionV1 phoneNetworkSelection;
       
   143 	phoneNetworkSelection.iMethod 			= RMobilePhone::ENetworkSelectionManual;
       
   144 	phoneNetworkSelection.iBandClass		= RMobilePhone::ENetworkBandClassAOnly;
       
   145 	phoneNetworkSelection.iOperationMode	= RMobilePhone::ENetworkOperationAnalogPreferred;
       
   146 
       
   147 	RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg setPckg(phoneNetworkSelection);
       
   148 
       
   149 	//set up the Mock LTSY data
       
   150 	TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkSelectionV1> phoneNetworkSelectionExpData(phoneNetworkSelection);
       
   151 	phoneNetworkSelectionExpData.SerialiseL(data);
       
   152 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetNetworkSelectionSetting::KLtsyDispatchPhoneSetNetworkSelectionSettingApiId, data, KErrNone);
       
   153 	data.Close();
       
   154 	
       
   155 	TMockLtsyData1<RMobilePhone::TMobilePhoneSelectionMethod> phoneNetworkSelectionCompData(phoneNetworkSelection.iMethod);
       
   156 	phoneNetworkSelectionCompData.SerialiseL(data);
       
   157 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetNetworkSelectionSetting::KLtsyDispatchPhoneSetNetworkSelectionSettingApiId, KErrNone, data);
       
   158 	data.Close();
       
   159 
       
   160 	//ETel calls
       
   161 	TRequestStatus notifyStatus;
       
   162 	iPhone.NotifyNetworkSelectionSettingChange(notifyStatus,notifiedPckg);
       
   163 	iPhone.SetNetworkSelectionSetting(status,setPckg);
       
   164 	
       
   165 	User::WaitForRequest(status);
       
   166 	User::WaitForRequest(notifyStatus);
       
   167 	ASSERT_EQUALS(status.Int(),KErrNone);
       
   168 	ASSERT_EQUALS(notifyStatus.Int(),KErrNone);
       
   169 	
       
   170 	//CTSY sets iBandClass and iOperationMode to defults values
       
   171 	ASSERT_EQUALS(phoneNetworkSelection.iMethod,notifiedPhoneNetworkSelection.iMethod);
       
   172 	ASSERT_EQUALS(RMobilePhone::ENetworkBandClassUnknown,notifiedPhoneNetworkSelection.iBandClass);
       
   173 	ASSERT_EQUALS(RMobilePhone::ENetworkOperationUnknown,notifiedPhoneNetworkSelection.iOperationMode);
       
   174 	AssertMockLtsyStatusL();
       
   175 	
       
   176 	/*********************************************************************************************/
       
   177 	
       
   178 	/********************************Get Detected Network List************************************/
       
   179 	
       
   180 	CGetDetectedNetworksAO* detAO = CGetDetectedNetworksAO::NewLC(iPhone,iMockLTSY);
       
   181 	
       
   182 	// --- prepare data for CompleteL ---
       
   183  	CMobilePhoneNetworkListV2* networkListV2 = CMobilePhoneNetworkListV2::NewL();
       
   184 	CleanupStack::PushL(networkListV2);
       
   185 	
       
   186  	RMobilePhone::TMobilePhoneNetworkInfoV2 infoV2;
       
   187 	
       
   188 	infoV2.iAccess      = RMobilePhone::ENetworkAccessUnknown;
       
   189 	infoV2.iMode        = RMobilePhone::ENetworkModeUnknown;
       
   190 	infoV2.iStatus      = RMobilePhone::ENetworkStatusUnknown;
       
   191 	infoV2.iBandInfo    = RMobilePhone::EBandUnknown;	
       
   192 	
       
   193 	_LIT(KCountryCode, "1234");
       
   194 	infoV2.iCountryCode = KCountryCode;
       
   195 
       
   196 	_LIT(KAnalogSID, "12345678");
       
   197 	infoV2.iAnalogSID   = KAnalogSID;
       
   198 
       
   199 	_LIT(KNetworkId, "12345678");
       
   200 	infoV2.iNetworkId   = KNetworkId;
       
   201 	
       
   202 	_LIT(KDisplayTag, "1234567890");
       
   203 	infoV2.iDisplayTag  = KDisplayTag;
       
   204 	
       
   205 	_LIT(KShortName, "1234567890");
       
   206 	infoV2.iShortName   = KShortName;
       
   207 
       
   208 	_LIT(KLongName, "12345678901234567890");
       
   209 	infoV2.iLongName    = KLongName;
       
   210 	
       
   211 	networkListV2->AddEntryL(infoV2);
       
   212 
       
   213 	//set up Mock LTSY expect and completes for a retrieve (not cancelled)
       
   214     iMockLTSY.ExpectL(MLtsyDispatchPhoneGetDetectedNetworks::KLtsyDispatchPhoneGetDetectedNetworksApiId, KErrNone);
       
   215 
       
   216     //execute the retrieve
       
   217 	detAO->TestRetrieveL(*networkListV2);
       
   218 
       
   219 	//check what has been returned 
       
   220 	ASSERT_EQUALS(detAO->CheckResultsL(),KErrNone);
       
   221 	
       
   222 	AssertMockLtsyStatusL();
       
   223 	
       
   224 	/*********************************************************************************************/
       
   225 
       
   226 	/********************************Manual Network Selection************************************/
       
   227 
       
   228 	//setup ETel required data
       
   229 	RMobilePhone::TMobilePhoneNetworkManualSelection selection;
       
   230 	selection.iCountry = KCountryCode;
       
   231 	selection.iNetwork = KNetworkId;
       
   232 
       
   233 	//setup MockTSY data
       
   234 	TBool isManual = ETrue;
       
   235 	TMockLtsyData2<TBool,RMobilePhone::TMobilePhoneNetworkManualSelection> selectData(isManual,selection);
       
   236     selectData.SerialiseL(data);
       
   237 	
       
   238 	//set up Mock LTSY expect and completes for a retrieve (not cancelled)
       
   239 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSelectNetwork::KLtsyDispatchPhoneSelectNetworkApiId, data, KErrNone);
       
   240 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSelectNetwork::KLtsyDispatchPhoneSelectNetworkApiId, KErrNone);
       
   241 	data.Close();
       
   242 	
       
   243 	//ETel calls
       
   244 	iPhone.SelectNetwork(status,isManual,selection);
       
   245 	User::WaitForRequest(status);
       
   246 
       
   247 	AssertMockLtsyStatusL();
       
   248 	/*********************************************************************************************/
       
   249 	
       
   250 	CleanupStack::PopAndDestroy(networkListV2);
       
   251 	CleanupStack::PopAndDestroy(detAO);
       
   252 	CleanupStack::PopAndDestroy(&data);
       
   253 	CleanupStack::PopAndDestroy(this);
       
   254 	}
       
   255 	
       
   256 /**
       
   257 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UC0003
       
   258 @SYMComponent telephony_ctsy
       
   259 @SYMTestCaseDesc Use-case: Network notifications at boot-up. 
       
   260 @SYMTestPriority High
       
   261 @SYMTestActions Invokes RMobilePhone::NotifyCurrentNetworkChange, RMobilePhone::NotifyModeChange, RMobilePhone::NotifyNITZInfoChange, RMobilePhone::NotifySignalStrengthChange  
       
   262 @SYMTestExpectedResults Pass
       
   263 @SYMTestType CT
       
   264  */
       
   265 void CCTsyPhoneFU::TestUseCase0003L()
       
   266 	{
       
   267 	OpenEtelServerL(EUseExtendedError);
       
   268 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   269 	OpenPhoneL();
       
   270 	
       
   271 	RBuf8 data;
       
   272 	CleanupClosePushL(data);
       
   273 	
       
   274 	TRequestStatus requestStatus1, requestStatus2, requestStatus3, requestStatus4, requestStatus5;
       
   275 	TRequestStatus mockLtsyStatus;
       
   276 	
       
   277 	//
       
   278 	// Post all the notifiers.
       
   279 	//
       
   280 	
       
   281 	// RMobilePhone::NotifyCurrentNetworkChange
       
   282 	RMobilePhone::TMobilePhoneNetworkInfoV5 networkInfoRet;
       
   283 	TPckg<RMobilePhone::TMobilePhoneNetworkInfoV5> networkInfoRetPckg(networkInfoRet);
       
   284 	RMobilePhone::TMobilePhoneLocationAreaV1 locationAreaRet;
       
   285 	iPhone.NotifyCurrentNetworkChange(requestStatus1, networkInfoRetPckg, locationAreaRet);
       
   286 	
       
   287 	// RMobilePhone::NotifyNetworkModeChange
       
   288 	RMobilePhone::TMobilePhoneNetworkMode networkModeRet;
       
   289 	iPhone.NotifyModeChange(requestStatus2, networkModeRet);
       
   290 	
       
   291 	// RMobilePhone::NotifyNitzInfoChange
       
   292 	RMobilePhone::TMobilePhoneNITZ nitzRet;
       
   293 	iPhone.NotifyNITZInfoChange(requestStatus3, nitzRet);
       
   294 	
       
   295 	// RMobilePhone::NotifySignalStrengthChange
       
   296 	TInt32 signalStrength(0);
       
   297 	TInt8 bar(0);
       
   298 	iPhone.NotifySignalStrengthChange(requestStatus4, signalStrength, bar);
       
   299 	
       
   300 	// RMobilePhone::NotifyBatteryInfoChange
       
   301 	RMobilePhone::TMobilePhoneBatteryInfoV1 battInfoRet;
       
   302 	iPhone.NotifyBatteryInfoChange(requestStatus5, battInfoRet);
       
   303 	
       
   304 	/*
       
   305 	 * RMobilePhone::NotifyCurrentNetworkChange
       
   306 	 */
       
   307 
       
   308 	// Prepare the NotifyCurrentNetworkChange data for CompleteL
       
   309 	RMobilePhone::TMobilePhoneNetworkInfoV5 networkInfoComplete;
       
   310 	
       
   311     RMobilePhone::TMobilePhoneNetworkCountryCode countryCode = _L("567");
       
   312     RMobilePhone::TMobilePhoneNetworkIdentity    cdmaSID     = _L("890");
       
   313     RMobilePhone::TMobilePhoneNetworkIdentity    analogSID   = _L("123");
       
   314     RMobilePhone::TMobilePhoneNetworkIdentity    networkId   = _L("56700");
       
   315     RMobilePhone::TMobilePhoneNetworkDisplayTag  displayTag  = _L("symbian2");
       
   316     RMobilePhone::TMobilePhoneNetworkShortName   shortName   = _L("symbian2");
       
   317     RMobilePhone::TMobilePhoneNetworkLongName    longName    = _L("symbian2 mobile");
       
   318 
       
   319 	// V5
       
   320 	networkInfoComplete.iEgprsAvailableIndicator = ETrue;
       
   321 	networkInfoComplete.iHsdpaAvailableIndicator = EFalse;
       
   322 	// V2
       
   323 	networkInfoComplete.iAccess = RMobilePhone::ENetworkAccessGsm;
       
   324 	// V1
       
   325 	networkInfoComplete.iMode        = RMobilePhone::ENetworkModeCdma2000   ;
       
   326 	networkInfoComplete.iStatus      = RMobilePhone::ENetworkStatusAvailable;
       
   327 	networkInfoComplete.iBandInfo    = RMobilePhone::E1900BandA             ;
       
   328 	networkInfoComplete.iCountryCode = countryCode;
       
   329 	networkInfoComplete.iCdmaSID     = cdmaSID    ;
       
   330 	networkInfoComplete.iAnalogSID   = analogSID  ;
       
   331 	networkInfoComplete.iNetworkId   = networkId  ;
       
   332 	networkInfoComplete.iDisplayTag  = displayTag ;
       
   333 	networkInfoComplete.iShortName   = shortName  ;
       
   334 	networkInfoComplete.iLongName    = longName   ;
       
   335 	
       
   336 	RMobilePhone::TMobilePhoneLocationAreaV1 locationAreaComplete;
       
   337 	locationAreaComplete.iAreaKnown = ETrue;
       
   338 	locationAreaComplete.iLocationAreaCode = KLocationAreaCode;
       
   339 	locationAreaComplete.iCellId = KCellId;
       
   340 	
       
   341     TMockLtsyData2<RMobilePhone::TMobilePhoneNetworkInfoV5, 
       
   342                    RMobilePhone::TMobilePhoneLocationAreaV1> mockCNCData2(networkInfoComplete, locationAreaComplete);
       
   343     
       
   344 	// Send the CompleteL to MockLtsy
       
   345 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   346 	
       
   347 	data.Close();
       
   348 	mockCNCData2.SerialiseL(data);
       
   349 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyCurrentNetworkChangeIndId, KErrNone, data);
       
   350 	User::WaitForRequest(mockLtsyStatus);
       
   351 	AssertMockLtsyStatusL();
       
   352     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   353     
       
   354     // Check completion of api
       
   355     User::WaitForRequest(requestStatus1);
       
   356     AssertMockLtsyStatusL();
       
   357     ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
   358 
       
   359     // Check returned data
       
   360     ASSERT_EQUALS(networkInfoRet.iMode, networkInfoComplete.iMode);
       
   361     ASSERT_EQUALS(networkInfoRet.iStatus, networkInfoComplete.iStatus);
       
   362     ASSERT_EQUALS(networkInfoRet.iBandInfo, networkInfoComplete.iBandInfo);
       
   363     ASSERT_EQUALS(networkInfoRet.iCountryCode, networkInfoComplete.iCountryCode);
       
   364     ASSERT_EQUALS(networkInfoRet.iCdmaSID, networkInfoComplete.iCdmaSID);
       
   365     ASSERT_EQUALS(networkInfoRet.iAnalogSID, networkInfoComplete.iAnalogSID);
       
   366     ASSERT_EQUALS(networkInfoRet.iNetworkId, networkInfoComplete.iNetworkId);
       
   367     ASSERT_EQUALS(networkInfoComplete.iDisplayTag, networkInfoComplete.iDisplayTag);
       
   368     ASSERT_EQUALS(networkInfoComplete.iShortName, networkInfoComplete.iShortName);
       
   369     ASSERT_EQUALS(networkInfoComplete.iLongName, networkInfoComplete.iLongName);
       
   370 
       
   371     ASSERT_EQUALS(locationAreaRet.iAreaKnown, locationAreaComplete.iAreaKnown);
       
   372     ASSERT_EQUALS(locationAreaRet.iLocationAreaCode, locationAreaComplete.iLocationAreaCode);
       
   373     ASSERT_EQUALS(locationAreaRet.iCellId, locationAreaComplete.iCellId);
       
   374     
       
   375 	/*
       
   376 	 * RMobilePhone::NotifyNetworkModeChange
       
   377 	 */
       
   378     
       
   379 	// Prepare the NotifyNetworkModeChange data for CompleteL
       
   380     RMobilePhone::TMobilePhoneNetworkMode networkModeComplete;
       
   381     
       
   382     networkModeComplete = RMobilePhone::ENetworkModeCdma95;
       
   383 
       
   384     TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkMode> mockNMCData1(networkModeComplete);
       
   385     
       
   386 	// Send the CompleteL to MockLtsy
       
   387 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   388 	
       
   389 	data.Close();
       
   390 	mockNMCData1.SerialiseL(data);
       
   391 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyNetworkModeChangeIndId, KErrNone, data);
       
   392 	User::WaitForRequest(mockLtsyStatus);
       
   393 	AssertMockLtsyStatusL();
       
   394     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   395     
       
   396     // Check completion of api
       
   397     User::WaitForRequest(requestStatus2);
       
   398     AssertMockLtsyStatusL();
       
   399     ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   400     
       
   401     // Check returned data
       
   402     ASSERT_EQUALS(networkModeRet, networkModeComplete);
       
   403     
       
   404 	/*
       
   405 	 * RMobilePhone::NotifyNitzInfoChange
       
   406 	 */
       
   407     
       
   408     // Prepare the NotifyNetworkModeChange data for CompleteL
       
   409     RMobilePhone::TMobilePhoneNITZ nitzComplete(2007, EOctober, 18, 16,  0,  0, 0);
       
   410     
       
   411 	RMobilePhone::TMobilePhoneNetworkShortName mobilePhoneNetworkShortName = _L("ShortName");
       
   412 	RMobilePhone::TMobilePhoneNetworkLongName mobilePhoneNetworkLongName = _L("MyLongName");
       
   413 	TInt32 nitzFieldsUsed = RMobilePhone::KCapsTimeAvailable |
       
   414 							RMobilePhone::KCapsTimezoneAvailable |
       
   415 							RMobilePhone::KCapsDSTAvailable |
       
   416 							RMobilePhone::KCapsShortNameAvailable |
       
   417 							RMobilePhone::KCapsLongNameAvailable;
       
   418 	
       
   419 	TInt timeZone = 10;
       
   420 	TInt DST = 5;
       
   421 	
       
   422 	nitzComplete.iShortNetworkId = mobilePhoneNetworkShortName;
       
   423 	nitzComplete.iLongNetworkId = mobilePhoneNetworkLongName;
       
   424 	nitzComplete.iNitzFieldsUsed = nitzFieldsUsed;
       
   425 	nitzComplete.iTimeZone = timeZone;
       
   426 	nitzComplete.iDST = DST;
       
   427 	
       
   428 	TMockLtsyData1<RMobilePhone::TMobilePhoneNITZ> mockNitzData1(nitzComplete);
       
   429 	
       
   430 	// Send the CompleteL to MockLtsy
       
   431 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   432 	
       
   433 	data.Close();
       
   434 	mockNitzData1.SerialiseL(data);
       
   435 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyNitzInfoChangeIndId, KErrNone, data);
       
   436 	User::WaitForRequest(mockLtsyStatus);
       
   437 	AssertMockLtsyStatusL();
       
   438     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   439     
       
   440     // Check completion of api
       
   441     User::WaitForRequest(requestStatus3);
       
   442     AssertMockLtsyStatusL();
       
   443     ASSERT_EQUALS(KErrNone, requestStatus3.Int());
       
   444     
       
   445     // Check returned data
       
   446     ASSERT_EQUALS(nitzRet.iNitzFieldsUsed, nitzComplete.iNitzFieldsUsed);
       
   447     ASSERT_EQUALS(nitzRet.iTimeZone, nitzComplete.iTimeZone);
       
   448     ASSERT_EQUALS(nitzRet.iDST, nitzComplete.iDST);
       
   449     // Note: CTSY will overwrite the iShortNetworkId and iLongNetworkId fields in the NITZ data
       
   450     // if it all ready holds values for them from previous notifications (such as a NotifyCurrentNetworkChange).
       
   451     // We therefore compare with values from a TMobilePhoneNetworkInfoV5 which was received earlier in the test.
       
   452     ASSERT_EQUALS(nitzRet.iShortNetworkId, networkInfoComplete.iShortName);
       
   453     ASSERT_EQUALS(nitzRet.iLongNetworkId, networkInfoComplete.iLongName);
       
   454     
       
   455 	/*
       
   456 	 * RMobilePhone::NotifySignalStrengthChange
       
   457 	 */
       
   458     
       
   459     // Prepare the NotifySignalStrengthChange data for CompleteL
       
   460 	TInt32 signalStrengthComplete(70);
       
   461 	TInt8 barComplete(3);
       
   462 	
       
   463 	TMockLtsyData2<TInt32, TInt8> mockSigSthData2(signalStrengthComplete, barComplete);
       
   464 	
       
   465 	// Send the CompleteL to MockLtsy
       
   466 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   467 	
       
   468 	data.Close();
       
   469 	mockSigSthData2.SerialiseL(data);
       
   470 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifySignalStrengthChangeIndId, KErrNone, data);
       
   471 	User::WaitForRequest(mockLtsyStatus);
       
   472 	AssertMockLtsyStatusL();
       
   473     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   474     
       
   475     // Check completion of api
       
   476     User::WaitForRequest(requestStatus4);
       
   477     AssertMockLtsyStatusL();
       
   478     ASSERT_EQUALS(KErrNone, requestStatus4.Int());
       
   479     
       
   480     // Check returned data
       
   481     ASSERT_EQUALS(signalStrength, signalStrengthComplete);
       
   482     ASSERT_EQUALS(bar, barComplete);
       
   483     
       
   484 	/*
       
   485 	 * RMobilePhone::NotifyBatteryInfoChange
       
   486 	 */
       
   487     
       
   488     // Prepare the NotifyBatteryInfoChange data for CompleteL
       
   489     RMobilePhone::TMobilePhoneBatteryInfoV1 battInfoComplete;
       
   490     battInfoComplete.iStatus = RMobilePhone::EBatteryConnectedButExternallyPowered;
       
   491     battInfoComplete.iChargeLevel = 99;
       
   492     
       
   493     TMockLtsyData1<RMobilePhone::TMobilePhoneBatteryInfoV1> mockBattData1(battInfoComplete);
       
   494 
       
   495 	// Send the CompleteL to MockLtsy
       
   496 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   497 	
       
   498 	data.Close();
       
   499 	mockBattData1.SerialiseL(data);
       
   500 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyBatteryInfoChangeIndId, KErrNone, data);
       
   501 	User::WaitForRequest(mockLtsyStatus);
       
   502 	AssertMockLtsyStatusL();
       
   503     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   504     
       
   505     // Check completion of api
       
   506     User::WaitForRequest(requestStatus5);
       
   507     AssertMockLtsyStatusL();
       
   508     ASSERT_EQUALS(KErrNone, requestStatus5.Int());
       
   509     
       
   510     // Check returned data
       
   511     ASSERT_EQUALS(battInfoRet.iStatus, battInfoComplete.iStatus);
       
   512     ASSERT_EQUALS(battInfoRet.iChargeLevel, battInfoComplete.iChargeLevel);
       
   513     
       
   514 	data.Close();
       
   515 	AssertMockLtsyStatusL();
       
   516 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   517 	}
       
   518 
       
   519 /**
       
   520 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UC0004
       
   521 @SYMComponent telephony_ctsy
       
   522 @SYMTestCaseDesc Use-case: Test for retrieval of network information without having to post notifiers. 
       
   523 @SYMTestPriority High
       
   524 @SYMTestActions Invokes RMobilePhone::GetCurrentNetwork, RMobilePhone::GetNITZInfo, RMobilePhone::GetSignalStrength, RMobilePhone::GetCurrentMode
       
   525 @SYMTestExpectedResults Pass
       
   526 @SYMTestType CT
       
   527  */
       
   528 void CCTsyPhoneFU::TestUseCase0004L()
       
   529 	{
       
   530 	OpenEtelServerL(EUseExtendedError);
       
   531 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   532 	OpenPhoneL();
       
   533 	
       
   534 	RBuf8 data;
       
   535 	CleanupClosePushL(data);
       
   536 	
       
   537 	TRequestStatus reqStatusGetCurrentNetwork;
       
   538 	TRequestStatus reqStatusGetSigStr;
       
   539 	TRequestStatus reqStatusGetBattInfo;
       
   540 	TInt ret;
       
   541 	
       
   542 	//
       
   543 	// Invoke get api's 
       
   544 	//
       
   545 	
       
   546 	// RMobilePhone::GetCurrentNetwork
       
   547 	RMobilePhone::TMobilePhoneNetworkInfoV5 networkInfo;
       
   548 	RMobilePhone::TMobilePhoneNetworkInfoV5Pckg networkInfoPckg(networkInfo);
       
   549 	RMobilePhone::TMobilePhoneLocationAreaV1 locationArea;
       
   550 	iPhone.GetCurrentNetwork(reqStatusGetCurrentNetwork, networkInfoPckg, locationArea);
       
   551 	
       
   552 	// RMobilePhone::GetNITZInfo
       
   553 	RMobilePhone::TMobilePhoneNITZ nitzRet;
       
   554 	ret = iPhone.GetNITZInfo(nitzRet);
       
   555 	ASSERT_EQUALS(ret, KErrNone);
       
   556 
       
   557 	// RMobilePhone::GetSignalStrength
       
   558 	TInt32 signalStrength(0);
       
   559 	TInt8 bar(0);
       
   560 	iPhone.GetSignalStrength(reqStatusGetSigStr, signalStrength, bar);
       
   561 	
       
   562 	// RMobilePhone::GetCurrentMode
       
   563 	RMobilePhone::TMobilePhoneNetworkMode mode;
       
   564 	ret = iPhone.GetCurrentMode(mode);
       
   565 	ASSERT_EQUALS(ret, KErrNone);
       
   566 	
       
   567 	// RMobilePhone::GetBatteryInfo
       
   568 	RMobilePhone::TMobilePhoneBatteryInfoV1 battInfo;
       
   569 	iPhone.GetBatteryInfo(reqStatusGetBattInfo, battInfo);
       
   570 
       
   571 	//
       
   572 	// Check returned values
       
   573 	//
       
   574 	
       
   575 	// Check RMobilePhone::GetCurrentMode returned data against the data that was set up in CCtsyComponentTestBase::OpenPhoneL()
       
   576 	ASSERT_EQUALS(mode, KNetworkMode);  // Note mode is given different value to that retrieved from GetCurrentNetwork for sake of the test.
       
   577 	
       
   578 	// Check RMobilePhone::GetCurrentNetwork returned data against the data that was set up in CCtsyComponentTestBase::OpenPhoneL()
       
   579 	User::WaitForRequest(reqStatusGetCurrentNetwork);
       
   580 	ASSERT_EQUALS(reqStatusGetCurrentNetwork.Int(), KErrNone);
       
   581 	ASSERT_EQUALS(networkInfo.iEgprsAvailableIndicator, KEgprsAvailable);
       
   582 	ASSERT_EQUALS(networkInfo.iHsdpaAvailableIndicator, KHsdpaAvailable);
       
   583 	ASSERT_EQUALS(networkInfo.iAccess, KAccess);
       
   584 	ASSERT_EQUALS(networkInfo.iMode, KMode);
       
   585 	ASSERT_EQUALS(networkInfo.iStatus, KStatus);
       
   586 	ASSERT_EQUALS(networkInfo.iBandInfo, KBandInfo);
       
   587 	ASSERT_EQUALS(networkInfo.iCountryCode, KCountryCode);
       
   588 	ASSERT_EQUALS(networkInfo.iCdmaSID, KCdmaSID);
       
   589 	ASSERT_EQUALS(networkInfo.iAnalogSID, KAnalogSID);
       
   590 	ASSERT_EQUALS(networkInfo.iNetworkId, KNetworkId);
       
   591 	ASSERT_EQUALS(networkInfo.iDisplayTag, KDisplayTag);
       
   592 	ASSERT_EQUALS(networkInfo.iShortName, KShortName);
       
   593 	ASSERT_EQUALS(networkInfo.iLongName, KLongName);
       
   594 	
       
   595 	ASSERT_EQUALS(locationArea.iAreaKnown, KAreaKnown);
       
   596 	ASSERT_EQUALS(locationArea.iLocationAreaCode, KLocationAreaCode);
       
   597 	ASSERT_EQUALS(locationArea.iCellId, KCellId);
       
   598 	
       
   599 	//Do tests for TMobilePhoneNetworkInfoV1 and TMobilePhoneNetworkInfoV2 ?
       
   600 	
       
   601 	// Check RMobilePhone::GetNITZInfo returned data against the data that was set up in CCtsyComponentTestBase::OpenPhoneL()
       
   602 	ASSERT_EQUALS(nitzRet.iShortNetworkId, KShortName);
       
   603 	ASSERT_EQUALS(nitzRet.iLongNetworkId, KLongName);
       
   604 	ASSERT_EQUALS(nitzRet.iNitzFieldsUsed, KNitzFieldsUsed);
       
   605 	ASSERT_EQUALS(nitzRet.iTimeZone, KTimeZone);
       
   606 	ASSERT_EQUALS(nitzRet.iDST, KDst);
       
   607 	
       
   608 	// Check RMobilePhone::GetSignalStrength returned data against the data that was set up in CCtsyComponentTestBase::OpenPhoneL()
       
   609 	// RMobilePhone::GetSignalStrength
       
   610 	User::WaitForRequest(reqStatusGetSigStr);
       
   611 	ASSERT_EQUALS(reqStatusGetSigStr.Int(), KErrNone);
       
   612 	ASSERT_EQUALS(signalStrength, KSignalStrength);
       
   613 	ASSERT_EQUALS(bar, KBar);
       
   614 	
       
   615 	// Check RMobilePhone::GetBatteryInfo returned data against the data that was set up in CCtsyComponentTestBase::OpenPhoneL()
       
   616 	User::WaitForRequest(reqStatusGetBattInfo);
       
   617 	ASSERT_EQUALS(reqStatusGetBattInfo.Int(), KErrNone);
       
   618 	ASSERT_EQUALS(battInfo.iStatus, KBatteryStatus); 
       
   619 	ASSERT_EQUALS(battInfo.iChargeLevel, KBatteryChargeLevel);
       
   620 	
       
   621 	data.Close();
       
   622 	
       
   623 	AssertMockLtsyStatusL();
       
   624 	
       
   625 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   626 	}
       
   627 
       
   628 
       
   629 
       
   630 //
       
   631 // Other unit tests
       
   632 //
       
   633 
       
   634 /**
       
   635 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0001
       
   636 @SYMComponent telephony_ctsy
       
   637 @SYMTestCaseDesc Test support in CTSY for receiving indication of RF status change.
       
   638 @SYMTestPriority High
       
   639 @SYMTestActions Invokes xxxx
       
   640 @SYMTestExpectedResults Pass
       
   641 @SYMTestType UT
       
   642  */
       
   643 void CCTsyPhoneFU::TestUnit0001L()
       
   644 	{
       
   645 	OpenEtelServerL(EUseExtendedError);
       
   646 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   647 	OpenPhoneL();
       
   648 	
       
   649 	RBuf8 data;
       
   650 	CleanupClosePushL(data);
       
   651 	
       
   652 	TRequestStatus mockLtsyStatus;
       
   653 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   654 		
       
   655 	TRfStateInfo rfstatus = ERfsStateInfoInactive;
       
   656 	TMockLtsyData1<TRfStateInfo> rfstatdata(rfstatus);
       
   657 	rfstatdata.SerialiseL(data);
       
   658 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyRfStatusChangeIndId,KErrNone, data, 0);
       
   659 	
       
   660 	User::WaitForRequest(mockLtsyStatus);
       
   661 	
       
   662 	AssertMockLtsyStatusL();
       
   663 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   664 	
       
   665 	}
       
   666 	
       
   667 /**
       
   668 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0002
       
   669 @SYMComponent telephony_ctsy
       
   670 @SYMTestCaseDesc Test support in CTSY for retrieving the Phone Identity
       
   671 @SYMTestPriority High
       
   672 @SYMTestActions Invokes RMobilePhone::GetPhoneId
       
   673 @SYMTestExpectedResults Pass
       
   674 @SYMTestType UT
       
   675  */
       
   676 void CCTsyPhoneFU::TestUnit0002L()
       
   677 	{
       
   678 	OpenEtelServerL(EUseExtendedError);
       
   679 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   680 	OpenPhoneL();
       
   681 
       
   682 	RBuf8 data;
       
   683 	CleanupClosePushL(data);	
       
   684 
       
   685 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetPhoneId::KLtsyDispatchPhoneGetPhoneIdApiId);
       
   686 	
       
   687 	_LIT(KManufacturer, "Manufacturer XYZ");
       
   688 	_LIT(KModel, "Model XYZ");	
       
   689 	_LIT(KRevision, "Revision abc");
       
   690 	_LIT(KSerialNumber, "SerialNumber 1234");
       
   691 	//_LIT(KSerialNumberShort15, "SNum 1234");
       
   692 	
       
   693 	RMobilePhone::TMobilePhoneIdentityV1 phoneId;
       
   694 	phoneId.iManufacturer = KManufacturer;
       
   695 	phoneId.iModel = KModel;
       
   696 	phoneId.iRevision = KRevision;
       
   697 	phoneId.iSerialNumber = KSerialNumber;
       
   698 	
       
   699 	TMockLtsyData1<RMobilePhone::TMobilePhoneIdentityV1> phoneIdData(phoneId);
       
   700 	data.Close();
       
   701 	phoneIdData.SerialiseL(data);
       
   702 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetPhoneId::KLtsyDispatchPhoneGetPhoneIdApiId, KErrNone, data);
       
   703 	
       
   704 	// IPC call
       
   705 	TRequestStatus reqStatus;
       
   706 	RMobilePhone::TMobilePhoneIdentityV1 id;
       
   707 	iPhone.GetPhoneId(reqStatus, id);
       
   708 	User::WaitForRequest(reqStatus);
       
   709 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   710 	
       
   711 	ASSERT_EQUALS(phoneId.iManufacturer, id.iManufacturer);
       
   712 	ASSERT_EQUALS(phoneId.iModel, id.iModel);
       
   713 	ASSERT_EQUALS(phoneId.iRevision, id.iRevision);
       
   714 	ASSERT_EQUALS(phoneId.iSerialNumber, id.iSerialNumber);
       
   715 
       
   716 	data.Close();
       
   717 	AssertMockLtsyStatusL();
       
   718 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   719 	}
       
   720 /**
       
   721 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0003
       
   722 @SYMComponent telephony_ctsy
       
   723 @SYMTestCaseDesc Test support in CTSY for retrieving the service provider name
       
   724 @SYMTestPriority High
       
   725 @SYMTestActions Invokes RMobilePhone::GetServiceProviderName
       
   726 @SYMTestExpectedResults Pass
       
   727 @SYMTestType UT
       
   728  */
       
   729 void CCTsyPhoneFU::TestUnit0003L()
       
   730 	{
       
   731 	OpenEtelServerL(EUseExtendedError);
       
   732 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   733 	OpenPhoneL();
       
   734 
       
   735 	RBuf8 data;
       
   736 	CleanupClosePushL(data);	
       
   737 
       
   738 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetServiceProviderName::KLtsyDispatchPhoneGetServiceProviderNameApiId);
       
   739 	
       
   740 	_LIT(KPLMNField, "plmn123");
       
   741 	_LIT(KSPName, "spn123");
       
   742 		
       
   743 	RMobilePhone::TMobilePhoneServiceProviderNameV2 spnExp;
       
   744 	spnExp.iDisplayReq = RMobilePhone::KDisplayPLMNRequired | RMobilePhone::KDisplaySPNRequired;
       
   745 	spnExp.iPLMNField  = KPLMNField;
       
   746 	spnExp.iSPName = KSPName;
       
   747 	
       
   748 	TMockLtsyData1<RMobilePhone::TMobilePhoneServiceProviderNameV2> spnData(spnExp);
       
   749 	data.Close();
       
   750 	spnData.SerialiseL(data);
       
   751 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetServiceProviderName::KLtsyDispatchPhoneGetServiceProviderNameApiId, KErrNone, data);
       
   752 	
       
   753 	// IPC call
       
   754 	TRequestStatus reqStatus;
       
   755 	RMobilePhone::TMobilePhoneServiceProviderNameV2 spn;
       
   756 	RMobilePhone::TMobilePhoneServiceProviderNameV2Pckg spnPkg(spn);
       
   757 	
       
   758 	iPhone.GetServiceProviderName(reqStatus, spnPkg);
       
   759 	User::WaitForRequest(reqStatus);
       
   760 	ASSERT_EQUALS(KErrNone, reqStatus.Int());	
       
   761 	ASSERT_EQUALS(spn.iDisplayReq, spnExp.iDisplayReq);
       
   762 	ASSERT_EQUALS(spn.iPLMNField, spnExp.iPLMNField);
       
   763 	ASSERT_EQUALS(spn.iSPName, spnExp.iSPName);
       
   764 		
       
   765 	data.Close();
       
   766 	AssertMockLtsyStatusL();
       
   767 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   768 	}
       
   769 
       
   770 /**
       
   771 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0004
       
   772 @SYMComponent telephony_ctsy
       
   773 @SYMTestCaseDesc Test support in CTSY for cancelling a Get detected network list
       
   774 @SYMTestPriority High
       
   775 @SYMTestActions Invokes CGetDetectedNetworksAO::Cancel
       
   776 @SYMTestExpectedResults Pass
       
   777 @SYMTestType UT
       
   778  */
       
   779 void CCTsyPhoneFU::TestUnit0004L()
       
   780 	{
       
   781 	OpenEtelServerL(EUseExtendedError);
       
   782 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   783 	OpenPhoneL();
       
   784 
       
   785 	CGetDetectedNetworksAO* detAO = CGetDetectedNetworksAO::NewLC(iPhone,iMockLTSY);
       
   786 	
       
   787 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetDetectedNetworks::KLtsyDispatchPhoneGetDetectedNetworksApiId, KErrNone);
       
   788 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetDetectedNetworksCancel::KLtsyDispatchPhoneGetDetectedNetworksCancelApiId, KErrNone);
       
   789 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetDetectedNetworksCancel::KLtsyDispatchPhoneGetDetectedNetworksCancelApiId, KErrNone);
       
   790 
       
   791 	detAO->TestCancel();
       
   792 	
       
   793 	AssertMockLtsyStatusL();
       
   794 	
       
   795 	CleanupStack::PopAndDestroy(detAO);
       
   796 	CleanupStack::PopAndDestroy(this);
       
   797 	}
       
   798 
       
   799 /**
       
   800 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0005
       
   801 @SYMComponent telephony_ctsy
       
   802 @SYMTestCaseDesc Test support in CTSY for cancelling for a manual network selection
       
   803 @SYMTestPriority High
       
   804 @SYMTestActions Invokes RMobilePhone::CancelAsyncRequest(EMobilePhoneSelectNetwork)
       
   805 @SYMTestExpectedResults Pass
       
   806 @SYMTestType UT
       
   807  */
       
   808 void CCTsyPhoneFU::TestUnit0005L()
       
   809 	{
       
   810 	OpenEtelServerL(EUseExtendedError);
       
   811 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   812 	OpenPhoneL();
       
   813 
       
   814 	RBuf8 data;
       
   815 	CleanupClosePushL(data);
       
   816 	
       
   817 	//setup ETel required data
       
   818 	_LIT(KCountryCode, "1234");
       
   819 	_LIT(KNetworkId, "12345678");
       
   820 
       
   821 	RMobilePhone::TMobilePhoneNetworkManualSelection selection;
       
   822 	selection.iCountry = KCountryCode;
       
   823 	selection.iNetwork = KNetworkId;
       
   824 	
       
   825 	TBool isManual = ETrue;
       
   826 	
       
   827     TMockLtsyData2<TBool,RMobilePhone::TMobilePhoneNetworkManualSelection> selectData(isManual,selection);
       
   828 
       
   829     selectData.SerialiseL(data);
       
   830 	
       
   831 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSelectNetwork::KLtsyDispatchPhoneSelectNetworkApiId, data, KErrNone);
       
   832 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSelectNetworkCancel::KLtsyDispatchPhoneSelectNetworkCancelApiId, KErrNone);
       
   833 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSelectNetworkCancel::KLtsyDispatchPhoneSelectNetworkCancelApiId, KErrNone);
       
   834 
       
   835 	TRequestStatus status;
       
   836 	iPhone.SelectNetwork(status,isManual,selection);
       
   837 	iPhone.CancelAsyncRequest(EMobilePhoneSelectNetwork);
       
   838 	User::WaitForRequest(status);	
       
   839 	
       
   840 	AssertMockLtsyStatusL();
       
   841 
       
   842 	CleanupStack::PopAndDestroy(&data);
       
   843 	CleanupStack::PopAndDestroy(this);
       
   844 	}
       
   845 
       
   846 /**
       
   847 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0006
       
   848 @SYMComponent telephony_ctsy
       
   849 @SYMTestCaseDesc Test support in CTSY network selection change notification
       
   850 @SYMTestPriority High
       
   851 @SYMTestActions Invokes RMobilePhone::NotifyNetworkSelectionSettingChange
       
   852 @SYMTestExpectedResults Pass
       
   853 @SYMTestType UT
       
   854  */
       
   855 void CCTsyPhoneFU::TestUnit0006L()
       
   856 	{
       
   857 	OpenEtelServerL(EUseExtendedError);
       
   858 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   859 	OpenPhoneL();
       
   860 
       
   861 	RBuf8 data;
       
   862 	CleanupClosePushL(data);
       
   863 
       
   864 	//set up the set data
       
   865 	RMobilePhone::TMobilePhoneSelectionMethod phoneNetworkSelection;
       
   866 	phoneNetworkSelection = RMobilePhone::ENetworkSelectionManual;
       
   867 
       
   868 	//set up the Mock LTSY data
       
   869 	TMockLtsyData1<RMobilePhone::TMobilePhoneSelectionMethod> phoneNetworkSelectionData(phoneNetworkSelection);
       
   870 	phoneNetworkSelectionData.SerialiseL(data);
       
   871 	//set up Mock LTSY expect and completes 
       
   872 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyNetworkSelectionSettingChangeIndId, KErrNone, data);
       
   873 	
       
   874 	//ETel calls
       
   875 	TRequestStatus status;
       
   876 	//set up the notified data
       
   877 	RMobilePhone::TMobilePhoneNetworkSelectionV1 notifiedPhoneNetworkSelection;
       
   878 	RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg notifiedPckg(notifiedPhoneNetworkSelection);
       
   879 	iPhone.NotifyNetworkSelectionSettingChange(status,notifiedPckg);
       
   880 
       
   881 	User::WaitForRequest(status);
       
   882 	
       
   883 	//CTSY sets iBandClass and iOperationMode to defults values
       
   884 	ASSERT_EQUALS(phoneNetworkSelection,notifiedPhoneNetworkSelection.iMethod);
       
   885 	ASSERT_EQUALS(RMobilePhone::ENetworkBandClassUnknown,notifiedPhoneNetworkSelection.iBandClass);
       
   886 	ASSERT_EQUALS(RMobilePhone::ENetworkOperationUnknown,notifiedPhoneNetworkSelection.iOperationMode);
       
   887 	AssertMockLtsyStatusL();
       
   888 	
       
   889 	
       
   890 	AssertMockLtsyStatusL();
       
   891 	
       
   892 	CleanupStack::PopAndDestroy(&data);
       
   893 	CleanupStack::PopAndDestroy(this);
       
   894 	}
       
   895 
       
   896 /**
       
   897 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0007
       
   898 @SYMComponent telephony_ctsy
       
   899 @SYMTestCaseDesc Test support for battery information change notification.
       
   900 @SYMTestPriority High
       
   901 @SYMTestActions Invokes RMobilePhone::NotifyBatteryInfoChange
       
   902 @SYMTestExpectedResults Pass
       
   903 @SYMTestType UT
       
   904  */
       
   905 void CCTsyPhoneFU::TestUnit0007L()
       
   906 	{
       
   907 	OpenEtelServerL(EUseExtendedError);
       
   908 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   909 	OpenPhoneL();
       
   910 
       
   911 	RBuf8 data;
       
   912 	CleanupClosePushL(data);
       
   913 
       
   914 	TRequestStatus mockLtsyStatus;
       
   915 	TRequestStatus requestStatus;
       
   916 	
       
   917 	// Post notifier RMobilePhone::NotifyBatteryInfoChange
       
   918 	RMobilePhone::TMobilePhoneBatteryInfoV1 battInfoRet;
       
   919 	iPhone.NotifyBatteryInfoChange(requestStatus, battInfoRet);
       
   920 	
       
   921     // Prepare the NotifyBatteryInfoChange data for CompleteL
       
   922     RMobilePhone::TMobilePhoneBatteryInfoV1 battInfoComplete;
       
   923     battInfoComplete.iStatus = RMobilePhone::EBatteryConnectedButExternallyPowered;
       
   924     battInfoComplete.iChargeLevel = 99;
       
   925     
       
   926     TMockLtsyData1<RMobilePhone::TMobilePhoneBatteryInfoV1> mockBattData1(battInfoComplete);
       
   927 
       
   928 	// Send the CompleteL to MockLtsy
       
   929 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   930 	
       
   931 	data.Close();
       
   932 	mockBattData1.SerialiseL(data);
       
   933 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyBatteryInfoChangeIndId, KErrNone, data);
       
   934 	User::WaitForRequest(mockLtsyStatus);
       
   935 	AssertMockLtsyStatusL();
       
   936     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   937     
       
   938     // Check completion of api
       
   939     User::WaitForRequest(requestStatus);
       
   940     AssertMockLtsyStatusL();
       
   941     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   942     
       
   943     // Check returned data
       
   944     ASSERT_EQUALS(battInfoRet.iStatus, battInfoComplete.iStatus);
       
   945     ASSERT_EQUALS(battInfoRet.iChargeLevel, battInfoComplete.iChargeLevel);
       
   946 	
       
   947 	data.Close();
       
   948 	AssertMockLtsyStatusL();
       
   949 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   950 	}
       
   951 
       
   952 /**
       
   953 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0008
       
   954 @SYMComponent telephony_ctsy
       
   955 @SYMTestCaseDesc Test support for retrieval battery information without having to post a notification.
       
   956 @SYMTestPriority High
       
   957 @SYMTestActions Invokes RMobilePhone::GetBatteryInfo
       
   958 @SYMTestExpectedResults Pass
       
   959 @SYMTestType UT
       
   960  */
       
   961 void CCTsyPhoneFU::TestUnit0008L()
       
   962 	{
       
   963 	OpenEtelServerL(EUseExtendedError);
       
   964 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   965 	OpenPhoneL();
       
   966 
       
   967 	RBuf8 data;
       
   968 	CleanupClosePushL(data);
       
   969 	
       
   970 	TRequestStatus reqStatus;
       
   971 	
       
   972 	RMobilePhone::TMobilePhoneBatteryInfoV1 battInfo;
       
   973 	iPhone.GetBatteryInfo(reqStatus, battInfo);
       
   974 	
       
   975 	// Check RMobilePhone::GetBatteryInfo returned data against the data that was set up in CCtsyComponentTestBase::OpenPhoneL()
       
   976 	User::WaitForRequest(reqStatus);
       
   977 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
   978 	ASSERT_EQUALS(battInfo.iStatus, KBatteryStatus); 
       
   979 	ASSERT_EQUALS(battInfo.iChargeLevel, KBatteryChargeLevel);
       
   980 	
       
   981 	data.Close();
       
   982 	AssertMockLtsyStatusL();
       
   983 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   984 	}
       
   985 
       
   986 /**
       
   987 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0009
       
   988 @SYMComponent telephony_ctsy
       
   989 @SYMTestCaseDesc Test support for network registration change notification.
       
   990 @SYMTestPriority High
       
   991 @SYMTestActions Invokes RMobilePhone::NotifyNetworkRegistrationStatusChange
       
   992 @SYMTestExpectedResults Pass
       
   993 @SYMTestType UT
       
   994  */
       
   995 void CCTsyPhoneFU::TestUnit0009L()
       
   996 	{
       
   997 	OpenEtelServerL(EUseExtendedError);
       
   998 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   999 	OpenPhoneL();
       
  1000 
       
  1001 	RBuf8 data;
       
  1002 	CleanupClosePushL(data);
       
  1003 
       
  1004 	TRequestStatus mockLtsyStatus;
       
  1005 	TRequestStatus requestStatus;
       
  1006 	
       
  1007 	// Post notifier RMobilePhone::NotifyNetworkRegistrationStatusChange
       
  1008 	RMobilePhone::TMobilePhoneRegistrationStatus regStatus;
       
  1009 	iPhone.NotifyNetworkRegistrationStatusChange(requestStatus, regStatus);
       
  1010 	
       
  1011     // Prepare the NotifyNetworkRegistrationStatusChange data for CompleteL
       
  1012 	// The Ctsy expects RMobilePhone::TMobilePhoneRegistrationStatus
       
  1013 	RMobilePhone::TMobilePhoneRegistrationStatus regStatusComplete;
       
  1014 	// Note: the registration status is made different to that set during phone boot-up intentionally
       
  1015 	regStatusComplete = RMobilePhone::ERegisteredRoaming;
       
  1016     
       
  1017     TMockLtsyData1<RMobilePhone::TMobilePhoneRegistrationStatus> mockNetRegData1(regStatusComplete);
       
  1018 
       
  1019 	// Send the CompleteL to MockLtsy
       
  1020 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1021 	
       
  1022 	data.Close();
       
  1023 	mockNetRegData1.SerialiseL(data);
       
  1024 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyNetworkRegistrationStatusChangeIndId, KErrNone, data);
       
  1025 	User::WaitForRequest(mockLtsyStatus);
       
  1026 	AssertMockLtsyStatusL();
       
  1027     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1028     
       
  1029     // Check completion of api
       
  1030     User::WaitForRequest(requestStatus);
       
  1031     AssertMockLtsyStatusL();
       
  1032     ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1033     
       
  1034     // Check returned data
       
  1035     ASSERT_EQUALS(regStatus, regStatusComplete);
       
  1036 	
       
  1037 	data.Close();
       
  1038 	AssertMockLtsyStatusL();
       
  1039 	CleanupStack::PopAndDestroy(2, this); // data, this
       
  1040 	}
       
  1041 
       
  1042 
       
  1043 /**
       
  1044 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0010
       
  1045 @SYMComponent telephony_ctsy
       
  1046 @SYMTestCaseDesc Test correct function of NSPS (No Signal, Power Save) notification and waking
       
  1047 @SYMTestPriority High
       
  1048 @SYMTestActions Invokes RMmCustomAPI::NotifyNSPSStatus and RMmCustomAPI::NetWakeup
       
  1049 @SYMTestExpectedResults Pass
       
  1050 @SYMTestType UT
       
  1051  */
       
  1052 void CCTsyPhoneFU::TestUnit0010L()
       
  1053 	{
       
  1054 	OpenEtelServerL(EUseExtendedError);
       
  1055 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1056 
       
  1057 	TRequestStatus reqStatus;
       
  1058 	
       
  1059 	RBuf8 data;
       
  1060 	CleanupClosePushL(data);
       
  1061 	
       
  1062 	OpenPhoneL();
       
  1063 	
       
  1064 	RMmCustomAPI customApi;
       
  1065 	OpenCustomApiLC(customApi);
       
  1066 
       
  1067 	RMmCustomAPI::TNspsStatus nspsStatus;
       
  1068 
       
  1069 	TBool nspsEnabled = ETrue;
       
  1070 	TMockLtsyData1<TBool> nspsStatusData(nspsEnabled);
       
  1071 
       
  1072 	
       
  1073 	customApi.NotifyNSPSStatus(reqStatus,nspsStatus);
       
  1074 	
       
  1075 	data.Close();
       
  1076 	nspsStatusData.SerialiseL(data);
       
  1077 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyNspsStatusChangeIndId, KErrNone, data);
       
  1078 
       
  1079 	User::WaitForRequest(reqStatus);
       
  1080 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1081 	ASSERT_EQUALS(RMmCustomAPI::ENspsOn, nspsStatus);
       
  1082 
       
  1083 	AssertMockLtsyStatusL();
       
  1084 	
       
  1085 	iMockLTSY.ExpectL(MLtsyDispatchPhoneNspsWakeup::KLtsyDispatchPhoneNspsWakeupApiId, KErrNone);
       
  1086 	iMockLTSY.CompleteL(MLtsyDispatchPhoneNspsWakeup::KLtsyDispatchPhoneNspsWakeupApiId, KErrNone);
       
  1087     customApi.NetWakeup(reqStatus);
       
  1088 	User::WaitForRequest(reqStatus);
       
  1089 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1090 	
       
  1091 	customApi.NotifyNSPSStatus(reqStatus,nspsStatus);
       
  1092 	nspsEnabled = EFalse;
       
  1093 	data.Close();
       
  1094 	nspsStatusData.SerialiseL(data);
       
  1095 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyNspsStatusChangeIndId, KErrNone, data);
       
  1096 	data.Close();
       
  1097 	User::WaitForRequest(reqStatus);
       
  1098 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1099 	ASSERT_EQUALS(RMmCustomAPI::ENspsOff, nspsStatus);
       
  1100 
       
  1101 	
       
  1102 	AssertMockLtsyStatusL();
       
  1103 		
       
  1104 	
       
  1105 	CleanupStack::PopAndDestroy(&customApi);
       
  1106 	CleanupStack::PopAndDestroy(&data);
       
  1107 	CleanupStack::PopAndDestroy(this);
       
  1108 	}
       
  1109 
       
  1110 /**
       
  1111 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0011
       
  1112 @SYMComponent telephony_ctsy
       
  1113 @SYMTestCaseDesc Test correct function of Edge Gprs notification
       
  1114 @SYMTestPriority High
       
  1115 @SYMTestActions Invokes RMmCustomAPI::NotifyEGprsInfoChange
       
  1116 @SYMTestExpectedResults Pass
       
  1117 @SYMTestType UT
       
  1118  */
       
  1119 void CCTsyPhoneFU::TestUnit0011L()
       
  1120 	{
       
  1121 	OpenEtelServerL(EUseExtendedError);
       
  1122 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1123 
       
  1124 	RBuf8 data;
       
  1125 	CleanupClosePushL(data);
       
  1126 	
       
  1127 	TRequestStatus reqStatus;
       
  1128 	
       
  1129 	OpenPhoneL();
       
  1130 	
       
  1131 	RMmCustomAPI customApi;
       
  1132 	OpenCustomApiLC(customApi);
       
  1133 	
       
  1134 	RPacketService packetService;
       
  1135 	OpenPacketServiceLC(packetService,RPacketService::EStatusUnattached);
       
  1136 	
       
  1137 	// custom API info
       
  1138 	RMmCustomAPI::TGprsInformation gprsInformation;
       
  1139 	RMmCustomAPI::TGprsInformationPckg gprsInformationPckg(gprsInformation);
       
  1140 	
       
  1141 
       
  1142 	// test the case when Edge is not supported
       
  1143 	TBool edgeSupported = EFalse;
       
  1144 	TMockLtsyData1<TBool> egprsInfoData(edgeSupported);
       
  1145 	egprsInfoData.SerialiseL(data);
       
  1146 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyEgprsInfoChangeIndId, KErrNone, data);
       
  1147 	data.Close();
       
  1148 		
       
  1149 	customApi.NotifyEGprsInfoChange(reqStatus,gprsInformationPckg);
       
  1150 	User::WaitForRequest(reqStatus);
       
  1151 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
  1152 	ASSERT_EQUALS(gprsInformation.iGprsInfo,RMmCustomAPI::EGprs);
       
  1153 	AssertMockLtsyStatusL();
       
  1154 	
       
  1155 	// test the case when Edge is supported
       
  1156 	edgeSupported = ETrue;
       
  1157 	egprsInfoData.SerialiseL(data);
       
  1158 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyEgprsInfoChangeIndId, KErrNone, data);
       
  1159 	data.Close();
       
  1160 
       
  1161 	customApi.NotifyEGprsInfoChange(reqStatus,gprsInformationPckg);
       
  1162 	User::WaitForRequest(reqStatus);
       
  1163 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
  1164 	ASSERT_EQUALS(gprsInformation.iGprsInfo ,RMmCustomAPI::EEdgeGprs);
       
  1165 	AssertMockLtsyStatusL();
       
  1166 
       
  1167 	
       
  1168 	// test the case when Edge is supported and KErrGeneral returned, (error returned not used in the CTSY)
       
  1169 	edgeSupported = ETrue;
       
  1170 	egprsInfoData.SerialiseL(data);
       
  1171 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyEgprsInfoChangeIndId, KErrGeneral, data);
       
  1172 	data.Close();
       
  1173 
       
  1174 	customApi.NotifyEGprsInfoChange(reqStatus,gprsInformationPckg);
       
  1175 	User::WaitForRequest(reqStatus);
       
  1176 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
  1177 	ASSERT_EQUALS(gprsInformation.iGprsInfo ,RMmCustomAPI::EEdgeGprs);
       
  1178 	AssertMockLtsyStatusL();
       
  1179 	
       
  1180 	CleanupStack::PopAndDestroy(&packetService);
       
  1181 	CleanupStack::PopAndDestroy(&customApi);
       
  1182 	CleanupStack::PopAndDestroy(&data);
       
  1183 	CleanupStack::PopAndDestroy(this);
       
  1184 	}
       
  1185 
       
  1186 /**
       
  1187 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0012
       
  1188 @SYMComponent telephony_ctsy
       
  1189 @SYMTestCaseDesc Test correct function of Getting the Fdn Status
       
  1190 @SYMTestPriority High
       
  1191 @SYMTestActions Invokes RMobilePhone::GetFdnStatus() (Sync and Async)
       
  1192 @SYMTestExpectedResults Pass
       
  1193 @SYMTestType UT
       
  1194  */
       
  1195 void CCTsyPhoneFU::TestUnit0012L()
       
  1196 	{
       
  1197 	OpenEtelServerL(EUseExtendedError);
       
  1198 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1199 
       
  1200 	RBuf8 data;
       
  1201 	CleanupClosePushL(data);
       
  1202 	
       
  1203 	TRequestStatus reqStatus;
       
  1204 	
       
  1205 	OpenPhoneL();
       
  1206 	
       
  1207 	//test the case where the LTSY returns KErrNone - asynchronous call
       
  1208 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetFdnStatus::KLtsyDispatchPhoneGetFdnStatusApiId);
       
  1209 
       
  1210 	RMobilePhone::TMobilePhoneFdnStatus compFdnStatus = RMobilePhone::EFdnNotActive;
       
  1211 	TMockLtsyData1<RMobilePhone::TMobilePhoneFdnStatus> fdnStatusData(compFdnStatus);
       
  1212 	fdnStatusData.SerialiseL(data);
       
  1213 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetFdnStatus::KLtsyDispatchPhoneGetFdnStatusApiId,KErrNone,data);
       
  1214 	data.Close();
       
  1215 	
       
  1216 	RMobilePhone::TMobilePhoneFdnStatus fdnStatus = RMobilePhone::EFdnUnknown;
       
  1217 	iPhone.GetFdnStatus(reqStatus,fdnStatus);
       
  1218 	User::WaitForRequest(reqStatus);
       
  1219 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
  1220 	ASSERT_EQUALS(compFdnStatus,fdnStatus);
       
  1221 	AssertMockLtsyStatusL();
       
  1222 
       
  1223 	//test the case where the LTSY returns KErrGeneral - asynchronous call
       
  1224 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetFdnStatus::KLtsyDispatchPhoneGetFdnStatusApiId);
       
  1225 
       
  1226 	compFdnStatus = RMobilePhone::EFdnNotActive;
       
  1227 	fdnStatusData.SerialiseL(data);
       
  1228 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetFdnStatus::KLtsyDispatchPhoneGetFdnStatusApiId,KErrGeneral,data);
       
  1229 	data.Close();
       
  1230 
       
  1231 	fdnStatus = RMobilePhone::EFdnUnknown;
       
  1232 	iPhone.GetFdnStatus(reqStatus,fdnStatus);
       
  1233 	User::WaitForRequest(reqStatus);
       
  1234 	ASSERT_EQUALS(reqStatus.Int(), KErrGeneral);
       
  1235 	ASSERT_EQUALS(compFdnStatus,fdnStatus);
       
  1236 	AssertMockLtsyStatusL();
       
  1237 
       
  1238 	//test the case where the LTSY returns KErrGeneral - synchronous call
       
  1239 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetFdnStatus::KLtsyDispatchPhoneGetFdnStatusApiId);
       
  1240 
       
  1241 	compFdnStatus = RMobilePhone::EFdnNotActive;
       
  1242 	fdnStatusData.SerialiseL(data);
       
  1243 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetFdnStatus::KLtsyDispatchPhoneGetFdnStatusApiId,KErrNone,data);
       
  1244 	data.Close();
       
  1245 	
       
  1246 	fdnStatus = RMobilePhone::EFdnUnknown;
       
  1247 	ASSERT_EQUALS(iPhone.GetFdnStatus(fdnStatus), KErrNone);
       
  1248 	ASSERT_EQUALS(compFdnStatus,fdnStatus);
       
  1249 	AssertMockLtsyStatusL();
       
  1250 	
       
  1251 	CleanupStack::PopAndDestroy(&data);
       
  1252 	CleanupStack::PopAndDestroy(this);
       
  1253 	}
       
  1254 
       
  1255 /**
       
  1256 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0013
       
  1257 @SYMComponent telephony_ctsy
       
  1258 @SYMTestCaseDesc Test correct function of Set Network Selection Setting error case
       
  1259 @SYMTestPriority High
       
  1260 @SYMTestActions Invokes RMobilePhone::NotifyNetworkSelectionSettingChange() RMobilePhone::SetNetworkSelectionSetting()
       
  1261 @SYMTestExpectedResults Pass
       
  1262 @SYMTestType UT
       
  1263  */
       
  1264 void CCTsyPhoneFU::TestUnit0013L()
       
  1265 	{
       
  1266 	OpenEtelServerL(EUseExtendedError);
       
  1267 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1268 
       
  1269 	RBuf8 data;
       
  1270 	CleanupClosePushL(data);
       
  1271 	
       
  1272 	OpenPhoneL();
       
  1273 	
       
  1274 	//set up the notified data
       
  1275 	RMobilePhone::TMobilePhoneNetworkSelectionV1 notifiedPhoneNetworkSelection;
       
  1276 	RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg notifiedPckg(notifiedPhoneNetworkSelection);
       
  1277 
       
  1278 	//set up the set data
       
  1279 	RMobilePhone::TMobilePhoneNetworkSelectionV1 phoneNetworkSelection;
       
  1280 	phoneNetworkSelection.iMethod 			= RMobilePhone::ENetworkSelectionManual;
       
  1281 	phoneNetworkSelection.iBandClass		= RMobilePhone::ENetworkBandClassAOnly;
       
  1282 	phoneNetworkSelection.iOperationMode	= RMobilePhone::ENetworkOperationAnalogPreferred;
       
  1283 
       
  1284 	RMobilePhone::TMobilePhoneNetworkSelectionV1Pckg setPckg(phoneNetworkSelection);
       
  1285 
       
  1286 	//set up the Mock LTSY data
       
  1287 	TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkSelectionV1> phoneNetworkSelectionExpData(phoneNetworkSelection);
       
  1288 	phoneNetworkSelectionExpData.SerialiseL(data);
       
  1289 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetNetworkSelectionSetting::KLtsyDispatchPhoneSetNetworkSelectionSettingApiId, data, KErrNone);
       
  1290 	data.Close();
       
  1291 	
       
  1292 	TMockLtsyData1<RMobilePhone::TMobilePhoneSelectionMethod> phoneNetworkSelectionCompData(phoneNetworkSelection.iMethod);
       
  1293 	phoneNetworkSelectionCompData.SerialiseL(data);
       
  1294 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetNetworkSelectionSetting::KLtsyDispatchPhoneSetNetworkSelectionSettingApiId, KErrGeneral, data);
       
  1295 	data.Close();
       
  1296 
       
  1297 	//ETel calls
       
  1298 	TRequestStatus notifyStatus;
       
  1299 	iPhone.NotifyNetworkSelectionSettingChange(notifyStatus,notifiedPckg);
       
  1300 	
       
  1301 	TRequestStatus setNetworkSelectionStatus;
       
  1302 	iPhone.SetNetworkSelectionSetting(setNetworkSelectionStatus,setPckg);
       
  1303 	
       
  1304 	User::WaitForRequest(setNetworkSelectionStatus);
       
  1305 	ASSERT_EQUALS(setNetworkSelectionStatus.Int(),KErrGeneral);
       
  1306 	ASSERT_EQUALS(notifyStatus.Int(),KRequestPending);
       
  1307 		
       
  1308 	//CTSY sets iBandClass and iOperationMode to defults values
       
  1309 	ASSERT_EQUALS(RMobilePhone::ENetworkSelectionUnknown,notifiedPhoneNetworkSelection.iMethod);
       
  1310 	ASSERT_EQUALS(RMobilePhone::ENetworkBandClassUnknown,notifiedPhoneNetworkSelection.iBandClass);
       
  1311 	ASSERT_EQUALS(RMobilePhone::ENetworkOperationUnknown,notifiedPhoneNetworkSelection.iOperationMode);
       
  1312 	AssertMockLtsyStatusL();
       
  1313 
       
  1314 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyNetworkSelectionSettingChange);
       
  1315 	ASSERT_EQUALS(notifyStatus.Int(),KErrCancel);
       
  1316 		
       
  1317 	CleanupStack::PopAndDestroy(&data);
       
  1318 	CleanupStack::PopAndDestroy(this);
       
  1319 	}
       
  1320 
       
  1321 /**
       
  1322 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0014
       
  1323 @SYMComponent telephony_ctsy
       
  1324 @SYMTestCaseDesc Test RMmCustomAPI::NotifyNetworkConnectionFailure
       
  1325 @SYMTestPriority High
       
  1326 @SYMTestActions Invokes RMmCustomAPI::NotifyNetworkConnectionFailure
       
  1327 @SYMTestExpectedResults Pass
       
  1328 @SYMTestType UT
       
  1329  */
       
  1330 void CCTsyPhoneFU::TestUnit0014L()
       
  1331 	{
       
  1332 	OpenEtelServerL(EUseExtendedError);
       
  1333 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1334 	OpenPhoneL();
       
  1335 	
       
  1336 	RMmCustomAPI customApi;
       
  1337 	OpenCustomApiLC(customApi);
       
  1338 
       
  1339 
       
  1340 	RBuf8 data;
       
  1341 	CleanupClosePushL(data);
       
  1342 
       
  1343     TRequestStatus requestStatus;
       
  1344     customApi.NotifyNetworkConnectionFailure(requestStatus);
       
  1345 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1346     
       
  1347 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyNetworkConnectionFailureIndId, KErrNone);
       
  1348 	User::WaitForRequest(requestStatus);
       
  1349 
       
  1350 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1351 
       
  1352 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1353 	}
       
  1354 
       
  1355 /**
       
  1356 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0015
       
  1357 @SYMComponent telephony_ctsy
       
  1358 @SYMTestCaseDesc Test RMmCustomAPI::NotifyDtmfEvent
       
  1359 @SYMTestPriority High
       
  1360 @SYMTestActions Invokes RMmCustomAPI::NotifyDtmfEvent
       
  1361 @SYMTestExpectedResults Pass
       
  1362 @SYMTestType UT
       
  1363  */
       
  1364 void CCTsyPhoneFU::TestUnit0015L()
       
  1365 	{
       
  1366 	OpenEtelServerL(EUseExtendedError);
       
  1367 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1368 	OpenPhoneL();
       
  1369 	
       
  1370 	RMmCustomAPI customApi;
       
  1371 	OpenCustomApiLC(customApi);
       
  1372 
       
  1373 	RBuf8 data;
       
  1374 	CleanupClosePushL(data);
       
  1375 
       
  1376     TRequestStatus requestStatus;
       
  1377     RMmCustomAPI::TDtmfInfo info;
       
  1378     customApi.NotifyDtmfEvent(requestStatus, info);
       
  1379 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1380     
       
  1381     RMmCustomAPI::TDtmfEventType compType = RMmCustomAPI::EDtmfSequence;
       
  1382     RMmCustomAPI::TDtmfEvent compEvent = RMmCustomAPI::EDtmfStop;
       
  1383     TChar compChar = '0';
       
  1384 	TMockLtsyData3<RMmCustomAPI::TDtmfEventType, RMmCustomAPI::TDtmfEvent, TChar>
       
  1385         modesData(compType, compEvent, compChar);
       
  1386 	data.Close();
       
  1387 	modesData.SerialiseL(data);
       
  1388 	iMockLTSY.CompleteL(KMockLtsyDispatchCustomPhoneNotifyDtmfEventIndId, KErrNone, data);
       
  1389 	User::WaitForRequest(requestStatus);
       
  1390 
       
  1391 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1392     ASSERT_EQUALS(compType, info.iType);
       
  1393     ASSERT_EQUALS(compEvent, info.iEvent);
       
  1394     ASSERT_EQUALS(compChar, info.iTone);
       
  1395 
       
  1396 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1397 	}
       
  1398 
       
  1399 /**
       
  1400 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0016
       
  1401 @SYMComponent telephony_ctsy
       
  1402 @SYMTestCaseDesc Test RMmCustomAPI::ResetNetServer
       
  1403 @SYMTestPriority High
       
  1404 @SYMTestActions Invokes RMmCustomAPI::ResetNetServer
       
  1405 @SYMTestExpectedResults Pass
       
  1406 @SYMTestType UT
       
  1407  */
       
  1408 void CCTsyPhoneFU::TestUnit0016L()
       
  1409 	{
       
  1410 	OpenEtelServerL(EUseExtendedError);
       
  1411 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1412 	OpenPhoneL();
       
  1413 	
       
  1414 	RMmCustomAPI customApi;
       
  1415 	OpenCustomApiLC(customApi);
       
  1416 
       
  1417 	iMockLTSY.ExpectL(MLtsyDispatchPhoneResetNetServer::KLtsyDispatchPhoneResetNetServerApiId, KErrNone);
       
  1418 
       
  1419     TRequestStatus requestStatus;
       
  1420     customApi.ResetNetServer(requestStatus);
       
  1421 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1422 	iMockLTSY.CompleteL(MLtsyDispatchPhoneResetNetServer::KLtsyDispatchPhoneResetNetServerApiId, KErrNone);
       
  1423 	User::WaitForRequest(requestStatus);
       
  1424 
       
  1425 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1426 
       
  1427 	CleanupStack::PopAndDestroy(2, this); // customApi, this
       
  1428 	}
       
  1429 
       
  1430 /**
       
  1431 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0017
       
  1432 @SYMComponent telephony_ctsy
       
  1433 @SYMTestCaseDesc Test RMmCustomAPI::SetAlwaysOn
       
  1434 @SYMTestPriority High
       
  1435 @SYMTestActions Invokes RMmCustomAPI::SetAlwaysOn
       
  1436 @SYMTestExpectedResults Pass
       
  1437 @SYMTestType UT
       
  1438  */
       
  1439 void CCTsyPhoneFU::TestUnit0017L()
       
  1440 	{
       
  1441 	OpenEtelServerL(EUseExtendedError);
       
  1442 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1443 	OpenPhoneL();
       
  1444 	
       
  1445 	RMmCustomAPI customApi;
       
  1446 	OpenCustomApiLC(customApi);
       
  1447 
       
  1448 
       
  1449 	RBuf8 data;
       
  1450 	CleanupClosePushL(data);
       
  1451 
       
  1452     // Open a packet service, ctsy must have a packet service sub session in order to activate the SetAlwaysOn 
       
  1453 	
       
  1454 	RPacketService packetService;
       
  1455 	OpenPacketServiceLC(packetService,RPacketService::EStatusUnattached);
       
  1456 
       
  1457     RMmCustomAPI::TSetAlwaysOnMode expData = RMmCustomAPI::EAlwaysModeBoth;
       
  1458 	TMockLtsyData1<RMmCustomAPI::TSetAlwaysOnMode> modesData(expData);
       
  1459 	data.Close();
       
  1460 	modesData.SerialiseL(data);
       
  1461 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetAlwaysOnMode::KLtsyDispatchPhoneSetAlwaysOnModeApiId, data, KErrNone);
       
  1462 
       
  1463     TRequestStatus requestStatus;
       
  1464     customApi.SetAlwaysOn(requestStatus, expData);
       
  1465 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1466     
       
  1467 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetAlwaysOnMode::KLtsyDispatchPhoneSetAlwaysOnModeApiId, KErrNone);
       
  1468 	User::WaitForRequest(requestStatus);
       
  1469 
       
  1470 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1471 
       
  1472 	CleanupStack::PopAndDestroy(4, this); // packetService, data, customApi, this
       
  1473 	}
       
  1474 
       
  1475 /**
       
  1476 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0018
       
  1477 @SYMComponent telephony_ctsy
       
  1478 @SYMTestCaseDesc Test RMmCustomAPI::SetDriveMode
       
  1479 @SYMTestPriority High
       
  1480 @SYMTestActions Invokes RMmCustomAPI::SetDriveMode
       
  1481 @SYMTestExpectedResults Pass
       
  1482 @SYMTestType UT
       
  1483  */
       
  1484 void CCTsyPhoneFU::TestUnit0018L()
       
  1485 	{
       
  1486 	OpenEtelServerL(EUseExtendedError);
       
  1487 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1488 	OpenPhoneL();
       
  1489 	
       
  1490 	RMmCustomAPI customApi;
       
  1491 	OpenCustomApiLC(customApi);
       
  1492 
       
  1493 
       
  1494 	RBuf8 data;
       
  1495 	CleanupClosePushL(data);
       
  1496 
       
  1497     RMmCustomAPI::TSetDriveMode expData = RMmCustomAPI::EActivateDriveMode;
       
  1498 	TMockLtsyData1<RMmCustomAPI::TSetDriveMode> modesData(expData);
       
  1499 	data.Close();
       
  1500 	modesData.SerialiseL(data);
       
  1501 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetDriveMode::KLtsyDispatchPhoneSetDriveModeApiId, data, KErrNone);
       
  1502 
       
  1503     TRequestStatus requestStatus;
       
  1504     customApi.SetDriveMode(requestStatus, RMmCustomAPI::EActivateDriveMode);
       
  1505 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1506     
       
  1507 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetDriveMode::KLtsyDispatchPhoneSetDriveModeApiId, KErrNone);
       
  1508 	User::WaitForRequest(requestStatus);
       
  1509 
       
  1510 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1511 
       
  1512 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1513 	}
       
  1514 
       
  1515 /**
       
  1516 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0019
       
  1517 @SYMComponent telephony_ctsy
       
  1518 @SYMTestCaseDesc Test RMmCustomAPI::ReadHSxPAStatus, RMmCustomAPI::WriteHSxPAStatus and RMmCustomAPI::NotifyHSxPAStatus
       
  1519 @SYMTestPriority High
       
  1520 @SYMTestActions Invokes RMmCustomAPI::ReadHSxPAStatus, RMmCustomAPI::WriteHSxPAStatus and RMmCustomAPI::NotifyHSxPAStatus
       
  1521 @SYMTestExpectedResults Pass
       
  1522 @SYMTestType UT
       
  1523  */
       
  1524 void CCTsyPhoneFU::TestUnit0019L()
       
  1525 	{
       
  1526 	OpenEtelServerL(EUseExtendedError);
       
  1527 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1528 	OpenPhoneL();
       
  1529 	
       
  1530 	RMmCustomAPI customApi;
       
  1531 	OpenCustomApiLC(customApi);
       
  1532 
       
  1533 
       
  1534 	RBuf8 data;
       
  1535 	CleanupClosePushL(data);
       
  1536 
       
  1537     // Register Notification
       
  1538     RMmCustomAPI::THSxPAStatus notifyHspaStatus;
       
  1539     TRequestStatus notifyRequestStatus;
       
  1540     customApi.NotifyHSxPAStatus(notifyRequestStatus, notifyHspaStatus);
       
  1541     ASSERT_EQUALS(KRequestPending, notifyRequestStatus.Int());
       
  1542 
       
  1543     // Expect for setter
       
  1544     RMmCustomAPI::THSxPAStatus expSetHspaStatus = RMmCustomAPI::EHSxPAEnabled;
       
  1545 	TMockLtsyData1<RMmCustomAPI::THSxPAStatus> expSetData(expSetHspaStatus);
       
  1546 	data.Close();
       
  1547 	expSetData.SerialiseL(data);
       
  1548 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetHspaStatus::KLtsyDispatchPhoneSetHspaStatusApiId, data, KErrNone);
       
  1549 
       
  1550     // Set the data
       
  1551     TRequestStatus setRequestStatus;
       
  1552     RMmCustomAPI::THSxPAStatus setHspaStatus = expSetHspaStatus;
       
  1553     customApi.WriteHSxPAStatus(setRequestStatus, setHspaStatus);
       
  1554 	ASSERT_EQUALS(KRequestPending, setRequestStatus.Int());
       
  1555 
       
  1556     // Complete the set
       
  1557 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetHspaStatus::KLtsyDispatchPhoneSetHspaStatusApiId, KErrNone);
       
  1558 	User::WaitForRequest(setRequestStatus);
       
  1559 	ASSERT_EQUALS(KErrNone, setRequestStatus.Int());
       
  1560 
       
  1561     // Expect for getter
       
  1562 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetHspaStatus::KLtsyDispatchPhoneGetHspaStatusApiId, KErrNone);
       
  1563 
       
  1564     // get the data
       
  1565     TRequestStatus getRequestStatus;
       
  1566     RMmCustomAPI::THSxPAStatus getHspaStatus;
       
  1567     customApi.ReadHSxPAStatus(getRequestStatus, getHspaStatus);
       
  1568 	ASSERT_EQUALS(KRequestPending, getRequestStatus.Int());
       
  1569 
       
  1570     // Complete the get
       
  1571     RMmCustomAPI::THSxPAStatus compGetHspaStatus = RMmCustomAPI::EHSxPAEnabled;
       
  1572 	TMockLtsyData1<RMmCustomAPI::THSxPAStatus> compGetData(compGetHspaStatus);
       
  1573 	data.Close();
       
  1574 	compGetData.SerialiseL(data);
       
  1575 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetHspaStatus::KLtsyDispatchPhoneGetHspaStatusApiId, KErrNone, data);
       
  1576 	User::WaitForRequest(getRequestStatus);
       
  1577 	ASSERT_EQUALS(KErrNone, getRequestStatus.Int());
       
  1578     ASSERT_EQUALS(compGetHspaStatus, getHspaStatus);
       
  1579 
       
  1580     // notify a change
       
  1581     RMmCustomAPI::THSxPAStatus compNotifyHspaStatus = RMmCustomAPI::EHSxPADisabled;
       
  1582 	TMockLtsyData1<RMmCustomAPI::THSxPAStatus> compNotiftData(compNotifyHspaStatus);
       
  1583 	data.Close();
       
  1584 	compNotiftData.SerialiseL(data);
       
  1585 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyHspaStatusChangedIndId, KErrNone, data);
       
  1586 	User::WaitForRequest(notifyRequestStatus);
       
  1587 	ASSERT_EQUALS(KErrNone, notifyRequestStatus.Int());
       
  1588     ASSERT_EQUALS(compNotifyHspaStatus, notifyHspaStatus);
       
  1589     
       
  1590     
       
  1591 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1592 	}
       
  1593 
       
  1594 
       
  1595 /**
       
  1596 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0020
       
  1597 @SYMComponent telephony_ctsy
       
  1598 @SYMTestCaseDesc Test RMmCustomAPI::GetNetworkProviderName
       
  1599 @SYMTestPriority High
       
  1600 @SYMTestActions Invokes RMmCustomAPI::GetNetworkProviderName
       
  1601 @SYMTestExpectedResults Pass
       
  1602 @SYMTestType UT
       
  1603  */
       
  1604 void CCTsyPhoneFU::TestUnit0020L()
       
  1605 	{
       
  1606 	OpenEtelServerL(EUseExtendedError);
       
  1607 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1608 	OpenPhoneL();
       
  1609 	
       
  1610 	RMmCustomAPI customApi;
       
  1611 	OpenCustomApiLC(customApi);
       
  1612 
       
  1613 	RBuf8 data;
       
  1614 	CleanupClosePushL(data);
       
  1615 
       
  1616     // Checking the synch API version
       
  1617 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetNetworkProviderName::KLtsyDispatchPhoneGetNetworkProviderNameApiId, KErrNone);
       
  1618 	_LIT(KNetworkProviderName, "Provider Name");
       
  1619     RMobilePhone::TMobilePhoneNetworkLongName completeData(KNetworkProviderName);
       
  1620 	TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkLongName> nameData(completeData);
       
  1621 	data.Close();
       
  1622 	nameData.SerialiseL(data);
       
  1623 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetNetworkProviderName::KLtsyDispatchPhoneGetNetworkProviderNameApiId, KErrNone, data);
       
  1624     RMobilePhone::TMobilePhoneNetworkLongName name;
       
  1625 	ASSERT_EQUALS(KErrNone, customApi.GetNetworkProviderName(name));
       
  1626     ASSERT_EQUALS(name, completeData);
       
  1627 
       
  1628     // Checking the asynch API version
       
  1629 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetNetworkProviderName::KLtsyDispatchPhoneGetNetworkProviderNameApiId, KErrNone);
       
  1630 	_LIT(KNetworkProviderName2, "Provider Name 2");
       
  1631     RMobilePhone::TMobilePhoneNetworkLongName completeData2(KNetworkProviderName2);
       
  1632 	TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkLongName> nameData2(completeData2);
       
  1633 	data.Close();
       
  1634 	nameData2.SerialiseL(data);
       
  1635 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetNetworkProviderName::KLtsyDispatchPhoneGetNetworkProviderNameApiId, KErrNone, data);
       
  1636     TRequestStatus status;
       
  1637 	customApi.GetNetworkProviderName(status, name);
       
  1638 	User::WaitForRequest(status);
       
  1639     ASSERT_EQUALS(status.Int(), KErrNone);
       
  1640     ASSERT_EQUALS(name, completeData2);
       
  1641 
       
  1642 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1643 	}
       
  1644 
       
  1645 /**
       
  1646 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0021
       
  1647 @SYMComponent telephony_ctsy
       
  1648 @SYMTestCaseDesc Test RMmCustomAPI::GetOperatorName
       
  1649 @SYMTestPriority High
       
  1650 @SYMTestActions Invokes RMmCustomAPI::GetOperatorName
       
  1651 @SYMTestExpectedResults Pass
       
  1652 @SYMTestType UT
       
  1653  */
       
  1654 void CCTsyPhoneFU::TestUnit0021L()
       
  1655 	{
       
  1656 	OpenEtelServerL(EUseExtendedError);
       
  1657 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1658 	OpenPhoneL();
       
  1659 	
       
  1660 	RMmCustomAPI customApi;
       
  1661 	OpenCustomApiLC(customApi);
       
  1662 
       
  1663 	RBuf8 data;
       
  1664 	CleanupClosePushL(data);
       
  1665 	
       
  1666 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetOperatorName::KLtsyDispatchPhoneGetOperatorNameApiId, KErrNone);
       
  1667 
       
  1668     TRequestStatus getRequestStatus;
       
  1669     RMmCustomAPI::TOperatorNameInfo getNameInfo;
       
  1670     customApi.GetOperatorName(getRequestStatus, getNameInfo);
       
  1671 	ASSERT_EQUALS(KRequestPending, getRequestStatus.Int());
       
  1672     
       
  1673     RMmCustomAPI::TOperatorNameType compType = RMmCustomAPI::EOperatorNameProgrammableLatin;
       
  1674 	_LIT(KNetworkOperatorName, "Network Operator Name");
       
  1675     TBuf<KMaxOperatorNameLength> compName(KNetworkOperatorName);
       
  1676 	TMockLtsyData2<RMmCustomAPI::TOperatorNameType, TBuf<KMaxOperatorNameLength> > modesData(compType, compName);
       
  1677 	data.Close();
       
  1678 	modesData.SerialiseL(data);
       
  1679 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetOperatorName::KLtsyDispatchPhoneGetOperatorNameApiId, KErrNone, data);
       
  1680 
       
  1681    	User::WaitForRequest(getRequestStatus);
       
  1682 	ASSERT_EQUALS(KErrNone, getRequestStatus.Int());
       
  1683     ASSERT_EQUALS(compType, getNameInfo.iType);
       
  1684     ASSERT_EQUALS(compName, getNameInfo.iName);
       
  1685 
       
  1686 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1687 	}
       
  1688 
       
  1689 /**
       
  1690 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0022
       
  1691 @SYMComponent telephony_ctsy
       
  1692 @SYMTestCaseDesc Test RMmCustomAPI::SetSystemNetworkMode
       
  1693 @SYMTestPriority High
       
  1694 @SYMTestActions Invokes RMmCustomAPI::SetSystemNetworkMode
       
  1695 @SYMTestExpectedResults Pass
       
  1696 @SYMTestType UT
       
  1697  */
       
  1698 void CCTsyPhoneFU::TestUnit0022L()
       
  1699 	{
       
  1700 	OpenEtelServerL(EUseExtendedError);
       
  1701 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1702 	OpenPhoneL();
       
  1703 	
       
  1704 	RMmCustomAPI customApi;
       
  1705 	OpenCustomApiLC(customApi);
       
  1706 
       
  1707 
       
  1708 	RBuf8 data;
       
  1709 	CleanupClosePushL(data);
       
  1710 
       
  1711     // Check synch version of the API
       
  1712     RMmCustomAPI::TNetworkModeCaps mode = RMmCustomAPI::KCapsNetworkModeUmts;
       
  1713 	TMockLtsyData1<RMmCustomAPI::TNetworkModeCaps> modeData(mode);
       
  1714 	data.Close();
       
  1715 	modeData.SerialiseL(data);
       
  1716 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetSystemNetworkMode::KLtsyDispatchPhoneSetSystemNetworkModeApiId, data, KErrNone);
       
  1717 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetSystemNetworkMode::KLtsyDispatchPhoneSetSystemNetworkModeApiId, KErrNone);
       
  1718 	ASSERT_EQUALS(KErrNone, customApi.SetSystemNetworkMode(mode));
       
  1719 
       
  1720     // Check asynch version of the API
       
  1721     TRequestStatus status;
       
  1722     mode = RMmCustomAPI::KCapsNetworkModeDual;
       
  1723 	TMockLtsyData1<RMmCustomAPI::TNetworkModeCaps> modeData2(mode);
       
  1724 	data.Close();
       
  1725 	modeData2.SerialiseL(data);
       
  1726 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetSystemNetworkMode::KLtsyDispatchPhoneSetSystemNetworkModeApiId, data, KErrNone);
       
  1727 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetSystemNetworkMode::KLtsyDispatchPhoneSetSystemNetworkModeApiId, KErrNone);
       
  1728     customApi.SetSystemNetworkMode(status, mode);
       
  1729    	User::WaitForRequest(status);
       
  1730 	ASSERT_EQUALS(KErrNone, status.Int());
       
  1731 
       
  1732 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1733 	}
       
  1734 
       
  1735 /**
       
  1736 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0023
       
  1737 @SYMComponent telephony_ctsy
       
  1738 @SYMTestCaseDesc Test RMmCustomAPI::GetCurrentSystemNetworkModes
       
  1739 @SYMTestPriority High
       
  1740 @SYMTestActions Invokes RMmCustomAPI::GetCurrentSystemNetworkModes
       
  1741 @SYMTestExpectedResults Pass
       
  1742 @SYMTestType UT
       
  1743  */
       
  1744 void CCTsyPhoneFU::TestUnit0023L()
       
  1745 	{
       
  1746 	OpenEtelServerL(EUseExtendedError);
       
  1747 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1748 	OpenPhoneL();
       
  1749 	
       
  1750 	RMmCustomAPI customApi;
       
  1751 	OpenCustomApiLC(customApi);
       
  1752 
       
  1753 
       
  1754 	RBuf8 data;
       
  1755 	CleanupClosePushL(data);
       
  1756 
       
  1757     // Check the synch version of the API
       
  1758 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCurrentSystemNetworkModes::KLtsyDispatchPhoneGetCurrentSystemNetworkModesApiId, KErrNone);
       
  1759     TUint32 compModes = RMmCustomAPI::KCapsNetworkModeUmts | RMmCustomAPI::KCapsNetworkModeGsm;
       
  1760 	TMockLtsyData1<TUint32> modesData(compModes);
       
  1761 	data.Close();
       
  1762 	modesData.SerialiseL(data);
       
  1763 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCurrentSystemNetworkModes::KLtsyDispatchPhoneGetCurrentSystemNetworkModesApiId, KErrNone, data);
       
  1764     TUint32 modes;
       
  1765 	ASSERT_EQUALS(KErrNone, customApi.GetCurrentSystemNetworkModes(modes));
       
  1766     ASSERT_EQUALS(modes, compModes);
       
  1767 
       
  1768     // Check the asynch version of the API
       
  1769 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCurrentSystemNetworkModes::KLtsyDispatchPhoneGetCurrentSystemNetworkModesApiId, KErrNone);
       
  1770     compModes = RMmCustomAPI::KCapsNetworkModeUmts;
       
  1771 	TMockLtsyData1<TUint32> modesData2(compModes);
       
  1772 	data.Close();
       
  1773 	modesData2.SerialiseL(data);
       
  1774 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCurrentSystemNetworkModes::KLtsyDispatchPhoneGetCurrentSystemNetworkModesApiId, KErrNone, data);
       
  1775     TRequestStatus status;
       
  1776     customApi.GetCurrentSystemNetworkModes(status, modes);
       
  1777    	User::WaitForRequest(status);
       
  1778 	ASSERT_EQUALS(KErrNone, status.Int());
       
  1779     ASSERT_EQUALS(modes, compModes);
       
  1780 
       
  1781 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1782 	}
       
  1783 
       
  1784 /**
       
  1785 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0024
       
  1786 @SYMComponent telephony_ctsy
       
  1787 @SYMTestCaseDesc Test RMmCustomAPI::NotifyRauEvent
       
  1788 @SYMTestPriority High
       
  1789 @SYMTestActions Invokes RMmCustomAPI::NotifyRauEvent
       
  1790 @SYMTestExpectedResults Pass
       
  1791 @SYMTestType UT
       
  1792  */
       
  1793 void CCTsyPhoneFU::TestUnit0024L()
       
  1794 	{
       
  1795 	OpenEtelServerL(EUseExtendedError);
       
  1796 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1797 	OpenPhoneL();
       
  1798 	
       
  1799 	RMmCustomAPI customApi;
       
  1800 	OpenCustomApiLC(customApi);
       
  1801 
       
  1802 	RBuf8 data;
       
  1803 	CleanupClosePushL(data);
       
  1804 
       
  1805     TRequestStatus requestStatus;
       
  1806     RMmCustomAPI::TRauEventStatus event;
       
  1807     customApi.NotifyRauEvent(requestStatus, event);
       
  1808 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1809     
       
  1810 	RMmCustomAPI::TRauEventStatus compEvent = RMmCustomAPI::ERauEventResumed;
       
  1811 	TMockLtsyData1<RMmCustomAPI::TRauEventStatus> modesData(compEvent);
       
  1812 	data.Close();
       
  1813 	modesData.SerialiseL(data);
       
  1814 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyRauEventIndId, KErrNone, data);
       
  1815 	User::WaitForRequest(requestStatus);
       
  1816 
       
  1817 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1818     ASSERT_EQUALS(compEvent, event);
       
  1819 
       
  1820 	CleanupStack::PopAndDestroy(3, this); // data, customApi, this
       
  1821 	}
       
  1822 
       
  1823 /**
       
  1824 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0025
       
  1825 @SYMComponent telephony_ctsy
       
  1826 @SYMTestCaseDesc Test RMmCustomAPI::NotifyCellInfoChange and RMmCustomAPI::GetCellInfo
       
  1827 @SYMTestPriority High
       
  1828 @SYMTestActions Invokes RMmCustomAPI::NotifyCellInfoChange and RMmCustomAPI::GetCellInfo
       
  1829 @SYMTestExpectedResults Pass
       
  1830 @SYMTestType UT
       
  1831  */
       
  1832 void CCTsyPhoneFU::TestUnit0025L()
       
  1833 	{
       
  1834 	OpenEtelServerL(EUseExtendedError);
       
  1835 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1836 	OpenPhoneL();
       
  1837 
       
  1838 	RMmCustomAPI customApi;
       
  1839 	OpenCustomApiLC(customApi);
       
  1840 
       
  1841 	RBuf8 data;
       
  1842 	CleanupClosePushL(data);
       
  1843 
       
  1844     TRequestStatus requestStatus;
       
  1845     RMmCustomAPI::TMmCellInfo* completeInfo = new(ELeave) RMmCustomAPI::TMmCellInfo;
       
  1846     CleanupStack::PushL(completeInfo);
       
  1847     RMmCustomAPI::TMmCellInfo* notifyInfo = new(ELeave) RMmCustomAPI::TMmCellInfo;
       
  1848     CleanupStack::PushL(notifyInfo);
       
  1849     RMmCustomAPI::TMmCellInfoPckg *notifyInfoPckg = new(ELeave) RMmCustomAPI::TMmCellInfoPckg(*notifyInfo);
       
  1850     CleanupStack::PushL(notifyInfoPckg);
       
  1851     RMmCustomAPI::TMmCellInfo* getInfo = new(ELeave) RMmCustomAPI::TMmCellInfo;
       
  1852     CleanupStack::PushL(getInfo);
       
  1853     RMmCustomAPI::TMmCellInfoPckg *getInfoPckg = new(ELeave) RMmCustomAPI::TMmCellInfoPckg(*getInfo);
       
  1854     CleanupStack::PushL(getInfoPckg);
       
  1855 	
       
  1856     // Register a notifier
       
  1857     customApi.NotifyCellInfoChange(requestStatus, *notifyInfoPckg);
       
  1858 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1859 
       
  1860     // Indicate cell changed to unknowd cell
       
  1861     (*completeInfo).iMode = RMmCustomAPI::TMmCellInfo::EUnknown;
       
  1862 	TMockLtsyData1<RMmCustomAPI::TMmCellInfo *> modesData1(completeInfo);
       
  1863 	data.Close();
       
  1864 	modesData1.SerialiseL(data);
       
  1865 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyCellInfoChangedIndId, KErrNone, data);
       
  1866 
       
  1867     // Check results
       
  1868 	User::WaitForRequest(requestStatus);
       
  1869 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1870     ASSERT_EQUALS((*completeInfo).iMode, (*notifyInfo).iMode);
       
  1871 
       
  1872     // Register a notifier
       
  1873     customApi.NotifyCellInfoChange(requestStatus, *notifyInfoPckg);
       
  1874 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1875 
       
  1876     // Indicate cell changed to GSM cell with some info
       
  1877     (*completeInfo).iMode = RMmCustomAPI::TMmCellInfo::EGSM;
       
  1878     (*completeInfo).iGsmCellInfo.iTA = 17;
       
  1879     (*completeInfo).iGsmCellInfo.iNmr[13].iARFCN = 4;
       
  1880     (*completeInfo).iGsmCellInfo.iNmr[8].iBSIC = 44;
       
  1881     (*completeInfo).iGsmCellInfo.iNmr[11].iRxLEV = 100;
       
  1882 	TMockLtsyData1<RMmCustomAPI::TMmCellInfo> modesData2(*completeInfo);
       
  1883 	data.Close();
       
  1884 	modesData2.SerialiseL(data);
       
  1885 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyCellInfoChangedIndId, KErrNone, data);
       
  1886 
       
  1887     // Check results
       
  1888 	User::WaitForRequest(requestStatus);
       
  1889 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1890     ASSERT_EQUALS((*completeInfo).iMode, (*notifyInfo).iMode);
       
  1891     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iTA, (*notifyInfo).iGsmCellInfo.iTA);
       
  1892     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iNmr[13].iARFCN, (*notifyInfo).iGsmCellInfo.iNmr[13].iARFCN);
       
  1893     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iNmr[8].iBSIC, (*notifyInfo).iGsmCellInfo.iNmr[8].iBSIC);
       
  1894     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iNmr[11].iRxLEV, (*notifyInfo).iGsmCellInfo.iNmr[11].iRxLEV);
       
  1895 
       
  1896     // Register a notifier
       
  1897     customApi.NotifyCellInfoChange(requestStatus, *notifyInfoPckg);
       
  1898 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1899 
       
  1900     // Indicate cell changed to WCDMA cell with some info
       
  1901     (*completeInfo).iMode = RMmCustomAPI::TMmCellInfo::EWCDMA;
       
  1902     (*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddUL = 33;
       
  1903     (*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddDL = 42;
       
  1904     (*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iTddNt = 18;
       
  1905     (*completeInfo).iWcdmaCellInfo.iPrimaryScrambilingCode = 100;
       
  1906     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[2].iFrequencyInfo.iFddUL = 311;
       
  1907     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[4].iFrequencyInfo.iFddDL = 11;
       
  1908     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[5].iCarrierRSSI = 25;
       
  1909     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[7].iCellMeasuredResult[3].iCID = 25;
       
  1910     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[7].iCellMeasuredResult[30].iTddInfo.iPrimaryCcpchRscp = 5;
       
  1911 	TMockLtsyData1<RMmCustomAPI::TMmCellInfo> modesData3(*completeInfo);
       
  1912 	data.Close();
       
  1913 	modesData3.SerialiseL(data);
       
  1914 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyCellInfoChangedIndId, KErrNone, data);
       
  1915 
       
  1916     // Check results
       
  1917 	User::WaitForRequest(requestStatus);
       
  1918 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1919     ASSERT_EQUALS((*completeInfo).iMode, (*notifyInfo).iMode );
       
  1920     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddUL, (*notifyInfo).iWcdmaCellInfo.iFrequencyInfo.iFddUL );
       
  1921     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddDL, (*notifyInfo).iWcdmaCellInfo.iFrequencyInfo.iFddDL );
       
  1922     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iTddNt, (*notifyInfo).iWcdmaCellInfo.iFrequencyInfo.iTddNt );
       
  1923     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iPrimaryScrambilingCode, (*notifyInfo).iWcdmaCellInfo.iPrimaryScrambilingCode );
       
  1924     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[2].iFrequencyInfo.iFddUL, (*notifyInfo).iWcdmaCellInfo.iNwkMeasureReport[2].iFrequencyInfo.iFddUL );
       
  1925     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[4].iFrequencyInfo.iFddDL, (*notifyInfo).iWcdmaCellInfo.iNwkMeasureReport[4].iFrequencyInfo.iFddDL );
       
  1926     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[5].iCarrierRSSI, (*notifyInfo).iWcdmaCellInfo.iNwkMeasureReport[5].iCarrierRSSI );
       
  1927     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[7].iCellMeasuredResult[3].iCID, (*notifyInfo).iWcdmaCellInfo.iNwkMeasureReport[7].iCellMeasuredResult[3].iCID );
       
  1928     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[7].iCellMeasuredResult[30].iTddInfo.iPrimaryCcpchRscp, (*notifyInfo).iWcdmaCellInfo.iNwkMeasureReport[7].iCellMeasuredResult[30].iTddInfo.iPrimaryCcpchRscp );
       
  1929 
       
  1930     // expect a GetCellInfo request
       
  1931 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCellInfo::KLtsyDispatchPhoneGetCellInfoApiId, KErrNone);
       
  1932 
       
  1933     // execute the GetCellInfo request
       
  1934     customApi.GetCellInfo(requestStatus, *getInfoPckg);
       
  1935 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1936 
       
  1937     // Complete with unknown cell info
       
  1938     (*completeInfo).iMode = RMmCustomAPI::TMmCellInfo::EUnknown;
       
  1939 	TMockLtsyData1<RMmCustomAPI::TMmCellInfo> modesData4(*completeInfo);
       
  1940 	data.Close();
       
  1941 	modesData4.SerialiseL(data);
       
  1942 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCellInfo::KLtsyDispatchPhoneGetCellInfoApiId, KErrNone, data);
       
  1943 
       
  1944     // Check results
       
  1945 	User::WaitForRequest(requestStatus);
       
  1946 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1947     ASSERT_EQUALS((*completeInfo).iMode, (*getInfo).iMode);
       
  1948 
       
  1949     // expect a GetCellInfo request
       
  1950 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCellInfo::KLtsyDispatchPhoneGetCellInfoApiId, KErrNone);
       
  1951 
       
  1952     // execute the GetCellInfo request
       
  1953     customApi.GetCellInfo(requestStatus, *getInfoPckg);
       
  1954 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1955 
       
  1956     // Complete with an GSM cell info
       
  1957     (*completeInfo).iMode = RMmCustomAPI::TMmCellInfo::EGSM;
       
  1958     (*completeInfo).iGsmCellInfo.iTA = 1;
       
  1959     (*completeInfo).iGsmCellInfo.iNmr[1].iARFCN = 2;
       
  1960     (*completeInfo).iGsmCellInfo.iNmr[2].iBSIC = 3;
       
  1961     (*completeInfo).iGsmCellInfo.iNmr[7].iRxLEV = 4;
       
  1962 	TMockLtsyData1<RMmCustomAPI::TMmCellInfo> modesData5(*completeInfo);
       
  1963 	data.Close();
       
  1964 	modesData1.SerialiseL(data);
       
  1965 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCellInfo::KLtsyDispatchPhoneGetCellInfoApiId, KErrNone, data);
       
  1966 
       
  1967     // Check results
       
  1968 	User::WaitForRequest(requestStatus);
       
  1969 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  1970     ASSERT_EQUALS((*completeInfo).iMode, (*getInfo).iMode);
       
  1971     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iTA, (*getInfo).iGsmCellInfo.iTA);
       
  1972     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iNmr[1].iARFCN, (*getInfo).iGsmCellInfo.iNmr[1].iARFCN);
       
  1973     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iNmr[2].iBSIC, (*getInfo).iGsmCellInfo.iNmr[2].iBSIC);
       
  1974     ASSERT_EQUALS((*completeInfo).iGsmCellInfo.iNmr[7].iRxLEV, (*getInfo).iGsmCellInfo.iNmr[7].iRxLEV);
       
  1975 
       
  1976     // expect a GetCellInfo request
       
  1977 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCellInfo::KLtsyDispatchPhoneGetCellInfoApiId, KErrNone);
       
  1978 
       
  1979     // execute the GetCellInfo request
       
  1980     customApi.GetCellInfo(requestStatus, *getInfoPckg);
       
  1981 	ASSERT_EQUALS(KRequestPending, requestStatus.Int());
       
  1982 
       
  1983     // Complete with an WCDMA cell info
       
  1984     (*completeInfo).iMode = RMmCustomAPI::TMmCellInfo::EWCDMA;
       
  1985     (*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddUL = 11;
       
  1986     (*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddDL = 12;
       
  1987     (*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iTddNt = 13;
       
  1988     (*completeInfo).iWcdmaCellInfo.iPrimaryScrambilingCode = 14;
       
  1989     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[1].iFrequencyInfo.iFddUL = 1;
       
  1990     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[2].iFrequencyInfo.iFddDL = 2;
       
  1991     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[3].iCarrierRSSI = 3;
       
  1992     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[4].iCellMeasuredResult[1].iCID = 6;
       
  1993     (*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[5].iCellMeasuredResult[2].iTddInfo.iPrimaryCcpchRscp = 8;
       
  1994 	TMockLtsyData1<RMmCustomAPI::TMmCellInfo> modesData6(*completeInfo);
       
  1995 	data.Close();
       
  1996 	modesData1.SerialiseL(data);
       
  1997 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCellInfo::KLtsyDispatchPhoneGetCellInfoApiId, KErrNone, data);
       
  1998 
       
  1999     // Check results
       
  2000 	User::WaitForRequest(requestStatus);
       
  2001 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2002     ASSERT_EQUALS((*completeInfo).iMode, (*getInfo).iMode);
       
  2003     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddUL, (*getInfo).iWcdmaCellInfo.iFrequencyInfo.iFddUL );
       
  2004     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iFddDL, (*getInfo).iWcdmaCellInfo.iFrequencyInfo.iFddDL );
       
  2005     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iFrequencyInfo.iTddNt, (*getInfo).iWcdmaCellInfo.iFrequencyInfo.iTddNt );
       
  2006     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iPrimaryScrambilingCode, (*getInfo).iWcdmaCellInfo.iPrimaryScrambilingCode );
       
  2007     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[1].iFrequencyInfo.iFddUL, (*getInfo).iWcdmaCellInfo.iNwkMeasureReport[1].iFrequencyInfo.iFddUL );
       
  2008     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[2].iFrequencyInfo.iFddDL, (*getInfo).iWcdmaCellInfo.iNwkMeasureReport[2].iFrequencyInfo.iFddDL );
       
  2009     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[3].iCarrierRSSI, (*getInfo).iWcdmaCellInfo.iNwkMeasureReport[3].iCarrierRSSI );
       
  2010     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[4].iCellMeasuredResult[1].iCID, (*getInfo).iWcdmaCellInfo.iNwkMeasureReport[4].iCellMeasuredResult[1].iCID );
       
  2011     ASSERT_EQUALS((*completeInfo).iWcdmaCellInfo.iNwkMeasureReport[5].iCellMeasuredResult[2].iTddInfo.iPrimaryCcpchRscp, (*getInfo).iWcdmaCellInfo.iNwkMeasureReport[5].iCellMeasuredResult[2].iTddInfo.iPrimaryCcpchRscp );
       
  2012 
       
  2013 	CleanupStack::PopAndDestroy(8, this); // getInfoPckg, getInfo, notifyInfoPckg, notifyInfo, completeInfo, data, customApi, this
       
  2014 	}
       
  2015 
       
  2016 /**
       
  2017 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0026
       
  2018 @SYMComponent telephony_ctsy
       
  2019 @SYMTestCaseDesc Test correct function of RMobilePhone::NotifyCellInfoChange() RMobilePhone::GetCellInfo()
       
  2020 @SYMTestPriority High
       
  2021 @SYMTestActions Invokes NotifyCellInfoChange, GetCellInfo
       
  2022 @SYMTestExpectedResults Pass
       
  2023 @SYMTestType UT
       
  2024  */
       
  2025 void CCTsyPhoneFU::TestUnit0026L()
       
  2026 	{
       
  2027 	OpenEtelServerL(EUseExtendedError);
       
  2028 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2029 
       
  2030 	RBuf8 data;
       
  2031 	CleanupClosePushL(data);
       
  2032 	
       
  2033 	OpenPhoneL();
       
  2034 	
       
  2035 	RMobilePhone::TMobilePhoneCellInfoV9 returnCellInfo;
       
  2036 	TMockLtsyData1<RMobilePhone::TMobilePhoneCellInfoV9> cellInfoCompData(returnCellInfo);
       
  2037 	
       
  2038 	iMockLTSY.ExpectL(MLtsyDispatchPhoneRegisterCellInfoChangeNotification::KLtsyDispatchPhoneRegisterCellInfoChangeNotificationApiId);
       
  2039 	iMockLTSY.CompleteL(MLtsyDispatchPhoneRegisterCellInfoChangeNotification::KLtsyDispatchPhoneRegisterCellInfoChangeNotificationApiId, KErrNone);
       
  2040 	
       
  2041 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetPhoneCellInfo::KLtsyDispatchPhoneGetPhoneCellInfoApiId);
       
  2042 
       
  2043 	returnCellInfo.iMode = RMobilePhone::ECellModeGsm;
       
  2044 	returnCellInfo.iCellId = 1;
       
  2045 	returnCellInfo.iTimingAdvance = 123;
       
  2046 	returnCellInfo.iStatus = RMobilePhone::ECellInfoStatusCurrent;
       
  2047 	cellInfoCompData.SerialiseL(data);
       
  2048 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetPhoneCellInfo::KLtsyDispatchPhoneGetPhoneCellInfoApiId, KErrNone, data);
       
  2049 	data.Close();
       
  2050 	
       
  2051 	//client side will be notified when a CellInfoChange has occurred, the first time called will result in
       
  2052 	//a NotifyCellInfo Request to inform the LTSY we are interested in these notifications
       
  2053 	TRequestStatus notifyCellInfoChangeReqStatus;
       
  2054 	RMobilePhone::TMobilePhoneCellInfoV9 cellInfo;
       
  2055 	RMobilePhone::TMobilePhoneCellInfoV9Pckg cellInfoPckg(cellInfo);
       
  2056 	iPhone.NotifyCellInfoChange(notifyCellInfoChangeReqStatus,cellInfoPckg);
       
  2057 		
       
  2058 	TRequestStatus getCellInfoReqStatus;
       
  2059 	RMobilePhone::TMobilePhoneCellInfoV9 cellInfo2;
       
  2060 	RMobilePhone::TMobilePhoneCellInfoV9Pckg cellInfoPckg2(cellInfo2);
       
  2061 	iPhone.GetCellInfo(getCellInfoReqStatus,cellInfoPckg2);
       
  2062 		
       
  2063 	User::WaitForRequest(notifyCellInfoChangeReqStatus);
       
  2064 	User::WaitForRequest(getCellInfoReqStatus);
       
  2065 	ASSERT_EQUALS(notifyCellInfoChangeReqStatus.Int(),KErrNone);
       
  2066 	ASSERT_EQUALS(getCellInfoReqStatus.Int(),KErrNone);
       
  2067 	
       
  2068 	ASSERT_EQUALS(returnCellInfo.iMode, cellInfo.iMode);
       
  2069 	ASSERT_EQUALS(returnCellInfo.iCellId, cellInfo.iCellId);
       
  2070 	ASSERT_EQUALS(returnCellInfo.iTimingAdvance, cellInfo.iTimingAdvance);
       
  2071 	ASSERT_EQUALS(returnCellInfo.iStatus, cellInfo.iStatus);
       
  2072 	
       
  2073 	ASSERT_EQUALS(returnCellInfo.iMode, cellInfo2.iMode);
       
  2074 	ASSERT_EQUALS(returnCellInfo.iCellId, cellInfo2.iCellId);
       
  2075 	ASSERT_EQUALS(returnCellInfo.iTimingAdvance, cellInfo2.iTimingAdvance);
       
  2076 	ASSERT_EQUALS(returnCellInfo.iStatus, cellInfo2.iStatus);
       
  2077 	
       
  2078 	AssertMockLtsyStatusL();
       
  2079 		
       
  2080 	//now a second get, the value is in the cach (rest cellInfo first)
       
  2081 	cellInfo.iMode = RMobilePhone::ECellModeUnknown;
       
  2082 	cellInfo.iCellId = 0;
       
  2083 	cellInfo.iTimingAdvance = 0;
       
  2084 	cellInfo.iStatus = RMobilePhone::ECellInfoStatusUnknown;
       
  2085 	iPhone.GetCellInfo(getCellInfoReqStatus,cellInfoPckg);
       
  2086 	User::WaitForRequest(getCellInfoReqStatus);
       
  2087 	ASSERT_EQUALS(getCellInfoReqStatus.Int(),KErrNone);
       
  2088 	ASSERT_EQUALS(returnCellInfo.iMode, cellInfo.iMode);
       
  2089 	ASSERT_EQUALS(returnCellInfo.iCellId, cellInfo.iCellId);
       
  2090 	ASSERT_EQUALS(returnCellInfo.iTimingAdvance, cellInfo.iTimingAdvance);
       
  2091 	ASSERT_EQUALS(returnCellInfo.iStatus, cellInfo.iStatus);
       
  2092 	
       
  2093 	AssertMockLtsyStatusL();
       
  2094 	
       
  2095 	// an unsolicited cellInfo change, with KErrNone
       
  2096 	returnCellInfo.iMode = RMobilePhone::ECellModeWcdma;
       
  2097 	returnCellInfo.iCellId = 2;
       
  2098 	returnCellInfo.iTimingAdvance = 124;
       
  2099 	returnCellInfo.iStatus = RMobilePhone::ECellInfoStatusNotCurrent;
       
  2100 	cellInfoCompData.SerialiseL(data);
       
  2101 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyCellInfoChangeIndId, KErrNone, data);
       
  2102 	data.Close();
       
  2103 	
       
  2104 	//reset the return data
       
  2105 	cellInfo.iMode = RMobilePhone::ECellModeUnknown;
       
  2106 	cellInfo.iCellId = 0;
       
  2107 	cellInfo.iTimingAdvance = 0;
       
  2108 	cellInfo.iStatus = RMobilePhone::ECellInfoStatusUnknown;
       
  2109 	iPhone.NotifyCellInfoChange(notifyCellInfoChangeReqStatus,cellInfoPckg);
       
  2110 	User::WaitForRequest(notifyCellInfoChangeReqStatus);
       
  2111 	ASSERT_EQUALS(notifyCellInfoChangeReqStatus.Int(),KErrNone);
       
  2112 	ASSERT_EQUALS(returnCellInfo.iMode, cellInfo.iMode);
       
  2113 	ASSERT_EQUALS(returnCellInfo.iCellId, cellInfo.iCellId);
       
  2114 	ASSERT_EQUALS(returnCellInfo.iTimingAdvance, cellInfo.iTimingAdvance);
       
  2115 	ASSERT_EQUALS(returnCellInfo.iStatus, cellInfo.iStatus);
       
  2116 		
       
  2117 	AssertMockLtsyStatusL();
       
  2118 	
       
  2119 	//an unsolicited cellInfo change, with KErrGeneral, the cache is now marked as dirty
       
  2120 	cellInfoCompData.SerialiseL(data);
       
  2121 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyCellInfoChangeIndId, KErrGeneral, data);
       
  2122 	data.Close();
       
  2123 
       
  2124 	iPhone.NotifyCellInfoChange(notifyCellInfoChangeReqStatus,cellInfoPckg);
       
  2125 	User::WaitForRequest(notifyCellInfoChangeReqStatus);
       
  2126 	ASSERT_EQUALS(notifyCellInfoChangeReqStatus.Int(),KErrGeneral);
       
  2127 	
       
  2128 	AssertMockLtsyStatusL();
       
  2129 	
       
  2130 	//a client side GetCellInfo call (post the cache being marked dirty), KErrGeneral returned
       
  2131 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetPhoneCellInfo::KLtsyDispatchPhoneGetPhoneCellInfoApiId);
       
  2132 	returnCellInfo.iMode = RMobilePhone::ECellModeGsm;
       
  2133 	returnCellInfo.iCellId = 1;
       
  2134 	returnCellInfo.iTimingAdvance = 123;
       
  2135 	returnCellInfo.iStatus = RMobilePhone::ECellInfoStatusCurrent;
       
  2136 	cellInfoCompData.SerialiseL(data);
       
  2137 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetPhoneCellInfo::KLtsyDispatchPhoneGetPhoneCellInfoApiId, KErrGeneral, data);
       
  2138 	data.Close();
       
  2139 	
       
  2140 	iPhone.GetCellInfo(getCellInfoReqStatus,cellInfoPckg);
       
  2141 	User::WaitForRequest(getCellInfoReqStatus);
       
  2142 	ASSERT_EQUALS(getCellInfoReqStatus.Int(),KErrGeneral);
       
  2143 	
       
  2144 	AssertMockLtsyStatusL(); 
       
  2145 	
       
  2146 	
       
  2147 	//an unsolicited cellInfo change, with KErrNone, the cache is now marked as clean
       
  2148 	cellInfoCompData.SerialiseL(data);
       
  2149 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyCellInfoChangeIndId, KErrNone, data);
       
  2150 	data.Close();
       
  2151 
       
  2152 	//reset the return data
       
  2153 	cellInfo.iMode = RMobilePhone::ECellModeUnknown;
       
  2154 	cellInfo.iCellId = 0;
       
  2155 	cellInfo.iTimingAdvance = 0;
       
  2156 	cellInfo.iStatus = RMobilePhone::ECellInfoStatusUnknown;
       
  2157 	iPhone.NotifyCellInfoChange(notifyCellInfoChangeReqStatus,cellInfoPckg);
       
  2158 	User::WaitForRequest(notifyCellInfoChangeReqStatus);
       
  2159 	ASSERT_EQUALS(notifyCellInfoChangeReqStatus.Int(),KErrNone);
       
  2160 	ASSERT_EQUALS(returnCellInfo.iMode, cellInfo.iMode);
       
  2161 	ASSERT_EQUALS(returnCellInfo.iCellId, cellInfo.iCellId);
       
  2162 	ASSERT_EQUALS(returnCellInfo.iTimingAdvance, cellInfo.iTimingAdvance);
       
  2163 	ASSERT_EQUALS(returnCellInfo.iStatus, cellInfo.iStatus);
       
  2164 	
       
  2165 	AssertMockLtsyStatusL();
       
  2166 
       
  2167 	//finally a cached get.
       
  2168 	//reset the return data
       
  2169 	cellInfo.iMode = RMobilePhone::ECellModeUnknown;
       
  2170 	cellInfo.iCellId = 0;
       
  2171 	cellInfo.iTimingAdvance = 0;
       
  2172 	cellInfo.iStatus = RMobilePhone::ECellInfoStatusUnknown;
       
  2173 	iPhone.GetCellInfo(getCellInfoReqStatus,cellInfoPckg);
       
  2174 	User::WaitForRequest(getCellInfoReqStatus);
       
  2175 	ASSERT_EQUALS(getCellInfoReqStatus.Int(),KErrNone);
       
  2176 	ASSERT_EQUALS(returnCellInfo.iMode, cellInfo.iMode);
       
  2177 	ASSERT_EQUALS(returnCellInfo.iCellId, cellInfo.iCellId);
       
  2178 	ASSERT_EQUALS(returnCellInfo.iTimingAdvance, cellInfo.iTimingAdvance);
       
  2179 	ASSERT_EQUALS(returnCellInfo.iStatus, cellInfo.iStatus);
       
  2180 
       
  2181 	AssertMockLtsyStatusL();
       
  2182 
       
  2183 	
       
  2184 	CleanupStack::PopAndDestroy(&data);
       
  2185 	CleanupStack::PopAndDestroy(this);
       
  2186 	
       
  2187 	}
       
  2188 
       
  2189 /**
       
  2190 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0027
       
  2191 @SYMComponent telephony_ctsy
       
  2192 @SYMTestCaseDesc Test correct function of RMobilePhone::NotifyCellInfoChange()
       
  2193 @SYMTestPriority High
       
  2194 @SYMTestActions Invokes NotifyCellInfoChange,with a complete error case
       
  2195 @SYMTestExpectedResults Pass
       
  2196 @SYMTestType UT
       
  2197  */
       
  2198 void CCTsyPhoneFU::TestUnit0027L()
       
  2199 	{
       
  2200 	OpenEtelServerL(EUseExtendedError);
       
  2201 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2202 
       
  2203 	RBuf8 data;
       
  2204 	CleanupClosePushL(data);
       
  2205 	
       
  2206 	OpenPhoneL();
       
  2207 	
       
  2208 	//test the complete of NotifyCellInfoChange with an error, this is in a differnet test case
       
  2209 	//as the IPC is only fired the first time a NotifyCellInfoChange is called as the 
       
  2210 	//Cache Ability is set ECacheUnknown
       
  2211 	
       
  2212 	iMockLTSY.ExpectL(MLtsyDispatchPhoneRegisterCellInfoChangeNotification::KLtsyDispatchPhoneRegisterCellInfoChangeNotificationApiId);
       
  2213 	iMockLTSY.CompleteL(MLtsyDispatchPhoneRegisterCellInfoChangeNotification::KLtsyDispatchPhoneRegisterCellInfoChangeNotificationApiId, KErrGeneral);
       
  2214 
       
  2215 	TRequestStatus notifyCellInfoChangeReqStatus;
       
  2216 	RMobilePhone::TMobilePhoneCellInfoV9 cellInfo;
       
  2217 	RMobilePhone::TMobilePhoneCellInfoV9Pckg cellInfoPckg(cellInfo);
       
  2218 	iPhone.NotifyCellInfoChange(notifyCellInfoChangeReqStatus,cellInfoPckg);
       
  2219 	User::WaitForRequest(notifyCellInfoChangeReqStatus);
       
  2220 	ASSERT_EQUALS(notifyCellInfoChangeReqStatus.Int(),KErrGeneral);
       
  2221 	
       
  2222 	AssertMockLtsyStatusL();
       
  2223 	
       
  2224 	CleanupStack::PopAndDestroy(&data);
       
  2225 	CleanupStack::PopAndDestroy(this);
       
  2226 	}
       
  2227 
       
  2228 /**
       
  2229 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0028
       
  2230 @SYMComponent telephony_ctsy
       
  2231 @SYMTestCaseDesc Test correct function of RMmCustomAPI::GetUSIMServiceSupport()
       
  2232 @SYMTestPriority High
       
  2233 @SYMTestActions Invokes GetUSIMServiceSupport, in KErrNone and KErrGeneral complete cases
       
  2234 @SYMTestExpectedResults Pass
       
  2235 @SYMTestType UT
       
  2236  */
       
  2237 void CCTsyPhoneFU::TestUnit0028L()
       
  2238 	{
       
  2239 	OpenEtelServerL(EUseExtendedError);
       
  2240 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2241 
       
  2242 	TRequestStatus reqStatus;
       
  2243 	
       
  2244 	RBuf8 data;
       
  2245 	CleanupClosePushL(data);
       
  2246 	
       
  2247 	OpenPhoneL();
       
  2248 	
       
  2249 	RMmCustomAPI customApi;
       
  2250 	OpenCustomApiLC(customApi);
       
  2251 	
       
  2252 	//test a Get Usim Service Support with KErrNone completion
       
  2253 	
       
  2254 	TInt applicationNumber = 101;
       
  2255 	TBool supported = ETrue;
       
  2256 	
       
  2257 	TMockLtsyData1<TInt> getUsimServiceSupportExpData(applicationNumber);
       
  2258 	getUsimServiceSupportExpData.SerialiseL(data);
       
  2259 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetUsimServiceSupport::KLtsyDispatchPhoneGetUsimServiceSupportApiId, data);
       
  2260 	data.Close();
       
  2261 	
       
  2262 	TMockLtsyData2<TInt, TBool> getUsimServiceSupportCompData(applicationNumber, supported);
       
  2263 	getUsimServiceSupportCompData.SerialiseL(data);
       
  2264 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetUsimServiceSupport::KLtsyDispatchPhoneGetUsimServiceSupportApiId, KErrNone, data);
       
  2265 	data.Close();
       
  2266 	
       
  2267 	RMmCustomAPI::TAppSupport usimSupport;
       
  2268 	usimSupport.iAppNum = applicationNumber; //in
       
  2269 	usimSupport.iSupported = EFalse; //out
       
  2270 	customApi.GetUSIMServiceSupport(reqStatus, usimSupport);
       
  2271 	User::WaitForRequest(reqStatus);
       
  2272 	ASSERT_EQUALS(reqStatus.Int(),KErrNone);
       
  2273 	ASSERT_EQUALS(usimSupport.iAppNum,applicationNumber);
       
  2274 	ASSERT_EQUALS(usimSupport.iSupported,supported);
       
  2275 		
       
  2276 	AssertMockLtsyStatusL();
       
  2277 
       
  2278 	//test a Get Usim Service Support with KErrGeneral completion
       
  2279 
       
  2280 	applicationNumber = 102;
       
  2281 	supported = EFalse;
       
  2282 	
       
  2283 	getUsimServiceSupportExpData.SerialiseL(data);
       
  2284 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetUsimServiceSupport::KLtsyDispatchPhoneGetUsimServiceSupportApiId, data);
       
  2285 	data.Close();
       
  2286 	
       
  2287 	getUsimServiceSupportCompData.SerialiseL(data);
       
  2288 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetUsimServiceSupport::KLtsyDispatchPhoneGetUsimServiceSupportApiId, KErrGeneral, data);
       
  2289 	data.Close();
       
  2290 	
       
  2291 	
       
  2292 	usimSupport.iAppNum = applicationNumber; //in
       
  2293 	usimSupport.iSupported = ETrue; //out
       
  2294 	customApi.GetUSIMServiceSupport(reqStatus, usimSupport);
       
  2295 	User::WaitForRequest(reqStatus);
       
  2296 	ASSERT_EQUALS(reqStatus.Int(),KErrGeneral);
       
  2297 	ASSERT_EQUALS(usimSupport.iAppNum,applicationNumber);
       
  2298 	ASSERT_EQUALS(usimSupport.iSupported, static_cast<TBool>(ETrue)); //i.e. not set to EFalse from the complete
       
  2299 	
       
  2300 	AssertMockLtsyStatusL();
       
  2301 	
       
  2302 	CleanupStack::PopAndDestroy(&customApi);
       
  2303 	CleanupStack::PopAndDestroy(&data);
       
  2304 	CleanupStack::PopAndDestroy(this);
       
  2305 	}
       
  2306 
       
  2307 /**
       
  2308 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0029
       
  2309 @SYMComponent telephony_ctsy
       
  2310 @SYMTestCaseDesc Test correct function of RMobilePhone::GetCurrentActiveUSimApplication()
       
  2311 @SYMTestPriority High
       
  2312 @SYMTestActions Invokes GetCurrentActiveUSimApplication, in KErrNone and KErrGeneral complete cases
       
  2313 @SYMTestExpectedResults Pass
       
  2314 @SYMTestType UT
       
  2315  */
       
  2316 void CCTsyPhoneFU::TestUnit0029L()
       
  2317 	{
       
  2318 	OpenEtelServerL(EUseExtendedError);
       
  2319 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2320 
       
  2321 	TRequestStatus reqStatus;
       
  2322 	
       
  2323 	RBuf8 data;
       
  2324 	CleanupClosePushL(data);
       
  2325 	
       
  2326 	OpenPhoneL();
       
  2327 	
       
  2328 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCurrentActiveUsimApplication::KLtsyDispatchPhoneGetCurrentActiveUsimApplicationApiId);
       
  2329 	
       
  2330 	RMobilePhone::TAID comopAid(_L8("AID_DATA"));
       
  2331 	
       
  2332 	TDesC8* aidPtr = &comopAid;
       
  2333 	TMockLtsyData1<TDesC8*> getCurrentActiveUsimAppCompData(aidPtr);
       
  2334 	getCurrentActiveUsimAppCompData.SerialiseL(data);
       
  2335 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCurrentActiveUsimApplication::KLtsyDispatchPhoneGetCurrentActiveUsimApplicationApiId, KErrNone, data);
       
  2336 	data.Close();
       
  2337 	
       
  2338 	RMobilePhone::TAID aid;
       
  2339 	iPhone.GetCurrentActiveUSimApplication(reqStatus,aid);
       
  2340 	User::WaitForRequest(reqStatus);
       
  2341 	ASSERT_EQUALS(reqStatus.Int(), KErrNone);
       
  2342 	ASSERT_EQUALS(comopAid, aid);
       
  2343 	AssertMockLtsyStatusL();
       
  2344 
       
  2345 	
       
  2346 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetCurrentActiveUsimApplication::KLtsyDispatchPhoneGetCurrentActiveUsimApplicationApiId);
       
  2347 	
       
  2348 	getCurrentActiveUsimAppCompData.SerialiseL(data);
       
  2349 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetCurrentActiveUsimApplication::KLtsyDispatchPhoneGetCurrentActiveUsimApplicationApiId, KErrGeneral, data);
       
  2350 	data.Close();
       
  2351 
       
  2352 	aid.Zero();
       
  2353 	iPhone.GetCurrentActiveUSimApplication(reqStatus,aid);
       
  2354 	User::WaitForRequest(reqStatus);
       
  2355 	ASSERT_EQUALS(reqStatus.Int(), KErrGeneral);
       
  2356 	ASSERT_EQUALS(comopAid, aid); //aid still copied
       
  2357 	AssertMockLtsyStatusL();
       
  2358 		
       
  2359 	CleanupStack::PopAndDestroy(&data);
       
  2360 	CleanupStack::PopAndDestroy(this);
       
  2361 	}
       
  2362 
       
  2363 
       
  2364 /**
       
  2365 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0030
       
  2366 @SYMComponent telephony_ctsy
       
  2367 @SYMTestCaseDesc Test correct function of RMobilePhone::TerminateAllCalls()
       
  2368 @SYMTestPriority High
       
  2369 @SYMTestActions Invokes RMobilePhone::TerminateAllCalls
       
  2370 @SYMTestExpectedResults Pass
       
  2371 @SYMTestType UT
       
  2372  */
       
  2373 void CCTsyPhoneFU::TestUnit0030L()
       
  2374 	{
       
  2375 	OpenEtelServerL(EUseExtendedError);
       
  2376 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2377 
       
  2378 	TRequestStatus requestStatus;
       
  2379 	
       
  2380 	RBuf8 data;
       
  2381 	CleanupClosePushL(data);
       
  2382 	
       
  2383 	OpenPhoneL();
       
  2384 
       
  2385 	
       
  2386 	TInt callId = 1;
       
  2387 	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
       
  2388 	DriverDialCallL(callId, mobileService);
       
  2389 	
       
  2390 	TInt callIdHangUp = 0; //callId is provided if a call is in connecting state; else 0
       
  2391     TMockLtsyData1<TInt> mockData(callIdHangUp); 
       
  2392 	mockData.SerialiseL(data);
       
  2393 	
       
  2394 	iMockLTSY.ExpectL(MLtsyDispatchPhoneTerminateAllCalls::KLtsyDispatchPhoneTerminateAllCallsApiId, data);
       
  2395 	iMockLTSY.CompleteL(MLtsyDispatchPhoneTerminateAllCalls::KLtsyDispatchPhoneTerminateAllCallsApiId, KErrNone);
       
  2396 	data.Close();
       
  2397 
       
  2398 	TInt hangUpCause = KErrGsmCCNormalCallClearing; // Hang up cause for normal hang up
       
  2399 	DriverHangUpCallL(callId, hangUpCause, ETrue);
       
  2400 	
       
  2401 
       
  2402 	// Client Side Test
       
  2403 
       
  2404 	RMobileLine mobileLine;
       
  2405 	CleanupClosePushL(mobileLine);
       
  2406 	RMobileCall mobileCall;
       
  2407 	CleanupClosePushL(mobileCall);
       
  2408 	ClientDialCallL(mobileLine, mobileCall, mobileService);
       
  2409 
       
  2410 
       
  2411 	TRequestStatus reqStatusTerminated;
       
  2412 	iMockLTSY.NotifyTerminated(reqStatusTerminated); 
       
  2413 
       
  2414 	iPhone.TerminateAllCalls(requestStatus);
       
  2415 	User::WaitForRequest(requestStatus);
       
  2416 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
  2417 
       
  2418 	ClientHangUpCallL(mobileCall);
       
  2419 	
       
  2420 	User::WaitForRequest(reqStatusTerminated);
       
  2421 	ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int());
       
  2422 	
       
  2423 	AssertMockLtsyStatusL();
       
  2424 	
       
  2425 	mobileCall.Close();
       
  2426 	mobileLine.Close();
       
  2427 	
       
  2428 	AssertMockLtsyStatusL();
       
  2429 	
       
  2430 	CleanupStack::PopAndDestroy(&mobileCall);
       
  2431 	CleanupStack::PopAndDestroy(&mobileLine);
       
  2432 	CleanupStack::PopAndDestroy(&data);
       
  2433 	CleanupStack::PopAndDestroy(this);
       
  2434 	}
       
  2435 
       
  2436 
       
  2437 /**
       
  2438 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0031
       
  2439 @SYMComponent telephony_ctsy
       
  2440 @SYMTestCaseDesc Test correct function of RMmCustomAPI::GetSystemNetworkBand() and RMmCustomAPI::SetSystemNetworkBand()
       
  2441 @SYMTestPriority High
       
  2442 @SYMTestActions Invokes RMmCustomAPI::SetSystemNetworkBand(), RMmCustomAPI::GetSystemNetworkBand()
       
  2443 @SYMTestExpectedResults Pass
       
  2444 @SYMTestType UT
       
  2445  */
       
  2446 void CCTsyPhoneFU::TestUnit0031L()
       
  2447 	{
       
  2448 	OpenEtelServerL(EUseExtendedError);
       
  2449 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2450 
       
  2451 	TRequestStatus requestStatus;
       
  2452 	
       
  2453 	RBuf8 data;
       
  2454 	CleanupClosePushL(data);
       
  2455 	
       
  2456 	OpenPhoneL();
       
  2457 	
       
  2458 	RMmCustomAPI customApi;
       
  2459 	OpenCustomApiLC(customApi);
       
  2460 
       
  2461 	RMmCustomAPI::TBandSelection band=RMmCustomAPI::ENetworkBandAny;
       
  2462 	RMmCustomAPI::TNetworkModeCaps mode=RMmCustomAPI::KCapsNetworkModeUmts;
       
  2463 	
       
  2464 	RMmCustomAPI::TBandSelection bandToGet=RMmCustomAPI::ENetworkBandUmts850;
       
  2465 	RMmCustomAPI::TNetworkModeCaps modeToGet=RMmCustomAPI::KCapsNetworkModeDual;
       
  2466 	
       
  2467 	RMmCustomAPI::TBandSelection bandToSet=RMmCustomAPI::ENetworkBandUmts2100;
       
  2468 	RMmCustomAPI::TNetworkModeCaps modeToSet=RMmCustomAPI::KCapsNetworkModeGsm;
       
  2469 	
       
  2470 	TRequestStatus req=0;
       
  2471 
       
  2472 	
       
  2473 	//1. Test GetSystemNetworkBand
       
  2474 
       
  2475 	iMockLTSY.ExpectL(MLtsyDispatchPhoneGetSystemNetworkBand::KLtsyDispatchPhoneGetSystemNetworkBandApiId);
       
  2476 	
       
  2477 	TMockLtsyData2<RMmCustomAPI::TBandSelection, RMmCustomAPI::TNetworkModeCaps> getData(bandToGet, modeToGet);
       
  2478 	getData.SerialiseL(data);
       
  2479 	iMockLTSY.CompleteL(MLtsyDispatchPhoneGetSystemNetworkBand::KLtsyDispatchPhoneGetSystemNetworkBandApiId, KErrNone, data);
       
  2480 	data.Close();
       
  2481 	
       
  2482 	
       
  2483 	customApi.GetSystemNetworkBand( req, band, mode);
       
  2484     User::WaitForRequest(req);
       
  2485     
       
  2486     ASSERT_EQUALS(KErrNone, req.Int());
       
  2487     ASSERT_EQUALS(bandToGet, band);
       
  2488     ASSERT_EQUALS(modeToGet, mode);
       
  2489     
       
  2490     AssertMockLtsyStatusL();
       
  2491     
       
  2492     
       
  2493     //2. Test SetSystemNetworkBand
       
  2494 
       
  2495 	TMockLtsyData2<RMmCustomAPI::TBandSelection, RMmCustomAPI::TNetworkModeCaps> setData(bandToSet, modeToSet);
       
  2496 	setData.SerialiseL(data);
       
  2497     
       
  2498 	iMockLTSY.ExpectL(MLtsyDispatchPhoneSetSystemNetworkBand::KLtsyDispatchPhoneSetSystemNetworkBandApiId, data);
       
  2499 
       
  2500 	iMockLTSY.CompleteL(MLtsyDispatchPhoneSetSystemNetworkBand::KLtsyDispatchPhoneSetSystemNetworkBandApiId, KErrNone);
       
  2501 	data.Close();
       
  2502     
       
  2503     
       
  2504     band = bandToSet;
       
  2505     mode = modeToSet;
       
  2506     customApi.SetSystemNetworkBand(req, band, mode);
       
  2507     User::WaitForRequest(req);
       
  2508     ASSERT_EQUALS(KErrNone, req.Int());
       
  2509 	
       
  2510 	AssertMockLtsyStatusL();
       
  2511 	
       
  2512 	CleanupStack::PopAndDestroy(&customApi);
       
  2513 	CleanupStack::PopAndDestroy(&data);
       
  2514 	CleanupStack::PopAndDestroy(this);
       
  2515 	}
       
  2516 
       
  2517 /**
       
  2518 @SYMTestCaseID BA-CTSYD-DIS-PHONE-UN0032
       
  2519 @SYMComponent telephony_ctsy
       
  2520 @SYMTestCaseDesc Test RPhone::NotifyDtmfEvent
       
  2521 @SYMTestPriority High
       
  2522 @SYMTestActions Invokes RPhone::NotifyDtmfEvent
       
  2523 @SYMTestExpectedResults Pass
       
  2524 @SYMTestType UT
       
  2525  */
       
  2526 void CCTsyPhoneFU::TestUnit0032L()
       
  2527 	{
       
  2528 	OpenEtelServerL(EUseExtendedError);
       
  2529 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  2530 	OpenPhoneL();
       
  2531 	
       
  2532 	RBuf8 data;
       
  2533 	CleanupClosePushL(data);
       
  2534 
       
  2535     TRequestStatus requestStatus;
       
  2536 	
       
  2537 	RMobilePhone::TMobilePhoneDTMFEvent event(RMobilePhone::EStopDtmfTone);	
       
  2538 	RMobilePhone::TMobilePhoneDTMFEvent startEvent(RMobilePhone::EStartDtmfTone);	
       
  2539 	TRequestStatus reqStatus;
       
  2540 	
       
  2541     TMockLtsyData1< RMobilePhone::TMobilePhoneDTMFEvent > toneEvent( startEvent );
       
  2542     toneEvent.SerialiseL(data);
       
  2543 
       
  2544 	iPhone.NotifyDTMFEvent(reqStatus, event);
       
  2545 	iMockLTSY.CompleteL(KMockLtsyDispatchPhoneNotifyDtmfEventIndId, KErrNone, data);
       
  2546 	
       
  2547 	User::WaitForRequest(reqStatus);
       
  2548 	ASSERT_EQUALS(KErrNone, reqStatus.Int());  
       
  2549 	ASSERT_EQUALS(RMobilePhone::EStartDtmfTone, event);
       
  2550 	
       
  2551 	
       
  2552 	CleanupStack::PopAndDestroy(2, this); // call, line, data, this	
       
  2553 	}