|
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 SendDTMF in the SAT. |
|
20 */ |
|
21 |
|
22 #include "ccsatsenddtmffu.h" |
|
23 #include <etel.h> |
|
24 #include <etelmm.h> |
|
25 #include <satcs.h> |
|
26 #include <test/tmockltsydata.h> |
|
27 |
|
28 // define used constants |
|
29 const TUint8 KPCmdNumber = 1; |
|
30 const TUint8 KSendDtmfQualifierNormal = 0x00; |
|
31 const TUint8 KIcon = 1; // record 1 in EFIMG |
|
32 |
|
33 _LIT8(KDtmf,"\xC1\xF2"); |
|
34 _LIT8(KSendDtmfAlpha, "Send DTMF"); |
|
35 _LIT8(KBasicIconAlpha, "Basic Icon"); |
|
36 |
|
37 // declare utility function |
|
38 LOCAL_C void ResetSendDtmfData(RSat::TSendDtmfV1&); |
|
39 |
|
40 CTestSuite* CCSatSendDTMFFU::CreateSuiteL(const TDesC& aName) |
|
41 { |
|
42 SUB_SUITE; |
|
43 |
|
44 ADD_TEST_STEP_ISO_CPP(CCSatSendDTMFFU, TestNotifySendDtmfPCmd0001L); |
|
45 ADD_TEST_STEP_ISO_CPP(CCSatSendDTMFFU, TestNotifySendDtmfPCmd0001bL); |
|
46 ADD_TEST_STEP_ISO_CPP(CCSatSendDTMFFU, TestNotifySendDtmfPCmd0002L); |
|
47 ADD_TEST_STEP_ISO_CPP(CCSatSendDTMFFU, TestNotifySendDtmfPCmd0004L); |
|
48 |
|
49 END_SUITE; |
|
50 } |
|
51 |
|
52 |
|
53 // |
|
54 // Actual test cases |
|
55 // |
|
56 |
|
57 |
|
58 /** |
|
59 @SYMTestCaseID BA-CSAT-SD-SNSDTPC-0001 |
|
60 @SYMPREQ 1780 |
|
61 @SYMComponent telephony_csat |
|
62 @SYMTestCaseDesc Test support in CSAT for RSat::NotifySendDtmfPCmd |
|
63 @SYMTestPriority High |
|
64 @SYMTestActions Invokes RSat::NotifySendDtmfPCmd |
|
65 @SYMTestExpectedResults Pass |
|
66 @SYMTestType CT |
|
67 */ |
|
68 void CCSatSendDTMFFU::TestNotifySendDtmfPCmd0001L() |
|
69 { |
|
70 |
|
71 OpenEtelServerL(EUseExtendedError); |
|
72 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
73 OpenPhoneL(); |
|
74 OpenSatL(); |
|
75 |
|
76 //------------------------------------------------------------------------- |
|
77 // TEST C: Successful completion request of |
|
78 // RSat::NotifySendDtmfPCmd |
|
79 //------------------------------------------------------------------------- |
|
80 // Expected Sequence 1.1(ETSI TS 131 124), SEND DTMF, normal |
|
81 //------------------------------------------------------------------------- |
|
82 |
|
83 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
84 |
|
85 RSat::TSendDtmfRspV1 resp; |
|
86 resp.SetPCmdNumber(KPCmdNumber); |
|
87 resp.iGeneralResult = RSat::KSuccess; |
|
88 resp.iInfoType = RSat::KNoAdditionalInfo; |
|
89 |
|
90 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
91 |
|
92 //------------------------------------------------------------------------- |
|
93 // TEST E: Unsolicited completion of RSat::NotifySendDtmfPCmd |
|
94 // from LTSY. |
|
95 //------------------------------------------------------------------------- |
|
96 |
|
97 PrepareSendDtmfCompleteDataL( |
|
98 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
99 |
|
100 RSat::TAdditionalInfo addInfo; |
|
101 addInfo.Append(RSat::KNoSpecificMeProblem); |
|
102 PrepareTerminalResponseMockDataL( |
|
103 KPCmdNumber, KSendDtmf, KSendDtmfQualifierNormal, |
|
104 addInfo, RSat::KMeUnableToProcessCmd); |
|
105 |
|
106 WaitForMockLTSYTerminated(); |
|
107 AssertMockLtsyStatusL(); |
|
108 |
|
109 //------------------------------------------------------------------------- |
|
110 // TEST F: Coverage test(s) for RSat::NotifySendDtmfPCmd |
|
111 //------------------------------------------------------------------------- |
|
112 // Expected Sequence 1.2(ETSI TS 131 124), |
|
113 // SEND DTMF, containing alpha identifier |
|
114 //------------------------------------------------------------------------- |
|
115 |
|
116 _LIT8(KDtmf12, "\x21\x43\x65\x87\x09"); // "1234567890" |
|
117 TestNotifySendDtmfPCmdL( |
|
118 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf12, &KSendDtmfAlpha); |
|
119 |
|
120 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
121 |
|
122 //------------------------------------------------------------------------- |
|
123 // Expected Sequence 1.3(ETSI TS 131 124), |
|
124 // SEND DTMF, containing alpha identifier with null data object |
|
125 //------------------------------------------------------------------------- |
|
126 |
|
127 // "1" pause pause pause pause pause pause pause pause pause pause "2" |
|
128 _LIT8(KDtmf13, "\xC1\xCC\xCC\xCC\xCC\x2C"); |
|
129 TestNotifySendDtmfPCmdL( |
|
130 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf13, &KNullDesC8); |
|
131 |
|
132 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
133 |
|
134 //------------------------------------------------------------------------- |
|
135 // Expected Sequence 2.1A(ETSI TS 131 124), |
|
136 // SEND DTMF, BASIC ICON self explanatory, successful |
|
137 //------------------------------------------------------------------------- |
|
138 |
|
139 RSat::TIconQualifier iconQual = RSat::ESelfExplanatory; |
|
140 TestNotifySendDtmfPCmdL( |
|
141 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, &KBasicIconAlpha, |
|
142 iconQual); |
|
143 |
|
144 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
145 |
|
146 //------------------------------------------------------------------------- |
|
147 // Expected Sequence 2.3A(ETSI TS 131 124), SEND DTMF, |
|
148 // Alpha identifier & BASIC-ICON, not self-explanatory, successful |
|
149 //------------------------------------------------------------------------- |
|
150 |
|
151 iconQual = RSat::ENotSelfExplanatory; |
|
152 TestNotifySendDtmfPCmdL( |
|
153 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, &KSendDtmfAlpha, |
|
154 iconQual); |
|
155 |
|
156 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
157 |
|
158 //------------------------------------------------------------------------- |
|
159 // Expected Sequence 3.1(ETSI TS 131 124), SEND DTMF, |
|
160 // successful, UCS2 text in Cyrillic |
|
161 //------------------------------------------------------------------------- |
|
162 |
|
163 //"Hello" in Russian, first byte "\x80" is 0x80 UCS2 coding type for Tlv data |
|
164 _LIT8(KRussianHello, "\x80\x04\x17\x04\x14\x04\x20\x04\x10\x04\x12\x04\x21\ |
|
165 \x04\x22\x04\x12\x04\x23\x04\x19\x04\x22\x04\x15"); |
|
166 //"Hello" in Russian in unicode for checking results |
|
167 _LIT16(KRussianHelloU, "\x0417\x0414\x0420\x0410\x0412\x0421\x0422\x0412\ |
|
168 \x0423\x0419\x0422\x0415"); |
|
169 |
|
170 TestNotifySendDtmfPCmdL( |
|
171 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, &KRussianHello, |
|
172 RSat::EIconQualifierNotSet, KErrNone, &KRussianHelloU); |
|
173 |
|
174 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
175 |
|
176 //------------------------------------------------------------------------- |
|
177 // Expected Sequence 5.1(ETSI TS 131 124), SEND DTMF, |
|
178 // successful, UCS2 text in Chinese |
|
179 //------------------------------------------------------------------------- |
|
180 |
|
181 //"Hello" in Chinese, first byte "\x80" is 0x80 UCS2 coding type for Tlv data |
|
182 _LIT8(KChineseHello, "\x80\x4F\x60\x59\x7D"); |
|
183 //"Hello" in Chinese in unicode for checking results |
|
184 _LIT16(KChineseHelloU, "\x4F60\x597D"); |
|
185 |
|
186 TestNotifySendDtmfPCmdL( |
|
187 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, &KChineseHello, |
|
188 RSat::EIconQualifierNotSet, KErrNone, &KChineseHelloU); |
|
189 |
|
190 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
191 |
|
192 //------------------------------------------------------------------------- |
|
193 // Expected Sequence 6.1(ETSI TS 131 124), SEND DTMF, |
|
194 // successful, UCS2 text in Katakana |
|
195 //------------------------------------------------------------------------- |
|
196 |
|
197 //Characters in Katakana, first byte "\x80" is 0x80 UCS2 coding type for Tlv data |
|
198 _LIT8(KKatakanaChars, "\x80\x30\xEB"); |
|
199 //Characters in Katakana in unicode for checking results |
|
200 _LIT16(KKatakanaCharsU, "\x30EB"); |
|
201 |
|
202 TestNotifySendDtmfPCmdL( |
|
203 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, &KKatakanaChars, |
|
204 RSat::EIconQualifierNotSet, KErrNone, &KKatakanaCharsU); |
|
205 |
|
206 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
207 |
|
208 //------------------------------------------------------------------------- |
|
209 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
210 //------------------------------------------------------------------------- |
|
211 |
|
212 TestNotifySendDtmfPCmdL( |
|
213 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, |
|
214 NULL, RSat::EIconQualifierNotSet, |
|
215 KErrUnknown); |
|
216 |
|
217 CleanupStack::PopAndDestroy(this); |
|
218 |
|
219 } |
|
220 |
|
221 |
|
222 /** |
|
223 @SYMTestCaseID BA-CSAT-SD-SNSDTPC-0001b |
|
224 @SYMPREQ 1780 |
|
225 @SYMComponent telephony_csat |
|
226 @SYMTestCaseDesc Test support in CSAT for RSat::NotifySendDtmfPCmd when problems in processing command |
|
227 @SYMTestPriority High |
|
228 @SYMTestActions Invokes RSat::NotifySendDtmfPCmd |
|
229 @SYMTestExpectedResults Pass |
|
230 @SYMTestType CT |
|
231 */ |
|
232 void CCSatSendDTMFFU::TestNotifySendDtmfPCmd0001bL() |
|
233 { |
|
234 |
|
235 OpenEtelServerL(EUseExtendedError); |
|
236 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
237 OpenPhoneL(); |
|
238 OpenSatL(); |
|
239 |
|
240 //------------------------------------------------------------------------- |
|
241 // Expected Sequence 1.4(ETSI TS 131 124), |
|
242 // SEND DTMF, mobile is not in a speech call |
|
243 //------------------------------------------------------------------------- |
|
244 |
|
245 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
246 |
|
247 RSat::TSendDtmfRspV1 resp; |
|
248 resp.SetPCmdNumber(KPCmdNumber); |
|
249 resp.iGeneralResult = RSat::KMeUnableToProcessCmd; |
|
250 resp.iInfoType = RSat::KMeProblem; |
|
251 resp.iAdditionalInfo.Append(RSat::KNotInSpeechCall); |
|
252 |
|
253 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
254 |
|
255 //------------------------------------------------------------------------- |
|
256 // Expected Sequence 2.1B(ETSI TS 131 124), SEND DTMF, |
|
257 // BASIC ICON self explanatory, requested icon could not be displayed |
|
258 //------------------------------------------------------------------------- |
|
259 |
|
260 RSat::TIconQualifier iconQual = RSat::ESelfExplanatory; |
|
261 TestNotifySendDtmfPCmdL( |
|
262 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, &KBasicIconAlpha, |
|
263 iconQual); |
|
264 |
|
265 resp.iGeneralResult = RSat::KSuccessRequestedIconNotDisplayed; |
|
266 resp.iInfoType = RSat::KNoAdditionalInfo; |
|
267 resp.iAdditionalInfo.Zero(); |
|
268 |
|
269 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
270 |
|
271 //------------------------------------------------------------------------- |
|
272 // Expected Sequence 2.3B(ETSI TS 131 124), SEND DTMF, |
|
273 // Alpha identifier & BASIC-ICON, not self-explanatory, |
|
274 // requested icon could not be displayed |
|
275 //------------------------------------------------------------------------- |
|
276 |
|
277 iconQual = RSat::ENotSelfExplanatory; |
|
278 TestNotifySendDtmfPCmdL( |
|
279 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, &KSendDtmfAlpha, |
|
280 iconQual); |
|
281 |
|
282 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
283 |
|
284 //------------------------------------------------------------------------- |
|
285 // SEND DTMF, DTMF string length is more then its max length |
|
286 //------------------------------------------------------------------------- |
|
287 |
|
288 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
289 |
|
290 // define very large dtmf |
|
291 // "1" pause pause "1" pause "1" pause "1" ... pause "1" pause "1" |
|
292 TBuf8< RSat::KDtmfStringMaxSize + 1 > veryLargeDtmf; |
|
293 veryLargeDtmf.SetMax(); |
|
294 veryLargeDtmf.Fill(0x1C); |
|
295 veryLargeDtmf[0] = 0xC1; |
|
296 |
|
297 // set device id to KDeviceIdNotSet to skip Device identities in Tlv data |
|
298 // and make possible insertion of very large Dtmf in Tlv data |
|
299 PrepareSendDtmfCompleteDataL( |
|
300 KPCmdNumber, KSendDtmfQualifierNormal, &veryLargeDtmf, |
|
301 NULL, RSat::EIconQualifierNotSet, KErrNone, KDefaultNoDelay, |
|
302 KDeviceIdNotSet); |
|
303 |
|
304 PrepareTerminalResponseMockDataL( |
|
305 KPCmdNumber, KSendDtmf, KSendDtmfQualifierNormal, |
|
306 KNullDesC, RSat::KCmdBeyondMeCapabilities); |
|
307 |
|
308 RSat::TSendDtmfV1 sendDtmfData; |
|
309 RSat::TSendDtmfV1Pckg sendDtmfDataPckg(sendDtmfData); |
|
310 TRequestStatus requestStatus; |
|
311 |
|
312 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
313 User::WaitForRequest(requestStatus); |
|
314 |
|
315 // check results |
|
316 ASSERT_EQUALS(KErrCorrupt, requestStatus.Int()); |
|
317 AssertMockLtsyStatusL(); |
|
318 |
|
319 //------------------------------------------------------------------------- |
|
320 // SEND DTMF, missing DTMF string |
|
321 //------------------------------------------------------------------------- |
|
322 |
|
323 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
324 |
|
325 PrepareSendDtmfCompleteDataL(KPCmdNumber, KSendDtmfQualifierNormal); |
|
326 |
|
327 PrepareTerminalResponseMockDataL( |
|
328 KPCmdNumber, KSendDtmf, KSendDtmfQualifierNormal, |
|
329 KNullDesC, RSat::KErrorRequiredValuesMissing); |
|
330 |
|
331 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
332 User::WaitForRequest(requestStatus); |
|
333 |
|
334 // check results |
|
335 ASSERT_EQUALS(KErrCorrupt, requestStatus.Int()); |
|
336 AssertMockLtsyStatusL(); |
|
337 |
|
338 //------------------------------------------------------------------------- |
|
339 // SEND DTMF, DTMF string is empty |
|
340 //------------------------------------------------------------------------- |
|
341 |
|
342 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
343 |
|
344 PrepareSendDtmfCompleteDataL( |
|
345 KPCmdNumber, KSendDtmfQualifierNormal, &KNullDesC8); |
|
346 |
|
347 PrepareTerminalResponseMockDataL( |
|
348 KPCmdNumber, KSendDtmf, KSendDtmfQualifierNormal, |
|
349 KNullDesC, RSat::KCmdDataNotUnderstood); |
|
350 |
|
351 ResetSendDtmfData(sendDtmfData); |
|
352 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
353 User::WaitForRequest(requestStatus); |
|
354 |
|
355 // check results |
|
356 ASSERT_EQUALS(KErrCorrupt, requestStatus.Int()); |
|
357 AssertMockLtsyStatusL(); |
|
358 |
|
359 //------------------------------------------------------------------------- |
|
360 // SEND DTMF, DTMF string is empty (first byte of the dtmf string is 0xFF) |
|
361 //------------------------------------------------------------------------- |
|
362 |
|
363 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
364 |
|
365 _LIT8(KEmptyDtmf,"\xFF"); |
|
366 PrepareSendDtmfCompleteDataL( |
|
367 KPCmdNumber, KSendDtmfQualifierNormal, &KEmptyDtmf); |
|
368 |
|
369 PrepareTerminalResponseMockDataL( |
|
370 KPCmdNumber, KSendDtmf, KSendDtmfQualifierNormal, |
|
371 KNullDesC, RSat::KCmdDataNotUnderstood); |
|
372 |
|
373 ResetSendDtmfData(sendDtmfData); |
|
374 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
375 User::WaitForRequest(requestStatus); |
|
376 |
|
377 // check results |
|
378 ASSERT_EQUALS(KErrCorrupt, requestStatus.Int()); |
|
379 AssertMockLtsyStatusL(); |
|
380 |
|
381 //------------------------------------------------------------------------- |
|
382 // SEND DTMF, command type not understood |
|
383 //------------------------------------------------------------------------- |
|
384 |
|
385 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
386 |
|
387 resp.iGeneralResult = RSat::KCmdTypeNotUnderstood; |
|
388 |
|
389 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
390 |
|
391 //------------------------------------------------------------------------- |
|
392 // SEND DTMF, command data not understood |
|
393 //------------------------------------------------------------------------- |
|
394 |
|
395 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
396 |
|
397 resp.iGeneralResult = RSat::KCmdDataNotUnderstood; |
|
398 |
|
399 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
400 |
|
401 //------------------------------------------------------------------------- |
|
402 // SEND DTMF, command number not known |
|
403 //------------------------------------------------------------------------- |
|
404 |
|
405 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
406 |
|
407 resp.iGeneralResult = RSat::KCmdNumberNotKnown; |
|
408 |
|
409 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
410 |
|
411 //------------------------------------------------------------------------- |
|
412 // SEND DTMF, command beyond me capabilities |
|
413 //------------------------------------------------------------------------- |
|
414 |
|
415 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
416 |
|
417 resp.iGeneralResult = RSat::KCmdBeyondMeCapabilities; |
|
418 |
|
419 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
420 |
|
421 //------------------------------------------------------------------------- |
|
422 // SEND DTMF, partial comprehension |
|
423 //------------------------------------------------------------------------- |
|
424 |
|
425 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
426 |
|
427 resp.iGeneralResult = RSat::KPartialComprehension; |
|
428 |
|
429 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
430 |
|
431 //------------------------------------------------------------------------- |
|
432 // SEND DTMF, missing information |
|
433 //------------------------------------------------------------------------- |
|
434 |
|
435 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
436 |
|
437 resp.iGeneralResult = RSat::KMissingInformation; |
|
438 |
|
439 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
440 |
|
441 //------------------------------------------------------------------------- |
|
442 // SEND DTMF, proactive session terminated by user |
|
443 //------------------------------------------------------------------------- |
|
444 |
|
445 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
446 |
|
447 resp.iGeneralResult = RSat::KPSessionTerminatedByUser; |
|
448 |
|
449 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
450 |
|
451 //------------------------------------------------------------------------- |
|
452 // SEND DTMF, required values missing |
|
453 //------------------------------------------------------------------------- |
|
454 |
|
455 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
456 |
|
457 resp.iGeneralResult = RSat::KErrorRequiredValuesMissing; |
|
458 |
|
459 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
460 |
|
461 //------------------------------------------------------------------------- |
|
462 // SEND DTMF, Me unable to process commandd, empty additional info |
|
463 //------------------------------------------------------------------------- |
|
464 |
|
465 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
466 |
|
467 resp.iGeneralResult = RSat::KMeUnableToProcessCmd; |
|
468 resp.iInfoType = RSat::KMeProblem; |
|
469 |
|
470 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal, KErrCorrupt ); |
|
471 |
|
472 //------------------------------------------------------------------------- |
|
473 // SEND DTMF, invalid error code |
|
474 //------------------------------------------------------------------------- |
|
475 |
|
476 TestNotifySendDtmfPCmdL(KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf); |
|
477 |
|
478 resp.iGeneralResult = RSat::KLaunchBrowserError; // invalid for this command |
|
479 |
|
480 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal, KErrCorrupt ); |
|
481 |
|
482 CleanupStack::PopAndDestroy(this); |
|
483 |
|
484 } |
|
485 |
|
486 |
|
487 /** |
|
488 @SYMTestCaseID BA-CSAT-SD-SNSDTPC-0002 |
|
489 @SYMPREQ 1780 |
|
490 @SYMComponent telephony_csat |
|
491 @SYMTestCaseDesc Test support in CSAT for cancelling of RSat::NotifySendDtmfPCmd |
|
492 @SYMTestPriority High |
|
493 @SYMTestActions Invokes cancelling of RSat::NotifySendDtmfPCmd |
|
494 @SYMTestExpectedResults Pass |
|
495 @SYMTestType CT |
|
496 */ |
|
497 void CCSatSendDTMFFU::TestNotifySendDtmfPCmd0002L() |
|
498 { |
|
499 |
|
500 OpenEtelServerL(EUseExtendedError); |
|
501 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
502 OpenPhoneL(); |
|
503 OpenSatL(); |
|
504 |
|
505 TRequestStatus mockLtsyStatus; |
|
506 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
507 |
|
508 //------------------------------------------------------------------------- |
|
509 // Test cancelling of RSat::NotifySendDtmfPCmd |
|
510 //------------------------------------------------------------------------- |
|
511 |
|
512 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
513 |
|
514 // delay for completion is used to cancel |
|
515 PrepareSendDtmfCompleteDataL( |
|
516 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, |
|
517 NULL, RSat::EIconQualifierNotSet, |
|
518 KErrNone, KDefaultDelay); |
|
519 |
|
520 RSat::TAdditionalInfo addInfo; |
|
521 addInfo.Append(RSat::KNoSpecificMeProblem); |
|
522 |
|
523 PrepareTerminalResponseMockDataL( |
|
524 KPCmdNumber, KSendDtmf, KSendDtmfQualifierNormal, |
|
525 addInfo, RSat::KMeUnableToProcessCmd); |
|
526 |
|
527 RSat::TSendDtmfV1 sendDtmfData; |
|
528 |
|
529 RSat::TSendDtmfV1Pckg sendDtmfDataPckg(sendDtmfData); |
|
530 TRequestStatus requestStatus; |
|
531 |
|
532 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
533 |
|
534 iSat.CancelAsyncRequest(ESatNotifySendDtmfPCmd); |
|
535 |
|
536 User::WaitForRequest(requestStatus); |
|
537 ASSERT_EQUALS(KErrCancel, requestStatus.Int()); |
|
538 |
|
539 // Wait for completion of iMockLTSY.NotifyTerminated |
|
540 User::WaitForRequest(mockLtsyStatus); |
|
541 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
542 |
|
543 AssertMockLtsyStatusL(); |
|
544 |
|
545 CleanupStack::PopAndDestroy(this); |
|
546 |
|
547 } |
|
548 |
|
549 |
|
550 /** |
|
551 @SYMTestCaseID BA-CSAT-SD-SNSDTPC-0004 |
|
552 @SYMPREQ 1780 |
|
553 @SYMComponent telephony_csat |
|
554 @SYMTestCaseDesc Test support in CSAT for multiple client requests to RSat::NotifySendDtmfPCmd |
|
555 @SYMTestPriority High |
|
556 @SYMTestActions Invokes multiple client requests to RSat::NotifySendDtmfPCmd |
|
557 @SYMTestExpectedResults Pass |
|
558 @SYMTestType CT |
|
559 */ |
|
560 void CCSatSendDTMFFU::TestNotifySendDtmfPCmd0004L() |
|
561 { |
|
562 |
|
563 OpenEtelServerL(EUseExtendedError); |
|
564 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
565 OpenPhoneL(); |
|
566 OpenSatL(); |
|
567 |
|
568 // Open second client |
|
569 RTelServer telServer2; |
|
570 TInt ret = telServer2.Connect(); |
|
571 ASSERT_EQUALS(KErrNone, ret); |
|
572 CleanupClosePushL(telServer2); |
|
573 |
|
574 RMobilePhone phone2; |
|
575 ret = phone2.Open(telServer2, KMmTsyPhoneName); |
|
576 ASSERT_EQUALS(KErrNone, ret); |
|
577 CleanupClosePushL(phone2); |
|
578 |
|
579 RSat sat2; |
|
580 ret = sat2.Open(phone2); |
|
581 ASSERT_EQUALS(KErrNone, ret); |
|
582 CleanupClosePushL(sat2); |
|
583 |
|
584 //------------------------------------------------------------------------- |
|
585 // Test A: Test multiple clients requesting RSat::NotifySendDtmfPCmd |
|
586 // when they both pass the same T-class version |
|
587 //------------------------------------------------------------------------- |
|
588 |
|
589 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
590 |
|
591 // delay for completion is used for make the 2nd request before |
|
592 // the completion arrives to CSATTSY |
|
593 PrepareSendDtmfCompleteDataL( |
|
594 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, |
|
595 NULL, RSat::EIconQualifierNotSet, |
|
596 KErrNone, KDefaultDelay); |
|
597 |
|
598 RSat::TSendDtmfV1 sendDtmfData; |
|
599 RSat::TSendDtmfV1 sendDtmfData2; |
|
600 RSat::TSendDtmfV1Pckg sendDtmfDataPckg(sendDtmfData); |
|
601 RSat::TSendDtmfV1Pckg sendDtmfData2Pckg(sendDtmfData2); |
|
602 TRequestStatus requestStatus; |
|
603 TRequestStatus requestStatus2; |
|
604 |
|
605 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
606 sat2.NotifySendDtmfPCmd(requestStatus2, sendDtmfData2Pckg); |
|
607 |
|
608 User::WaitForRequest(requestStatus); |
|
609 User::WaitForRequest(requestStatus2); |
|
610 |
|
611 // check results |
|
612 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
613 ASSERT_EQUALS( KPCmdNumber, sendDtmfData.PCmdNumber() ); |
|
614 ASSERT_EQUALS( 0, KDtmf().Compare(sendDtmfData.iDtmfString) ); |
|
615 ASSERT_TRUE( (RSat::EAlphaIdNotPresent == sendDtmfData.iAlphaId.iStatus) || |
|
616 (RSat::EAlphaIdNotSet == sendDtmfData.iAlphaId.iStatus) ); |
|
617 ASSERT_EQUALS( RSat::ENoIconId, sendDtmfData.iIconId.iQualifier ); |
|
618 |
|
619 ASSERT_EQUALS(KErrNone, requestStatus2.Int()); |
|
620 ASSERT_EQUALS( KPCmdNumber, sendDtmfData2.PCmdNumber() ); |
|
621 ASSERT_EQUALS( 0, KDtmf().Compare(sendDtmfData2.iDtmfString) ); |
|
622 ASSERT_TRUE( (RSat::EAlphaIdNotPresent == sendDtmfData2.iAlphaId.iStatus) || |
|
623 (RSat::EAlphaIdNotSet == sendDtmfData2.iAlphaId.iStatus) ); |
|
624 ASSERT_EQUALS( RSat::ENoIconId, sendDtmfData2.iIconId.iQualifier ); |
|
625 |
|
626 AssertMockLtsyStatusL(); |
|
627 |
|
628 RSat::TSendDtmfRspV1 resp; |
|
629 resp.SetPCmdNumber(KPCmdNumber); |
|
630 resp.iGeneralResult = RSat::KSuccess; |
|
631 resp.iInfoType = RSat::KNoAdditionalInfo; |
|
632 |
|
633 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
634 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
635 |
|
636 //------------------------------------------------------------------------- |
|
637 // Test B: Test multiple clients requesting RSat::NotifySendDtmfPCmd |
|
638 // when they both pass different T-class versions |
|
639 //------------------------------------------------------------------------- |
|
640 |
|
641 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
642 |
|
643 // delay for completion is used for make the 2nd request before |
|
644 // the completion arrives to CSATTSY |
|
645 PrepareSendDtmfCompleteDataL( |
|
646 KPCmdNumber, KSendDtmfQualifierNormal, &KDtmf, |
|
647 NULL, RSat::EIconQualifierNotSet, |
|
648 KErrNone, KDefaultDelay); |
|
649 |
|
650 ResetSendDtmfData(sendDtmfData); |
|
651 RSat::TSendDtmfV5 sendDtmfDataV5; |
|
652 RSat::TSendDtmfV5Pckg sendDtmfDataV5Pckg(sendDtmfDataV5); |
|
653 |
|
654 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
655 sat2.NotifySendDtmfPCmd(requestStatus2, sendDtmfDataV5Pckg); |
|
656 |
|
657 // When multiple clients requesting RSat::NotifySendDtmfPCmd and they both pass |
|
658 // different packaged parameter versions only the last request completes, because |
|
659 // etel reposts request with new parameter size and looses previous requests. |
|
660 // May be it would be worth to make ESatNotifySendDtmfPCmd ipc requests flow controlled |
|
661 // by CSATTSY instead of multiple completed by ETEL. Similar defects are 51, 58 and 71 |
|
662 ERR_PRINTF2(_L("<font color=Orange>$CSATKnownFailure: defect id = %d</font>"), 78); |
|
663 // assert below added to avoid the test hang here |
|
664 ASSERT_TRUE( EFalse ); |
|
665 |
|
666 User::WaitForRequest(requestStatus2); |
|
667 User::WaitForRequest(requestStatus); |
|
668 |
|
669 // check results |
|
670 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
671 ASSERT_EQUALS( KPCmdNumber, sendDtmfData.PCmdNumber() ); |
|
672 ASSERT_EQUALS( 0, KDtmf().Compare(sendDtmfData.iDtmfString) ); |
|
673 ASSERT_TRUE( (RSat::EAlphaIdNotPresent == sendDtmfData.iAlphaId.iStatus) || |
|
674 (RSat::EAlphaIdNotSet == sendDtmfData.iAlphaId.iStatus) ); |
|
675 ASSERT_EQUALS( RSat::ENoIconId, sendDtmfData.iIconId.iQualifier ); |
|
676 |
|
677 ASSERT_EQUALS(KErrNone, requestStatus2.Int()); |
|
678 ASSERT_EQUALS( KPCmdNumber, sendDtmfDataV5.PCmdNumber() ); |
|
679 ASSERT_EQUALS( 0, KDtmf().Compare(sendDtmfDataV5.iDtmfString) ); |
|
680 ASSERT_TRUE( (RSat::EAlphaIdNotPresent == sendDtmfDataV5.iAlphaId.iStatus) || |
|
681 (RSat::EAlphaIdNotSet == sendDtmfDataV5.iAlphaId.iStatus) ); |
|
682 ASSERT_EQUALS( RSat::ENoIconId, sendDtmfDataV5.iIconId.iQualifier ); |
|
683 ASSERT_TRUE( RSat::ETextAttributeProvided != |
|
684 sendDtmfDataV5.iTextAttribute.iStatus ); |
|
685 |
|
686 AssertMockLtsyStatusL(); |
|
687 |
|
688 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
689 GenerateSendDtmfTerminalResponseL( resp, KSendDtmfQualifierNormal ); |
|
690 |
|
691 CleanupStack::PopAndDestroy(4, this); // sat2, phone2, telServer2, this |
|
692 |
|
693 } |
|
694 |
|
695 |
|
696 /** |
|
697 Resets RSat::TSendDtmfV1 data fields |
|
698 @param aSendDtmfData data to be reset |
|
699 */ |
|
700 LOCAL_C void ResetSendDtmfData(RSat::TSendDtmfV1& aSendDtmfData) |
|
701 { |
|
702 // reset public members |
|
703 aSendDtmfData.iAlphaId.iStatus = RSat::EAlphaIdNotSet; |
|
704 aSendDtmfData.iAlphaId.iAlphaId.Zero(); |
|
705 aSendDtmfData.iDtmfString.Zero(); |
|
706 aSendDtmfData.iIconId.iQualifier = RSat::EIconQualifierNotSet; |
|
707 aSendDtmfData.iIconId.iIdentifier = 0; |
|
708 |
|
709 // reset protected members; |
|
710 aSendDtmfData.SetPCmdNumber(0); |
|
711 } |
|
712 |
|
713 |
|
714 /** |
|
715 Prepares SendDtmf proactive command complete data for Mock |
|
716 @param aPCmdNumber Proactive command number. |
|
717 @param aCmdQual Command qualifier |
|
718 @param aDtmf Dtmf string |
|
719 @param aAlphaId Alpha identifier |
|
720 @param aIconQual Type of icon |
|
721 @param aResult Proactive command notify result |
|
722 @param aDelay Delay value for MockLtsy completion |
|
723 @param aDestDeviceId command destination device Id |
|
724 */ |
|
725 void CCSatSendDTMFFU::PrepareSendDtmfCompleteDataL( |
|
726 TUint8 aPCmdNumber, |
|
727 TUint8 aCmdQual, |
|
728 const TDesC8* aDtmf, |
|
729 const TDesC8* aAlphaId, |
|
730 RSat::TIconQualifier aIconQual, |
|
731 TInt aResult, |
|
732 TInt aDelay, |
|
733 TUint8 aDestDeviceId) |
|
734 { |
|
735 TTlv tlv; |
|
736 ProactiveCmdTlvBegin(tlv, aPCmdNumber, KSendDtmf, aCmdQual, aDestDeviceId); |
|
737 |
|
738 // add alphaId tag if alphaId string present |
|
739 if ( aAlphaId ) |
|
740 { |
|
741 tlv.AddTag(KTlvAlphaIdentifierTag); |
|
742 tlv.AddData(*aAlphaId);//ETLV_AlphaIdentifier |
|
743 } |
|
744 |
|
745 // add dtmf tag if dtmf string present |
|
746 if ( aDtmf ) |
|
747 { |
|
748 tlv.AddTag(KTlvDtmfStringTag); |
|
749 tlv.AddData(*aDtmf);//ETLV_DtmfString |
|
750 } |
|
751 |
|
752 // For RSat::EIconQualifierNotSet and RSat::ENoIconId does not add tag |
|
753 if ( ( RSat::ESelfExplanatory == aIconQual ) || |
|
754 ( RSat::ENotSelfExplanatory == aIconQual ) ) |
|
755 { |
|
756 tlv.AddTag(KTlvIconIdentifierTag); |
|
757 tlv.AddByte((RSat::ESelfExplanatory == aIconQual)?0:1);//ETLV_IconQualifier |
|
758 tlv.AddByte(KIcon);//ETLV_IconIdentifier |
|
759 } |
|
760 |
|
761 PrepareMockWithCompleteDataForPCmdNotifyL(tlv.End(), aResult, aDelay); |
|
762 } |
|
763 |
|
764 |
|
765 /** |
|
766 Prepares and calls SendDtmf proactive command |
|
767 @param aPCmdNumber Proactive command number |
|
768 @param aCmdQual Command qualifier |
|
769 @param aDtmf Dtmf string |
|
770 @param aAlphaId Alpha identifier |
|
771 @param aIconQual Type of icon |
|
772 @param aResult Proactive command notify result |
|
773 @param aAlphaIdCheck Alpha identifier value to ckeck with returned value |
|
774 */ |
|
775 void CCSatSendDTMFFU::TestNotifySendDtmfPCmdL( |
|
776 TUint8 aPCmdNumber, |
|
777 TUint8 aCmdQual, |
|
778 const TDesC8* aDtmf, |
|
779 const TDesC8* aAlphaId, |
|
780 RSat::TIconQualifier aIconQual, |
|
781 TInt aResult, |
|
782 const TDesC16* aAlphaIdCheck) |
|
783 { |
|
784 PrepareMockWithExpDataForPCmdNotifyL(KSendDtmf); |
|
785 |
|
786 PrepareSendDtmfCompleteDataL( |
|
787 aPCmdNumber, aCmdQual, aDtmf, |
|
788 aAlphaId, aIconQual, aResult); |
|
789 |
|
790 RSat::TSendDtmfV1 sendDtmfData; |
|
791 |
|
792 TRequestStatus requestStatus; |
|
793 RSat::TSendDtmfV1Pckg sendDtmfDataPckg(sendDtmfData); |
|
794 iSat.NotifySendDtmfPCmd(requestStatus, sendDtmfDataPckg); |
|
795 |
|
796 User::WaitForRequest(requestStatus); |
|
797 |
|
798 ASSERT_EQUALS(aResult, requestStatus.Int()); |
|
799 |
|
800 // check results |
|
801 if ( KErrNone == aResult ) |
|
802 { |
|
803 ASSERT_EQUALS(aPCmdNumber, sendDtmfData.PCmdNumber()); |
|
804 |
|
805 if ( aAlphaId && ( 0 < aAlphaId->Length() ) ) |
|
806 { |
|
807 ASSERT_EQUALS(RSat::EAlphaIdProvided, sendDtmfData.iAlphaId.iStatus); |
|
808 if ( aAlphaIdCheck ) |
|
809 { |
|
810 ASSERT_EQUALS( 0, aAlphaIdCheck->Compare( |
|
811 sendDtmfData.iAlphaId.iAlphaId)); |
|
812 } |
|
813 else |
|
814 { |
|
815 ASSERT_EQUALS(0, Compare16bitDesWith8bitDesL( |
|
816 *aAlphaId, |
|
817 sendDtmfData.iAlphaId.iAlphaId)); |
|
818 } |
|
819 } |
|
820 else if ( aAlphaId && ( 0 == aAlphaId->Length() ) ) |
|
821 { |
|
822 ASSERT_EQUALS( RSat::EAlphaIdNull, sendDtmfData.iAlphaId.iStatus ); |
|
823 } |
|
824 else |
|
825 { |
|
826 ASSERT_TRUE( (RSat::EAlphaIdNotPresent == sendDtmfData.iAlphaId.iStatus) || |
|
827 (RSat::EAlphaIdNotSet == sendDtmfData.iAlphaId.iStatus) ); |
|
828 } |
|
829 |
|
830 if ( aDtmf ) |
|
831 { |
|
832 ASSERT_EQUALS( 0, aDtmf->Compare(sendDtmfData.iDtmfString) ); |
|
833 } |
|
834 else |
|
835 { |
|
836 ASSERT_EQUALS( 0, KNullDesC8().Compare(sendDtmfData.iDtmfString) ); |
|
837 } |
|
838 |
|
839 if (RSat::EIconQualifierNotSet != aIconQual) |
|
840 { |
|
841 ASSERT_EQUALS(aIconQual, sendDtmfData.iIconId.iQualifier); |
|
842 ASSERT_EQUALS(KIcon, sendDtmfData.iIconId.iIdentifier); |
|
843 } |
|
844 else |
|
845 { |
|
846 ASSERT_EQUALS(RSat::ENoIconId, sendDtmfData.iIconId.iQualifier); |
|
847 } |
|
848 } |
|
849 |
|
850 AssertMockLtsyStatusL(); |
|
851 } |
|
852 |
|
853 |
|
854 /** |
|
855 Handles sending a terminal response |
|
856 @param aResp terminal response data |
|
857 @param aCmdQual Command qualifier |
|
858 @param aExpResult Expected result of TerminalRsp() request |
|
859 */ |
|
860 void CCSatSendDTMFFU::GenerateSendDtmfTerminalResponseL( |
|
861 const RSat::TSendDtmfRspV1& aResp, |
|
862 TUint8 aCmdQual, |
|
863 TInt aExpResult) |
|
864 { |
|
865 |
|
866 TPtrC genResultAddInfo(KNullDesC); |
|
867 if ( RSat::KMeProblem == aResp.iInfoType ) |
|
868 { |
|
869 genResultAddInfo.Set( aResp.iAdditionalInfo ); |
|
870 } |
|
871 |
|
872 RSat::RSat::TSendDtmfRspV1Pckg respPckg(aResp); |
|
873 GenerateTerminalResponseL( |
|
874 aResp.PCmdNumber(), |
|
875 KSendDtmf, |
|
876 aCmdQual, |
|
877 RSat::ESendDtmf, |
|
878 respPckg, |
|
879 genResultAddInfo, |
|
880 aResp.iGeneralResult, |
|
881 KNullDesC8, |
|
882 aExpResult); |
|
883 |
|
884 AssertMockLtsyStatusL(); |
|
885 } |
|
886 |
|
887 |