telephonyserverplugins/simatktsy/tests/src/ccsatgetinkeyfu.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file  The TEFUnit test suite for GetInkey in the SAT.
       
    20 */
       
    21 
       
    22 #include <cstktsy/bertlv_defs.h>
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <satcs.h>
       
    26 #include <ctsy/ltsy/sat_defs.h>
       
    27 
       
    28 
       
    29 #include <ctsy/ltsy/mltsydispatchsatinterface.h>
       
    30 #include <test/mockltsyindicatorids.h>
       
    31 #include <test/tmockltsydata.h>
       
    32 
       
    33 #include "ccsatgetinkeyfu.h"
       
    34 
       
    35 static const TUint8 KCommandNumber = 1;
       
    36 static const TUint8 KCommandType   = KGetInkey;
       
    37 static const TUint8 KSourceDevice = KSim;
       
    38 static const TUint8 KDestinationDevice = KMe;
       
    39 
       
    40 static const TInt KDelay = 10;
       
    41 
       
    42 _LIT8(KEnterPlus, "Enter \"+\"");
       
    43 _LIT8(KPlus, "+");
       
    44 _LIT8(KNOCAUSE, "\x00");
       
    45 
       
    46 CCSatGetInkeyFU::TData::TIcon::TIcon() 
       
    47 	{ 
       
    48 	Clear();
       
    49 	}
       
    50 
       
    51 void CCSatGetInkeyFU::TData::TIcon::Clear()
       
    52 	{
       
    53 	iIfUse = EFalse; 
       
    54 	iQualifier = 0;
       
    55 	iIdentifier = 0;
       
    56 	}
       
    57 
       
    58 CTestSuite* CCSatGetInkeyFU::CreateSuiteL(const TDesC& aName)
       
    59 	{
       
    60 	SUB_SUITE;
       
    61 
       
    62 	ADD_TEST_STEP_ISO_CPP(CCSatGetInkeyFU, TestNotifyGetInkeyPCmd0001L);
       
    63 	ADD_TEST_STEP_ISO_CPP(CCSatGetInkeyFU, TestNotifyGetInkeyPCmd0002L);
       
    64 	ADD_TEST_STEP_ISO_CPP(CCSatGetInkeyFU, TestNotifyGetInkeyPCmd0004L);
       
    65 	
       
    66 	ADD_TEST_STEP_ISO_CPP(CCSatGetInkeyFU, TestNotifyGetInkeyPCmd0001bL);
       
    67 
       
    68 	END_SUITE;
       
    69 	}
       
    70 
       
    71 void CCSatGetInkeyFU::PrepareTlvData ( TTlv& aTlvData )
       
    72 	{	
       
    73 	aTlvData.Begin(KBerTlvProactiveSimCommandTag);
       
    74 	
       
    75 	aTlvData.AddTag(KTlvCommandDetailsTag);         // Command details
       
    76 	aTlvData.AddByte(KCommandNumber);                // Command number     
       
    77 	aTlvData.AddByte(KCommandType);                  // Command type     
       
    78 	aTlvData.AddByte(iData.iCommandQualifier);      // Command qualifier  
       
    79 	
       
    80 	aTlvData.AddTag(KTlvDeviceIdentityTag);         // Device identities          
       
    81 	aTlvData.AddByte(KSourceDevice);          // Source device     
       
    82 	aTlvData.AddByte(KDestinationDevice);     // Destination device     
       
    83 
       
    84 	if (iData.iText.Length() > 0 )
       
    85 		{
       
    86 		aTlvData.AddTag(KTlvTextStringTag);
       
    87 		aTlvData.AddByte(iData.iCodingScheme); 
       
    88 		aTlvData.AddData(iData.iText); 
       
    89 		}
       
    90 
       
    91 	if ( iData.iIcon.iIfUse )
       
    92 		{
       
    93 		aTlvData.AddTag(KTlvIconIdentifierTag);
       
    94 		aTlvData.AddByte(iData.iIcon.iQualifier);
       
    95 		aTlvData.AddByte(iData.iIcon.iIdentifier);
       
    96 		}
       
    97 	}
       
    98 
       
    99 void CCSatGetInkeyFU::PrepareExpectDataL ()
       
   100 	{
       
   101 	RBuf8 data;
       
   102 	CleanupClosePushL(data);	
       
   103 	
       
   104 	TUint8 commandType = KGetInkey;
       
   105 	TMockLtsyData1<TUint8> expLtsyData(commandType);
       
   106 	expLtsyData.SerialiseL(data);
       
   107 	iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId, data);
       
   108 
       
   109 	CleanupStack::PopAndDestroy(1); // data
       
   110 	}
       
   111 
       
   112 void CCSatGetInkeyFU::PrepareCompleteDataL ( TInt aResultCode )
       
   113 	{
       
   114 	RBuf8 data;
       
   115 	CleanupClosePushL(data);	
       
   116 	
       
   117 	TTlv tlv;
       
   118 	PrepareTlvData( tlv );
       
   119 	
       
   120 	TPtrC8 tlvDsc = tlv.End();
       
   121 	TDesC8* tlvDscPtr = &tlvDsc;
       
   122 	TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr);
       
   123 	tlvDscPack.SerialiseL(data);
       
   124 	iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, aResultCode, data, KDelay);
       
   125 
       
   126 	CleanupStack::PopAndDestroy(1); // data
       
   127 	}
       
   128 
       
   129 void CCSatGetInkeyFU::ProactiveCommandCallL( RSat::TGetInkeyV2& aGetInkeyData,
       
   130 		                                     TInt aCompleteErrorCode,
       
   131 		                                     TInt aResultCode )
       
   132 	{
       
   133 	TRequestStatus requestStatus;
       
   134 	
       
   135 	PrepareExpectDataL ();
       
   136 	
       
   137 	TPckg< RSat::TGetInkeyV2 > setpPck(aGetInkeyData);
       
   138 	iSat.NotifyGetInkeyPCmd(requestStatus, setpPck);
       
   139 		
       
   140 	PrepareCompleteDataL ( aCompleteErrorCode );
       
   141 	
       
   142 	User::WaitForRequest(requestStatus);
       
   143 	ASSERT_EQUALS(aResultCode, requestStatus.Int());
       
   144 	}
       
   145 
       
   146 void CCSatGetInkeyFU::TerminalResponseCallL(
       
   147 		const RSat& aSat,
       
   148 		RSat::TPCmdResult aGeneralResult,
       
   149 		TUint aInfoType,
       
   150 		const TDesC8& aText,
       
   151 		TUint8 aCodingScheme,
       
   152 		TInt aCodeError,
       
   153 		RSat::TGetInkeyRspFormat aRspFormat)
       
   154 	{
       
   155 	RSat::TGetInkeyRspV2 getInkeyRspV2;
       
   156 	RSat::TGetInkeyRspV2Pckg getInkeyRspV2Pckg(getInkeyRspV2);
       
   157 	TTlv getInpRspTlv;
       
   158 	TRequestStatus requestStatus;
       
   159 
       
   160 	getInkeyRspV2.iGeneralResult = aGeneralResult;
       
   161 	getInkeyRspV2.iRspFormat = aRspFormat;
       
   162 	getInkeyRspV2.SetPCmdNumber(KCommandNumber);
       
   163 	getInkeyRspV2.iInfoType = aInfoType;
       
   164 
       
   165 	TInt length = aText.Length();
       
   166 	if (length > 0)
       
   167 		{
       
   168 		for (TInt i = 0; i < length; i+=2)
       
   169 			{
       
   170 			TUint16 element = aText[i];
       
   171 			if ( (i+1) < length )
       
   172 				{
       
   173 				element = ( element<<8 ) | aText[i+1];
       
   174 				}
       
   175 			getInkeyRspV2.iAdditionalInfo.Append( element );
       
   176 			}
       
   177 
       
   178 		getInpRspTlv.AddTag(KTlvTextStringTag);
       
   179 		getInpRspTlv.AddByte(aCodingScheme);
       
   180 		getInpRspTlv.AddData(aText);
       
   181 		}
       
   182 
       
   183 	PrepareTerminalResponseMockDataL(
       
   184 			KCommandNumber,
       
   185 			KCommandType,
       
   186 			iData.iCommandQualifier,
       
   187 			KNullDesC16,
       
   188 			getInkeyRspV2.iGeneralResult,
       
   189 			getInpRspTlv.GetDataWithoutTopLevelTag());
       
   190 
       
   191 	aSat.TerminalRsp(requestStatus, RSat::EGetInkey, getInkeyRspV2Pckg);
       
   192 	User::WaitForRequest(requestStatus);
       
   193 	ASSERT_EQUALS(aCodeError, requestStatus.Int());
       
   194 	}
       
   195 
       
   196 void CCSatGetInkeyFU::DataInitialization(
       
   197 		const TData::TIcon& aIcon,
       
   198 		const TDesC8& aText,
       
   199 		TUint8 aCommandQualifier,
       
   200 		TUint8 aCodingScheme)
       
   201 	{
       
   202 	iData.iCommandQualifier = aCommandQualifier;
       
   203 	iData.iCodingScheme  = aCodingScheme;
       
   204 	iData.iText.Copy(aText);
       
   205 	iData.iIcon = aIcon;
       
   206 	}
       
   207 
       
   208 void CCSatGetInkeyFU::DataCompareL( const RSat::TGetInkeyV2& aGetInkeyData )
       
   209 {
       
   210 	RSat::TGetInkeyRspFormat rspFormat;
       
   211 	switch( iData.iCommandQualifier )
       
   212 		{
       
   213 		case 0x0:
       
   214 			rspFormat = RSat::EDigitOnly;
       
   215 			break;
       
   216 		case 0x01:
       
   217 			rspFormat = RSat::ECharSmsDefaultAlphabet;
       
   218 			break;
       
   219 		case 0x03:
       
   220 			rspFormat = RSat::ECharUcs2Alphabet;
       
   221 			break;
       
   222 		case 0x04:
       
   223 			rspFormat = RSat::EYesNo;
       
   224 			break;
       
   225 		default:
       
   226 			rspFormat = RSat::EGetInkeyRspFormatNotSet;
       
   227 		}
       
   228 
       
   229 	RSat::TIconQualifier iconQualifier;
       
   230 	if ( !iData.iIcon.iIfUse )
       
   231 		{
       
   232         iconQualifier = RSat::ENoIconId;
       
   233 		}
       
   234 	else
       
   235 		{
       
   236 	    if ( iData.iIcon.iQualifier )
       
   237 	        {
       
   238 	        iconQualifier = RSat::ENotSelfExplanatory;
       
   239 	        }
       
   240 	    else
       
   241 	        {
       
   242 	        iconQualifier = RSat::ESelfExplanatory;
       
   243 	        }
       
   244 		}
       
   245 
       
   246 	ASSERT_EQUALS( rspFormat, aGetInkeyData.iRspFormat );
       
   247 	
       
   248 	ASSERT_EQUALS( iconQualifier,  aGetInkeyData.iIconId.iQualifier  );
       
   249 	ASSERT_EQUALS( iData.iIcon.iIdentifier, aGetInkeyData.iIconId.iIdentifier );
       
   250 
       
   251 	RSat::TGetInkeyText text;
       
   252 	if ( iData.iCodingScheme == K8BitDCS )
       
   253 		{
       
   254 		text.Copy( iData.iText );
       
   255 		}
       
   256 	else if ( iData.iCodingScheme == KUCS2DCS )
       
   257 		{
       
   258 		TSatUtility::Copy8to16LE( iData.iText, text );
       
   259 		}
       
   260 	else if ( iData.iCodingScheme == K7BitDefaultSmsDCS )
       
   261 		{
       
   262 		TBuf8<RSat::KGetInkeyTextMaxSize> string;
       
   263 		TSatUtility::Packed7to8Unpacked( iData.iText, string );
       
   264 
       
   265 		TInt maxLength = text.MaxLength();
       
   266 		if ( maxLength < string.Length() )
       
   267 			{
       
   268 			string.SetLength( maxLength );
       
   269 			}
       
   270 		// Convert to unicode format
       
   271 		TSatUtility::Convert7BitToUnicode16( string, text );
       
   272 		}
       
   273 
       
   274 	ASSERT_EQUALS( 0, text.Compare( aGetInkeyData.iText ) );
       
   275 
       
   276 }
       
   277 
       
   278 //
       
   279 // Actual test cases
       
   280 //
       
   281 
       
   282 
       
   283 /**
       
   284 @SYMTestCaseID BA-CSAT-GUI-NGIPC-0001
       
   285 @SYMPREQ 1780
       
   286 @SYMComponent  telephony_csat
       
   287 @SYMTestCaseDesc Test support in CSAT for RSat::NotifyGetInkeyPCmd
       
   288 @SYMTestPriority High
       
   289 @SYMTestActions Invokes RSat::NotifyGetInkeyPCmd
       
   290 @SYMTestExpectedResults Pass
       
   291 @SYMTestType CT
       
   292 */
       
   293 void CCSatGetInkeyFU::TestNotifyGetInkeyPCmd0001L()
       
   294 	{
       
   295 
       
   296 	static const RSat::TPCmdResult KArrayGR[] = { 
       
   297 			RSat::KErrorRequiredValuesMissing,
       
   298 			RSat::KHelpRequestedByUser
       
   299 			};
       
   300 
       
   301 	static const TUint KArrayInfoType[] = { 
       
   302 			RSat::KMeProblem,
       
   303 			RSat::KTextString 
       
   304 			};
       
   305 
       
   306 	OpenEtelServerL(EUseExtendedError);
       
   307 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   308 	OpenPhoneL();
       
   309 	OpenSatL();
       
   310 
       
   311 	TRequestStatus requestStatus;
       
   312 
       
   313 	RSat::TGetInkeyV2 getInkeyData;
       
   314 	TData::TIcon icon;
       
   315 
       
   316 	DataInitialization(icon);
       
   317 
       
   318  	//-------------------------------------------------------------------------
       
   319 	// TEST C: Successful completion request of
       
   320 	// RSat::NotifyGetInkeyPCmd 
       
   321  	//-------------------------------------------------------------------------
       
   322 
       
   323 	// test C - implemented in 0001b function
       
   324 
       
   325  	//-------------------------------------------------------------------------
       
   326 	// TEST E: Coverage test(s) for RSat::NotifyGetInkeyPCmd
       
   327  	//-------------------------------------------------------------------------
       
   328 
       
   329 	iMockLTSY.NotifyTerminated(requestStatus);
       
   330 	
       
   331 	PrepareCompleteDataL ();
       
   332 
       
   333 	RSat::TAdditionalInfo additionalInfo;
       
   334 	additionalInfo.Append(KNoCause);
       
   335 
       
   336 	PrepareTerminalResponseMockDataL(
       
   337 			KCommandNumber,
       
   338 			KCommandType,
       
   339 			iData.iCommandQualifier,
       
   340 			additionalInfo,
       
   341 			RSat::KMeUnableToProcessCmd,
       
   342 			KNullDesC8);
       
   343 
       
   344 	User::WaitForRequest(requestStatus);
       
   345 	ASSERT_EQUALS(KErrNone, requestStatus.Int());
       
   346 	AssertMockLtsyStatusL();
       
   347 
       
   348 	//-------------------------------------------------------------------------
       
   349 	// to increase CSatNotifyGetInkey::CompleteNotifyL coverage 
       
   350 	// in case of "if ( KHelpAvailabilityMask & cmdQualifier )"
       
   351 	// in CSatNotifyGetInkey::CompleteNotifyL()
       
   352  	//-------------------------------------------------------------------------
       
   353 
       
   354 	DataInitialization(
       
   355 			icon,
       
   356 			KEnterPlus,
       
   357 			KHelpAvailabilityMask);
       
   358 
       
   359 	ProactiveCommandCallL(getInkeyData);
       
   360 	AssertMockLtsyStatusL();
       
   361 
       
   362 	//-------------------------------------------------------------------------
       
   363 	// to increase CSatNotifyGetInkey::CompleteNotifyL coverage 
       
   364 	// in case of "if ( KImmediateDigitResponse & cmdQualifier )"
       
   365 	// in CSatNotifyGetInkey::CompleteNotifyL()
       
   366  	//-------------------------------------------------------------------------
       
   367 
       
   368 	DataInitialization(
       
   369 			icon,
       
   370 			KEnterPlus,
       
   371 			KImmediateDigitResponse);
       
   372 
       
   373 	ProactiveCommandCallL(getInkeyData);
       
   374 	AssertMockLtsyStatusL();
       
   375 
       
   376 	//-------------------------------------------------------------------------
       
   377 	// to increase CSatNotifyGetInkey::CompleteNotifyL coverage 
       
   378 	// in case of "if ( KImmediateDigitResponse & cmdQualifier )"
       
   379 	// in CSatNotifyGetInkey::CreateTerminalRespL()
       
   380  	//-------------------------------------------------------------------------
       
   381 
       
   382 	TInt size = sizeof(KArrayGR)/sizeof(KArrayGR[0]);
       
   383 
       
   384 	for ( TInt i = 0; i < size; i++ )
       
   385 		{
       
   386 		DataInitialization(
       
   387 				icon,
       
   388 				KEnterPlus);
       
   389 
       
   390 		ProactiveCommandCallL(getInkeyData);
       
   391 		TerminalResponseCallL(iSat, KArrayGR[i]);
       
   392 		AssertMockLtsyStatusL();
       
   393 		}
       
   394 
       
   395 	//-------------------------------------------------------------------------
       
   396 	// to increase CSatNotifyGetInkey::CompleteNotifyL coverage 
       
   397 	// in case of "if ( KErrNone == returnValue )"
       
   398  	//-------------------------------------------------------------------------
       
   399 
       
   400 	RSat::TGetInkeyRspV2 getInkeyRspV2;
       
   401 	RSat::TGetInkeyRspV2Pckg getInkeyRspV2Pckg(getInkeyRspV2);
       
   402 
       
   403 	getInkeyRspV2.iGeneralResult = RSat::KErrorRequiredValuesMissing;
       
   404 	getInkeyRspV2.iRspFormat = RSat::EGetInkeyRspFormatNotSet;
       
   405 	getInkeyRspV2.SetPCmdNumber(KCommandNumber);
       
   406 	getInkeyRspV2.iInfoType = RSat::KNoAdditionalInfo;
       
   407 	getInkeyRspV2.iAdditionalInfo.Copy( KNOCAUSE );
       
   408 
       
   409 	DataInitialization(
       
   410 			icon,
       
   411 			KNullDesC8);
       
   412 
       
   413 	PrepareExpectDataL ();
       
   414 	TPckg< RSat::TGetInkeyV2 > setpPck(getInkeyData);
       
   415 	iSat.NotifyGetInkeyPCmd(requestStatus, setpPck);
       
   416 		
       
   417 	PrepareCompleteDataL ( KErrNone );
       
   418 
       
   419 	PrepareTerminalResponseMockDataL(
       
   420 			KCommandNumber,
       
   421 			KCommandType,
       
   422 			iData.iCommandQualifier,
       
   423 			KNullDesC16,
       
   424 			getInkeyRspV2.iGeneralResult,
       
   425 			KNullDesC8);
       
   426 
       
   427 	User::WaitForRequest(requestStatus);
       
   428 	ASSERT_EQUALS(KErrCorrupt, requestStatus.Int());
       
   429 	AssertMockLtsyStatusL();
       
   430 
       
   431 	//-------------------------------------------------------------------------
       
   432 	// to increase CSatNotifyGetInkey::TerminalResponseL coverage for 
       
   433 	// RSat::TGetInkeyRspV2::iInfotype
       
   434  	//-------------------------------------------------------------------------
       
   435 
       
   436 	RSat::TPCmdResult generalResult = RSat::KSuccess;
       
   437 	TUint infoType = RSat::KSatNetworkErrorInfo; // bad infoType
       
   438 
       
   439 	TerminalResponseCallL(
       
   440 			iSat,
       
   441 			generalResult, 
       
   442 			infoType, 
       
   443 			KNOCAUSE(),
       
   444 			K8BitDCS,
       
   445 			KErrCorrupt);
       
   446 	AssertMockLtsyStatusL();
       
   447 
       
   448 	//-------------------------------------------------------------------------
       
   449 	// to increase CSatNotifyGetInkey::TerminalResponseL coverage for 
       
   450 	// RSat::TGetInkeyRspV2::IRspFormat
       
   451  	//-------------------------------------------------------------------------
       
   452 
       
   453 	RSat::TGetInkeyRspFormat rspFormat = RSat::EGetInkeyRspFormatNotSet;
       
   454 	infoType = RSat::KNoAdditionalInfo;
       
   455 
       
   456 	TerminalResponseCallL(
       
   457 			iSat,
       
   458 			generalResult, 
       
   459 			infoType, 
       
   460 			KNOCAUSE(),
       
   461 			K8BitDCS,
       
   462 			KErrCorrupt,
       
   463 			rspFormat);
       
   464 	AssertMockLtsyStatusL();
       
   465 
       
   466 	//-------------------------------------------------------------------------
       
   467 	// to increase CSatNotifyGetInkey::TerminalResponseL coverage for 
       
   468 	// Rsat::TGetInkeyRspV2::iAdditionalInfo
       
   469  	//-------------------------------------------------------------------------
       
   470 
       
   471 	getInkeyRspV2.iAdditionalInfo.Zero();
       
   472 	size = sizeof(KArrayInfoType)/sizeof(KArrayInfoType[0]);
       
   473 	for ( TInt i = 0; i < size; i++ )
       
   474 		{
       
   475 		TTlv tlv;
       
   476 		tlv.AddTag(KTlvTextStringTag);
       
   477 		tlv.AddByte(K8BitDCS);
       
   478 		tlv.AddData(KNOCAUSE());
       
   479 
       
   480 		getInkeyRspV2.iGeneralResult = RSat::KPartialComprehension;
       
   481 		getInkeyRspV2.iRspFormat = RSat::EDigitOnly;
       
   482 		getInkeyRspV2.SetPCmdNumber(KCommandNumber);
       
   483 		getInkeyRspV2.iInfoType = KArrayInfoType[i];
       
   484 
       
   485 		PrepareTerminalResponseMockDataL(
       
   486 				KCommandNumber,
       
   487 				KCommandType,
       
   488 				iData.iCommandQualifier,
       
   489 				KNullDesC16,
       
   490 				getInkeyRspV2.iGeneralResult,
       
   491 				tlv.GetDataWithoutTopLevelTag());
       
   492 
       
   493 		iSat.TerminalRsp(requestStatus, RSat::EGetInkey, getInkeyRspV2Pckg);
       
   494 		User::WaitForRequest(requestStatus);
       
   495 		ASSERT_EQUALS(KErrCorrupt, requestStatus.Int());
       
   496 		AssertMockLtsyStatusL();
       
   497 		}
       
   498 
       
   499 	//-------------------------------------------------------------------------
       
   500 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   501  	//-------------------------------------------------------------------------
       
   502 
       
   503 	ProactiveCommandCallL( getInkeyData, KErrUnknown, KErrUnknown);
       
   504 
       
   505 	AssertMockLtsyStatusL();
       
   506 	CleanupStack::PopAndDestroy(1); // this
       
   507 
       
   508 	}
       
   509 
       
   510 
       
   511 /**
       
   512 @SYMTestCaseID BA-CSAT-GUI-NGIPC-0002
       
   513 @SYMPREQ 1780
       
   514 @SYMComponent  telephony_csat
       
   515 @SYMTestCaseDesc Test support in CSAT for cancelling of RSat::NotifyGetInkeyPCmd
       
   516 @SYMTestPriority High
       
   517 @SYMTestActions Invokes cancelling of RSat::NotifyGetInkeyPCmd
       
   518 @SYMTestExpectedResults Pass
       
   519 @SYMTestType CT
       
   520 */
       
   521 void CCSatGetInkeyFU::TestNotifyGetInkeyPCmd0002L()
       
   522 	{
       
   523 
       
   524 	OpenEtelServerL(EUseExtendedError);
       
   525 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   526 	OpenPhoneL();
       
   527 	OpenSatL();
       
   528 
       
   529 	TRequestStatus requestStatus;
       
   530 
       
   531 	RSat::TGetInkeyV2 getInkey;
       
   532 	RSat::TGetInkeyV2Pckg getInkeyPck(getInkey);
       
   533 
       
   534  	//-------------------------------------------------------------------------
       
   535 	// Test cancelling of RSat::NotifyGetInkeyPCmd
       
   536  	//-------------------------------------------------------------------------
       
   537 
       
   538 	PrepareExpectDataL();
       
   539 
       
   540 	iSat.NotifyGetInkeyPCmd(requestStatus, getInkeyPck);
       
   541 
       
   542 	iSat.CancelAsyncRequest(ESatNotifyGetInkeyPCmd);
       
   543 
       
   544 	User::WaitForRequest(requestStatus);
       
   545 	ASSERT_EQUALS(KErrCancel, requestStatus.Int());
       
   546 	AssertMockLtsyStatusL();
       
   547 
       
   548 	CleanupStack::PopAndDestroy(1); // this
       
   549 
       
   550 	}
       
   551 
       
   552 /**
       
   553 @SYMTestCaseID BA-CSAT-GUI-NGIPC-0004
       
   554 @SYMPREQ 1780
       
   555 @SYMComponent  telephony_csat
       
   556 @SYMTestCaseDesc Test support in CSAT for multiple client requests to RSat::NotifyGetInkeyPCmd
       
   557 @SYMTestPriority High
       
   558 @SYMTestActions Invokes multiple client requests to RSat::NotifyGetInkeyPCmd
       
   559 @SYMTestExpectedResults Pass
       
   560 @SYMTestType CT
       
   561 */
       
   562 void CCSatGetInkeyFU::TestNotifyGetInkeyPCmd0004L()
       
   563 	{
       
   564 
       
   565 	OpenEtelServerL(EUseExtendedError);
       
   566 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   567 	OpenPhoneL();
       
   568 	OpenSatL();
       
   569 
       
   570 	// Open second client
       
   571 	RTelServer telServer2;
       
   572 	TInt ret = telServer2.Connect();
       
   573 	ASSERT_EQUALS(KErrNone, ret);
       
   574 	CleanupClosePushL(telServer2);
       
   575 
       
   576 	RMobilePhone phone2;
       
   577 	ret = phone2.Open(telServer2, KMmTsyPhoneName);
       
   578 	ASSERT_EQUALS(KErrNone, ret);
       
   579 	CleanupClosePushL(phone2);
       
   580 	
       
   581 	RSat sat2;
       
   582 	ret = sat2.Open(iPhone);
       
   583 	ASSERT_EQUALS(KErrNone, ret);
       
   584 	CleanupClosePushL(sat2);
       
   585 
       
   586 	TRequestStatus requestStatus1;
       
   587 	TRequestStatus requestStatus2;
       
   588 
       
   589 	TData::TIcon icon;
       
   590 	DataInitialization(
       
   591 			icon,
       
   592 			KEnterPlus);
       
   593 	
       
   594 	//-------------------------------------------------------------------------
       
   595 	// Test A: Test multiple clients requesting RSat::NotifyGetInkeyPCmd
       
   596 	// when they both pass the same T-class version
       
   597  	//-------------------------------------------------------------------------
       
   598 
       
   599 	PrepareExpectDataL();
       
   600 	
       
   601 	RSat::TGetInkeyV2 getInkey1;
       
   602 	RSat::TGetInkeyV2Pckg getInkey1Pck1(getInkey1);
       
   603 	iSat.NotifyGetInkeyPCmd(requestStatus1, getInkey1Pck1);
       
   604 
       
   605 	RSat::TGetInkeyV2 getInkey2;
       
   606 	RSat::TGetInkeyV2Pckg getInkey1Pck2(getInkey2);
       
   607 	sat2.NotifyGetInkeyPCmd(requestStatus2, getInkey1Pck2);
       
   608 
       
   609 	PrepareCompleteDataL();
       
   610 
       
   611 	User::WaitForRequest(requestStatus1);
       
   612 	User::WaitForRequest(requestStatus2);
       
   613 
       
   614 	ASSERT_EQUALS(KErrNone, requestStatus1.Int());
       
   615 	//probably «KErrServerBusy?is more appropriate result here
       
   616 	ASSERT_EQUALS(KErrNone, requestStatus2.Int());
       
   617 
       
   618 	RSat::TPCmdResult generalResult = RSat::KSuccess;
       
   619 	TUint infoType = RSat::KTextString;
       
   620 
       
   621 	TerminalResponseCallL(
       
   622 			iSat,
       
   623 			generalResult, 
       
   624 			infoType, 
       
   625 			KNOCAUSE() );
       
   626 
       
   627 	TerminalResponseCallL(
       
   628 			sat2,
       
   629 			generalResult, 
       
   630 			infoType, 
       
   631 			KNOCAUSE() );
       
   632 
       
   633 	DataCompareL( getInkey1 );
       
   634 	DataCompareL( getInkey2 );
       
   635 
       
   636 	AssertMockLtsyStatusL();
       
   637 	CleanupStack::PopAndDestroy(4, this); // sat2, phone2, telServer2, this
       
   638 
       
   639 	}
       
   640 
       
   641 /*
       
   642 @SYMTestCaseID BA-CSAT-GUI-NGIPC-0001b
       
   643 @SYMPREQ 1780
       
   644 @SYMComponent  telephony_csat
       
   645 @SYMTestCaseDesc Test support in CSAT for RSat::NotifyGetInkeyPCmd ( Expected Sequence 1 See ETSI TS 102 384 ) 
       
   646 @SYMTestPriority High
       
   647 @SYMTestActions Invokes RSat::NotifyGetInkeyPCmd
       
   648 @SYMTestExpectedResults Pass
       
   649 @SYMTestType CT
       
   650 */
       
   651 void CCSatGetInkeyFU::TestNotifyGetInkeyPCmd0001bL()
       
   652 	{
       
   653 	// "Enter "0"" string in K7BitDefaultSmsDCS coding scheme
       
   654 	_LIT8( KStringPC1, "\x45\x37\xBD\x2C\x07\x89\x60\x22" );
       
   655 	// string in KUCS2DCS coding scheme 
       
   656 	_LIT8( KStringPC2, "\x04\x17\x04\x14\x04\x20\x04\x10\x04\x12\x04\x21\x04\x22\x04\x12\x04\x23\x04\x19\
       
   657 x04\x22\x04\x15" );
       
   658 	// string in KUCS2DCS coding scheme 
       
   659 	_LIT8( KStringTR1, "\x04\x14" ); // char in KUCS2DCS coding scheme
       
   660 	_LIT8( KGOBACKWARDS, "<GO-BACKWARDS>" );
       
   661 	_LIT8( KABORT, "<ABORT>" );
       
   662 	_LIT8( KEnterq, "Enter \"q\"" );
       
   663 	_LIT8( KLongString1, "Enter \"x\". This command instructs the ME to display text, and to \
       
   664 expect the user to enter a single character. Any response entered by the user shall be passed t" );
       
   665 	_LIT8( KTIMEOUT, "<TIME-OUT>" );
       
   666 	_LIT8( KEnter, "Enter" );
       
   667 	_LIT8( KEnterYES, "Enter YES" );
       
   668 	_LIT8( KEnterNO, "Enter NO" );
       
   669 	_LIT8( KNOICON, "<NO-ICON>" );
       
   670 	_LIT8( KBASICICON, "<BASIC-ICON>" );
       
   671 	_LIT8( KCOLOURICON, "<COLOUR-ICON>" );
       
   672 	_LIT8( KNULL, "0" );
       
   673 	_LIT8( Kq, "q" );
       
   674 	_LIT8( Kx, "x" );
       
   675 	_LIT8( KHexNULL, "\x00" );
       
   676 	_LIT8( KHexOne, "\x01" );
       
   677 	_LIT8( KLargeString, "\x04\x17\x04\x14\x04\x20\x04\x10\x04\x12\x04\x21\x04\x22\x04\x12\x04\x23\x04\x19\
       
   678 x04\x22\x04\x15\x04\x17\x04\x14\x04\x20\x04\x10\x04\x12\x04\x21\x04\x22\x04\x12\x04\x23\x04\x19\
       
   679 x04\x22\x04\x15\x04\x17\x04\x14\x04\x20\x04\x10\x04\x12\x04\x21\x04\x22\x04\x12\x04\x23\x04\x19\
       
   680 x04\x22\x04\x15\x04\x17\x04\x14\x04\x20\x04\x10\x04\x12\x04\x21\x04\x22\x04\x12\x04\x23\x04\x19\
       
   681 x04\x22\x04\x15\x04\x17\x04\x14\x04\x20\x04\x10\x04\x12\x04\x21\x04\x22\x04\x12\x04\x23\x04\x19" );
       
   682 
       
   683 	const TPtrC8 KTextPCArray[] =
       
   684 	{
       
   685 		KEnterPlus(),
       
   686 		KStringPC1(),
       
   687 		KGOBACKWARDS(),
       
   688 		KABORT(),
       
   689 		KEnterq(),
       
   690 		KLongString1(),
       
   691 		KTIMEOUT(),
       
   692 		KStringPC2(),
       
   693 		KLargeString(),
       
   694 		KEnter(),
       
   695 		KEnterYES(),
       
   696 		KEnterNO(),
       
   697 		KNOICON(),
       
   698 		KBASICICON(),
       
   699 		KNOICON(),
       
   700 		KCOLOURICON(),
       
   701 		KEnterPlus()
       
   702 	};
       
   703 	
       
   704 	const TPtrC8 KTextTRArray[] =
       
   705 	{
       
   706 		KPlus(),
       
   707 		KNULL(),
       
   708 		KNullDesC8(),
       
   709 		KNullDesC8(),
       
   710 		Kq(),
       
   711 		Kx(),
       
   712 		KNullDesC8(),
       
   713 		KPlus(),
       
   714 		KPlus(),
       
   715 		KStringTR1(),
       
   716 		KHexOne(),
       
   717 		KHexNULL(),
       
   718 		KPlus(),
       
   719 		KPlus(),
       
   720 		KPlus(),
       
   721 		KPlus(),
       
   722 		KNullDesC8()
       
   723 	};
       
   724 
       
   725 	const TUint8 KSizeArray = sizeof(KTextPCArray)/sizeof(KTextPCArray[0]);
       
   726 
       
   727 	OpenEtelServerL(EUseExtendedError);
       
   728 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   729 	OpenPhoneL();
       
   730 	OpenSatL();
       
   731 
       
   732 	//
       
   733 	// See ETSI TS 102 384 V6.5.0 (2007-02) in subclause 27.22.4.2.1 
       
   734 	// Expected Sequence 1.1 - 7.1
       
   735 	//
       
   736 
       
   737 	for (TUint8 i = 0; i < KSizeArray; i++)
       
   738 		{
       
   739 		TUint8 commandQualifier = 0; // digits (0-9, *, # and +) only, no help information available
       
   740 		TUint8 codingSchemePC = K8BitDCS;
       
   741 		TUint8 codingSchemeTR = K8BitDCS;
       
   742 		RSat::TPCmdResult generalResult = RSat::KSuccess;
       
   743 		TUint infoType = RSat::KTextString;
       
   744 		TData::TIcon icon;
       
   745 		TBool iconNotDisplayed = EFalse;
       
   746 
       
   747 		switch( i )
       
   748 			{
       
   749 			case 1:
       
   750 				{
       
   751 				// in case of Expected Sequence 1.2
       
   752 				codingSchemePC = K7BitDefaultSmsDCS;
       
   753 				break;
       
   754 				}
       
   755 			case 2:
       
   756 				{
       
   757 				// in case of Expected Sequence 1.3
       
   758 				generalResult = RSat::KBackwardModeRequestedByUser;
       
   759 				infoType = RSat::KNoAdditionalInfo;
       
   760 				break;
       
   761 				}
       
   762 			case 3:
       
   763 				{
       
   764 				// in case of Expected Sequence 1.4
       
   765 				generalResult = RSat::KPSessionTerminatedByUser;
       
   766 				infoType = RSat::KNoAdditionalInfo;
       
   767 				break;
       
   768 				}
       
   769 			case 4:
       
   770 				{
       
   771 				// in case of Expected Sequence 1.5
       
   772 				commandQualifier = 0x01; // SMS default alphabet, no help information available
       
   773 				break;
       
   774 				}
       
   775 			case 5:
       
   776 				{
       
   777 				// in case of Expected Sequence 1.6
       
   778 				commandQualifier = 0x01; // SMS default alphabet, no help information available
       
   779 				break;
       
   780 				}
       
   781 			case 6:
       
   782 				{
       
   783 				// in case of Expected Sequence 2.1
       
   784 				infoType = RSat::KNoAdditionalInfo;
       
   785 				generalResult = RSat::KNoResponseFromUser;
       
   786 				break;
       
   787 				}
       
   788 			case 7:
       
   789 				{
       
   790 				// in case of Expected Sequence 3.1
       
   791 				codingSchemePC = KUCS2DCS;
       
   792 				break;
       
   793 				}
       
   794 			case 8:
       
   795 				{
       
   796 				// in case of Expected Sequence 3.2
       
   797 				codingSchemePC = KUCS2DCS;
       
   798 				break;
       
   799 				}
       
   800 			case 9:
       
   801 				{
       
   802 				// in case of Expected Sequence 4.1
       
   803 				codingSchemeTR = KUCS2DCS;
       
   804 				commandQualifier = 0x03; // characters from UCS2 alphabet, no help information available
       
   805 				break;
       
   806 				}
       
   807 			case 10:
       
   808 				{
       
   809 				// in case of Expected Sequence 5.1
       
   810 				commandQualifier = 0x04; // "Yes/No" Response, no help information available
       
   811 				break;
       
   812 				}
       
   813 			case 11:
       
   814 				{
       
   815 				// in case of Expected Sequence 5.2
       
   816 				commandQualifier = 0x04; // "Yes/No" Response, no help information available
       
   817 				break;
       
   818 				}
       
   819 			case 12:
       
   820 				{
       
   821 				// in case of Expected Sequence 6.1A, 6.1B
       
   822 				icon.iIfUse = ETrue;
       
   823 				icon.iIdentifier = 0;
       
   824 				icon.iQualifier  = 0x01;
       
   825 				iconNotDisplayed = ETrue;
       
   826 				break;
       
   827 				}
       
   828 			case 13:
       
   829 				{
       
   830 				// in case of Expected Sequence 6.2A, 6.2B
       
   831 				icon.iIfUse = ETrue;
       
   832 				icon.iIdentifier = 0x01;
       
   833 				icon.iQualifier  = 0x01;
       
   834 				iconNotDisplayed = ETrue;
       
   835 				break;
       
   836 				}
       
   837 			case 14:
       
   838 				{
       
   839 				// in case of Expected Sequence 6.3A, 6.3B
       
   840 				icon.iIfUse = ETrue;
       
   841 				icon.iIdentifier = 0x00;
       
   842 				icon.iQualifier  = 0x02;
       
   843 				iconNotDisplayed = ETrue;
       
   844 				break;
       
   845 				}
       
   846 			case 15:
       
   847 				{
       
   848 				// in case of Expected Sequence 6.4A, 6.4B
       
   849 				icon.iIfUse = ETrue;
       
   850 				icon.iIdentifier = 0x01;
       
   851 				icon.iQualifier  = 0x02;
       
   852 				iconNotDisplayed = ETrue;
       
   853 				break;
       
   854 				}
       
   855 			case 16:
       
   856 				{
       
   857 				// in case of Expected Sequence 7.1
       
   858 				generalResult = RSat::KHelpRequestedByUser;
       
   859 				infoType = RSat::KNoAdditionalInfo;
       
   860 				break;
       
   861 				}
       
   862 			default:
       
   863 				// in case of Expected Sequence 1.1
       
   864 				break;
       
   865 			}
       
   866 
       
   867 		TInt iteration_number = 1;
       
   868 		if ( iconNotDisplayed )
       
   869 			{
       
   870 			iteration_number = 2;
       
   871 			}
       
   872 
       
   873 		for (TInt j = 0; j < iteration_number; j++)
       
   874 			{
       
   875 			RSat::TGetInkeyV2 getInkeyData;
       
   876 
       
   877 			DataInitialization(
       
   878 					icon,
       
   879 					KTextPCArray[i],
       
   880 					commandQualifier,
       
   881 					codingSchemePC);
       
   882 			ProactiveCommandCallL(getInkeyData);
       
   883 
       
   884 			TerminalResponseCallL(
       
   885 					iSat,
       
   886 					generalResult, 
       
   887 					infoType, 
       
   888 					KTextTRArray[i], 
       
   889 					codingSchemeTR);
       
   890 			AssertMockLtsyStatusL();
       
   891 		
       
   892 			DataCompareL( getInkeyData );
       
   893 
       
   894 			if ( iconNotDisplayed )
       
   895 				{
       
   896 				generalResult = RSat::KSuccessRequestedIconNotDisplayed;
       
   897 				}
       
   898 			}
       
   899 		}
       
   900 
       
   901 	CleanupStack::PopAndDestroy(this); // this
       
   902 	}
       
   903