|
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 mtlr16Step.cpp |
|
20 @internalTechnology |
|
21 */ |
|
22 #include "mtlr16Step.h" |
|
23 #include "te_suplprotocolsuitedefs.h" |
|
24 |
|
25 /** |
|
26 Destructor |
|
27 */ |
|
28 Cmtlr16Step::~Cmtlr16Step() |
|
29 |
|
30 { |
|
31 } |
|
32 |
|
33 /** |
|
34 Constructor |
|
35 */ |
|
36 Cmtlr16Step::Cmtlr16Step() |
|
37 { |
|
38 SetTestStepName(Kmtlr16Step); |
|
39 } |
|
40 |
|
41 /** |
|
42 @return - TVerdict code |
|
43 Override of base class virtual |
|
44 */ |
|
45 TVerdict Cmtlr16Step::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 Cmtlr16Step test step. |
|
62 |
|
63 MT-LR - cancel before Privacy Response received. |
|
64 Protocol Module should connect and send SUPL END with error code |
|
65 indicating user denied request |
|
66 |
|
67 @return TVerdict test result code |
|
68 */ |
|
69 TVerdict Cmtlr16Step::doTestStepL() |
|
70 { |
|
71 INFO_PRINTF1(_L("\t********************************************************************")); |
|
72 INFO_PRINTF1(_L("\tMTLR - Cancel before Privacy Response received")); |
|
73 INFO_PRINTF1(_L("\t********************************************************************")); |
|
74 INFO_PRINTF1(_L("- START -")); |
|
75 |
|
76 // Initiate MT-LR |
|
77 // Generate received SUPL INIT message (test message content #0) |
|
78 TPtr8 messagePtr(iReceiveBuffer.Des()); |
|
79 TInt err = iSuplInitGenerator->GenerateSuplInitL(0, messagePtr); |
|
80 if (err != KErrNone) |
|
81 { |
|
82 SetTestStepResult(EFail); |
|
83 return TestStepResult(); |
|
84 } |
|
85 |
|
86 // Inject SUPL INIT using the SUPL Push API |
|
87 INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()")); |
|
88 TLbsSuplPushRequestId reqId = 12345; |
|
89 TPtrC8 message(messagePtr); |
|
90 iSuplPush->SuplInit(reqId, message, 0); |
|
91 |
|
92 // Check Gateway receives a Privacy request and Location Request |
|
93 INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()")); |
|
94 if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) || |
|
95 !iGatewayObserver->IsPrivReqReceived() || |
|
96 MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() ) |
|
97 { |
|
98 SetTestStepResult(EFail); |
|
99 return TestStepResult(); |
|
100 } |
|
101 |
|
102 // Inject a RespondLocationRequest() with aReason == KErrCancel |
|
103 INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest (KErrCancel)")); |
|
104 TPositionInfo mobilePosInfo; |
|
105 iModule->RespondLocationRequest(iGatewayObserver->SessionIdValue(), KErrCancel, mobilePosInfo); |
|
106 |
|
107 // Check gateway session completes |
|
108 if (EFail == CheckGatewayCallbackL( |
|
109 CSuplGatewayObserver::EProcessSessionComplete)) |
|
110 { |
|
111 SetTestStepResult(EFail); |
|
112 return TestStepResult(); |
|
113 } |
|
114 INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); |
|
115 |
|
116 // Check if more observer activity takes place |
|
117 if (iGatewayObserver->IsMoreObserverActivity() || |
|
118 iNetworkObserver->IsMoreObserverActivity()) |
|
119 { |
|
120 SetTestStepResult(EFail); |
|
121 return TestStepResult(); |
|
122 } |
|
123 INFO_PRINTF1(_L("- END -")); |
|
124 |
|
125 SetTestStepResult(EPass); |
|
126 return TestStepResult(); |
|
127 } |
|
128 |
|
129 |
|
130 /** |
|
131 * @return - TVerdict code |
|
132 * Override of base class virtual |
|
133 */ |
|
134 TVerdict Cmtlr16Step::doTestStepPostambleL() |
|
135 { |
|
136 delete iModule; |
|
137 |
|
138 delete iSuplPush; |
|
139 delete iSuplInitGenerator; |
|
140 |
|
141 // Call base class method for post test actions |
|
142 CTe_suplprotocolSuiteStepBase::doTestStepPostambleL(); |
|
143 return TestStepResult(); |
|
144 } |
|
145 |
|
146 |
|
147 /** |
|
148 Overrides the pure virtual MLbsSuplPushObserver::OnSuplInitComplete. |
|
149 Receives the result of the message sending. |
|
150 |
|
151 @param aError [In] The error code or KErrNone if successful. |
|
152 |
|
153 @see MTe_LbsSuplSmsTriggerSenderObserver::OnMessageSent |
|
154 @see CTe_LbsSuplSmsTriggerSender::SendMessage |
|
155 */ |
|
156 void Cmtlr16Step::OnSuplInitComplete(TLbsSuplPushChannel /*aChannel*/, TLbsSuplPushRequestId /*aReqId*/, TInt aError, TInt /*aReserved*/) |
|
157 { |
|
158 iSmsSendError = aError; |
|
159 if (iSmsSendError != KErrNone) |
|
160 { |
|
161 User::Invariant(); |
|
162 } |
|
163 } |
|
164 |