24
|
1 |
// Copyright (c) 2005-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 |
#include "Te_SimPacketGPRSQOSTest.h"
|
|
17 |
|
|
18 |
CSimPacketGPRSQOSTest::CSimPacketGPRSQOSTest()
|
|
19 |
{
|
|
20 |
SetTestStepName(_L("GPRSQOSTest"));
|
|
21 |
}
|
|
22 |
|
|
23 |
TVerdict CSimPacketGPRSQOSTest::doTestStepL()
|
|
24 |
{
|
|
25 |
INFO_PRINTF1(_L("BeginPacketGPRSQOSTest"));
|
|
26 |
|
|
27 |
CreateConfigFileL(_L("c:\\config3.txt"));
|
|
28 |
SetTestNumberL(6);
|
|
29 |
|
|
30 |
TInt ret = iPhone.Open(iTelServer,KPhoneName);
|
|
31 |
INFO_PRINTF2(_L("Result: %d"),ret);
|
|
32 |
TESTL(ret == KErrNone);
|
|
33 |
INFO_PRINTF1(_L("Opened phone object"));
|
|
34 |
TESTL(iPacketService.Open(iPhone)==KErrNone);
|
|
35 |
INFO_PRINTF1(_L("Opened Packet object"));
|
|
36 |
TName contextName;
|
|
37 |
TName contextNameCompare;
|
|
38 |
TESTL(iFirstPrimaryPacketContext.OpenNewContext(iPacketService, contextName)==KErrNone);
|
|
39 |
contextNameCompare.Append(KSimPrimaryPacketContextName);
|
|
40 |
contextNameCompare.AppendNum(1);
|
|
41 |
TESTL(contextName.Compare(contextNameCompare)==KErrNone);
|
|
42 |
INFO_PRINTF1(_L("Opened Context object"));
|
|
43 |
|
|
44 |
TRequestStatus reqStatus;
|
|
45 |
TRequestStatus notifyStatus;
|
|
46 |
TName gprsQosName;
|
|
47 |
TESTL(iGPRSPacketqos.OpenNewQoS(iFirstPrimaryPacketContext, gprsQosName)==KErrNone);
|
|
48 |
TName gprsQosNameCompare;
|
|
49 |
gprsQosNameCompare.Append(KSimPacketQosName);
|
|
50 |
gprsQosNameCompare.AppendNum(1);
|
|
51 |
TESTL(gprsQosName.Compare(gprsQosNameCompare)==KErrNone);
|
|
52 |
INFO_PRINTF1(_L("Opened GPRS QoS object"));
|
|
53 |
|
|
54 |
TName qosname;
|
|
55 |
iFirstPrimaryPacketContext.GetProfileName(qosname);
|
|
56 |
INFO_PRINTF1(_L("Retrieved GPRS QoS object reference name"));
|
|
57 |
|
|
58 |
// Set QoS Profile Params
|
|
59 |
RPacketQoS::TQoSGPRSRequested aGPRSQoSReqConfig;
|
|
60 |
TPckg<RPacketQoS::TQoSGPRSRequested> aGPRSQoSReqPckg(aGPRSQoSReqConfig);
|
|
61 |
|
|
62 |
// post a notification
|
|
63 |
RPacketQoS::TQoSGPRSNegotiated aGPRSNotifyQoS;
|
|
64 |
TPckg<RPacketQoS::TQoSGPRSNegotiated> aGPRSNotifyQoSPckg(aGPRSNotifyQoS);
|
|
65 |
|
|
66 |
//Profile data
|
|
67 |
aGPRSQoSReqConfig.iMinDelay = RPacketQoS::EDelayClass1;
|
|
68 |
aGPRSQoSReqConfig.iMinMeanThroughput = RPacketQoS::EMeanThroughput200;
|
|
69 |
aGPRSQoSReqConfig.iMinPeakThroughput = RPacketQoS::EPeakThroughput16000;
|
|
70 |
aGPRSQoSReqConfig.iMinPrecedence = RPacketQoS::EPriorityLowPrecedence;
|
|
71 |
aGPRSQoSReqConfig.iMinReliability = RPacketQoS::EReliabilityClass1;
|
|
72 |
aGPRSQoSReqConfig.iReqDelay = RPacketQoS::EDelayClass2;
|
|
73 |
aGPRSQoSReqConfig.iReqMeanThroughput = RPacketQoS::EMeanThroughput2000;
|
|
74 |
aGPRSQoSReqConfig.iReqPeakThroughput = RPacketQoS::EPeakThroughput64000;
|
|
75 |
aGPRSQoSReqConfig.iReqPrecedence = RPacketQoS::EPriorityMediumPrecedence;
|
|
76 |
aGPRSQoSReqConfig.iReqReliability = RPacketQoS::EReliabilityClass2;
|
|
77 |
|
|
78 |
//post the notification
|
|
79 |
iGPRSPacketqos.NotifyProfileChanged(notifyStatus, aGPRSNotifyQoSPckg);
|
|
80 |
//Set the config
|
|
81 |
iGPRSPacketqos.SetProfileParameters(reqStatus, aGPRSQoSReqPckg);
|
|
82 |
|
|
83 |
User::WaitForRequest(notifyStatus);
|
|
84 |
User::WaitForRequest(reqStatus);
|
|
85 |
|
|
86 |
TESTL(aGPRSNotifyQoS.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
|
|
87 |
TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
|
|
88 |
TESTL(aGPRSNotifyQoS.iDelay == RPacketQoS::EDelayClass2);
|
|
89 |
TESTL(aGPRSNotifyQoS.iMeanThroughput == RPacketQoS::EMeanThroughput2000);
|
|
90 |
TESTL(aGPRSNotifyQoS.iPeakThroughput == RPacketQoS::EPeakThroughput64000);
|
|
91 |
TESTL(aGPRSNotifyQoS.iPrecedence == RPacketQoS::EPriorityMediumPrecedence);
|
|
92 |
TESTL(aGPRSNotifyQoS.iReliability == RPacketQoS::EReliabilityClass2);
|
|
93 |
|
|
94 |
// post a notification
|
|
95 |
TRequestStatus cancelStatus;
|
|
96 |
iGPRSPacketqos.NotifyProfileChanged(cancelStatus, aGPRSNotifyQoSPckg);
|
|
97 |
iGPRSPacketqos.CancelAsyncRequest(EPacketQoSNotifyProfileChanged);
|
|
98 |
User::WaitForRequest(cancelStatus);
|
|
99 |
|
|
100 |
TESTL(cancelStatus.Int()==KErrCancel);
|
|
101 |
INFO_PRINTF1(_L("Set Profile Test passed"));
|
|
102 |
|
|
103 |
// need to call Notify first to set pending to true after
|
|
104 |
// cancel event which sets it to false
|
|
105 |
iGPRSPacketqos.NotifyProfileChanged(notifyStatus, aGPRSNotifyQoSPckg);
|
|
106 |
iGPRSPacketqos.SetProfileParameters(reqStatus, aGPRSQoSReqPckg);
|
|
107 |
User::WaitForRequest(notifyStatus);
|
|
108 |
TESTL(notifyStatus.Int()==KErrNone);
|
|
109 |
User::WaitForRequest(reqStatus);
|
|
110 |
TESTL(reqStatus.Int()==KErrNone);
|
|
111 |
|
|
112 |
// test RPacketContext::Activate - before calling ModifyActiveContext
|
|
113 |
StartNTRasSimulation();
|
|
114 |
iFirstPrimaryPacketContext.Activate(reqStatus);
|
|
115 |
User::WaitForRequest(reqStatus);
|
|
116 |
TESTL(reqStatus.Int()==KErrNone);
|
|
117 |
INFO_PRINTF1(_L("Activate test passed"));
|
|
118 |
|
|
119 |
// test RPacketContext::ModifyActiveContext - it shouldn't work unless
|
|
120 |
// a profile/tft has changed since activation
|
|
121 |
TRequestStatus modifyStatus;
|
|
122 |
iFirstPrimaryPacketContext.ModifyActiveContext(modifyStatus);
|
|
123 |
User::WaitForRequest(modifyStatus);
|
|
124 |
TESTL(modifyStatus.Int()==KErrNotReady);
|
|
125 |
iGPRSPacketqos.SetProfileParameters(reqStatus, aGPRSQoSReqPckg);
|
|
126 |
User::WaitForRequest(reqStatus);
|
|
127 |
TESTL(reqStatus.Int()==KErrNone);
|
|
128 |
iFirstPrimaryPacketContext.ModifyActiveContext(modifyStatus);
|
|
129 |
User::WaitForRequest(modifyStatus);
|
|
130 |
TESTL(modifyStatus.Int()==KErrNone);
|
|
131 |
INFO_PRINTF1(_L("ModifyActiveContext Test Passed"));
|
|
132 |
INFO_PRINTF1(_L("Notify GPRS QoS Profile Test passed"));
|
|
133 |
|
|
134 |
// Get QoS GPRS Capabilities
|
|
135 |
RPacketQoS::TQoSCapsGPRS aQoSCaps;
|
|
136 |
TPckg<RPacketQoS::TQoSCapsGPRS> aQoSCapsPckg(aQoSCaps);
|
|
137 |
|
|
138 |
iGPRSPacketqos.GetProfileCapabilities(reqStatus, aQoSCapsPckg);
|
|
139 |
User::WaitForRequest(reqStatus);
|
|
140 |
TESTL(reqStatus.Int()==KErrNone);
|
|
141 |
TESTL(aQoSCaps.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
|
|
142 |
TESTL(aQoSCaps.iDelay == RPacketQoS::EDelayClass2);
|
|
143 |
TESTL(aQoSCaps.iMean == RPacketQoS::EMeanThroughput100);
|
|
144 |
TESTL(aQoSCaps.iPeak == RPacketQoS::EPeakThroughput64000);
|
|
145 |
TESTL(aQoSCaps.iPrecedence == RPacketQoS::EPriorityMediumPrecedence);
|
|
146 |
TESTL(aQoSCaps.iReliability == RPacketQoS::EReliabilityClass2);
|
|
147 |
INFO_PRINTF1(_L("Get QoS Profile Capabilities Test passed"));
|
|
148 |
|
|
149 |
//Get QoS Profile Params
|
|
150 |
RPacketQoS::TQoSGPRSNegotiated aGPRSQoSNegConfig;
|
|
151 |
TPckg<RPacketQoS::TQoSGPRSNegotiated> aGPRSQoSNegPckg(aGPRSQoSNegConfig);
|
|
152 |
|
|
153 |
iGPRSPacketqos.GetProfileParameters(cancelStatus, aGPRSQoSNegPckg);
|
|
154 |
iGPRSPacketqos.CancelAsyncRequest(EPacketQoSGetProfileParams);//no implementation-does nothing
|
|
155 |
User::WaitForRequest(cancelStatus);
|
|
156 |
TESTL(cancelStatus.Int()==KErrNone);
|
|
157 |
|
|
158 |
TESTL(aGPRSQoSNegConfig.ExtensionId()==TPacketDataConfigBase::KConfigGPRS);
|
|
159 |
TESTL(aGPRSQoSNegConfig.iDelay==RPacketQoS::EDelayClass2);
|
|
160 |
TESTL(aGPRSQoSNegConfig.iMeanThroughput==RPacketQoS::EMeanThroughput100);
|
|
161 |
TESTL(aGPRSQoSNegConfig.iPeakThroughput==RPacketQoS::EPeakThroughput64000);
|
|
162 |
TESTL(aGPRSQoSNegConfig.iPrecedence==RPacketQoS::EPriorityMediumPrecedence);
|
|
163 |
TESTL(aGPRSQoSNegConfig.iReliability==RPacketQoS::EReliabilityClass2);
|
|
164 |
INFO_PRINTF1(_L("Get QoS Profile Test passed"));
|
|
165 |
|
|
166 |
// End of RPacketQos tests
|
|
167 |
iGPRSPacketqos.Close();
|
|
168 |
iFirstPrimaryPacketContext.Close();
|
|
169 |
iPacketService.Close();
|
|
170 |
iPhone.Close();
|
|
171 |
ASSERT(RThread().RequestCount()==0);
|
|
172 |
|
|
173 |
return TestStepResult();
|
|
174 |
}
|
|
175 |
|