|
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 // Example CTestStep derived implementation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file mtlr18Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "mtlr18Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmtlr18Step::~Cmtlr18Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmtlr18Step::Cmtlr18Step() |
|
37 { |
|
38 SetTestStepName(Kmtlr18Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmtlr18Step::doTestStepPreambleL() |
|
46 { |
|
47 // Call base class method for pre test actions |
|
48 CTe_suplprotocolSuiteStepBase::doTestStepPreambleL(); |
|
49 |
|
50 TLbsNetProtocolModuleParams param(*iGatewayObserver); |
|
51 iModule = CSuplGatewayInterface::NewL(reinterpret_cast<TAny*>(¶m)); |
|
52 |
|
53 // components for generating incoming SMS SUPL INIT |
|
54 iSuplPush = CLbsSuplPush::NewL(ELbsSuplPushChannelSMS, *this); |
|
55 iSuplInitGenerator = CSuplInitGenerator::NewL(); |
|
56 |
|
57 return TestStepResult(); |
|
58 } |
|
59 |
|
60 |
|
61 /** Perform Cmtlr18Step test step. |
|
62 |
|
63 MT-LR - cancel after Privacy Response accepted and connection requested, |
|
64 but before connection is set up. |
|
65 |
|
66 Protocol Module should continue the connect and send SUPL END with error code |
|
67 indicating user denied request |
|
68 |
|
69 @return TVerdict test result code |
|
70 */ |
|
71 TVerdict Cmtlr18Step::doTestStepL() |
|
72 { |
|
73 INFO_PRINTF1(_L("\t********************************************************************")); |
|
74 INFO_PRINTF1(_L("\tMTLR - Cancel after Connect requested / before Connected response received")); |
|
75 INFO_PRINTF1(_L("\t********************************************************************")); |
|
76 INFO_PRINTF1(_L("- START -")); |
|
77 |
|
78 // Initiate MT-LR |
|
79 // Generate received SUPL INIT message (test message content #0) |
|
80 TPtr8 messagePtr(iReceiveBuffer.Des()); |
|
81 TInt err = iSuplInitGenerator->GenerateSuplInitL(0, messagePtr); |
|
82 if (err != KErrNone) |
|
83 { |
|
84 SetTestStepResult(EFail); |
|
85 return TestStepResult(); |
|
86 } |
|
87 |
|
88 // Inject SUPL INIT using the SUPL Push API |
|
89 INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()")); |
|
90 TLbsSuplPushRequestId reqId = 12345; |
|
91 TPtrC8 message(messagePtr); |
|
92 iSuplPush->SuplInit(reqId, message, 0); |
|
93 |
|
94 // Check Gateway receives a Privacy request and Location Request (no method specified) |
|
95 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
96 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || |
|
97 !iGatewayObserver->IsPrivReqReceived() || |
|
98 MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() ) |
|
99 { |
|
100 SetTestStepResult(EFail); |
|
101 return TestStepResult(); |
|
102 } |
|
103 |
|
104 // LBS delivers privacy response |
|
105 INFO_PRINTF1(_L("\tLBS -> PrivacyResponse (EPrivacyResponseAccepted)")); |
|
106 CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted; |
|
107 iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0); |
|
108 |
|
109 // Check Connection Manager receives a request for connecting |
|
110 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq)) |
|
111 { |
|
112 SetTestStepResult(EFail); |
|
113 return TestStepResult(); |
|
114 } |
|
115 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET")); |
|
116 |
|
117 // Inject a RespondLocationRequest() with aReason == KErrCancel |
|
118 INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest (KErrCancel)")); |
|
119 TPositionInfo mobilePosInfo; |
|
120 iModule->RespondLocationRequest(iGatewayObserver->SessionIdValue(), KErrCancel, mobilePosInfo); |
|
121 |
|
122 // Simulate the connection is up (inject that event) |
|
123 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET")); |
|
124 iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId()); |
|
125 |
|
126 // Check gateway session completes |
|
127 if (EFail == CheckGatewayCallbackL( |
|
128 CSuplGatewayObserver::EProcessSessionComplete)) |
|
129 { |
|
130 SetTestStepResult(EFail); |
|
131 return TestStepResult(); |
|
132 } |
|
133 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
134 |
|
135 // Check the Connection Manager receives a request to send a SUPL END |
|
136 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq)) |
|
137 { |
|
138 SetTestStepResult(EFail); |
|
139 return TestStepResult(); |
|
140 } |
|
141 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET")); |
|
142 |
|
143 // Check Connection Manager receives a disconnection request |
|
144 if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq)) |
|
145 { |
|
146 SetTestStepResult(EFail); |
|
147 return TestStepResult(); |
|
148 } |
|
149 INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET")); |
|
150 |
|
151 // Check if more observer activity takes place |
|
152 if (iGatewayObserver->IsMoreObserverActivity() || |
|
153 iNetworkObserver->IsMoreObserverActivity()) |
|
154 { |
|
155 SetTestStepResult(EFail); |
|
156 return TestStepResult(); |
|
157 } |
|
158 INFO_PRINTF1(_L("- END -")); |
|
159 |
|
160 SetTestStepResult(EPass); |
|
161 return TestStepResult(); |
|
162 } |
|
163 |
|
164 |
|
165 /** |
|
166 * @return - TVerdict code |
|
167 * Override of base class virtual |
|
168 */ |
|
169 TVerdict Cmtlr18Step::doTestStepPostambleL() |
|
170 { |
|
171 delete iModule; |
|
172 |
|
173 delete iSuplPush; |
|
174 delete iSuplInitGenerator; |
|
175 |
|
176 // Call base class method for post test actions |
|
177 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
178 return TestStepResult(); |
|
179 } |
|
180 |
|
181 |
|
182 /** |
|
183 Overrides the pure virtual MLbsSuplPushObserver::OnSuplInitComplete. |
|
184 Receives the result of the message sending. |
|
185 |
|
186 @param aError [In] The error code or KErrNone if successful. |
|
187 |
|
188 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent |
|
189 @see CTe_LbsSuplSmsTriggerSender::SendMessage |
|
190 */ |
|
191 void Cmtlr18Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) |
|
192 { |
|
193 iSmsSendError = aError; |
|
194 if (iSmsSendError != KErrNone) |
|
195 { |
|
196 User::Invariant(); |
|
197 } |
|
198 } |
|
199 |