|
1 // Copyright (c) 2001-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 // CsdAgtTestStateMachineInit.cpp |
|
15 // This contains CsdAgt TestCase Test 5.1 - 5.15 |
|
16 // |
|
17 // |
|
18 |
|
19 // EPOC includes |
|
20 #include <e32base.h> |
|
21 #include <in_sock.h> |
|
22 #include <dummyetel.h> // include here to avoid picking up the real etel.h |
|
23 #include <etelmm.h> |
|
24 #include <nd_err.h> |
|
25 |
|
26 // Test system includes |
|
27 #include "log.h" |
|
28 #include "teststep.h" |
|
29 #include "TestStepCsdAgt.h" |
|
30 #include "TestSuiteCsdAgt.h" |
|
31 |
|
32 // COMMDB Database Undo |
|
33 #include "DbUndo.h" |
|
34 // EFinishedDialling |
|
35 #include <csdprog.h> |
|
36 |
|
37 // Class definitions |
|
38 #include "CsdAgtTestScriptErr.h" |
|
39 |
|
40 |
|
41 // The tests in this file test the following script processing conditions: |
|
42 // |
|
43 // KErrNoExpression |
|
44 // KErrMissingQuote |
|
45 // KErrVariableNotFound |
|
46 // KErrInvalidNumber |
|
47 // KErrNumberOutOfRange |
|
48 // KErrNoEquals |
|
49 // KErrNoOpenExpresion |
|
50 // KErrNestedLoop |
|
51 // KErrLoopCounterOutOfRange |
|
52 // KErrMissingChevron |
|
53 // KErrIllegalCommand |
|
54 // KErrNoDropOrRaise |
|
55 // KErrVariableNameTooLong |
|
56 // KErrMissingBracket |
|
57 // KErrExitScriptTimeOut |
|
58 // KErrCharacterSetDoesNotExist |
|
59 // |
|
60 // In fact, apart from KErrExitScriptTimeOut, these are all error values internal to csdagt, and get reduced to |
|
61 // KErrExitScriptError before they are visible to the test harness. |
|
62 // If you need to check that a specific error value was generated for a test, then the |
|
63 // information is logged in Logs\Netdial\NetDial.txt |
|
64 // You then need to check the error represented by the logged number in nd_std.h |
|
65 // |
|
66 |
|
67 void CCsdAgtTest5_xx::CustomiseLoginScriptL(const TDesC16& aLoginScript) |
|
68 { |
|
69 csd = CDbCsdTable::NewL(); |
|
70 CleanupStack::PushL(csd); |
|
71 |
|
72 csd->SetColumnBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue); |
|
73 csd->SetColumnLongTextL(TPtrC(ISP_LOGIN_SCRIPT),aLoginScript); |
|
74 } |
|
75 void CCsdAgtTest5_xx::RevertCommdbChangesL() |
|
76 { |
|
77 Log(_L("Reverting COMMDB changes")); |
|
78 |
|
79 csd->UndoDatabaseChangesL(); |
|
80 |
|
81 CleanupStack::PopAndDestroy(csd); |
|
82 } |
|
83 |
|
84 |
|
85 enum TVerdict CCsdAgtTest5_xx::DoScriptErrTestL(TInt aTestNo, const TDesC& aLoginScript) |
|
86 { |
|
87 char OK = 1; |
|
88 |
|
89 TInt ret = KErrGeneral; |
|
90 |
|
91 TRealAgtNotify AgtNotify; |
|
92 |
|
93 AgtNotify.SetTestCase(aTestNo); |
|
94 |
|
95 if(OK) |
|
96 { |
|
97 TRAP(ret,SetGSMModeL(AgtNotify)); |
|
98 OK = (ret == KErrNone); |
|
99 } |
|
100 |
|
101 // Set up the login script to use. |
|
102 if(OK) |
|
103 CustomiseLoginScriptL(aLoginScript); |
|
104 |
|
105 if(OK) |
|
106 { |
|
107 switch(aTestNo) |
|
108 { |
|
109 case 10515: // special case - timeout gets reported as such |
|
110 case 10517: |
|
111 case 10518: |
|
112 { |
|
113 TRAP(ret,ConnectExpectErrorL(KErrExitScriptTimeOut,ECsdFinishedLogIn)); |
|
114 } |
|
115 break; |
|
116 case 10516: // no error expected here. |
|
117 { |
|
118 TRAP(ret,NormalConnectL()); |
|
119 } |
|
120 break; |
|
121 default: |
|
122 { |
|
123 TRAP(ret,ConnectExpectErrorL(KErrExitScriptError,ECsdFinishedLogIn)); |
|
124 } |
|
125 break; |
|
126 } |
|
127 } |
|
128 if(OK) OK = (ret == KErrNone); |
|
129 |
|
130 // Close database object, forcing it to undo all changes that were made |
|
131 RevertCommdbChangesL(); |
|
132 |
|
133 return(OK ? EPass : EFail); |
|
134 } |
|
135 enum TVerdict CCsdAgtTest5_1::doCsdAgtTestStepL( void ) |
|
136 { |
|
137 iTestStepResult = DoScriptErrTestL(10501, _L("SEND\n")); |
|
138 return(iTestStepResult); |
|
139 } |
|
140 enum TVerdict CCsdAgtTest5_2::doCsdAgtTestStepL( void ) |
|
141 { |
|
142 iTestStepResult = DoScriptErrTestL(10502, _L("SEND \"AT+<0x0d>\n")); |
|
143 return(iTestStepResult); |
|
144 } |
|
145 enum TVerdict CCsdAgtTest5_3::doCsdAgtTestStepL( void ) |
|
146 { |
|
147 iTestStepResult = DoScriptErrTestL(10503, _L("SEND login_init11$+<0x0d>\n")); |
|
148 return(iTestStepResult); |
|
149 } |
|
150 enum TVerdict CCsdAgtTest5_4::doCsdAgtTestStepL( void ) |
|
151 { |
|
152 iTestStepResult = DoScriptErrTestL(10504, _L("LOOP 2147483648\n{\n}\nExit KErrNoModem$\nalive:\n")); |
|
153 return(iTestStepResult); |
|
154 } |
|
155 enum TVerdict CCsdAgtTest5_5::doCsdAgtTestStepL( void ) |
|
156 { |
|
157 iTestStepResult = DoScriptErrTestL(10505, _L("WAIT 500001\n{\n\"OK\" alive\n}\nExit KErrNoModem$\nalive:\n")); |
|
158 return(iTestStepResult); |
|
159 } |
|
160 enum TVerdict CCsdAgtTest5_6::doCsdAgtTestStepL( void ) |
|
161 { |
|
162 iTestStepResult = DoScriptErrTestL(10506, _L("SET err$ 0\n")); |
|
163 return(iTestStepResult); |
|
164 } |
|
165 enum TVerdict CCsdAgtTest5_7::doCsdAgtTestStepL( void ) |
|
166 { |
|
167 iTestStepResult = DoScriptErrTestL(10507, _L("WAIT 10\n\"OK\" alive\n}\nExit KErrNoModem$\nalive:\n")); |
|
168 return(iTestStepResult); |
|
169 } |
|
170 enum TVerdict CCsdAgtTest5_8::doCsdAgtTestStepL( void ) |
|
171 { |
|
172 iTestStepResult = DoScriptErrTestL(10508, _L("LOOP 2\n{\nSEND \"AT\"+<0xd>\nLOOP 4\n{\nSEND \"AT\"+<0xd>\n}\n}\n")); |
|
173 return(iTestStepResult); |
|
174 } |
|
175 enum TVerdict CCsdAgtTest5_9::doCsdAgtTestStepL( void ) |
|
176 { |
|
177 iTestStepResult = DoScriptErrTestL(10509, _L("LOOP 10001\n{\nSEND \"AT\"+<0xd>\n}\n")); |
|
178 return(iTestStepResult); |
|
179 } |
|
180 enum TVerdict CCsdAgtTest5_10::doCsdAgtTestStepL( void ) |
|
181 { |
|
182 iTestStepResult = DoScriptErrTestL(10510, _L("SEND \"AT\"+<0x0d\n")); |
|
183 return(iTestStepResult); |
|
184 } |
|
185 enum TVerdict CCsdAgtTest5_11::doCsdAgtTestStepL( void ) |
|
186 { |
|
187 iTestStepResult = DoScriptErrTestL(10511, _L("WIAT 10\n{\n\"OK\" alive\n}\nExit KErrNoModem$\nalive:\n")); |
|
188 return(iTestStepResult); |
|
189 } |
|
190 enum TVerdict CCsdAgtTest5_12::doCsdAgtTestStepL( void ) |
|
191 { |
|
192 iTestStepResult = DoScriptErrTestL(10512, _L("DTR\n")); |
|
193 return(iTestStepResult); |
|
194 } |
|
195 enum TVerdict CCsdAgtTest5_13::doCsdAgtTestStepL( void ) |
|
196 { |
|
197 iTestStepResult = DoScriptErrTestL(10513, _L("SET e12345678901234567890$=\"hello\"\n")); |
|
198 return(iTestStepResult); |
|
199 } |
|
200 enum TVerdict CCsdAgtTest5_14::doCsdAgtTestStepL( void ) |
|
201 { |
|
202 iTestStepResult = DoScriptErrTestL(10514, _L("SEND \"Hello\"+<0x0d> [UNICODE\n")); |
|
203 return(iTestStepResult); |
|
204 } |
|
205 enum TVerdict CCsdAgtTest5_15::doCsdAgtTestStepL( void ) |
|
206 { |
|
207 iTestStepResult = DoScriptErrTestL(10515, _L("WAIT 3\n{\n}\nExit KErrTimeOut$\n")); |
|
208 return(iTestStepResult); |
|
209 } |
|
210 enum TVerdict CCsdAgtTest5_16::doCsdAgtTestStepL( void ) |
|
211 { |
|
212 iTestStepResult = DoScriptErrTestL(10516, _L("SEND \"Hello\"+<0x0d>\n")); |
|
213 return(iTestStepResult); |
|
214 } |
|
215 enum TVerdict CCsdAgtTest5_17::doCsdAgtTestStepL( void ) |
|
216 { |
|
217 iTestStepResult = DoScriptErrTestL(10517, _L("letsgo:\nWAIT 20\n{\n\"ogin:\" loginok\n}\nGOTO timeout\nloginok:\nSEND login_name$+<0x0d>\nWAIT 20\n{\n\"assword:\" passok\n}\nGOTO timeout\npassok:\nSEND login_pass$+<0x0d>\nWAIT 20\n{\n\"rotocol:\" protocolok\n}\nGOTO lofail\nprotocolok:\nSend \"PPP\"+<0x0d>\nEXIT\ntimeout:\nEXIT KErrTimeOut$\nlofail:\nEXIT KErrLoginFail$\n")); |
|
218 return(iTestStepResult); |
|
219 } |
|
220 enum TVerdict CCsdAgtTest5_18::doCsdAgtTestStepL( void ) |
|
221 { |
|
222 iTestStepResult = DoScriptErrTestL(10518, _L("letsgo:\nWAIT 20\n {\n\"ogin:\" loginok\n}\nGOTO timeout\nloginok:\n! READ\nWAIT 20\n{\n\"assword:\" passok\n}\nGOTO timeout\npassok:\n! READ\nWAIT 20\n{\n\"rotocol:\" protocolok\n}\nGOTO lofail\nprotocolok:\nSend \"PPP\"+<0x0d>\nEXIT\ntimeout:\nEXIT KErrTimeOut$\nlofail:\nEXIT KErrLoginFail$\n")); |
|
223 return(iTestStepResult); |
|
224 } |
|
225 enum TVerdict CCsdAgtTest5_19::doCsdAgtTestStepL( void ) |
|
226 { |
|
227 iTestStepResult = DoScriptErrTestL(10519, _L("CHARMAP [UNKNOWN]\nletsgo:\nWAIT 20\n{\n\"ogin:\" loginok\n}\nGOTO timeout\nloginok:\nWAIT 20\n{\n\"assword:\" passok\n}\nGOTO timeout\npassok:\nWAIT 20\n{\n\"rotocol:\" protocolok\n}\nGOTO lofail\nprotocolok:\nSend \"PPP\"+<0x0d>\nEXIT\ntimeout:\nEXIT KErrTimeOut$\nlofail:\nEXIT KErrLoginFail$\n")); |
|
228 return(iTestStepResult); |
|
229 } |