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_SimPacketRel99ContextTest.h"
|
|
17 |
|
|
18 |
CSimPacketRel99ContextTest::CSimPacketRel99ContextTest()
|
|
19 |
{
|
|
20 |
SetTestStepName(_L("Rel99ContextTest"));
|
|
21 |
}
|
|
22 |
|
|
23 |
TVerdict CSimPacketRel99ContextTest::doTestStepL()
|
|
24 |
{
|
|
25 |
INFO_PRINTF1(_L("BeginPacketRel99ContextTest"));
|
|
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 |
|
|
35 |
TESTL(iRel99PacketService.Open(iPhone)==KErrNone);
|
|
36 |
INFO_PRINTF1(_L("Opened Packet object"));
|
|
37 |
|
|
38 |
TRequestStatus reqStatus;
|
|
39 |
TRequestStatus notifyStatus;
|
|
40 |
|
|
41 |
// test RPacketContext::OpenNewContext
|
|
42 |
TName rel99ContextName;
|
|
43 |
TName rel99ContextNameCompare;
|
|
44 |
TESTL(iRel99PacketContext.OpenNewContext(iRel99PacketService, rel99ContextName)==KErrNone);
|
|
45 |
rel99ContextNameCompare.Append(KSimPrimaryPacketContextName);
|
|
46 |
rel99ContextNameCompare.AppendNum(1);
|
|
47 |
TESTL(rel99ContextName.Compare(rel99ContextNameCompare)==KErrNone);
|
|
48 |
INFO_PRINTF1(_L("Opened Rel99 Context object"));
|
|
49 |
|
|
50 |
// UMTS Rel99
|
|
51 |
RPacketContext::TContextConfigR99_R4 rel99ContextConfig;
|
|
52 |
|
|
53 |
TESTL(rel99ContextConfig.ExtensionId()==TPacketDataConfigBase::KConfigRel99Rel4);
|
|
54 |
TPckg<RPacketContext::TContextConfigR99_R4> contextConfigPckgRel99(rel99ContextConfig);
|
|
55 |
|
|
56 |
rel99ContextConfig.iAccessPointName = DPCKTTSY_ACCESS_POINT1;
|
|
57 |
rel99ContextConfig.iPdpAddress = DPCKTTSY_PDP_ADDRESS1;
|
|
58 |
rel99ContextConfig.iPdpType = DPCKTTSY_PDP_TYPE1;
|
|
59 |
rel99ContextConfig.iUseEdge = DPCKTTSY_EGPRS_REQUIRED;
|
|
60 |
rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iProtocol = SIM_PACKET_CONTEXT_PROTOCOL2;
|
|
61 |
rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iUsername = SIM_PACKET_CONTEXT_USERNAME2;
|
|
62 |
rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iPassword = SIM_PACKET_CONTEXT_PASSWORD2;
|
|
63 |
rel99ContextConfig.iProtocolConfigOption.iChallenge = SIM_PACKET_CONTEXT_CHALLENGE2;
|
|
64 |
rel99ContextConfig.iProtocolConfigOption.iResponse = SIM_PACKET_CONTEXT_RESPONSE2;
|
|
65 |
rel99ContextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns = SIM_PACKET_CONTEXT_PRIMARYSERVER2;
|
|
66 |
rel99ContextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns = SIM_PACKET_CONTEXT_SECONDARYSERVER2;
|
|
67 |
rel99ContextConfig.iProtocolConfigOption.iId = SIM_PACKET_CONTEXT_ID2;
|
|
68 |
|
|
69 |
iRel99PacketContext.NotifyConfigChanged(notifyStatus, contextConfigPckgRel99);
|
|
70 |
iRel99PacketContext.SetConfig(reqStatus, contextConfigPckgRel99);
|
|
71 |
User::WaitForRequest(notifyStatus);
|
|
72 |
TESTL(notifyStatus.Int()==KErrNone);
|
|
73 |
User::WaitForRequest(reqStatus);
|
|
74 |
TESTL(reqStatus.Int()==KErrNone);
|
|
75 |
CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.14"));
|
|
76 |
INFO_PRINTF1(_L("SetConfig Rel99 test passed"));
|
|
77 |
|
|
78 |
TESTL(rel99ContextConfig.iAccessPointName == DPCKTTSY_ACCESS_POINT1);
|
|
79 |
TESTL(rel99ContextConfig.iPdpAddress == DPCKTTSY_PDP_ADDRESS1);
|
|
80 |
TESTL(rel99ContextConfig.iPdpType == DPCKTTSY_PDP_TYPE1);
|
|
81 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iProtocol == SIM_PACKET_CONTEXT_PROTOCOL2);
|
|
82 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iUsername == SIM_PACKET_CONTEXT_USERNAME2);
|
|
83 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iPassword == SIM_PACKET_CONTEXT_PASSWORD2);
|
|
84 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iChallenge == SIM_PACKET_CONTEXT_CHALLENGE2);
|
|
85 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iResponse == SIM_PACKET_CONTEXT_RESPONSE2);
|
|
86 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns == SIM_PACKET_CONTEXT_PRIMARYSERVER2);
|
|
87 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns == SIM_PACKET_CONTEXT_SECONDARYSERVER2);
|
|
88 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iId == SIM_PACKET_CONTEXT_ID2);
|
|
89 |
|
|
90 |
INFO_PRINTF1(_L("NotifyConfigChanged Rel99 Test Passed"));
|
|
91 |
|
|
92 |
iRel99PacketContext.SetConfig(reqStatus, contextConfigPckgRel99);
|
|
93 |
iRel99PacketContext.CancelAsyncRequest(EPacketContextSetConfig);
|
|
94 |
User::WaitForRequest(reqStatus);
|
|
95 |
TESTL(reqStatus.Int()==KErrNone); //not supporting cancel of setconfig umts
|
|
96 |
CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.17"));
|
|
97 |
INFO_PRINTF1(_L("SetConfig Cancel Rel99 test passed"));
|
|
98 |
// UMTS Rel99 tests finished
|
|
99 |
|
|
100 |
// GetConfig - UMTS Rel99
|
|
101 |
iRel99PacketContext.GetConfig(reqStatus, contextConfigPckgRel99);
|
|
102 |
User::WaitForRequest(reqStatus);
|
|
103 |
TESTL(rel99ContextConfig.iAccessPointName == DPCKTTSY_ACCESS_POINT1);
|
|
104 |
TESTL(rel99ContextConfig.iPdpAddress == DPCKTTSY_PDP_ADDRESS1);
|
|
105 |
TESTL(rel99ContextConfig.iPdpType == DPCKTTSY_PDP_TYPE1);
|
|
106 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iProtocol == SIM_PACKET_CONTEXT_PROTOCOL2);
|
|
107 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iUsername == SIM_PACKET_CONTEXT_USERNAME2);
|
|
108 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iAuthInfo.iPassword == SIM_PACKET_CONTEXT_PASSWORD2);
|
|
109 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iChallenge == SIM_PACKET_CONTEXT_CHALLENGE2);
|
|
110 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iResponse == SIM_PACKET_CONTEXT_RESPONSE2);
|
|
111 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iDnsAddresses.iPrimaryDns == SIM_PACKET_CONTEXT_PRIMARYSERVER2);
|
|
112 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iDnsAddresses.iSecondaryDns == SIM_PACKET_CONTEXT_SECONDARYSERVER2);
|
|
113 |
TESTL(rel99ContextConfig.iProtocolConfigOption.iId == SIM_PACKET_CONTEXT_ID2);
|
|
114 |
|
|
115 |
CHECKPOINTL(reqStatus.Int(),KErrNone,CHP_CNTXT_CASE("E.20"));
|
|
116 |
INFO_PRINTF1(_L("GetConfig UMTS test passed"));
|
|
117 |
|
|
118 |
// now test the getting of DNS server names
|
|
119 |
RPacketContext::TDnsInfoV2 dnsInfoV2;
|
|
120 |
RPacketContext::TTDnsInfoV2Pckg dnsInfoV2pckg(dnsInfoV2);
|
|
121 |
|
|
122 |
iRel99PacketContext.GetDnsInfo(reqStatus, dnsInfoV2pckg);
|
|
123 |
User::WaitForRequest(reqStatus);
|
|
124 |
|
|
125 |
TESTL(dnsInfoV2.iPrimaryDns==SIM_PACKET_CONTEXT_PRIMARYSERVER2);
|
|
126 |
TESTL(dnsInfoV2.iSecondaryDns==SIM_PACKET_CONTEXT_SECONDARYSERVER2);
|
|
127 |
|
|
128 |
TESTL(reqStatus.Int()==KErrNone);
|
|
129 |
INFO_PRINTF1(_L("GetDnsInfo Test Passed"));
|
|
130 |
|
|
131 |
iRel99PacketContext.GetDnsInfo(reqStatus, dnsInfoV2pckg);
|
|
132 |
iRel99PacketContext.CancelAsyncRequest(EPacketContextGetDNSInfo);
|
|
133 |
User::WaitForRequest(reqStatus);
|
|
134 |
TESTL(reqStatus.Int()==KErrNone);
|
|
135 |
INFO_PRINTF1(_L("GetDnsInfoCancel Test Passed"));
|
|
136 |
|
|
137 |
iRel99PacketContext.Close();
|
|
138 |
iRel99PacketService.Close();
|
|
139 |
iPhone.Close();
|
|
140 |
ASSERT(RThread().RequestCount()==0);
|
|
141 |
|
|
142 |
return TestStepResult();
|
|
143 |
}
|
|
144 |
|