24
|
1 |
// Copyright (c) 1997-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 |
// This file implements various tests for incoming call handling.
|
|
15 |
// See CDataCall.cpp for fully documented test scenario.
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
/**
|
|
20 |
@file
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include <e32test.h>
|
|
24 |
#include <mmretrieve.h>
|
|
25 |
#include <etelmm.h>
|
|
26 |
#include "Te_LoopBackcincall.h"
|
|
27 |
#include "../../hayes/TSYCONFG.H" // for KInternetAccessPoint
|
|
28 |
|
|
29 |
//
|
|
30 |
// Test-side class
|
|
31 |
// With the assistance of the base class, this class must start the emulator
|
|
32 |
// and drive the ETel API.
|
|
33 |
//
|
|
34 |
CTestDriveInCall* CTestDriveInCall::NewL(const TScriptList aScriptListEntry)
|
|
35 |
{
|
|
36 |
CTestDriveInCall* aA = new (ELeave) CTestDriveInCall(aScriptListEntry);
|
|
37 |
CleanupStack::PushL(aA);
|
|
38 |
aA->ConstructL();
|
|
39 |
CleanupStack::Pop();
|
|
40 |
return (aA);
|
|
41 |
}
|
|
42 |
|
|
43 |
CTestDriveInCall::CTestDriveInCall(const TScriptList aScriptListEntry) :
|
|
44 |
iScriptListEntry(aScriptListEntry)
|
|
45 |
{}
|
|
46 |
|
|
47 |
TInt CTestDriveInCall::RunTestL()
|
|
48 |
{
|
|
49 |
iCurrentScript = iScriptListEntry;
|
|
50 |
return (StartEmulatorL());
|
|
51 |
}
|
|
52 |
|
|
53 |
TInt CTestDriveInCall::DriveETelApiL()
|
|
54 |
//
|
|
55 |
// This function contains the real meat of the Client-side test code
|
|
56 |
//
|
|
57 |
{
|
|
58 |
_LIT(KVoiceLineName, "Voice");
|
|
59 |
_LIT(KDataLineName, "Data");
|
|
60 |
//_LIT(KFaxLineName, "Fax");
|
|
61 |
|
|
62 |
RLine voiceLine;
|
|
63 |
INFO_PRINTF1(_L("Opening Voice Line\n"));
|
|
64 |
TESTL(voiceLine.Open(iPhone,KVoiceLineName) == KErrNone);
|
|
65 |
RCall voiceCall;
|
|
66 |
INFO_PRINTF1(_L("Opening New Voice Call\n"));
|
|
67 |
TESTL(voiceCall.OpenNewCall(voiceLine) == KErrNone);
|
|
68 |
|
|
69 |
RLine dataLine;
|
|
70 |
INFO_PRINTF1(_L("Opening Data Line\n"));
|
|
71 |
TESTL(dataLine.Open(iPhone,KDataLineName) == KErrNone);
|
|
72 |
RCall dataCall;
|
|
73 |
INFO_PRINTF1(_L("Opening New Data Call\n"));
|
|
74 |
TESTL(dataCall.OpenNewCall(dataLine) == KErrNone);
|
|
75 |
|
|
76 |
TRequestStatus stat1, stat2, stat3, reqStatus;
|
|
77 |
|
|
78 |
RMobilePhone::TMMTableSettings tableSettings;
|
|
79 |
tableSettings.iLocId=KInternetAccessPoint;
|
|
80 |
RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
|
|
81 |
iPhone.InitialiseMM(reqStatus , tableSettingsPckg);
|
|
82 |
User::WaitForRequest(reqStatus);
|
|
83 |
TESTL(reqStatus == KErrNone);
|
|
84 |
|
|
85 |
// Now wait for an incoming voice call...
|
|
86 |
INFO_PRINTF1(_L("Answering a Voice Call...\n"));
|
|
87 |
voiceCall.AnswerIncomingCall(stat1);
|
|
88 |
dataCall.AnswerIncomingCall(stat2);
|
|
89 |
User::WaitForRequest(stat1);
|
|
90 |
TESTL(stat1 == KErrNone);
|
|
91 |
dataCall.AnswerIncomingCallCancel();
|
|
92 |
User::WaitForRequest(stat2);
|
|
93 |
User::After(1000000L);
|
|
94 |
INFO_PRINTF1(_L("Hangup a Voice Call...\n"));
|
|
95 |
TESTL(voiceCall.HangUp() == KErrNone);
|
|
96 |
|
|
97 |
// Now wait for an incoming data call...
|
|
98 |
INFO_PRINTF1(_L("Answering a Data Call\n"));
|
|
99 |
TInt ret = dataCall.AnswerIncomingCall();
|
|
100 |
INFO_PRINTF2(_L("ret=%d "),ret);
|
|
101 |
if (ret == KErrNone)
|
|
102 |
{
|
|
103 |
SetTestStepResult(EPass);
|
|
104 |
}
|
|
105 |
else
|
|
106 |
SetTestStepResult(EFail);
|
|
107 |
|
|
108 |
User::After(300000L);
|
|
109 |
TESTL(dataCall.HangUp() == KErrNone);
|
|
110 |
|
|
111 |
// Get the FaxSettings before closing the line and call
|
|
112 |
|
|
113 |
dataCall.Close();
|
|
114 |
dataLine.Close();
|
|
115 |
voiceCall.Close();
|
|
116 |
voiceLine.Close();
|
|
117 |
|
|
118 |
return (KErrNone);
|
|
119 |
}
|
|
120 |
|
|
121 |
//
|
|
122 |
// Emulator-side class
|
|
123 |
// With the assistance of the base class, this class must run the designated script
|
|
124 |
//
|
|
125 |
CTestInCall* CTestInCall::NewL(const TScript* aScript)
|
|
126 |
{
|
|
127 |
CTestInCall* aA = new (ELeave) CTestInCall(aScript);
|
|
128 |
CleanupStack::PushL(aA);
|
|
129 |
aA->ConstructL();
|
|
130 |
CleanupStack::Pop();
|
|
131 |
return (aA);
|
|
132 |
}
|
|
133 |
|
|
134 |
CTestInCall::CTestInCall(const TScript* aScript) :
|
|
135 |
iScript(aScript)
|
|
136 |
{}
|
|
137 |
|
|
138 |
void CTestInCall::ConstructL()
|
|
139 |
{
|
|
140 |
CATScriptEng::ConstructL();
|
|
141 |
}
|
|
142 |
|
|
143 |
TInt CTestInCall::Start()
|
|
144 |
{
|
|
145 |
StartScript(iScript);
|
|
146 |
return (KErrNone);
|
|
147 |
}
|
|
148 |
|
|
149 |
void CTestInCall::SpecificAlgorithmL(TInt /* aParam */)
|
|
150 |
{
|
|
151 |
}
|
|
152 |
|
|
153 |
void CTestInCall::Complete(TInt aError)
|
|
154 |
{
|
|
155 |
iReturnValue = aError;
|
|
156 |
CActiveScheduler::Stop();
|
|
157 |
}
|