telephonyserverplugins/common_tsy/test/component/src/cctsysubscriberinfofu.cpp
changeset 0 3553901f7fa8
child 17 3f227a47ad75
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // The TEFUnit test suite for SubscriberInfo in the Common TSY.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file 
       
    20 */
       
    21 #include "cctsysubscriberinfofu.h"
       
    22 #include <etel.h>
       
    23 #include <etelmm.h>
       
    24 #include <etelmmerr.h>
       
    25 #include <et_clsvr.h>
       
    26 #include <ctsy/mmtsy_names.h>
       
    27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h>
       
    28 #include "tmockltsydata.h"
       
    29 #include <ctsy/serviceapi/gsmerror.h>
       
    30 
       
    31 CTestSuite* CCTsySubscriberInfoFU::CreateSuiteL(const TDesC& aName)
       
    32 	{
       
    33 	SUB_SUITE;
       
    34 
       
    35 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0001L);
       
    36 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0001aL);
       
    37 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0001bL);
       
    38 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0001cL);
       
    39 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0002L);
       
    40 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0003L);
       
    41 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0004L);
       
    42 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetServiceTable0005L);
       
    43 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetSubscriberId0001L);
       
    44 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetSubscriberId0002L);
       
    45 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetSubscriberId0004L);
       
    46 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetIccAccessCaps0001L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetCustomerServiceProfile0001L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetCustomerServiceProfile0002L);
       
    49 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetCustomerServiceProfile0002bL);
       
    50 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetCustomerServiceProfile0003L);
       
    51 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetCustomerServiceProfile0004L);
       
    52 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetCustomerServiceProfile0005L);
       
    53 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestNotifyIccAccessCapsChange0001L);
       
    54 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestNotifyIccAccessCapsChange0002L);
       
    55 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestNotifyIccAccessCapsChange0004L);
       
    56 	ADD_TEST_STEP_ISO_CPP(CCTsySubscriberInfoFU, TestGetIccIdentity0001L);
       
    57 
       
    58 	END_SUITE;
       
    59 	}
       
    60 
       
    61 
       
    62 /**
       
    63 Fill in a service table
       
    64 @param aTable the table to fill in
       
    65 @param aValue the value of the table members
       
    66 */
       
    67 LOCAL_C void FillInServiceTable(RMobilePhone::TMobilePhoneServiceTableV1 &aTable, TUint8 aValue)
       
    68 	{
       
    69 	aTable.iServices1To8   = aValue;
       
    70 	aTable.iServices9To16  = aValue;
       
    71 	aTable.iServices17To24 = aValue;
       
    72 	aTable.iServices25To32 = aValue;
       
    73 	aTable.iServices33To40 = aValue;
       
    74 	aTable.iServices41To48 = aValue;
       
    75 	aTable.iServices49To56 = aValue;
       
    76 	}
       
    77 
       
    78 
       
    79 /**
       
    80 Fill in a csp file
       
    81 @aCsp aCsp the file to fill in
       
    82 */
       
    83 LOCAL_C void FillInCspFile(RMobilePhone::TMobilePhoneCspFileV1 &aCsp)
       
    84 	{
       
    85 	aCsp.iCallOfferingServices = 1;
       
    86 	aCsp.iCallRestrictionServices = 2;
       
    87 	aCsp.iOtherSuppServices = 3;
       
    88 	aCsp.iCallCompletionServices = 4;
       
    89 	aCsp.iTeleservices = 5;
       
    90 	aCsp.iCphsTeleservices = 6;
       
    91 	aCsp.iCphsFeatures = 7;
       
    92 	aCsp.iNumberIdentServices = 8;
       
    93 	aCsp.iPhase2PlusServices = 9;
       
    94 	aCsp.iValueAddedServices = 10;
       
    95 	}
       
    96 /**
       
    97 Opens phone object and connects to mockLTSY.
       
    98 */
       
    99 void CCTsySubscriberInfoFU::OpenPhone()
       
   100     {
       
   101 	TInt err = iPhone.Open(iTelServer,KMmTsyPhoneName);
       
   102 	ASSERT_EQUALS(KErrNone, err);
       
   103 	
       
   104 	err = iMockLTSY.Connect();
       
   105 	ASSERT_EQUALS(KErrNone, err);
       
   106     }
       
   107 
       
   108 /**
       
   109 Initializes CTSY and caches SIM and USIM service tables.
       
   110 @param aSimServiceTable If not NULL contains SIM service table to be cached in CTSY
       
   111 @param aUSimServiceTable If not NULL contains USIM service table to be cached in CTSY
       
   112 */
       
   113 void CCTsySubscriberInfoFU::InitAndCacheSimServiceTableL(
       
   114     const RMobilePhone::TMobilePhoneServiceTableV1* aSimServiceTable,
       
   115     const RMobilePhone::TMobilePhoneServiceTableV1* aUSimServiceTable,
       
   116     TInt aSimServiceTableError)
       
   117 	{
       
   118 	RBuf8 data;
       
   119 	CleanupClosePushL(data);
       
   120 
       
   121 	TRequestStatus mockLtsyStatus;
       
   122 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   123 	
       
   124 	// EMmTsyBootNotifyModemStatusReadyIPC
       
   125 	iMockLTSY.CompleteL(EMmTsyBootNotifyModemStatusReadyIPC, KErrNone);
       
   126 
       
   127 	// EMobilePhoneGetNetworkRegistrationStatus
       
   128 	iMockLTSY.ExpectL(EMobilePhoneGetNetworkRegistrationStatus);
       
   129 	iMockLTSY.CompleteL(EMobilePhoneGetNetworkRegistrationStatus, KErrNone, 0);
       
   130 	
       
   131 	// EMmTsyBootNotifySimStatusReadyIPC
       
   132 	iMockLTSY.ExpectL(EMmTsyBootNotifySimStatusReadyIPC);
       
   133 	iMockLTSY.CompleteL(EMmTsyBootNotifySimStatusReadyIPC, KErrNone, 0);
       
   134 	
       
   135 	// EMobilePhoneGetHomeNetwork
       
   136 	iMockLTSY.ExpectL(EMobilePhoneGetHomeNetwork);
       
   137 	RMobilePhone::TMobilePhoneNetworkInfoV5 homeNetwork;
       
   138 	homeNetwork.iMode = RMobilePhone::ENetworkModeWcdma;
       
   139 	homeNetwork.iStatus = RMobilePhone::ENetworkStatusCurrent;
       
   140 	homeNetwork.iBandInfo = RMobilePhone::EBandUnknown;
       
   141 	homeNetwork.iCountryCode = _L("234");
       
   142 	homeNetwork.iCdmaSID = _L("");
       
   143 	homeNetwork.iAnalogSID = _L("");
       
   144 	homeNetwork.iNetworkId = _L("23499");
       
   145 	homeNetwork.iDisplayTag = _L("symbian");
       
   146 	homeNetwork.iShortName = _L("symbian");
       
   147 	homeNetwork.iLongName = _L("symbian mobile");
       
   148 	homeNetwork.iAccess = RMobilePhone::ENetworkAccessUtran;
       
   149 	homeNetwork.iEgprsAvailableIndicator = ETrue;
       
   150 	homeNetwork.iHsdpaAvailableIndicator = ETrue;
       
   151 	TMockLtsyData1<RMobilePhone::TMobilePhoneNetworkInfoV5> homeNetworkData(homeNetwork);
       
   152 	homeNetworkData.SerialiseL(data);
       
   153 	iMockLTSY.CompleteL(EMobilePhoneGetHomeNetwork,KErrNone, data, 0);
       
   154 
       
   155 	// EMmTsyPhoneGetPin1DisableSupportedIPC
       
   156  	iMockLTSY.ExpectL(EMmTsyPhoneGetPin1DisableSupportedIPC);
       
   157 	TBool pin1DisableSupport = ETrue;
       
   158 	TMockLtsyData1<TBool> pin1DisableSupportData(pin1DisableSupport);
       
   159 	data.Close();
       
   160 	pin1DisableSupportData.SerialiseL(data);
       
   161 	iMockLTSY.CompleteL(EMmTsyPhoneGetPin1DisableSupportedIPC, KErrNone, data, 0);
       
   162 
       
   163 	// EMmTsySimRefreshRegisterIPC
       
   164 	iMockLTSY.ExpectL(EMmTsySimRefreshRegisterIPC);
       
   165 	iMockLTSY.CompleteL(EMmTsySimRefreshRegisterIPC, KErrNone, 0);
       
   166 
       
   167 	// EMobilePhoneGetServiceTable
       
   168 	if ( aSimServiceTable != NULL )
       
   169 	    {
       
   170         RMobilePhone::TMobilePhoneServiceTable serviceTable = RMobilePhone::ESIMServiceTable;
       
   171         TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTable> serviceTableData(serviceTable);
       
   172         data.Close();
       
   173         serviceTableData.SerialiseL(data);
       
   174         iMockLTSY.ExpectL(EMobilePhoneGetServiceTable, data);
       
   175 
       
   176         RMobilePhone::TMobilePhoneServiceTableV1Pckg simServiceTableData(
       
   177             *const_cast<RMobilePhone::TMobilePhoneServiceTableV1*>(aSimServiceTable));
       
   178         iMockLTSY.CompleteL(EMobilePhoneGetServiceTable, aSimServiceTableError, simServiceTableData, 0);
       
   179         }
       
   180 
       
   181 	// EMobilePhoneGetALSLine
       
   182 	iMockLTSY.ExpectL(EMobilePhoneGetALSLine);
       
   183 
       
   184 	RMobilePhone::TMobilePhoneALSLine alsLine = RMobilePhone::EAlternateLinePrimary;
       
   185 	TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine);
       
   186 	data.Close();
       
   187 	alsLineData.SerialiseL(data);
       
   188 	iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data, 0);
       
   189 	
       
   190 	iMockLTSY.ExpectL(ECustomGetIccCallForwardingStatusIPC);
       
   191 
       
   192 	// EMobilePhoneGetIccMessageWaitingIndicators
       
   193 	iMockLTSY.ExpectL(EMobilePhoneGetIccMessageWaitingIndicators);
       
   194 
       
   195 	RMobilePhone::TMobilePhoneMessageWaitingV1 expectedMessageIndicators;
       
   196 	TMockLtsyData1<RMobilePhone::TMobilePhoneMessageWaitingV1>
       
   197 	                                indicatorsData(expectedMessageIndicators);
       
   198     data.Close();
       
   199     indicatorsData.SerialiseL(data); 
       
   200 	iMockLTSY.CompleteL(EMobilePhoneGetIccMessageWaitingIndicators, KErrNone, data);
       
   201 
       
   202 	iMockLTSY.ExpectL(ECustomCheckAlsPpSupportIPC);
       
   203 	iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile);
       
   204 	
       
   205 	if ( aUSimServiceTable != NULL )
       
   206 	    {
       
   207 	    RMobilePhone::TMobilePhoneServiceTable USIMserviceTable = RMobilePhone::EUSIMServiceTable;
       
   208     	TMockLtsyData1<RMobilePhone::TMobilePhoneServiceTable> USIMserviceTableData(USIMserviceTable);
       
   209     	data.Close();
       
   210     	USIMserviceTableData.SerialiseL(data);
       
   211     	iMockLTSY.ExpectL(EMobilePhoneGetServiceTable, data);
       
   212     	
       
   213     	RMobilePhone::TMobilePhoneServiceTableV1Pckg usimServiceTableData(
       
   214     			*const_cast<RMobilePhone::TMobilePhoneServiceTableV1*>(aUSimServiceTable));
       
   215     	iMockLTSY.CompleteL(EMobilePhoneGetServiceTable, KErrNone, usimServiceTableData, 0);
       
   216 	    }
       
   217 	    
       
   218 	User::WaitForRequest(mockLtsyStatus);
       
   219 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   220 
       
   221 	CleanupStack::PopAndDestroy(&data);
       
   222 	AssertMockLtsyStatusL();
       
   223 	
       
   224 	}
       
   225 
       
   226 
       
   227 //
       
   228 // Actual test cases
       
   229 //
       
   230 
       
   231 
       
   232 /**
       
   233 @SYMTestCaseID BA-CTSY-SUBI-MGST-0001
       
   234 @SYMComponent  telephony_ctsy
       
   235 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetServiceTable
       
   236 @SYMTestPriority High
       
   237 @SYMTestActions Invokes RMobilePhone::GetServiceTable for cached service tables
       
   238 @SYMTestExpectedResults Pass
       
   239 @SYMTestType CT
       
   240 */
       
   241 void CCTsySubscriberInfoFU::TestGetServiceTable0001L()
       
   242 	{
       
   243 	
       
   244 	OpenEtelServerL(EUseExtendedError);
       
   245 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   246 
       
   247 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable;
       
   248 	FillInServiceTable(completeTable, 0xFF);
       
   249 
       
   250     OpenPhone();
       
   251 	InitAndCacheSimServiceTableL(&completeTable, NULL, KErrNone);
       
   252 
       
   253 	TRequestStatus reqStatus;
       
   254 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   255 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   256 
       
   257 	//-------------------------------------------------------------------------
       
   258 	// TEST D1: Successful completion of RMobilePhone::GetServiceTable request
       
   259 	// when CTSY gets SIM service table from the cache
       
   260  	//-------------------------------------------------------------------------
       
   261  	
       
   262 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   263 	User::WaitForRequest(reqStatus);
       
   264 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   265 	ASSERT_TRUE( TComparator<RMobilePhone::TMobilePhoneServiceTableV1>::IsEqual(completeTable, serviceTable) );
       
   266 	AssertMockLtsyStatusL();
       
   267 
       
   268 	//-------------------------------------------------------------------------
       
   269 	// TEST C: Successful completion of RMobilePhone::GetServiceTable request,
       
   270 	// this time request USIM table for USIM ICC 
       
   271  	//-------------------------------------------------------------------------
       
   272 	
       
   273 	// change ICC to USIM (3G)
       
   274 	ChangeUsedSimCardTypeL(EICCTypeSim3G);
       
   275 	
       
   276 	// prepare mockLtsy
       
   277 	RMobilePhone::TMobilePhoneServiceTable expTable = RMobilePhone::EUSIMServiceTable;
       
   278 	TPckg<RMobilePhone::TMobilePhoneServiceTable> expLtsyData(expTable);
       
   279 	
       
   280 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable2;
       
   281 	RMobilePhone::TMobilePhoneServiceTableV1Pckg completeLtsyData2(completeTable2);
       
   282 	FillInServiceTable(completeTable2, 0x08);
       
   283 
       
   284 	iMockLTSY.ExpectL(EMobilePhoneGetServiceTable, expLtsyData);
       
   285 	iMockLTSY.CompleteL(EMobilePhoneGetServiceTable, KErrNone, completeLtsyData2);
       
   286 
       
   287 	// test
       
   288 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EUSIMServiceTable, tableData);
       
   289 	User::WaitForRequest(reqStatus);
       
   290 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   291 	ASSERT_TRUE( TComparator<RMobilePhone::TMobilePhoneServiceTableV1>::IsEqual(completeTable2, serviceTable) );
       
   292 	AssertMockLtsyStatusL();
       
   293 	
       
   294 	//-------------------------------------------------------------------------
       
   295 	// TEST D2: RMobilePhone::GetServiceTable again,
       
   296 	// this time request SIM table for USIM ICC,
       
   297 	// CTSY gets SIM service table from the cache
       
   298  	//-------------------------------------------------------------------------
       
   299 	
       
   300 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   301 	User::WaitForRequest(reqStatus);
       
   302 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   303 	ASSERT_TRUE( TComparator<RMobilePhone::TMobilePhoneServiceTableV1>::IsEqual(completeTable, serviceTable) );
       
   304 	AssertMockLtsyStatusL();
       
   305 
       
   306 	//-------------------------------------------------------------------------
       
   307 	// TEST: request USIM table for SIM ICC 
       
   308  	//-------------------------------------------------------------------------
       
   309 
       
   310 	// change ICC to SIM (2G)
       
   311 	ChangeUsedSimCardTypeL(EICCTypeSim2GGsm);
       
   312 
       
   313 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EUSIMServiceTable, tableData);
       
   314 	User::WaitForRequest(reqStatus);
       
   315 	ASSERT_EQUALS(KErrMMEtelWrongMode, reqStatus.Int());
       
   316 	AssertMockLtsyStatusL();
       
   317 
       
   318 	//-------------------------------------------------------------------------
       
   319 	// TEST: request unsupported tables
       
   320  	//-------------------------------------------------------------------------
       
   321 
       
   322 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ECDMAServiceTable, tableData);
       
   323 	User::WaitForRequest(reqStatus);
       
   324 	ASSERT_EQUALS(KErrNotFound, reqStatus.Int());
       
   325 
       
   326 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EUSIMEnabledServiceTable, tableData);
       
   327 	User::WaitForRequest(reqStatus);
       
   328 	ASSERT_EQUALS(KErrNotFound, reqStatus.Int());
       
   329 
       
   330 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EISIMServiceTable, tableData);
       
   331 	User::WaitForRequest(reqStatus);
       
   332 	ASSERT_EQUALS(KErrNotFound, reqStatus.Int());
       
   333 
       
   334 	AssertMockLtsyStatusL();
       
   335 
       
   336 	CleanupStack::PopAndDestroy(this);
       
   337 	
       
   338 	}
       
   339 
       
   340 
       
   341 /**
       
   342 @SYMTestCaseID BA-CTSY-SUBI-MGST-0001a
       
   343 @SYMComponent  telephony_ctsy
       
   344 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetServiceTable
       
   345 @SYMTestPriority High
       
   346 @SYMTestActions Invokes RMobilePhone::GetServiceTable for non-cached service tables (SIM table first)
       
   347 @SYMTestExpectedResults Pass
       
   348 @SYMTestType CT
       
   349 */
       
   350 void CCTsySubscriberInfoFU::TestGetServiceTable0001aL()
       
   351 	{
       
   352 	
       
   353 	OpenEtelServerL(EUseExtendedError);
       
   354 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   355 
       
   356     OpenPhone();
       
   357 
       
   358 	TRequestStatus reqStatus;
       
   359 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   360 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   361             
       
   362     
       
   363         // Change ICC to USIM (3G)
       
   364 	ChangeUsedSimCardTypeL(EICCTypeSim3G);
       
   365 
       
   366 	//In case when SIM is not ready EMobilePhoneGetServiceTable request is writen 
       
   367 	//to CMmPhoneTsy::iServiceTableRequests array of cached requests to be completed 
       
   368 	//later when SIM is ready.
       
   369 	
       
   370 	//-------------------------------------------------------------------------
       
   371 	// TEST C1: Successful completion of RMobilePhone::GetServiceTable request,
       
   372 	// request SIM table for SIM ICC 
       
   373  	//-------------------------------------------------------------------------
       
   374 	
       
   375 	// Call GetServiceTable
       
   376 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   377 
       
   378 	// complete data for SimServiceTable
       
   379 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable;
       
   380 	FillInServiceTable(completeTable, 0xFF);
       
   381 	RMobilePhone::TMobilePhoneServiceTableV1Pckg completeLtsyData(completeTable);
       
   382 	
       
   383 	// complete data for USimServiceTable
       
   384 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable2;
       
   385 	FillInServiceTable(completeTable2, 0x08);
       
   386 	RMobilePhone::TMobilePhoneServiceTableV1Pckg completeLtsyData2(completeTable2);
       
   387 
       
   388 	InitAndCacheSimServiceTableL(&completeTable, &completeTable2, KErrNone);
       
   389 
       
   390 	User::WaitForRequest(reqStatus);
       
   391 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   392 	AssertMockLtsyStatusL();
       
   393 
       
   394 	//-------------------------------------------------------------------------
       
   395 	// TEST C2: Successful completion of RMobilePhone::GetServiceTable request,
       
   396 	// this time request USIM table for USIM ICC 
       
   397  	//-------------------------------------------------------------------------
       
   398 
       
   399 	// Call GetServiceTable
       
   400 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EUSIMServiceTable, tableData);	
       
   401 	User::WaitForRequest(reqStatus);
       
   402 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   403 
       
   404 	AssertMockLtsyStatusL();
       
   405 
       
   406 	//-------------------------------------------------------------------------
       
   407 	// TEST: request unsupported tables
       
   408  	//-------------------------------------------------------------------------
       
   409 
       
   410 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ECDMAServiceTable, tableData);
       
   411 	User::WaitForRequest(reqStatus);
       
   412 	ASSERT_EQUALS(KErrNotFound, reqStatus.Int());
       
   413 
       
   414 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EUSIMEnabledServiceTable, tableData);
       
   415 	User::WaitForRequest(reqStatus);
       
   416 	ASSERT_EQUALS(KErrNotFound, reqStatus.Int());
       
   417 
       
   418 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EISIMServiceTable, tableData);
       
   419 	User::WaitForRequest(reqStatus);
       
   420 	ASSERT_EQUALS(KErrNotFound, reqStatus.Int());
       
   421 
       
   422 	AssertMockLtsyStatusL();
       
   423 
       
   424 	//-------------------------------------------------------------------------
       
   425 	// TEST: request USIM table for SIM ICC 
       
   426  	//-------------------------------------------------------------------------
       
   427 
       
   428 	// change ICC to SIM (2G)
       
   429 	ChangeUsedSimCardTypeL(EICCTypeSim2GGsm);
       
   430 
       
   431 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EUSIMServiceTable, tableData);
       
   432 	User::WaitForRequest(reqStatus);
       
   433 	ASSERT_EQUALS(KErrMMEtelWrongMode, reqStatus.Int());
       
   434 
       
   435 	AssertMockLtsyStatusL();
       
   436 	CleanupStack::PopAndDestroy(this);
       
   437 	}
       
   438 
       
   439 
       
   440 /**
       
   441 @SYMTestCaseID BA-CTSY-SUBI-MGST-0001b
       
   442 @SYMComponent  telephony_ctsy
       
   443 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetServiceTable
       
   444 @SYMTestPriority High
       
   445 @SYMTestActions Invokes RMobilePhone::GetServiceTable for non-cached service tables (USIM table first)
       
   446 @SYMTestExpectedResults Pass
       
   447 @SYMTestType CT
       
   448 */
       
   449 void CCTsySubscriberInfoFU::TestGetServiceTable0001bL()
       
   450 	{
       
   451 	
       
   452 	OpenEtelServerL(EUseExtendedError);
       
   453 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   454 
       
   455 	OpenPhone();
       
   456 
       
   457 	TRequestStatus reqStatus;
       
   458 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   459 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   460 
       
   461 	//-------------------------------------------------------------------------
       
   462 	// TEST C: Successful completion of RMobilePhone::GetServiceTable request,
       
   463 	// request USIM table for USIM ICC when cache for SIM table is empty
       
   464  	//-------------------------------------------------------------------------
       
   465 
       
   466 	// change ICC to USIM (3G)
       
   467 	ChangeUsedSimCardTypeL(EICCTypeSim3G);
       
   468 
       
   469 	// both SIM and USIM service tables are cached sequentially
       
   470 	// prepare mockLtsy
       
   471 	
       
   472 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable;
       
   473 	FillInServiceTable(completeTable, 0xFF);
       
   474 	RMobilePhone::TMobilePhoneServiceTableV1Pckg completeLtsyData(completeTable);
       
   475 	
       
   476 	iMockLTSY.CompleteL(EMobilePhoneGetServiceTable, KErrTimedOut, completeLtsyData);
       
   477 		
       
   478 	// test
       
   479 	iPhone.GetServiceTable(reqStatus, RMobilePhone::EUSIMServiceTable, tableData);
       
   480 	User::WaitForRequest(reqStatus);
       
   481 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
   482 	AssertMockLtsyStatusL();
       
   483 
       
   484 	//-------------------------------------------------------------------------
       
   485 	// TEST D: RMobilePhone::GetServiceTable again,
       
   486 	// this time request SIM table for USIM ICC,
       
   487 	// CTSY gets SIM service table from the cache
       
   488  	//-------------------------------------------------------------------------
       
   489 
       
   490 	iMockLTSY.CompleteL(EMobilePhoneGetServiceTable, KErrTimedOut, completeLtsyData);
       
   491 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   492 	User::WaitForRequest(reqStatus);
       
   493 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
   494 	AssertMockLtsyStatusL();
       
   495 
       
   496 	CleanupStack::PopAndDestroy(this);
       
   497 	
       
   498 	}
       
   499 
       
   500 
       
   501 /**
       
   502 @SYMTestCaseID BA-CTSY-SUBI-MGST-0001c
       
   503 @SYMComponent  telephony_ctsy
       
   504 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetServiceTable
       
   505 @SYMTestPriority High
       
   506 @SYMTestActions Invokes RMobilePhone::GetServiceTable to test negative flows through the CTSY
       
   507 @SYMTestExpectedResults Pass
       
   508 @SYMTestType CT
       
   509 */
       
   510 void CCTsySubscriberInfoFU::TestGetServiceTable0001cL()
       
   511 	{
       
   512 	
       
   513 	OpenEtelServerL(EUseExtendedError);
       
   514 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   515 
       
   516 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable;
       
   517 	FillInServiceTable(completeTable, 0xFF);
       
   518 
       
   519     OpenPhone();
       
   520 	InitAndCacheSimServiceTableL(&completeTable, NULL, KErrUnknown);
       
   521 
       
   522 	RMobilePhone::TMobilePhoneServiceTable expTable(RMobilePhone::ESIMServiceTable);
       
   523 	TPckg<RMobilePhone::TMobilePhoneServiceTable> expLtsyData(expTable);
       
   524 
       
   525 	RMobilePhone::TMobilePhoneServiceTableV1Pckg completeLtsyData(completeTable);
       
   526 	
       
   527 	TRequestStatus reqStatus;
       
   528 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   529 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   530 
       
   531 	//-------------------------------------------------------------------------
       
   532 	// TEST B: failure on pending LTSY->CTSY request completion
       
   533  	//-------------------------------------------------------------------------
       
   534 
       
   535     iMockLTSY.ExpectL(EMobilePhoneGetServiceTable, expLtsyData, KErrNone);
       
   536 	iMockLTSY.CompleteL(EMobilePhoneGetServiceTable, KErrUnknown, completeLtsyData);
       
   537 
       
   538 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   539 	
       
   540 	User::WaitForRequest(reqStatus);
       
   541     ASSERT_EQUALS(KErrUnknown, reqStatus.Int());
       
   542 	AssertMockLtsyStatusL();
       
   543 
       
   544 	//-------------------------------------------------------------------------
       
   545 	// TEST A: failure to dispatch request to LTSY
       
   546  	//-------------------------------------------------------------------------
       
   547 
       
   548 	iMockLTSY.ExpectL(EMobilePhoneGetServiceTable, expLtsyData, KErrUnknown);
       
   549 
       
   550 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   551 	
       
   552 	User::WaitForRequest(reqStatus);
       
   553     ASSERT_EQUALS(KErrUnknown, reqStatus.Int());
       
   554 	AssertMockLtsyStatusL();
       
   555 
       
   556 	CleanupStack::PopAndDestroy(this);
       
   557 
       
   558 	}
       
   559 
       
   560 
       
   561 /**
       
   562 @SYMTestCaseID BA-CTSY-SUBI-MGST-0002
       
   563 @SYMComponent  telephony_ctsy
       
   564 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::GetServiceTable
       
   565 @SYMTestPriority High
       
   566 @SYMTestActions Invokes cancelling of RMobilePhone::GetServiceTable
       
   567 @SYMTestExpectedResults Pass
       
   568 @SYMTestType CT
       
   569 */
       
   570 void CCTsySubscriberInfoFU::TestGetServiceTable0002L()
       
   571 	{
       
   572 
       
   573 	OpenEtelServerL(EUseExtendedError);
       
   574 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   575 	OpenPhone();
       
   576 
       
   577 	//-------------------------------------------------------------------------
       
   578 	// Test cancelling of RMobilePhone::GetServiceTable
       
   579  	//-------------------------------------------------------------------------
       
   580 	TRequestStatus reqStatus;
       
   581 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   582 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   583 	
       
   584 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   585 	iPhone.CancelAsyncRequest(EMobilePhoneGetServiceTable);
       
   586 
       
   587 	User::WaitForRequest(reqStatus);	
       
   588 	// There is no cancel for this ipc, so status is KErrNone
       
   589 	ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
   590 
       
   591 	AssertMockLtsyStatusL();
       
   592 	CleanupStack::PopAndDestroy(this);
       
   593 	
       
   594 	}
       
   595 
       
   596 
       
   597 /**
       
   598 @SYMTestCaseID BA-CTSY-SUBI-MGST-0003
       
   599 @SYMComponent  telephony_ctsy
       
   600 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetServiceTable with bad parameter data
       
   601 @SYMTestPriority High
       
   602 @SYMTestActions Invokes RMobilePhone::GetServiceTable with bad parameter data
       
   603 @SYMTestExpectedResults Pass
       
   604 @SYMTestType CT
       
   605 */
       
   606 void CCTsySubscriberInfoFU::TestGetServiceTable0003L()
       
   607 	{
       
   608 
       
   609 	OpenEtelServerL(EUseExtendedError);
       
   610 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   611 	OpenPhoneL();
       
   612 
       
   613 	TRequestStatus reqStatus;
       
   614 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   615 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   616 
       
   617 	//-------------------------------------------------------------------------
       
   618 	// Test B: Test passing wrong descriptor size to parameter in
       
   619 	// RMobilePhone::GetServiceTable
       
   620  	//-------------------------------------------------------------------------
       
   621 
       
   622 	TBuf8<1> buf(KNullDesC8);
       
   623 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, buf);
       
   624 	User::WaitForRequest(reqStatus);
       
   625 	ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
   626 	AssertMockLtsyStatusL();
       
   627 	
       
   628 	CleanupStack::PopAndDestroy(this);
       
   629 
       
   630 	}
       
   631 
       
   632 
       
   633 /**
       
   634 @SYMTestCaseID BA-CTSY-SUBI-MGST-0004
       
   635 @SYMComponent  telephony_ctsy
       
   636 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::GetServiceTable
       
   637 @SYMTestPriority High
       
   638 @SYMTestActions Invokes multiple client requests to RMobilePhone::GetServiceTable
       
   639 @SYMTestExpectedResults Pass
       
   640 @SYMTestType CT
       
   641 */
       
   642 void CCTsySubscriberInfoFU::TestGetServiceTable0004L()
       
   643 	{
       
   644 
       
   645 	OpenEtelServerL(EUseExtendedError);
       
   646 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
   647 
       
   648 	OpenPhone();
       
   649 
       
   650 	// change ICC to USIM (3G)
       
   651 	ChangeUsedSimCardTypeL(EICCTypeSim3G);
       
   652 	
       
   653 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable;
       
   654 	FillInServiceTable(completeTable, 0xFF);
       
   655 	
       
   656 	RMobilePhone::TMobilePhoneServiceTableV1 completeTable2;
       
   657 	FillInServiceTable(completeTable2, 0x08);
       
   658 
       
   659 	// Open second client
       
   660 	RTelServer telServer2;
       
   661 	TInt ret = telServer2.Connect();
       
   662 	ASSERT_EQUALS(KErrNone, ret);
       
   663 	CleanupClosePushL(telServer2);
       
   664 
       
   665 	RMobilePhone phone2;
       
   666 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
   667 	ASSERT_EQUALS(KErrNone, ret);
       
   668 	CleanupClosePushL(phone2);
       
   669 
       
   670     TRequestStatus reqStatus;
       
   671 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   672 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   673 	
       
   674 	TRequestStatus reqStatus2;
       
   675 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable2;
       
   676 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData2(serviceTable2);
       
   677 
       
   678 	//-------------------------------------------------------------------------
       
   679 	// Test A: Test multiple clients requesting RMobilePhone::GetServiceTable
       
   680  	//-------------------------------------------------------------------------
       
   681 
       
   682 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   683 
       
   684 	phone2.GetServiceTable(reqStatus2, RMobilePhone::EUSIMServiceTable, tableData2);
       
   685 
       
   686     InitAndCacheSimServiceTableL(&completeTable, &completeTable2, KErrNone);
       
   687      
       
   688 	User::WaitForRequest(reqStatus);
       
   689 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
   690 	ASSERT_TRUE( TComparator<RMobilePhone::TMobilePhoneServiceTableV1>::IsEqual(completeTable, serviceTable) );
       
   691 
       
   692 	User::WaitForRequest(reqStatus2);
       
   693 	ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int());
       
   694 	
       
   695 	AssertMockLtsyStatusL();
       
   696 
       
   697 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
   698 
       
   699 	}
       
   700 
       
   701 
       
   702 /**
       
   703 @SYMTestCaseID BA-CTSY-SUBI-MGST-0005
       
   704 @SYMComponent  telephony_ctsy
       
   705 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetServiceTable with timeout
       
   706 @SYMTestPriority High
       
   707 @SYMTestActions Invokes RMobilePhone::GetServiceTable and tests for timeout
       
   708 @SYMTestExpectedResults Pass
       
   709 @SYMTestType CT
       
   710 */
       
   711 void CCTsySubscriberInfoFU::TestGetServiceTable0005L()
       
   712 	{
       
   713 
       
   714 	OpenEtelServerL(EUseExtendedError);
       
   715 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   716 
       
   717 	OpenPhone();
       
   718 	
       
   719 	//-------------------------------------------------------------------------
       
   720 	// Test A: Test timeout of RMobilePhone::GetServiceTable
       
   721  	//-------------------------------------------------------------------------
       
   722 
       
   723 	RMobilePhone::TMobilePhoneServiceTable expTable(RMobilePhone::EUSIMServiceTable);
       
   724 	TPckg<RMobilePhone::TMobilePhoneServiceTable> expLtsyData(expTable);
       
   725 	iMockLTSY.ExpectL(EMobilePhoneGetServiceTable, expLtsyData);
       
   726 	
       
   727 	RMobilePhone::TMobilePhoneServiceTableV1 serviceTable;
       
   728 	RMobilePhone::TMobilePhoneServiceTableV1Pckg tableData(serviceTable);
       
   729 	TRequestStatus reqStatus;
       
   730 	iPhone.GetServiceTable(reqStatus, RMobilePhone::ESIMServiceTable, tableData);
       
   731 
       
   732 	User::WaitForRequest(reqStatus);
       
   733 	ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 310108);
       
   734 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
   735 
       
   736 	AssertMockLtsyStatusL();
       
   737 
       
   738 	CleanupStack::PopAndDestroy(this);
       
   739 
       
   740 	}
       
   741 
       
   742 
       
   743 /**
       
   744 @SYMTestCaseID BA-CTSY-SUBI-MSI-0001
       
   745 @SYMComponent  telephony_ctsy
       
   746 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetSubscriberId
       
   747 @SYMTestPriority High
       
   748 @SYMTestActions Invokes RMobilePhone::GetSubscriberId
       
   749 @SYMTestExpectedResults Pass
       
   750 @SYMTestType CT
       
   751 */
       
   752 void CCTsySubscriberInfoFU::TestGetSubscriberId0001L()
       
   753 	{
       
   754 
       
   755 	OpenEtelServerL();
       
   756 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   757 	OpenPhoneL();
       
   758 
       
   759 	_LIT8(KImsi,"01234567890123");
       
   760 	_LIT8(KImsi2,"98765432100123");
       
   761 
       
   762  	//-------------------------------------------------------------------------
       
   763 	// TEST A: failure to dispatch request to LTSY
       
   764  	//-------------------------------------------------------------------------
       
   765 
       
   766 	// Queue response
       
   767 	iMockLTSY.ExpectL(EMobilePhoneGetSubscriberId, KErrNotSupported);
       
   768 	// Post request
       
   769 	TRequestStatus requestStatus;
       
   770 	RMobilePhone::TMobilePhoneSubscriberId subscriberId;
       
   771 	iPhone.GetSubscriberId(requestStatus, subscriberId);
       
   772 	User::WaitForRequest(requestStatus);
       
   773 	AssertMockLtsyStatusL();
       
   774 	ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());
       
   775 
       
   776 	//-------------------------------------------------------------------------
       
   777 	// TEST B: failure on pending LTSY->CTSY request completion
       
   778  	//-------------------------------------------------------------------------
       
   779 
       
   780 	iMockLTSY.ExpectL(EMobilePhoneGetSubscriberId);
       
   781 	iMockLTSY.CompleteL(EMobilePhoneGetSubscriberId, KErrGeneral, KNullDesC8);
       
   782 	iPhone.GetSubscriberId(requestStatus, subscriberId);
       
   783 	User::WaitForRequest(requestStatus);
       
   784 	AssertMockLtsyStatusL();
       
   785 	ASSERT_EQUALS(KErrGeneral, requestStatus.Int());
       
   786 
       
   787  	//-------------------------------------------------------------------------
       
   788 	// TEST C: Successful completion of RMobilePhone::GetSubscriberId request
       
   789 	// when result is not cached.
       
   790  	//-------------------------------------------------------------------------
       
   791 
       
   792 	iMockLTSY.ExpectL(EMobilePhoneGetSubscriberId);
       
   793 	iMockLTSY.CompleteL(EMobilePhoneGetSubscriberId, KErrNone, KImsi);
       
   794 
       
   795 	iPhone.GetSubscriberId(requestStatus, subscriberId);
       
   796 	User::WaitForRequest(requestStatus);
       
   797 	AssertMockLtsyStatusL();
       
   798 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   799 	// Check result
       
   800 	TBuf8<RMobilePhone::KIMSISize> convertedSubscriberId;
       
   801 	convertedSubscriberId.Copy(subscriberId);
       
   802 	ASSERT_TRUE(convertedSubscriberId == KImsi);
       
   803 
       
   804  	//-------------------------------------------------------------------------
       
   805 	// TEST D: RMobilePhone::GetSubscriberId again, this time CTSY
       
   806 	// will get result from the cache.
       
   807  	//-------------------------------------------------------------------------
       
   808 
       
   809 	iPhone.GetSubscriberId(requestStatus, subscriberId);
       
   810 	User::WaitForRequest(requestStatus);
       
   811 	AssertMockLtsyStatusL();
       
   812 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   813 	// Check result
       
   814 	convertedSubscriberId.Copy(subscriberId);
       
   815 	ASSERT_TRUE(convertedSubscriberId == KImsi);
       
   816 
       
   817  	//-------------------------------------------------------------------------
       
   818 	// TEST E: Unsolicited completion of RMobilePhone::GetSubscriberId
       
   819 	// from LTSY.
       
   820  	//-------------------------------------------------------------------------
       
   821 	TRequestStatus mockLtsyStatus;
       
   822 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   823 	iMockLTSY.CompleteL(EMobilePhoneGetSubscriberId, KErrNone, KImsi2, 0);
       
   824 	User::WaitForRequest(mockLtsyStatus);
       
   825 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   826 
       
   827 	// Check cache has been updated
       
   828 	iPhone.GetSubscriberId(requestStatus, subscriberId);
       
   829 	User::WaitForRequest(requestStatus);
       
   830 	AssertMockLtsyStatusL();
       
   831 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   832 	convertedSubscriberId.Copy(subscriberId);
       
   833 	ASSERT_TRUE(convertedSubscriberId == KImsi2); 	// Check result
       
   834 
       
   835  	//-------------------------------------------------------------------------
       
   836 	// Invoke GetSubscriberId from ltsy 
       
   837 	// by sim refresh procedure
       
   838  	//-------------------------------------------------------------------------
       
   839  	
       
   840 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   841 	TUint16 files = 0;
       
   842 	TPckg<TUint16> filesData(files);
       
   843 	iMockLTSY.CompleteL(EMmTsySimRefreshNowIPC, KErrNone, filesData);
       
   844 	iMockLTSY.ExpectL(EMobilePhoneGetSubscriberId);
       
   845 	iMockLTSY.CompleteL(EMobilePhoneGetSubscriberId, KErrNone, KImsi2);
       
   846 	User::WaitForRequest(mockLtsyStatus);
       
   847 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   848 	AssertMockLtsyStatusL();
       
   849 
       
   850 	CleanupStack::PopAndDestroy(this);
       
   851 	}
       
   852 
       
   853 
       
   854 /**
       
   855 @SYMTestCaseID BA-CTSY-SUBI-MSI-0002
       
   856 @SYMComponent  telephony_ctsy
       
   857 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::GetSubscriberId
       
   858 @SYMTestPriority High
       
   859 @SYMTestActions Invokes cancelling of RMobilePhone::GetSubscriberId
       
   860 @SYMTestExpectedResults Pass
       
   861 @SYMTestType CT
       
   862 */
       
   863 void CCTsySubscriberInfoFU::TestGetSubscriberId0002L()
       
   864 	{
       
   865 
       
   866 	OpenEtelServerL(EUseExtendedError);
       
   867 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   868 	OpenPhoneL();
       
   869 
       
   870 	TRequestStatus mockLtsyStatus;
       
   871 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
   872 
       
   873 	//-------------------------------------------------------------------------
       
   874 	// Test cancellation of RMobilePhone::GetSubscriberId
       
   875  	//-------------------------------------------------------------------------
       
   876 
       
   877 	// Needs to be done in separate test as it requires the CTSY
       
   878 	// to not have cached the subscriberID otherwise it will just
       
   879 	// get it from the cache and return immediately.
       
   880 
       
   881 	// Expect call down to LTSY for this IPC
       
   882 	iMockLTSY.ExpectL(EMobilePhoneGetSubscriberId);
       
   883 
       
   884 	// Queue response to be delayed to give time for cancel to come through
       
   885 	// Return data is needed because CTSY does not pass the cancel to
       
   886 	// LTSY
       
   887 	_LIT8(KImsi,"01234567890123");
       
   888 	iMockLTSY.CompleteL(EMobilePhoneGetSubscriberId, KErrNone, KImsi, 10);
       
   889 
       
   890 	TRequestStatus requestStatus;
       
   891 	RMobilePhone::TMobilePhoneSubscriberId subscriberId;
       
   892 	iPhone.GetSubscriberId(requestStatus, subscriberId);
       
   893 	iPhone.CancelAsyncRequest(EMobilePhoneGetSubscriberId);
       
   894 	User::WaitForRequest(requestStatus);
       
   895 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
   896 
       
   897 	User::WaitForRequest(mockLtsyStatus);
       
   898 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   899 	
       
   900 	AssertMockLtsyStatusL();
       
   901 	CleanupStack::PopAndDestroy(this);
       
   902 	}
       
   903 
       
   904 
       
   905 
       
   906 /**
       
   907 @SYMTestCaseID BA-CTSY-SUBI-MSI-0004
       
   908 @SYMComponent  telephony_ctsy
       
   909 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::GetSubscriberId
       
   910 @SYMTestPriority High
       
   911 @SYMTestActions Invokes multiple client requests to RMobilePhone::GetSubscriberId
       
   912 @SYMTestExpectedResults Pass
       
   913 @SYMTestType CT
       
   914 */
       
   915 void CCTsySubscriberInfoFU::TestGetSubscriberId0004L()
       
   916 	{
       
   917 
       
   918 	OpenEtelServerL(EUseExtendedError);
       
   919 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   920 	OpenPhoneL();
       
   921 
       
   922 	// Open second client
       
   923 	RTelServer telServer2;
       
   924 	TInt ret = telServer2.Connect();
       
   925 	ASSERT_EQUALS(KErrNone, ret);
       
   926 	CleanupClosePushL(telServer2);
       
   927 
       
   928 	RMobilePhone phone2;
       
   929 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
   930 	ASSERT_EQUALS(KErrNone, ret);
       
   931 	CleanupClosePushL(phone2);
       
   932 
       
   933 	//-------------------------------------------------------------------------
       
   934 	// Test A: Test multiple clients requesting RMobilePhone::GetSubscriberId
       
   935  	//-------------------------------------------------------------------------
       
   936 
       
   937 	// Expect call down to LTSY for this IPC from first client
       
   938 	iMockLTSY.ExpectL(EMobilePhoneGetSubscriberId);
       
   939 
       
   940 	_LIT8(KImsi,"01234567890123");
       
   941 	// warning: CTSY expect the IMSI as a 8 bit descriptor!
       
   942 	// First request completion should complete the request for both clients.
       
   943 	iMockLTSY.CompleteL(EMobilePhoneGetSubscriberId, KErrNone, KImsi, 10);
       
   944 
       
   945 	// First client makes request
       
   946 	TRequestStatus requestStatus;
       
   947 	RMobilePhone::TMobilePhoneSubscriberId subscriberId;
       
   948 	iPhone.GetSubscriberId(requestStatus, subscriberId);
       
   949 
       
   950 	// Second client makes request
       
   951 	TRequestStatus requestStatus2;
       
   952 	RMobilePhone::TMobilePhoneSubscriberId subscriberId2;
       
   953 	phone2.GetSubscriberId(requestStatus2, subscriberId2);
       
   954 
       
   955 	// Check result for first client
       
   956 	User::WaitForRequest(requestStatus);
       
   957 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   958 	TBuf8<RMobilePhone::KIMSISize> convertedSubscriberId;
       
   959 	convertedSubscriberId.Copy(subscriberId);
       
   960 	ASSERT_TRUE(convertedSubscriberId == KImsi);
       
   961 
       
   962 	// Check result for second client
       
   963 	User::WaitForRequest(requestStatus2);
       
   964 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   965 	convertedSubscriberId.Copy(subscriberId2);
       
   966 	ASSERT_TRUE(convertedSubscriberId == KImsi);
       
   967 
       
   968 	AssertMockLtsyStatusL();
       
   969 
       
   970 	CleanupStack::PopAndDestroy(3, this); // telServer2, phone2, this
       
   971 	}
       
   972 
       
   973 
       
   974 /**
       
   975 @SYMTestCaseID BA-CTSY-SUBI-MGIAC-0001
       
   976 @SYMComponent  telephony_ctsy
       
   977 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetIccAccessCaps
       
   978 @SYMTestPriority High
       
   979 @SYMTestActions Invokes RMobilePhone::GetIccAccessCaps
       
   980 @SYMTestExpectedResults Pass
       
   981 @SYMTestType CT
       
   982 */
       
   983 void CCTsySubscriberInfoFU::TestGetIccAccessCaps0001L()
       
   984 	{
       
   985 
       
   986 	OpenEtelServerL(EUseExtendedError);
       
   987 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   988 	OpenPhoneL();
       
   989 
       
   990 	// change ICC to unknown type
       
   991 	ChangeUsedSimCardTypeL(EICCTypeSimUnknown);
       
   992 
       
   993 	TUint32 caps(0);
       
   994 	TInt res = iPhone.GetIccAccessCaps(caps);
       
   995 	ASSERT_EQUALS(KErrNone, res);
       
   996 	AssertMockLtsyStatusL();
       
   997 	ASSERT_EQUALS(static_cast<TUint32>(0), caps);
       
   998 
       
   999 	// change ICC to SIM (2G)
       
  1000 	ChangeUsedSimCardTypeL(EICCTypeSim2GGsm);
       
  1001 
       
  1002 	res = iPhone.GetIccAccessCaps(caps);
       
  1003 	ASSERT_EQUALS(KErrNone, res);
       
  1004 	AssertMockLtsyStatusL();
       
  1005 	ASSERT_EQUALS(static_cast<TUint32>(RMobilePhone::KCapsSimAccessSupported), caps);
       
  1006 
       
  1007 	// change ICC to USIM (3G)
       
  1008 	ChangeUsedSimCardTypeL(EICCTypeSim3G);
       
  1009 
       
  1010 	res = iPhone.GetIccAccessCaps(caps);
       
  1011 	ASSERT_EQUALS(KErrNone, res);
       
  1012 	AssertMockLtsyStatusL();
       
  1013 	ASSERT_EQUALS(static_cast<TUint32>(RMobilePhone::KCapsUSimAccessSupported +
       
  1014             RMobilePhone::KCapsSimAccessSupported), caps);
       
  1015 
       
  1016 	CleanupStack::PopAndDestroy(this);
       
  1017 	
       
  1018 	}
       
  1019 
       
  1020 
       
  1021 /**
       
  1022 @SYMTestCaseID BA-CTSY-SUBI-MGCSP-0001
       
  1023 @SYMComponent  telephony_ctsy
       
  1024 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetCustomerServiceProfile
       
  1025 @SYMTestPriority High
       
  1026 @SYMTestActions Invokes RMobilePhone::GetCustomerServiceProfile
       
  1027 @SYMTestExpectedResults Pass
       
  1028 @SYMTestType CT
       
  1029 */
       
  1030 void CCTsySubscriberInfoFU::TestGetCustomerServiceProfile0001L()
       
  1031 	{
       
  1032 
       
  1033 	OpenEtelServerL(EUseExtendedError);
       
  1034 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1035 	OpenPhoneL();
       
  1036 
       
  1037  	//-------------------------------------------------------------------------
       
  1038 	// TEST A: failure to dispatch request to LTSY
       
  1039  	//-------------------------------------------------------------------------
       
  1040 
       
  1041 	iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile, KErrNotSupported);
       
  1042 	
       
  1043 	TRequestStatus reqStatus;
       
  1044 	RMobilePhone::TMobilePhoneCspFileV1 csp;
       
  1045 	RMobilePhone::TMobilePhoneCspFileV1Pckg cspPckg(csp);
       
  1046 	iPhone.GetCustomerServiceProfile(reqStatus, cspPckg);
       
  1047 	User::WaitForRequest(reqStatus);
       
  1048 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
  1049 	AssertMockLtsyStatusL();
       
  1050 
       
  1051 	//-------------------------------------------------------------------------
       
  1052 	// TEST B: failure on pending LTSY->CTSY request completion
       
  1053  	//-------------------------------------------------------------------------
       
  1054 
       
  1055 	iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile);
       
  1056 	
       
  1057 	RMobilePhone::TMobilePhoneCspFileV1 completeCsp;
       
  1058 	FillInCspFile(completeCsp);
       
  1059 	TPckg<RMobilePhone::TMobilePhoneCspFileV1> completeLtsyData(completeCsp);
       
  1060 	
       
  1061 	iMockLTSY.CompleteL(EMobilePhoneGetCustomerServiceProfile, KErrGeneral, completeLtsyData);
       
  1062 	
       
  1063 	iPhone.GetCustomerServiceProfile(reqStatus, cspPckg);
       
  1064 	User::WaitForRequest(reqStatus);
       
  1065 	ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
       
  1066 	AssertMockLtsyStatusL();
       
  1067 
       
  1068  	//-------------------------------------------------------------------------
       
  1069 	// TEST C: Successful completion of RMobilePhone::GetCustomerServiceProfile request
       
  1070  	//-------------------------------------------------------------------------
       
  1071 
       
  1072 	iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile);
       
  1073 	iMockLTSY.CompleteL(EMobilePhoneGetCustomerServiceProfile, KErrNone, completeLtsyData);
       
  1074 	iPhone.GetCustomerServiceProfile(reqStatus, cspPckg);
       
  1075 	User::WaitForRequest(reqStatus);
       
  1076 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1077 	AssertMockLtsyStatusL();
       
  1078 	ASSERT_TRUE(TComparator<RMobilePhone::TMobilePhoneCspFileV1>::IsEqual(completeCsp, csp));
       
  1079 
       
  1080  	//-------------------------------------------------------------------------
       
  1081 	// TEST E: Unsolicited completion of RMobilePhone::GetCustomerServiceProfile
       
  1082 	// from LTSY.
       
  1083  	//-------------------------------------------------------------------------
       
  1084 
       
  1085 	TRequestStatus mockLtsyStatus;
       
  1086 	iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1087 	iMockLTSY.CompleteL(EMobilePhoneGetCustomerServiceProfile, KErrNone, completeLtsyData, 0);
       
  1088 	User::WaitForRequest(mockLtsyStatus);
       
  1089 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1090 	AssertMockLtsyStatusL();
       
  1091 
       
  1092 	CleanupStack::PopAndDestroy(this);
       
  1093 	
       
  1094 	}
       
  1095 
       
  1096 /**
       
  1097 @SYMTestCaseID BA-CTSY-SUBI-MGCSP-0002
       
  1098 @SYMComponent  telephony_ctsy
       
  1099 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::GetCustomerServiceProfile
       
  1100 @SYMTestPriority High
       
  1101 @SYMTestActions Invokes cancelling of RMobilePhone::GetCustomerServiceProfile
       
  1102 @SYMTestExpectedResults Pass
       
  1103 @SYMTestType CT
       
  1104 */
       
  1105 void CCTsySubscriberInfoFU::TestGetCustomerServiceProfile0002L()
       
  1106     {
       
  1107     OpenEtelServerL(EUseExtendedError);
       
  1108     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1109     OpenPhoneL();
       
  1110 
       
  1111     TRequestStatus mockLtsyStatus;
       
  1112     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1113 
       
  1114     //-------------------------------------------------------------------------
       
  1115     // Test cancelling of RMobilePhone::GetCustomerServiceProfile
       
  1116     //-------------------------------------------------------------------------
       
  1117     
       
  1118     iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile);
       
  1119     
       
  1120     TRequestStatus reqStatus;
       
  1121     RMobilePhone::TMobilePhoneCspFileV1 csp;
       
  1122     RMobilePhone::TMobilePhoneCspFileV1Pckg cspPckg(csp);
       
  1123     
       
  1124     iPhone.GetCustomerServiceProfile(reqStatus, cspPckg);
       
  1125     
       
  1126     iPhone.CancelAsyncRequest(EMobilePhoneGetCustomerServiceProfile);
       
  1127     
       
  1128     User::WaitForRequest(reqStatus);
       
  1129     ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
  1130 
       
  1131     // Wait for completion of iMockLTSY.NotifyTerminated
       
  1132     User::WaitForRequest(mockLtsyStatus);
       
  1133     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1134 
       
  1135     AssertMockLtsyStatusL();
       
  1136     CleanupStack::PopAndDestroy(this); // this
       
  1137     }
       
  1138 
       
  1139 /**
       
  1140 @SYMTestCaseID BA-CTSY-SUBI-MGCSP-0002b
       
  1141 @SYMComponent  telephony_ctsy
       
  1142 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::GetCustomerServiceProfile combined with a request
       
  1143 @SYMTestPriority High
       
  1144 @SYMTestActions Invokes multiple client requests to RMobilePhone::GetCustomerServiceProfile, cancels the first request
       
  1145 @SYMTestExpectedResults Pass
       
  1146 @SYMTestType CT
       
  1147 */
       
  1148 void CCTsySubscriberInfoFU::TestGetCustomerServiceProfile0002bL()
       
  1149     {
       
  1150     OpenEtelServerL(EUseExtendedError);
       
  1151     CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1152     OpenPhoneL();
       
  1153 
       
  1154     // Open second client
       
  1155     RTelServer telServer2;
       
  1156     TInt ret = telServer2.Connect();
       
  1157     ASSERT_EQUALS(KErrNone, ret);
       
  1158     CleanupClosePushL(telServer2);
       
  1159     
       
  1160     RMobilePhone phone2;
       
  1161     ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
  1162     ASSERT_EQUALS(KErrNone, ret);
       
  1163     CleanupClosePushL(phone2);
       
  1164 
       
  1165     TRequestStatus mockLtsyStatus;
       
  1166     iMockLTSY.NotifyTerminated(mockLtsyStatus);
       
  1167 
       
  1168     //---------------------------------------------------------------------------------
       
  1169     // Test cancelling of RMobilePhone::GetCustomerServiceProfile with multiple clients
       
  1170     //---------------------------------------------------------------------------------
       
  1171     
       
  1172     // expect and complete the second request
       
  1173     iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile);
       
  1174     
       
  1175     RMobilePhone::TMobilePhoneCspFileV1 completeCsp;
       
  1176     FillInCspFile(completeCsp);
       
  1177     TPckg<RMobilePhone::TMobilePhoneCspFileV1> completeLtsyData(completeCsp);
       
  1178     iMockLTSY.CompleteL(EMobilePhoneGetCustomerServiceProfile, KErrNone, completeLtsyData, 10);
       
  1179 
       
  1180     TRequestStatus reqStatus;
       
  1181     RMobilePhone::TMobilePhoneCspFileV1 csp;
       
  1182     RMobilePhone::TMobilePhoneCspFileV1Pckg cspPckg(csp);
       
  1183     
       
  1184     iPhone.GetCustomerServiceProfile(reqStatus, cspPckg);
       
  1185  
       
  1186     TRequestStatus reqStatus2;
       
  1187     RMobilePhone::TMobilePhoneCspFileV1 csp2;
       
  1188     RMobilePhone::TMobilePhoneCspFileV1Pckg cspPckg2(csp2);
       
  1189     
       
  1190     phone2.GetCustomerServiceProfile(reqStatus2, cspPckg2);
       
  1191     
       
  1192     // Cancel the first request
       
  1193     iPhone.CancelAsyncRequest(EMobilePhoneGetCustomerServiceProfile);
       
  1194     
       
  1195     User::WaitForRequest(reqStatus2);
       
  1196     ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  1197     ASSERT_TRUE(TComparator<RMobilePhone::TMobilePhoneCspFileV1>::IsEqual(completeCsp, csp2));
       
  1198     
       
  1199     User::WaitForRequest(reqStatus);
       
  1200     ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
  1201 
       
  1202     // Wait for completion of iMockLTSY.NotifyTerminated
       
  1203     User::WaitForRequest(mockLtsyStatus);
       
  1204     ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
  1205     
       
  1206     AssertMockLtsyStatusL();
       
  1207     CleanupStack::PopAndDestroy(3, this); // telserver2 phone2, this
       
  1208     }
       
  1209 
       
  1210 /**
       
  1211 @SYMTestCaseID BA-CTSY-SUBI-MGCSP-0003
       
  1212 @SYMComponent  telephony_ctsy
       
  1213 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetCustomerServiceProfile with bad parameter data
       
  1214 @SYMTestPriority High
       
  1215 @SYMTestActions Invokes RMobilePhone::GetCustomerServiceProfile with bad parameter data
       
  1216 @SYMTestExpectedResults Pass
       
  1217 @SYMTestType CT
       
  1218 */
       
  1219 void CCTsySubscriberInfoFU::TestGetCustomerServiceProfile0003L()
       
  1220 	{
       
  1221 
       
  1222 	OpenEtelServerL(EUseExtendedError);
       
  1223 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1224 	OpenPhoneL();
       
  1225 
       
  1226 	//-------------------------------------------------------------------------
       
  1227 	// Test B: Test passing wrong descriptor size to parameter in
       
  1228 	// RMobilePhone::GetCustomerServiceProfile
       
  1229  	//-------------------------------------------------------------------------
       
  1230 
       
  1231 	TRequestStatus reqStatus;
       
  1232 	TBuf8<1> smallBuf(KNullDesC8);
       
  1233 	iPhone.GetCustomerServiceProfile(reqStatus, smallBuf);
       
  1234 	User::WaitForRequest(reqStatus);
       
  1235 	ASSERT_EQUALS(KErrArgument, reqStatus.Int());
       
  1236 	AssertMockLtsyStatusL();
       
  1237 
       
  1238 	CleanupStack::PopAndDestroy(this);
       
  1239 
       
  1240 	}
       
  1241 
       
  1242 
       
  1243 /**
       
  1244 @SYMTestCaseID BA-CTSY-SUBI-MGCSP-0004
       
  1245 @SYMComponent  telephony_ctsy
       
  1246 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::GetCustomerServiceProfile
       
  1247 @SYMTestPriority High
       
  1248 @SYMTestActions Invokes multiple client requests to RMobilePhone::GetCustomerServiceProfile
       
  1249 @SYMTestExpectedResults Pass
       
  1250 @SYMTestType CT
       
  1251 */
       
  1252 void CCTsySubscriberInfoFU::TestGetCustomerServiceProfile0004L()
       
  1253 	{
       
  1254 
       
  1255 	OpenEtelServerL(EUseExtendedError);
       
  1256 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1257 	OpenPhoneL();
       
  1258 
       
  1259 	// Open second client
       
  1260 	RTelServer telServer2;
       
  1261 	TInt ret = telServer2.Connect();
       
  1262 	ASSERT_EQUALS(KErrNone, ret);
       
  1263 	CleanupClosePushL(telServer2);
       
  1264 
       
  1265 	RMobilePhone phone2;
       
  1266 	ret = phone2.Open(telServer2 ,KMmTsyPhoneName);
       
  1267 	ASSERT_EQUALS(KErrNone, ret);
       
  1268 	CleanupClosePushL(phone2);
       
  1269 
       
  1270 	//-------------------------------------------------------------------------
       
  1271 	// Test A: Test multiple clients requesting RMobilePhone::GetCustomerServiceProfile
       
  1272  	//-------------------------------------------------------------------------
       
  1273 
       
  1274 	iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile);
       
  1275 	
       
  1276 	RMobilePhone::TMobilePhoneCspFileV1 completeCsp;
       
  1277 	FillInCspFile(completeCsp);
       
  1278 	TPckg<RMobilePhone::TMobilePhoneCspFileV1> completeLtsyData(completeCsp);
       
  1279 	iMockLTSY.CompleteL(EMobilePhoneGetCustomerServiceProfile, KErrNone, completeLtsyData);
       
  1280 
       
  1281 	TRequestStatus reqStatus;
       
  1282 	RMobilePhone::TMobilePhoneCspFileV1 csp;
       
  1283 	RMobilePhone::TMobilePhoneCspFileV1Pckg cspPckg(csp);
       
  1284 	iPhone.GetCustomerServiceProfile(reqStatus, cspPckg);
       
  1285 	
       
  1286 	TRequestStatus reqStatus2;
       
  1287 	RMobilePhone::TMobilePhoneCspFileV1 csp2;
       
  1288 	RMobilePhone::TMobilePhoneCspFileV1Pckg cspPckg2(csp2);
       
  1289 	phone2.GetCustomerServiceProfile(reqStatus2, cspPckg2);
       
  1290 	
       
  1291 	User::WaitForRequest(reqStatus);
       
  1292 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1293 	ASSERT_TRUE(TComparator<RMobilePhone::TMobilePhoneCspFileV1>::IsEqual(completeCsp, csp));
       
  1294 
       
  1295 	User::WaitForRequest(reqStatus2);
       
  1296 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  1297 	ASSERT_TRUE(TComparator<RMobilePhone::TMobilePhoneCspFileV1>::IsEqual(completeCsp, csp2));
       
  1298 
       
  1299 	AssertMockLtsyStatusL();
       
  1300 
       
  1301 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
  1302 
       
  1303 	}
       
  1304 
       
  1305 
       
  1306 /**
       
  1307 @SYMTestCaseID BA-CTSY-SUBI-MGCSP-0005
       
  1308 @SYMComponent  telephony_ctsy
       
  1309 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetCustomerServiceProfile with timeout
       
  1310 @SYMTestPriority High
       
  1311 @SYMTestActions Invokes RMobilePhone::GetCustomerServiceProfile and tests for timeout
       
  1312 @SYMTestExpectedResults Pass
       
  1313 @SYMTestType CT
       
  1314 */
       
  1315 void CCTsySubscriberInfoFU::TestGetCustomerServiceProfile0005L()
       
  1316 	{
       
  1317 
       
  1318 	OpenEtelServerL(EUseExtendedError);
       
  1319 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1320 	OpenPhoneL();
       
  1321 
       
  1322 	//-------------------------------------------------------------------------
       
  1323 	// Test A: Test timeout of RMobilePhone::GetCustomerServiceProfile
       
  1324  	//-------------------------------------------------------------------------
       
  1325 
       
  1326 	iMockLTSY.ExpectL(EMobilePhoneGetCustomerServiceProfile);
       
  1327 	
       
  1328 	TRequestStatus reqStatus;
       
  1329 	RMobilePhone::TMobilePhoneCspFileV1 csp;
       
  1330 	RMobilePhone::TMobilePhoneCspFileV1Pckg cspPckg(csp);
       
  1331 	iPhone.GetCustomerServiceProfile(reqStatus, cspPckg);
       
  1332 	
       
  1333 	User::WaitForRequest(reqStatus);
       
  1334 	ASSERT_EQUALS(KErrTimedOut, reqStatus.Int());
       
  1335 	AssertMockLtsyStatusL();
       
  1336 
       
  1337 	CleanupStack::PopAndDestroy(this);
       
  1338 
       
  1339 	}
       
  1340 
       
  1341 
       
  1342 /**
       
  1343 @SYMTestCaseID BA-CTSY-SUBI-MNISS-0001
       
  1344 @SYMComponent  telephony_ctsy
       
  1345 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyIccAccessCapsChange
       
  1346 @SYMTestPriority High
       
  1347 @SYMTestActions Invokes RMobilePhone::NotifyIccAccessCapsChange
       
  1348 @SYMTestExpectedResults Pass
       
  1349 @SYMTestType CT
       
  1350 */
       
  1351 void CCTsySubscriberInfoFU::TestNotifyIccAccessCapsChange0001L()
       
  1352 	{
       
  1353 
       
  1354 	OpenEtelServerL(EUseExtendedError);
       
  1355 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1356 	OpenPhoneL();
       
  1357 
       
  1358  	//-------------------------------------------------------------------------
       
  1359 	// TEST C: Successful completion of RMobilePhone::NotifyIccAccessCapsChange request
       
  1360  	//-------------------------------------------------------------------------
       
  1361 	
       
  1362 	TRequestStatus reqStatus;
       
  1363 	TUint32 caps(0);
       
  1364 	iPhone.NotifyIccAccessCapsChange(reqStatus, caps);
       
  1365 	
       
  1366 	// change ICC to SIM (2G)
       
  1367 	ChangeUsedSimCardTypeL(EICCTypeSim2GGsm);
       
  1368 
       
  1369     iMockLTSY.CompleteL(EMobilePhoneNotifyIccAccessCapsChange, KErrNone);	
       
  1370 
       
  1371 	User::WaitForRequest(reqStatus);
       
  1372 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1373 	ASSERT_EQUALS(static_cast<TUint32>(RMobilePhone::KCapsSimAccessSupported), caps);
       
  1374 	AssertMockLtsyStatusL();
       
  1375 
       
  1376 	// test for UICC icc type
       
  1377 	iPhone.NotifyIccAccessCapsChange(reqStatus, caps);
       
  1378 	
       
  1379 	// change ICC to USIM (3G)
       
  1380 	ChangeUsedSimCardTypeL(EICCTypeSim3G);
       
  1381 
       
  1382 	iMockLTSY.CompleteL(EMobilePhoneNotifyIccAccessCapsChange, KErrNone);	
       
  1383 
       
  1384 	User::WaitForRequest(reqStatus);
       
  1385 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1386 	ASSERT_EQUALS(static_cast<TUint32>(RMobilePhone::KCapsUSimAccessSupported), caps);
       
  1387 	AssertMockLtsyStatusL();
       
  1388 
       
  1389 	// test for unknown icc type
       
  1390 	iPhone.NotifyIccAccessCapsChange(reqStatus, caps);
       
  1391 	
       
  1392 	// change ICC to Unknown
       
  1393 	ChangeUsedSimCardTypeL(EICCTypeSimUnknown);
       
  1394 
       
  1395     iMockLTSY.CompleteL(EMobilePhoneNotifyIccAccessCapsChange, KErrNone);	
       
  1396 
       
  1397 	User::WaitForRequest(reqStatus);
       
  1398 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
  1399 	ASSERT_EQUALS(static_cast<TUint32>(0), caps);
       
  1400 	AssertMockLtsyStatusL();
       
  1401 
       
  1402 	CleanupStack::PopAndDestroy(this);
       
  1403 	
       
  1404 	}
       
  1405 
       
  1406 
       
  1407 /**
       
  1408 @SYMTestCaseID BA-CTSY-SUBI-MNISS-0002
       
  1409 @SYMComponent  telephony_ctsy
       
  1410 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifyIccAccessCapsChange
       
  1411 @SYMTestPriority High
       
  1412 @SYMTestActions Invokes cancelling of RMobilePhone::NotifyIccAccessCapsChange
       
  1413 @SYMTestExpectedResults Pass
       
  1414 @SYMTestType CT
       
  1415 */
       
  1416 void CCTsySubscriberInfoFU::TestNotifyIccAccessCapsChange0002L()
       
  1417 	{
       
  1418 
       
  1419 	OpenEtelServerL(EUseExtendedError);
       
  1420 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1421 	OpenPhoneL();
       
  1422 
       
  1423  	//-------------------------------------------------------------------------
       
  1424 	// Test cancelling of RMobilePhone::NotifyIccAccessCapsChange
       
  1425  	//-------------------------------------------------------------------------
       
  1426  	
       
  1427 	TRequestStatus reqStatus;
       
  1428 	TUint32 caps(0);
       
  1429 	iPhone.NotifyIccAccessCapsChange(reqStatus, caps);
       
  1430 	
       
  1431 	iPhone.CancelAsyncRequest(EMobilePhoneNotifyIccAccessCapsChange);
       
  1432 
       
  1433 	User::WaitForRequest(reqStatus);
       
  1434 	ASSERT_EQUALS(KErrCancel, reqStatus.Int());
       
  1435 	AssertMockLtsyStatusL();
       
  1436 
       
  1437 	// change ICC to SIM (2G)
       
  1438 	ChangeUsedSimCardTypeL(EICCTypeSim2GGsm);
       
  1439 
       
  1440 	AssertMockLtsyStatusL();
       
  1441 	CleanupStack::PopAndDestroy(this);
       
  1442 	
       
  1443 	}
       
  1444 
       
  1445 
       
  1446 /**
       
  1447 @SYMTestCaseID BA-CTSY-SUBI-MNISS-0004
       
  1448 @SYMComponent  telephony_ctsy
       
  1449 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifyIccAccessCapsChange
       
  1450 @SYMTestPriority High
       
  1451 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifyIccAccessCapsChange
       
  1452 @SYMTestExpectedResults Pass
       
  1453 @SYMTestType CT
       
  1454 */
       
  1455 void CCTsySubscriberInfoFU::TestNotifyIccAccessCapsChange0004L()
       
  1456 	{
       
  1457 
       
  1458 	OpenEtelServerL(EUseExtendedError);
       
  1459 	CleanupStack::PushL(TCleanupItem(Cleanup, this));
       
  1460 	OpenPhoneL();
       
  1461 
       
  1462 	// Open second client
       
  1463 	RTelServer telServer2;
       
  1464 	TInt ret = telServer2.Connect();
       
  1465 	ASSERT_EQUALS(KErrNone, ret);
       
  1466 	CleanupClosePushL(telServer2);
       
  1467 
       
  1468 	RMobilePhone phone2;
       
  1469 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
  1470 	ASSERT_EQUALS(KErrNone, ret);
       
  1471 	CleanupClosePushL(phone2);
       
  1472 
       
  1473 	//-------------------------------------------------------------------------
       
  1474 	// Test A: Test multiple clients requesting RMobilePhone::NotifyIccAccessCapsChange
       
  1475  	//-------------------------------------------------------------------------
       
  1476 
       
  1477 	TRequestStatus reqStatus;
       
  1478 	TUint32 caps(0);
       
  1479 	iPhone.NotifyIccAccessCapsChange(reqStatus, caps);
       
  1480 	
       
  1481 	TRequestStatus reqStatus2;
       
  1482 	TUint32 caps2(0);
       
  1483 	phone2.NotifyIccAccessCapsChange(reqStatus2, caps2);
       
  1484 	
       
  1485 	// change ICC to SIM (2G)
       
  1486 	ChangeUsedSimCardTypeL(EICCTypeSim2GGsm);
       
  1487 
       
  1488     iMockLTSY.CompleteL(EMobilePhoneNotifyIccAccessCapsChange, KErrNone);	
       
  1489 
       
  1490 	User::WaitForRequest(reqStatus);
       
  1491 	ASSERT_EQUALS(KErrNone, reqStatus.Int());
       
  1492 	ASSERT_EQUALS(static_cast<TUint32>(RMobilePhone::KCapsSimAccessSupported), caps);
       
  1493 
       
  1494 	User::WaitForRequest(reqStatus2);
       
  1495 	ASSERT_EQUALS(KErrNone, reqStatus2.Int());
       
  1496 	ASSERT_EQUALS(static_cast<TUint32>(RMobilePhone::KCapsSimAccessSupported), caps2);
       
  1497 	AssertMockLtsyStatusL();
       
  1498 
       
  1499 	CleanupStack::PopAndDestroy(3, this); // phone2, telServer2, this
       
  1500 
       
  1501 	}
       
  1502 
       
  1503 
       
  1504 /**
       
  1505 @SYMTestCaseID BA-CTSY-SUBI-MGII-0001
       
  1506 @SYMComponent  telephony_ctsy
       
  1507 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetIccIdentity
       
  1508 @SYMTestPriority High
       
  1509 @SYMTestActions Invokes RMobilePhone::GetIccIdentity
       
  1510 @SYMTestExpectedResults Pass
       
  1511 @SYMTestType CT
       
  1512 */
       
  1513 void CCTsySubscriberInfoFU::TestGetIccIdentity0001L()
       
  1514 	{
       
  1515 
       
  1516 	OpenEtelServerL(EUseExtendedError);
       
  1517 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
  1518 	OpenPhoneL();
       
  1519 
       
  1520 	TRequestStatus reqStatus;
       
  1521 	RMobilePhone::TIccIdentity identity;
       
  1522 	iPhone.GetIccIdentity(reqStatus, identity);
       
  1523 	User::WaitForRequest(reqStatus);
       
  1524 	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
       
  1525 
       
  1526 	AssertMockLtsyStatusL();
       
  1527 	CleanupStack::PopAndDestroy(this);
       
  1528 	
       
  1529 	}
       
  1530