|
24
|
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 base class for the CTSY integration test suite.
|
|
|
15 |
//
|
|
|
16 |
//
|
|
|
17 |
|
|
|
18 |
/**
|
|
|
19 |
@file
|
|
|
20 |
@internalTechnology
|
|
|
21 |
*/
|
|
|
22 |
|
|
|
23 |
#include "tetelrequeststatus.h"
|
|
|
24 |
#include "cetelsessionmgr.h"
|
|
|
25 |
#include "cctsyintegrationtestsuitebase.h"
|
|
|
26 |
#include "rpsmaster.h"
|
|
|
27 |
#include "cctsyinidata.h"
|
|
|
28 |
#include "trpsfunctor.h"
|
|
|
29 |
#include "trpsfunctor.cpp" //CW does not let us put function body of a templated function into separate translation unit
|
|
|
30 |
//It causes a link error where function is invoked. Instead we need to provide function body
|
|
|
31 |
//in for use by the invoking translation unit.
|
|
|
32 |
/**
|
|
|
33 |
* Default constructor.
|
|
|
34 |
*/
|
|
|
35 |
CCTSYIntegrationTestSuiteStepBase::CCTSYIntegrationTestSuiteStepBase(CEtelSessionMgr& aEtelSessionMgr)
|
|
|
36 |
:iEtelSessionMgr(aEtelSessionMgr)
|
|
|
37 |
{
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Destructor.
|
|
|
42 |
*/
|
|
|
43 |
CCTSYIntegrationTestSuiteStepBase::~CCTSYIntegrationTestSuiteStepBase()
|
|
|
44 |
{
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Implementation of CTestStep base class virtual.
|
|
|
50 |
*
|
|
|
51 |
* It is used for doing all initialisation common to derived classes in here.
|
|
|
52 |
* Make it able to leave if there are any errors here as there's no point in
|
|
|
53 |
* trying to run a test step if anything fails.
|
|
|
54 |
* The leave will be picked up by the framework.
|
|
|
55 |
*
|
|
|
56 |
* @return TVerdict
|
|
|
57 |
*/
|
|
|
58 |
TVerdict CCTSYIntegrationTestSuiteStepBase::doTestStepPreambleL()
|
|
|
59 |
{
|
|
|
60 |
//cleanup RPS from previous test
|
|
|
61 |
RPSCleanupL();
|
|
|
62 |
|
|
|
63 |
iEtelSessionMgr.OpenL(ETrue); // Open all session by default
|
|
|
64 |
iOwnNumbersCache.CacheOwnNumbersL();
|
|
|
65 |
|
|
|
66 |
SetTestStepResult(EPass);
|
|
|
67 |
StartSetup();
|
|
|
68 |
return TestStepResult();
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
/**
|
|
|
72 |
* Implementation of CTestStep base class virtual
|
|
|
73 |
* It is used for doing all after test treatment common to derived classes in here.
|
|
|
74 |
* Make it able to leave.
|
|
|
75 |
* The leave will be picked up by the framework.
|
|
|
76 |
*
|
|
|
77 |
* @return TVerdict
|
|
|
78 |
*/
|
|
|
79 |
TVerdict CCTSYIntegrationTestSuiteStepBase::doTestStepPostambleL()
|
|
|
80 |
{
|
|
|
81 |
iEtelSessionMgr.Close();
|
|
|
82 |
return TestStepResult();
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
/**
|
|
|
86 |
*/
|
|
|
87 |
void CCTSYIntegrationTestSuiteStepBase::StartSetup()
|
|
|
88 |
{
|
|
|
89 |
iAssertResult = ETestSuiteError;
|
|
|
90 |
iCheckResult = EInconclusive;
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
/**
|
|
|
94 |
* Called when the test starts.
|
|
|
95 |
*/
|
|
|
96 |
void CCTSYIntegrationTestSuiteStepBase::StartTest()
|
|
|
97 |
{
|
|
|
98 |
iAssertResult = EFail;
|
|
|
99 |
iCheckResult = EFail;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
/**
|
|
|
103 |
* Called when the test has finished and the test clean up begins.
|
|
|
104 |
*/
|
|
|
105 |
void CCTSYIntegrationTestSuiteStepBase::StartCleanup()
|
|
|
106 |
{
|
|
|
107 |
// don't report cleanup problems as failures
|
|
|
108 |
iAssertResult = EPass;
|
|
|
109 |
iCheckResult = EPass;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
/**
|
|
|
113 |
*/
|
|
|
114 |
void CCTSYIntegrationTestSuiteStepBase::SetAssertResult()
|
|
|
115 |
{
|
|
|
116 |
if (iAssertResult != EPass)
|
|
|
117 |
SetTestStepResult(iAssertResult);
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
/**
|
|
|
121 |
*/
|
|
|
122 |
void CCTSYIntegrationTestSuiteStepBase::SetCheckResultL()
|
|
|
123 |
{
|
|
|
124 |
if (iCheckResult != EPass)
|
|
|
125 |
SetTestStepResult(iCheckResult);
|
|
|
126 |
User::Leave(iCheckResult);
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
/**
|
|
|
130 |
* This function should be used by manual tests to pause a test and
|
|
|
131 |
* wait for user interaction. The user is prompted to perform an
|
|
|
132 |
* action and then the test will wait until the user presses a key
|
|
|
133 |
* to indicate that the action has been performed.
|
|
|
134 |
*
|
|
|
135 |
* @param aText The instructions to display to the user.
|
|
|
136 |
* @param aTimeout Timeout.
|
|
|
137 |
*/
|
|
|
138 |
void CCTSYIntegrationTestSuiteStepBase::DisplayUserInteractionPromptL(const TDesC& aText, TTimeDuration aTimeOut)
|
|
|
139 |
{
|
|
|
140 |
_LIT(KPressAnyKeyToContinue, "\nPress any key to continue.");
|
|
|
141 |
TBuf<255> instructionBuf(aText);
|
|
|
142 |
instructionBuf.Append(KPressAnyKeyToContinue);
|
|
|
143 |
DoPauseL(instructionBuf, aTimeOut);
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
/**
|
|
|
147 |
* Waits for asynchronous request using aRequestStatus to complete or for
|
|
|
148 |
* a period of time aTimeOut to pass which ever is sooner.
|
|
|
149 |
*
|
|
|
150 |
* @param aRequestStatus Request status to wait for.
|
|
|
151 |
* @param aTimeOut Timeout for aRequestStatus.
|
|
|
152 |
*
|
|
|
153 |
* @return KErrNone if aRequestStatus completes or KErrTimedOut if
|
|
|
154 |
* aRequestStatus did not complete within the aTimeOut period.
|
|
|
155 |
*/
|
|
|
156 |
TInt CCTSYIntegrationTestSuiteStepBase::WaitForRequestWithTimeOut
|
|
|
157 |
(TEtelRequestBase& aRequestStatus, TTimeDuration aTimeOut)
|
|
|
158 |
{
|
|
|
159 |
RTimer timer;
|
|
|
160 |
TRequestStatus timerRequest;
|
|
|
161 |
timer.CreateLocal();
|
|
|
162 |
timer.After(timerRequest, aTimeOut);
|
|
|
163 |
|
|
|
164 |
// Wait for the request to complete or until we time out
|
|
|
165 |
User::WaitForRequest(timerRequest, aRequestStatus);
|
|
|
166 |
|
|
|
167 |
// we must cancel the callers request if it is still outstanding
|
|
|
168 |
if (aRequestStatus.Int() == KRequestPending)
|
|
|
169 |
{
|
|
|
170 |
WARN_PRINTF1(_L("WaitForRequestWithTimeOut - cancelling pending request"));
|
|
|
171 |
aRequestStatus.Cancel();
|
|
|
172 |
}
|
|
|
173 |
|
|
|
174 |
// If timer is no longer pending => we have timed out
|
|
|
175 |
if (timerRequest != KRequestPending)
|
|
|
176 |
{
|
|
|
177 |
INFO_PRINTF1(_L("WaitForRequestWithTimeOut *** Timed out ***"));
|
|
|
178 |
return KErrTimedOut;
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
timer.Cancel();
|
|
|
182 |
User::WaitForRequest(timerRequest);
|
|
|
183 |
|
|
|
184 |
return KErrNone;
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
void CCTSYIntegrationTestSuiteStepBase::RPSCleanupL()
|
|
|
188 |
{
|
|
|
189 |
if(iRPS)
|
|
|
190 |
{
|
|
|
191 |
_LIT(KRpsCallTxt, "RPS: CLEANUP");
|
|
|
192 |
INFO_PRINTF1(KRpsCallTxt);
|
|
|
193 |
iRPS->CleanupL();
|
|
|
194 |
}
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
void CCTSYIntegrationTestSuiteStepBase::ConsolePrintL(const TDesC& aText )
|
|
|
198 |
{
|
|
|
199 |
CConsoleBase* con = NULL;
|
|
|
200 |
TRAPD(err, con = Console::NewL(_L("Interactive Print"), TSize(KConsFullScreen, KConsFullScreen)));
|
|
|
201 |
TEST(err == KErrNone);
|
|
|
202 |
|
|
|
203 |
CleanupStack::PushL(con);
|
|
|
204 |
con->Printf(_L("%S"), &aText);
|
|
|
205 |
CleanupStack::PopAndDestroy(); // con
|
|
|
206 |
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
TInt CCTSYIntegrationTestSuiteStepBase::DoPauseL(const TDesC& aText, TTimeDuration aTimeout /* = ETimeMedium */)
|
|
|
211 |
/**
|
|
|
212 |
Performs a pause, usually to allow user to intervene in Manual tests
|
|
|
213 |
|
|
|
214 |
@param aText - text for prompt
|
|
|
215 |
@param aTimeout -
|
|
|
216 |
@return KErrNone if user pressed a key
|
|
|
217 |
*/
|
|
|
218 |
{
|
|
|
219 |
TInt ret = KErrNone;
|
|
|
220 |
|
|
|
221 |
CConsoleBase* con = NULL;
|
|
|
222 |
TRAPD(err, con = Console::NewL(_L("Interactive Test"), TSize(KConsFullScreen, KConsFullScreen)));
|
|
|
223 |
|
|
|
224 |
INFO_PRINTF2(_L("Console status = %d"), err);
|
|
|
225 |
TEST(err == KErrNone);
|
|
|
226 |
CleanupStack::PushL(con);
|
|
|
227 |
|
|
|
228 |
TConsoleReadRequestStatus readRequest(*con);
|
|
|
229 |
//add to cleanup stack
|
|
|
230 |
CleanupStack::PushL(readRequest);
|
|
|
231 |
con->Printf(_L("%S (timeout %d secs) ..."), &aText, aTimeout / KOneSecond);
|
|
|
232 |
con->Read(readRequest);
|
|
|
233 |
|
|
|
234 |
ret = WaitForRequestWithTimeOut(readRequest, aTimeout);
|
|
|
235 |
|
|
|
236 |
if (ret == KErrTimedOut)
|
|
|
237 |
{
|
|
|
238 |
WARN_PRINTF1(_L("[doPause] No keypress detected, timeout! Manual action may not have occurred."));
|
|
|
239 |
}
|
|
|
240 |
|
|
|
241 |
if (readRequest.Int() == KRequestPending)
|
|
|
242 |
{
|
|
|
243 |
readRequest.Cancel();
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
CleanupStack::PopAndDestroy(); // readRequest
|
|
|
247 |
CleanupStack::PopAndDestroy(); // con
|
|
|
248 |
|
|
|
249 |
return ret;
|
|
|
250 |
}
|
|
|
251 |
|
|
|
252 |
TInt CCTSYIntegrationTestSuiteStepBase::ExecuteRemoteRequestL(MRpsFunctorBase& aRpsFunctor, const TDesC& aRpsCallMsg)
|
|
|
253 |
{
|
|
|
254 |
TInt ret = KErrNone;
|
|
|
255 |
if(iRPS) //if RPS is being used then dispatch the request to the RPS slave
|
|
|
256 |
{
|
|
|
257 |
INFO_PRINTF1(aRpsCallMsg);
|
|
|
258 |
aRpsFunctor.ExecuteRpsRequestL();
|
|
|
259 |
}
|
|
|
260 |
else //if RPS not being used then default to dislay request text through UI.
|
|
|
261 |
{
|
|
|
262 |
INFO_PRINTF1(aRpsFunctor.DisplayToClientTxt());
|
|
|
263 |
ret = DoPauseL(aRpsFunctor.DisplayToClientTxt());
|
|
|
264 |
}
|
|
|
265 |
return ret;
|
|
|
266 |
}
|
|
|
267 |
|
|
|
268 |
TPtrC CCTSYIntegrationTestSuiteStepBase::Number(TEtelLine aLine)
|
|
|
269 |
{
|
|
|
270 |
TPtrC ptr;
|
|
|
271 |
switch(aLine)
|
|
|
272 |
{
|
|
|
273 |
case EDataLine:
|
|
|
274 |
ptr.Set(iOwnNumbersCache.OwnNumbers().OwnDataNumber());
|
|
|
275 |
break;
|
|
|
276 |
case EFaxLine:
|
|
|
277 |
ptr.Set(iOwnNumbersCache.OwnNumbers().OwnFaxNumber());
|
|
|
278 |
break;
|
|
|
279 |
case EVoiceLine:
|
|
|
280 |
default:
|
|
|
281 |
ptr.Set(iOwnNumbersCache.OwnNumbers().OwnVoiceNumber());
|
|
|
282 |
}
|
|
|
283 |
|
|
|
284 |
return ptr;
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
// Set aNumber to the relevant phone number based on the line type (either data, fax or voice line)
|
|
|
288 |
// If Using RPS then the number will be retrieved from RPS, otherwise it will read the number from the
|
|
|
289 |
// ctsyintegration_data.ini file.
|
|
|
290 |
void CCTSYIntegrationTestSuiteStepBase::GetRPSNumber(TEtelLine aLine, TPtrC& aNumber)
|
|
|
291 |
{
|
|
|
292 |
|
|
|
293 |
if (UsingRps())
|
|
|
294 |
{
|
|
|
295 |
switch(aLine)
|
|
|
296 |
{
|
|
|
297 |
case EDataLine:
|
|
|
298 |
aNumber.Set(iRPS->RpsSlaveTelNumData());
|
|
|
299 |
break;
|
|
|
300 |
case EFaxLine:
|
|
|
301 |
aNumber.Set(iRPS->RpsSlaveTelNumFax());
|
|
|
302 |
break;
|
|
|
303 |
case EVoiceLine:
|
|
|
304 |
default:
|
|
|
305 |
aNumber.Set(iRPS->RpsSlaveTelNum());
|
|
|
306 |
}
|
|
|
307 |
}
|
|
|
308 |
else
|
|
|
309 |
{
|
|
|
310 |
switch(aLine)
|
|
|
311 |
{
|
|
|
312 |
case EDataLine:
|
|
|
313 |
GetStringFromConfig(KIniOwnNumSection,KIniOwnDataNumber,aNumber);
|
|
|
314 |
break;
|
|
|
315 |
case EFaxLine:
|
|
|
316 |
GetStringFromConfig(KIniOwnNumSection,KIniOwnFaxNumber,aNumber);
|
|
|
317 |
break;
|
|
|
318 |
case EVoiceLine:
|
|
|
319 |
default:
|
|
|
320 |
GetStringFromConfig(KIniOwnNumSection, KIniOwnVoiceNumber1, aNumber);
|
|
|
321 |
}
|
|
|
322 |
}
|
|
|
323 |
}
|
|
|
324 |
|
|
|
325 |
//RPS Dispatch requests.
|
|
|
326 |
//IF RPS off then will defualt to user interaction.
|
|
|
327 |
|
|
|
328 |
// Requests RPS to dial out to the specified number
|
|
|
329 |
//aLine line to use - voice, data, fax
|
|
|
330 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSDialNumberL(const TDesC& aNumToDial, TEtelLine aLine)
|
|
|
331 |
{
|
|
|
332 |
|
|
|
333 |
_LIT(KDisplayToClientTxt, "Hit a key and dial the number");
|
|
|
334 |
_LIT(KRpsCallTxt, "RPS: RPSDialNumberL");
|
|
|
335 |
|
|
|
336 |
TRpsFunctor<const TDesC&, TEtelLine, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::CallNumberL, aNumToDial, aLine);
|
|
|
337 |
|
|
|
338 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
339 |
}
|
|
|
340 |
|
|
|
341 |
//RPS Dispatch requests.
|
|
|
342 |
//IF RPS off then will defualt to user interaction.
|
|
|
343 |
|
|
|
344 |
// Requests an incoming call.
|
|
|
345 |
//aLine line to use - voice, data, fax
|
|
|
346 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSRequestIncomingCallL(TEtelLine aLine)
|
|
|
347 |
{
|
|
|
348 |
|
|
|
349 |
_LIT(KDisplayToClientTxt, "Hit a key to place the incoming %S call yourself...");
|
|
|
350 |
_LIT(KRpsCallTxt, "RPS: REQUESTINCOMINGCALLL");
|
|
|
351 |
|
|
|
352 |
TRpsFunctor<const TDesC&, TEtelLine, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::CallNumberL, Number(aLine), aLine);
|
|
|
353 |
|
|
|
354 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
355 |
}
|
|
|
356 |
|
|
|
357 |
//
|
|
|
358 |
// REQUESTINCOMING_CANCEL_BEFORE_CONNECTL().
|
|
|
359 |
// Requests an incoming call which will get cancelled (ie the caller will end the call) after the delay.
|
|
|
360 |
// There is no gaurantee that the call will not get answered by the network before the delay completes,
|
|
|
361 |
// so the delay should be kept to a minimum.
|
|
|
362 |
// aLine the line to operate on
|
|
|
363 |
// aDelay A delay in seconds
|
|
|
364 |
//
|
|
|
365 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSRequestIncomingCancelBeforeConnectL(TEtelLine aLine, TInt aDelay)
|
|
|
366 |
{
|
|
|
367 |
|
|
|
368 |
_LIT(KDisplayToClientTxt, "Place an incoming %S call and hangup before TSY answers. Press any key to continue.");
|
|
|
369 |
_LIT(KRpsCallTxt, "RPS: REQUESTINCOMING_CANCEL_BEFORE_CONNECTL");
|
|
|
370 |
|
|
|
371 |
TRpsFunctor<const TDesC&, TEtelLine, TInt> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::CallNumberHangUpBeforeConnectL, Number(aLine), aLine, aDelay);
|
|
|
372 |
|
|
|
373 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
374 |
}
|
|
|
375 |
|
|
|
376 |
//
|
|
|
377 |
// Requests an incoming call which will get hung up by the remote party after the specified delay once
|
|
|
378 |
// the call is answered. The incoming call must be answered else the operation will fail.
|
|
|
379 |
// aLine the line to operate on
|
|
|
380 |
// aDelay A delay in seconds
|
|
|
381 |
//
|
|
|
382 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSRequestIncomingHangupAfterConnectL(TEtelLine aLine, TInt aDelay)
|
|
|
383 |
{
|
|
|
384 |
|
|
|
385 |
_LIT(KDisplayToClientTxt, "Place an incoming %S call and hangup after the TSY answers. Press any key to continue.");
|
|
|
386 |
_LIT(KRpsCallTxt, "RPS: REQUESTINCOMING_HANGUP_AFTER_CONNECTL");
|
|
|
387 |
|
|
|
388 |
TRpsFunctor<const TDesC&, TEtelLine, TInt> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::CallNumberHangUpAfterConnectL, Number(aLine), aLine, aDelay);
|
|
|
389 |
|
|
|
390 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
391 |
}
|
|
|
392 |
|
|
|
393 |
//
|
|
|
394 |
// Requests the remote party to expect a call which is to be answered by the remote party, and then
|
|
|
395 |
// wait for a delay before it hangs up.
|
|
|
396 |
// A call must be made to the remote party after issuing this request and before any other request
|
|
|
397 |
// is made, else this request will fail.
|
|
|
398 |
// aLine the line to operate on
|
|
|
399 |
// aDelay A delay in seconds
|
|
|
400 |
//
|
|
|
401 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSAnswerNextCallThenHangupL(TEtelLine aLine, TInt aDelay)
|
|
|
402 |
{
|
|
|
403 |
|
|
|
404 |
_LIT(KDisplayToClientTxt, "Answer next %S call and then hangup. Press any key to continue.");
|
|
|
405 |
_LIT(KRpsCallTxt, "RPS: ANSWERNEXTCALL_THEN_HANGUPL");
|
|
|
406 |
|
|
|
407 |
TRpsFunctor<TEtelLine, TInt, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::AnswerNextCallHangUpL, aLine, aDelay);
|
|
|
408 |
|
|
|
409 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
410 |
}
|
|
|
411 |
|
|
|
412 |
//
|
|
|
413 |
// Requests the remote party to expect a call which is to be answered by the remote party, and then
|
|
|
414 |
// wait for a delay before it hangs up.
|
|
|
415 |
// A call must be made to the remote party after issuing this request and before any other request
|
|
|
416 |
// is made, else this request will fail.
|
|
|
417 |
// aLine the line to operate on
|
|
|
418 |
//
|
|
|
419 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSAnswerNextCallL(TEtelLine aLine)
|
|
|
420 |
{
|
|
|
421 |
|
|
|
422 |
_LIT(KDisplayToClientTxt, "Answer next %S call. Press any key to continue.");
|
|
|
423 |
_LIT(KRpsCallTxt, "RPS: ANSWERNEXTCALLL");
|
|
|
424 |
|
|
|
425 |
TRpsFunctor<TEtelLine, MRpsFunctorBase::TNotUsed, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::AnswerNextCallL, aLine);
|
|
|
426 |
|
|
|
427 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
428 |
}
|
|
|
429 |
|
|
|
430 |
//
|
|
|
431 |
// Requests the remote party to expect a call which is to be answered by the remote party, and then
|
|
|
432 |
// wait for a delay before it puts the call on hold.
|
|
|
433 |
// A call must be made to the remote party after issuing this request and before any other request
|
|
|
434 |
// is made, else this request will fail.
|
|
|
435 |
// The call at the remote party needs to be hung up (which can be achieved using the request HANGUP()).
|
|
|
436 |
// There is no gaurantee the call supports or is in a state to be put on hold. The user is advised to
|
|
|
437 |
// check the call state reflects it has been put on hold successfully.
|
|
|
438 |
//
|
|
|
439 |
// aLine the line to operate on
|
|
|
440 |
// aDelay A delay in seconds
|
|
|
441 |
//
|
|
|
442 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSAnswerNextCallThenHoldL(TEtelLine aLine, TInt aDelay)
|
|
|
443 |
{
|
|
|
444 |
|
|
|
445 |
_LIT(KDisplayToClientTxt, "Answer next %S call and then hold. Press any key to continue.");
|
|
|
446 |
_LIT(KRpsCallTxt, "RPS: ANSWERNEXTCALL_THEN_HOLDL");
|
|
|
447 |
|
|
|
448 |
TRpsFunctor<TEtelLine, TInt, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::AnswerNextCallHoldL, aLine, aDelay);
|
|
|
449 |
|
|
|
450 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
451 |
}
|
|
|
452 |
|
|
|
453 |
//
|
|
|
454 |
// Requests the remote party to expect a call which is not to be answered by the remote party.
|
|
|
455 |
// A call must be made to the remote party after issuing this request and before any other request
|
|
|
456 |
// is made, else this request will fail.
|
|
|
457 |
//
|
|
|
458 |
// aLine the line to operate on
|
|
|
459 |
//
|
|
|
460 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSIgnoreNextCallL(TEtelLine aLine)
|
|
|
461 |
{
|
|
|
462 |
|
|
|
463 |
_LIT(KDisplayToClientTxt, "Dont answer next %S call. Press any key to continue.");
|
|
|
464 |
_LIT(KRpsCallTxt, "RPS: IGNORE_NEXT_CALLL");
|
|
|
465 |
|
|
|
466 |
TRpsFunctor<TEtelLine, MRpsFunctorBase::TNotUsed, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::IgnoreNextCallL, aLine);
|
|
|
467 |
|
|
|
468 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
469 |
}
|
|
|
470 |
|
|
|
471 |
|
|
|
472 |
//
|
|
|
473 |
// Requests the remote party to wait for a delay before it puts the default call (call1) on hold.
|
|
|
474 |
// This make no assumption on whether the remote party currently has an active call.
|
|
|
475 |
// It is up to the user to ensure a call exists and is in a state to be put on hold.
|
|
|
476 |
// The user is advised to check the call state reflects it has been put on hold successfully.
|
|
|
477 |
|
|
|
478 |
// aDelay A delay in seconds
|
|
|
479 |
//
|
|
|
480 |
|
|
|
481 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSHoldL(TEtelLine aLine, TInt aDelay)
|
|
|
482 |
{
|
|
|
483 |
|
|
|
484 |
_LIT(KDisplayToClientTxt, "Place active %S call on hold. Press any key to continue.");
|
|
|
485 |
_LIT(KRpsCallTxt, "RPS: HOLDL");
|
|
|
486 |
|
|
|
487 |
TRpsFunctor<TEtelLine, TInt, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::HoldL, aLine, aDelay);
|
|
|
488 |
|
|
|
489 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
490 |
}
|
|
|
491 |
|
|
|
492 |
//
|
|
|
493 |
// Requests the remote party to wait for a delay before it puts the default call (call1) on hold.
|
|
|
494 |
// This make no assumption on whether the remote party currently has an active call.
|
|
|
495 |
// It is up to the user to ensure a call exists and is in a state to be put on hold.
|
|
|
496 |
// The user is advised to check the call state reflects it has been put on hold successfully.
|
|
|
497 |
// aDelay A delay in seconds
|
|
|
498 |
//
|
|
|
499 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSResumeL(TEtelLine aLine, TInt aDelay)
|
|
|
500 |
{
|
|
|
501 |
|
|
|
502 |
_LIT(KDisplayToClientTxt, "Resume the held %S call. Press any key to continue.");
|
|
|
503 |
_LIT(KRpsCallTxt, "RPS: RESUMEL");
|
|
|
504 |
|
|
|
505 |
TRpsFunctor<TEtelLine, TInt, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::ResumeL, aLine, aDelay);
|
|
|
506 |
|
|
|
507 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
508 |
}
|
|
|
509 |
|
|
|
510 |
//
|
|
|
511 |
// HANGUPL().
|
|
|
512 |
// Requests the remote party wait for a delay before and then hang up the default call (call1).
|
|
|
513 |
// This make no assumption on whether the remote party currently has an active call, or whether
|
|
|
514 |
// it is in a state to be hung up.
|
|
|
515 |
// It is up to the user to ensure a call exists and is in a state to be hung up.
|
|
|
516 |
//
|
|
|
517 |
// aLine the line to operate on
|
|
|
518 |
// aDelay A delay in seconds
|
|
|
519 |
//
|
|
|
520 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSHangupL(TEtelLine aLine, TInt aDelay)
|
|
|
521 |
{
|
|
|
522 |
|
|
|
523 |
_LIT(KDisplayToClientTxt, "Hangup the %S call. Press any key to continue.");
|
|
|
524 |
_LIT(KRpsCallTxt, "RPS: HANGUPL");
|
|
|
525 |
|
|
|
526 |
TRpsFunctor<TEtelLine, TInt, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::HangUpL, aLine, aDelay);
|
|
|
527 |
|
|
|
528 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
529 |
}
|
|
|
530 |
|
|
|
531 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSHangUpNextCallBeforeConnectL(TEtelLine aLine)
|
|
|
532 |
{
|
|
|
533 |
|
|
|
534 |
_LIT(KDisplayToClientTxt, "Reject the next incoming %S call. Press any key to continue.");
|
|
|
535 |
_LIT(KRpsCallTxt, "RPS: HANGUPNEXTCALLBEFORECONNECTL");
|
|
|
536 |
|
|
|
537 |
TRpsFunctor<TEtelLine, MRpsFunctorBase::TNotUsed, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::HangUpNextCallBeforeConnectL, aLine);
|
|
|
538 |
|
|
|
539 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
540 |
}
|
|
|
541 |
|
|
|
542 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSEchoDataL(const TDesC& aDataToSend)
|
|
|
543 |
{
|
|
|
544 |
_LIT(KDisplayToClientTxt, "Echo incoming data back to device.");
|
|
|
545 |
_LIT(KRpsCallTxt, "RPS: SENDDATABACKONDATAPORTL");
|
|
|
546 |
|
|
|
547 |
TRpsFunctor<const TDesC&, MRpsFunctorBase::TNotUsed, MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, TEtelLine(-1), &CRPSMaster::SendDataBackOnDataPortL, aDataToSend);
|
|
|
548 |
|
|
|
549 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
550 |
}
|
|
|
551 |
|
|
|
552 |
//
|
|
|
553 |
// RPSRejectNextCallL().
|
|
|
554 |
// Requests the remote party to reject the next incoming call.
|
|
|
555 |
//
|
|
|
556 |
// aLine the line to operate on
|
|
|
557 |
//
|
|
|
558 |
TInt CCTSYIntegrationTestSuiteStepBase::RPSRejectNextCallL(TEtelLine aLine)
|
|
|
559 |
{
|
|
|
560 |
_LIT(KDisplayToClientTxt, "Reject the next incoming call");
|
|
|
561 |
_LIT(KRpsCallTxt, "RPS: REJECTNEXTCALLL");
|
|
|
562 |
|
|
|
563 |
TRpsFunctor<TEtelLine, MRpsFunctorBase::TNotUsed,MRpsFunctorBase::TNotUsed> rpsFunctor(iRPS, KDisplayToClientTxt, aLine, &CRPSMaster::RejectNextCallL, aLine);
|
|
|
564 |
|
|
|
565 |
return ExecuteRemoteRequestL(rpsFunctor, KRpsCallTxt);
|
|
|
566 |
}
|
|
|
567 |
|
|
|
568 |
TBool assert_equals_des16(CTestExecuteLogger& aLogger, const TText8* aFile, TInt aLine, TInt aSeverity,
|
|
|
569 |
const TDesC& aRes, const TDesC& aExp, const TDesC& aMsg)
|
|
|
570 |
{
|
|
|
571 |
if(aRes != aExp)
|
|
|
572 |
{
|
|
|
573 |
TPtrC exp;
|
|
|
574 |
TPtrC res;
|
|
|
575 |
|
|
|
576 |
exp.Set(aExp.Ptr(), aExp.Length());
|
|
|
577 |
res.Set(aRes.Ptr(), aRes.Length());
|
|
|
578 |
|
|
|
579 |
//truncate to 20 characters, to avoid logging too big strings
|
|
|
580 |
if(exp.Length() > KMaxLogCharLength)
|
|
|
581 |
{
|
|
|
582 |
exp.Set(exp.Ptr(), KMaxLogCharLength);
|
|
|
583 |
}
|
|
|
584 |
|
|
|
585 |
if(res.Length() > KMaxLogCharLength)
|
|
|
586 |
{
|
|
|
587 |
res.Set(res.Ptr(), KMaxLogCharLength);
|
|
|
588 |
}
|
|
|
589 |
|
|
|
590 |
aLogger.LogExtra(aFile, aLine, aSeverity, KAssertErrorEqualsTextDes, &res, &exp, &aMsg);
|
|
|
591 |
return EFalse;
|
|
|
592 |
}
|
|
|
593 |
return ETrue;
|
|
|
594 |
}
|
|
|
595 |
|
|
|
596 |
|
|
|
597 |
TBool assert_equals_des8(CTestExecuteLogger& aLogger, const TText8* aFile, TInt aLine, TInt aSeverity,
|
|
|
598 |
const TDesC8& aRes, const TDesC8& aExp, const TDesC& aMsg)
|
|
|
599 |
{
|
|
|
600 |
if(aRes != aExp)
|
|
|
601 |
{
|
|
|
602 |
TBuf<20> tempRes;
|
|
|
603 |
TBuf<20> tempExp;
|
|
|
604 |
|
|
|
605 |
TPtrC8 exp;
|
|
|
606 |
TPtrC8 res;
|
|
|
607 |
|
|
|
608 |
exp.Set(aExp.Ptr(), aExp.Length());
|
|
|
609 |
res.Set(aRes.Ptr(), aRes.Length());
|
|
|
610 |
|
|
|
611 |
if(exp.Length() > KMaxLogCharLength)
|
|
|
612 |
{
|
|
|
613 |
exp.Set(exp.Ptr(), KMaxLogCharLength);
|
|
|
614 |
}
|
|
|
615 |
|
|
|
616 |
if(res.Length() > KMaxLogCharLength)
|
|
|
617 |
{
|
|
|
618 |
res.Set(res.Ptr(), KMaxLogCharLength);
|
|
|
619 |
}
|
|
|
620 |
|
|
|
621 |
//8-bit copy to unicode for logging
|
|
|
622 |
tempRes.Copy(res);
|
|
|
623 |
tempExp.Copy(exp);
|
|
|
624 |
|
|
|
625 |
aLogger.LogExtra(aFile, aLine, aSeverity, KAssertErrorEqualsTextDes, &tempRes, &tempExp, &aMsg);
|
|
|
626 |
return EFalse;
|
|
|
627 |
}
|
|
|
628 |
return ETrue;
|
|
|
629 |
}
|
|
|
630 |
|
|
|
631 |
void CCTSYIntegrationTestSuiteStepBase::AsyncExec(CThreadExec::MFunctor* aFunction)
|
|
|
632 |
/**
|
|
|
633 |
* Execute a function asycnhronously.
|
|
|
634 |
* @param aFunction the function to execute
|
|
|
635 |
*/
|
|
|
636 |
{
|
|
|
637 |
iEtelSessionMgr.AsyncExec(aFunction);
|
|
|
638 |
}
|
|
|
639 |
|
|
|
640 |
void CCTSYIntegrationTestSuiteStepBase::SyncExec(CThreadExec::MFunctor* aFunction)
|
|
|
641 |
/**
|
|
|
642 |
* Execute a function sycnhronously from another thread.
|
|
|
643 |
* @param aFunction the function to execute
|
|
|
644 |
*/
|
|
|
645 |
{
|
|
|
646 |
iEtelSessionMgr.SyncExec(aFunction);
|
|
|
647 |
}
|