53
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
* WLAN Wizard UT.
|
|
16 |
*/
|
|
17 |
|
|
18 |
// System includes
|
60
|
19 |
|
53
|
20 |
#include <HbApplication>
|
|
21 |
#include <HbDocumentLoader>
|
|
22 |
#include <HbStackedWidget>
|
|
23 |
#include <HbRadioButtonList>
|
|
24 |
#include <HbAction>
|
|
25 |
#include <HbLineEdit>
|
|
26 |
#include <HbLabel>
|
60
|
27 |
|
53
|
28 |
#include <QGraphicsWidget>
|
|
29 |
#include <QObjectList>
|
|
30 |
#include <QtCore>
|
|
31 |
#include <QTest>
|
|
32 |
#include <QDebug>
|
|
33 |
#include <QList>
|
60
|
34 |
|
53
|
35 |
#include <cmmanagerdefines_shim.h>
|
|
36 |
#include <wlanerrorcodes.h>
|
|
37 |
|
|
38 |
// User includes
|
60
|
39 |
|
53
|
40 |
#include "testwlanwizardconnect.h"
|
|
41 |
#include "testwlanwizardconnect_conf.h"
|
|
42 |
#include "hbautotest.h"
|
|
43 |
#include "wlanwizard.h"
|
|
44 |
#include "wlanwizard_p.h"
|
|
45 |
#include "wlanwizardpagessid.h"
|
|
46 |
#include "wlanqtutils_context.h"
|
|
47 |
#include "wlanqtutils.h"
|
|
48 |
#include "wlanqtutilsap.h"
|
|
49 |
|
|
50 |
// External function prototypes
|
|
51 |
|
|
52 |
// Local constants
|
|
53 |
|
|
54 |
|
|
55 |
// ======== LOCAL FUNCTIONS ========
|
|
56 |
|
|
57 |
// ======== MEMBER FUNCTIONS ========
|
|
58 |
|
|
59 |
|
|
60 |
// ---------------------------------------------------------
|
|
61 |
// TEST CASES
|
|
62 |
// ---------------------------------------------------------
|
|
63 |
|
|
64 |
/*!
|
|
65 |
* Connect to open:
|
|
66 |
* - verifies IAP settings
|
|
67 |
* - ICT success
|
|
68 |
* - Finish button pressed
|
|
69 |
*/
|
|
70 |
void TestWlanWizardConnect::tc_connect_to_open_success()
|
|
71 |
{
|
|
72 |
#ifdef tc_connect_to_open_success_enabled
|
|
73 |
tc_connect_success("tc_connect_to_open_success", CMManagerShim::Infra,
|
|
74 |
CMManagerShim::WlanSecModeOpen, false, "");
|
|
75 |
#endif
|
|
76 |
}
|
|
77 |
|
|
78 |
/*!
|
|
79 |
* Connect to open
|
|
80 |
*/
|
|
81 |
void TestWlanWizardConnect::tc_connect_to_open_success_adhoc()
|
|
82 |
{
|
|
83 |
#ifdef tc_connect_to_open_success_adhoc_enabled
|
|
84 |
tc_connect_success("tc_connect_to_open_success_adhoc", CMManagerShim::Adhoc,
|
|
85 |
CMManagerShim::WlanSecModeOpen, false, "");
|
|
86 |
#endif
|
|
87 |
}
|
|
88 |
|
|
89 |
/*!
|
|
90 |
* Connect to open
|
|
91 |
*/
|
|
92 |
void TestWlanWizardConnect::tc_connect_to_wep_success()
|
|
93 |
{
|
|
94 |
#ifdef tc_connect_to_wep_success_enabled
|
|
95 |
tc_connect_success("tc_connect_to_wep_success", CMManagerShim::Adhoc,
|
|
96 |
CMManagerShim::WlanSecModeWep, false, "abcde");
|
|
97 |
#endif
|
|
98 |
}
|
|
99 |
|
|
100 |
/*!
|
|
101 |
* Connect to open
|
|
102 |
*/
|
|
103 |
void TestWlanWizardConnect::tc_connect_to_wpa_psk_success()
|
|
104 |
{
|
|
105 |
#ifdef tc_connect_to_wpa_psk_success_enabled
|
|
106 |
tc_connect_success("tc_connect_to_wpa_psk_success", CMManagerShim::Infra,
|
|
107 |
CMManagerShim::WlanSecModeWpa, false, "password");
|
|
108 |
#endif
|
|
109 |
}
|
|
110 |
/*!
|
|
111 |
* Connect to open
|
|
112 |
*/
|
|
113 |
void TestWlanWizardConnect::tc_connect_to_wpa2_psk_success()
|
|
114 |
{
|
|
115 |
#ifdef tc_connect_to_wpa2_psk_success_enabled
|
|
116 |
tc_connect_success("tc_connect_to_wpa2_psk_success", CMManagerShim::Adhoc,
|
|
117 |
CMManagerShim::WlanSecModeWpa2, false, "password");
|
|
118 |
#endif
|
|
119 |
}
|
|
120 |
|
|
121 |
/*!
|
|
122 |
* Connect to open:
|
|
123 |
* - Opens
|
|
124 |
* - ICT success
|
|
125 |
* - Cancel pressed in summary page
|
|
126 |
*/
|
|
127 |
void TestWlanWizardConnect::tc_connect_to_open_success_cancel()
|
|
128 |
{
|
|
129 |
#ifdef tc_connect_to_open_success_cancel_enabled
|
|
130 |
|
|
131 |
mWlanQtUtilsContext->setCreateWlanIapResult(3);
|
|
132 |
mWlanQtUtilsContext->setConnectionSuccessed(true);
|
|
133 |
mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
|
|
134 |
mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
|
|
135 |
|
|
136 |
mView->mWizard->setParameters(
|
|
137 |
"tc_connect_to_open_success_cancel",
|
60
|
138 |
"tc_connect_to_open_success_cancel",
|
53
|
139 |
CMManagerShim::Infra,
|
|
140 |
CMManagerShim::WlanSecModeOpen,
|
|
141 |
false,
|
|
142 |
false);
|
|
143 |
|
|
144 |
mView->showWizard();
|
|
145 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "tc_connect_to_open_success_cancel"), true );
|
|
146 |
QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
|
|
147 |
QTest::qWait(WaitTimeForUi);
|
|
148 |
|
|
149 |
// Ignore previous calls
|
|
150 |
mWlanQtUtilsContext->calledMethods();
|
|
151 |
|
|
152 |
QCOMPARE( mouseClickCancel(), true );
|
|
153 |
|
|
154 |
QStringList calledMethods;
|
|
155 |
calledMethods << "disconnectIap" << "deleteIap";
|
|
156 |
|
|
157 |
QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
158 |
QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true);
|
|
159 |
#endif
|
|
160 |
}
|
|
161 |
|
|
162 |
void TestWlanWizardConnect::tc_network_failure_OpenAuthFailed()
|
|
163 |
{
|
|
164 |
#ifdef tc_network_failure_OpenAuthFailed_enabled
|
|
165 |
tc_network_error_codes(
|
|
166 |
"tc_network_failure_OpenAuthFailed",
|
|
167 |
CMManagerShim::Adhoc,
|
|
168 |
CMManagerShim::WlanSecModeOpen,
|
|
169 |
false,
|
|
170 |
"",
|
|
171 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
172 |
KErrWlanOpenAuthFailed );
|
|
173 |
#endif
|
|
174 |
}
|
|
175 |
void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthRequired()
|
|
176 |
{
|
|
177 |
#ifdef tc_network_failure_SharedKeyAuthRequired_enabled
|
|
178 |
tc_network_error_codes(
|
|
179 |
"tc_network_failure_SharedKeyAuthRequired",
|
|
180 |
CMManagerShim::Adhoc,
|
|
181 |
CMManagerShim::WlanSecModeOpen,
|
|
182 |
false,
|
|
183 |
"",
|
|
184 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
185 |
KErrWlanSharedKeyAuthRequired );
|
|
186 |
#endif
|
|
187 |
}
|
|
188 |
void TestWlanWizardConnect::tc_network_failure_WpaAuthRequired()
|
|
189 |
{
|
|
190 |
#ifdef tc_network_failure_WpaAuthRequired_enabled
|
|
191 |
tc_network_error_codes(
|
|
192 |
"tc_network_failure_WpaAuthRequired",
|
|
193 |
CMManagerShim::Adhoc,
|
|
194 |
CMManagerShim::WlanSecModeOpen,
|
|
195 |
false,
|
|
196 |
"",
|
|
197 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
198 |
KErrWlanWpaAuthRequired );
|
|
199 |
#endif
|
|
200 |
}
|
|
201 |
void TestWlanWizardConnect::tc_network_failure_WpaAuthFailed()
|
|
202 |
{
|
|
203 |
#ifdef tc_network_failure_WpaAuthFailed_enabled
|
|
204 |
tc_network_error_codes(
|
|
205 |
"tc_network_failure_WpaAuthFailed",
|
|
206 |
CMManagerShim::Adhoc,
|
|
207 |
CMManagerShim::WlanSecModeWpa,
|
|
208 |
false,
|
|
209 |
"password",
|
|
210 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
211 |
KErrWlanWpaAuthFailed );
|
|
212 |
#endif
|
|
213 |
}
|
|
214 |
void TestWlanWizardConnect::tc_network_failure_802dot1xAuthFailed()
|
|
215 |
{
|
|
216 |
#ifdef tc_network_failure_802dot1xAuthFailed_enabled
|
|
217 |
tc_network_error_codes(
|
|
218 |
"tc_network_failure_802dot1xAuthFailed",
|
|
219 |
CMManagerShim::Adhoc,
|
|
220 |
CMManagerShim::WlanSecModeOpen,
|
|
221 |
false,
|
|
222 |
"",
|
|
223 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
224 |
KErrWlan802dot1xAuthFailed );
|
|
225 |
#endif
|
|
226 |
}
|
|
227 |
void TestWlanWizardConnect::tc_network_failure_IllegalEncryptionKeys()
|
|
228 |
{
|
|
229 |
#ifdef tc_network_failure_IllegalEncryptionKeys_enabled
|
|
230 |
tc_network_error_codes(
|
|
231 |
"tc_network_failure_IllegalEncryptionKeys",
|
|
232 |
CMManagerShim::Adhoc,
|
|
233 |
CMManagerShim::WlanSecModeOpen,
|
|
234 |
false,
|
|
235 |
"",
|
|
236 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
237 |
KErrWlanIllegalEncryptionKeys );
|
|
238 |
#endif
|
|
239 |
}
|
|
240 |
void TestWlanWizardConnect::tc_network_failure_PskModeRequired()
|
|
241 |
{
|
|
242 |
#ifdef tc_network_failure_PskModeRequired_enabled
|
|
243 |
tc_network_error_codes(
|
|
244 |
"tc_network_failure_PskModeRequired",
|
|
245 |
CMManagerShim::Adhoc,
|
|
246 |
CMManagerShim::WlanSecModeOpen,
|
|
247 |
false,
|
|
248 |
"",
|
|
249 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
250 |
KErrWlanPskModeRequired );
|
|
251 |
#endif
|
|
252 |
}
|
|
253 |
void TestWlanWizardConnect::tc_network_failure_EapModeRequired()
|
|
254 |
{
|
|
255 |
#ifdef tc_network_failure_EapModeRequired_enabled
|
|
256 |
tc_network_error_codes(
|
|
257 |
"tc_network_failure_EapModeRequired",
|
|
258 |
CMManagerShim::Adhoc,
|
|
259 |
CMManagerShim::WlanSecModeOpen,
|
|
260 |
false,
|
|
261 |
"",
|
|
262 |
hbTrId("txt_occ_dialog_authentication_unsuccessful"),
|
|
263 |
KErrWlanEapModeRequired );
|
|
264 |
#endif
|
|
265 |
}
|
|
266 |
void TestWlanWizardConnect::tc_network_failure_IllefalWpaPskKey()
|
|
267 |
{
|
|
268 |
#ifdef tc_network_failure_IllefalWpaPskKey_enabled
|
|
269 |
tc_network_error_codes(
|
|
270 |
"tc_network_failure_IllefalWpaPskKey",
|
|
271 |
CMManagerShim::Adhoc,
|
|
272 |
CMManagerShim::WlanSecModeOpen,
|
|
273 |
false,
|
|
274 |
"",
|
|
275 |
hbTrId("txt_occ_dialog_incorrect_wpa_preshared_key_pleas"),
|
|
276 |
KErrWlanIllegalWpaPskKey );
|
|
277 |
#endif
|
|
278 |
}
|
|
279 |
void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthFailed()
|
|
280 |
{
|
|
281 |
#ifdef tc_network_failure_SharedKeyAuthFailed_enabled
|
|
282 |
tc_network_error_codes(
|
|
283 |
"tc_network_failure_SharedKeyAuthFailed",
|
|
284 |
CMManagerShim::Adhoc,
|
|
285 |
CMManagerShim::WlanSecModeOpen,
|
|
286 |
false,
|
|
287 |
"",
|
|
288 |
hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"),
|
|
289 |
KErrWlanSharedKeyAuthFailed );
|
|
290 |
#endif
|
|
291 |
}
|
|
292 |
void TestWlanWizardConnect::tc_network_failure_ErrNone()
|
|
293 |
{
|
|
294 |
#ifdef tc_network_failure_ErrNone_enabled
|
|
295 |
tc_network_error_codes(
|
|
296 |
"tc_network_failure_ErrNone",
|
|
297 |
CMManagerShim::Adhoc,
|
|
298 |
CMManagerShim::WlanSecModeOpen,
|
|
299 |
false,
|
|
300 |
"",
|
|
301 |
hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"),
|
|
302 |
KErrWlanSharedKeyAuthFailed );
|
|
303 |
#endif
|
|
304 |
}
|
|
305 |
void TestWlanWizardConnect::tc_network_failure_30180()
|
|
306 |
{
|
|
307 |
#ifdef tc_network_failure_30180_enabled
|
|
308 |
const QString ssid("tc_network_failure_30180");
|
|
309 |
tc_network_error_codes(
|
|
310 |
ssid,
|
|
311 |
CMManagerShim::Adhoc,
|
|
312 |
CMManagerShim::WlanSecModeWep,
|
|
313 |
false,
|
|
314 |
"abcde",
|
|
315 |
hbTrId("txt_occ_dialog_connection_failed"),
|
|
316 |
30180 );
|
|
317 |
|
|
318 |
QCOMPARE( mouseClickPrevious(), true );
|
|
319 |
QTest::qWait(WaitTimeForUi);
|
|
320 |
|
|
321 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true );
|
|
322 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
|
|
323 |
QTest::qWait(WaitTimeForUi);
|
|
324 |
|
|
325 |
QCOMPARE( mouseClickNext(), true );
|
|
326 |
|
|
327 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
|
|
328 |
QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
329 |
QTest::qWait(WaitTimeForUi);
|
|
330 |
|
|
331 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_connection_failed")), true );
|
|
332 |
QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
333 |
QTest::qWait(WaitTimeForUi);
|
|
334 |
|
|
335 |
QStringList calledMethods;
|
|
336 |
calledMethods
|
|
337 |
<< "updateIap"
|
|
338 |
<< "activeIap"
|
|
339 |
<< "disconnectIap"
|
|
340 |
<< "connectIap";
|
|
341 |
|
|
342 |
QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
343 |
|
|
344 |
#endif
|
|
345 |
}
|
|
346 |
|
|
347 |
void TestWlanWizardConnect::tc_iap_creation_fails()
|
|
348 |
{
|
|
349 |
#ifdef tc_iap_creation_fails_enabled
|
|
350 |
|
|
351 |
const QString ssid("tc_iap_creation_fails");
|
|
352 |
|
|
353 |
mWlanQtUtilsContext->setCreateWlanIapResult(-1);
|
|
354 |
|
|
355 |
mView->mWizard->setParameters(
|
|
356 |
ssid,
|
60
|
357 |
ssid.toUtf8(),
|
53
|
358 |
CMManagerShim::Infra,
|
|
359 |
CMManagerShim::WlanSecModeOpen,
|
|
360 |
false,
|
|
361 |
false);
|
|
362 |
|
|
363 |
mView->showWizard();
|
|
364 |
|
|
365 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
|
|
366 |
QCOMPARE( verifyCurrentPageWithInfo(
|
|
367 |
WlanWizardPageInternal::PageGenericError,
|
|
368 |
hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret") ), true );
|
|
369 |
|
|
370 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
371 |
QTest::qWait(WaitTimeForUi);
|
|
372 |
|
|
373 |
QStringList calledMethods;
|
|
374 |
calledMethods << "WlanQtUtils" << "createIap";
|
|
375 |
QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
376 |
|
|
377 |
QCOMPARE( mouseClickCancel(), true );
|
|
378 |
QTest::qWait(WaitTimeForUi);
|
|
379 |
QCOMPARE( verifyStatus(WizardStatusSignalCancelled, 2), true);
|
|
380 |
QTest::qWait(WaitTimeForUi);
|
|
381 |
#endif
|
|
382 |
}
|
|
383 |
|
|
384 |
void TestWlanWizardConnect::tc_cancel_key_query()
|
|
385 |
{
|
|
386 |
#ifdef tc_cancel_key_query_enabled
|
|
387 |
|
|
388 |
const QString ssid("tc_cancel_key_query");
|
|
389 |
|
|
390 |
mView->mWizard->setParameters(
|
|
391 |
ssid,
|
60
|
392 |
ssid.toUtf8(),
|
53
|
393 |
CMManagerShim::Adhoc,
|
|
394 |
CMManagerShim::WlanSecModeWep,
|
|
395 |
true,
|
|
396 |
false);
|
|
397 |
mView->showWizard();
|
|
398 |
|
|
399 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true );
|
|
400 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
|
|
401 |
QTest::qWait(WaitTimeForUi);
|
|
402 |
|
|
403 |
QCOMPARE( mouseClickCancel(), true );
|
|
404 |
QTest::qWait(WaitTimeForUi);
|
|
405 |
QCOMPARE( verifyStatus(WizardStatusSignalCancelled), true);
|
|
406 |
|
|
407 |
mWlanQtUtilsContext->emitWlanNetworkClosed(-1, KErrCancel);
|
|
408 |
callWlanWizard_startPageOperation();
|
|
409 |
|
|
410 |
QStringList calledMethods;
|
|
411 |
calledMethods << "WlanQtUtils";
|
|
412 |
QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
413 |
#endif
|
|
414 |
}
|
|
415 |
|
|
416 |
/*!
|
|
417 |
* Helpper test case for testing success case with compinations of provided
|
|
418 |
* parameters.
|
|
419 |
*/
|
|
420 |
void TestWlanWizardConnect::tc_connect_success(const QString &ssid, int networkMode,
|
|
421 |
int securityMode, bool hidden, QString key)
|
|
422 |
{
|
|
423 |
|
|
424 |
mWlanQtUtilsContext->setCreateWlanIapResult(2);
|
|
425 |
mWlanQtUtilsContext->setConnectionSuccessed(true);
|
|
426 |
mWlanQtUtilsContext->setSignalWlanNetworkOpened(2);
|
|
427 |
mWlanQtUtilsContext->setSignalIctResult(2, WlanQtUtils::IctPassed);
|
|
428 |
|
|
429 |
mView->mWizard->setParameters(
|
|
430 |
ssid,
|
60
|
431 |
ssid.toUtf8(),
|
53
|
432 |
networkMode,
|
|
433 |
securityMode,
|
|
434 |
true,
|
|
435 |
false);
|
|
436 |
|
|
437 |
WlanQtUtilsAp ap;
|
|
438 |
ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode);
|
|
439 |
ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode);
|
60
|
440 |
ap.setValue(WlanQtUtilsAp::ConfIdName, ssid);
|
|
441 |
ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid.toUtf8());
|
53
|
442 |
ap.setValue(WlanQtUtilsAp::ConfIdHidden, false);
|
|
443 |
ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, hidden);
|
|
444 |
|
|
445 |
// Default values
|
|
446 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString());
|
|
447 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true );
|
|
448 |
ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 );
|
|
449 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString());
|
|
450 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString());
|
|
451 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString());
|
|
452 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString());
|
|
453 |
|
|
454 |
QStringList calledMethods;
|
|
455 |
calledMethods << "WlanQtUtils";
|
|
456 |
QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
457 |
|
|
458 |
mView->showWizard();
|
|
459 |
if (securityMode == CMManagerShim::WlanSecModeWep || securityMode
|
|
460 |
== CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) {
|
|
461 |
// Key query short pwd
|
|
462 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true );
|
|
463 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
|
|
464 |
QTest::qWait(WaitTimeForUi);
|
|
465 |
|
|
466 |
QCOMPARE( mouseClickObject("lineEditKey"), true );
|
|
467 |
QTest::qWait(WaitTimeForUi);
|
|
468 |
|
|
469 |
if (securityMode == CMManagerShim::WlanSecModeWep) {
|
|
470 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key);
|
|
471 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key);
|
|
472 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key);
|
|
473 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key);
|
|
474 |
ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1);
|
|
475 |
QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true );
|
|
476 |
}
|
|
477 |
else {
|
|
478 |
QCOMPARE( insertTextToObject("lineEditKey", "password"), true );
|
|
479 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key);
|
|
480 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true);
|
|
481 |
}
|
|
482 |
QCOMPARE( mouseClickObject("dialog"), true );
|
|
483 |
|
|
484 |
QTest::qWait(WaitTimeForUi);
|
|
485 |
QCOMPARE( mouseClickNext(), true );
|
|
486 |
|
|
487 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
|
|
488 |
QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
489 |
QTest::qWait(WaitTimeForUi);
|
|
490 |
|
|
491 |
QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
|
|
492 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
|
|
493 |
QTest::qWait(WaitTimeForUi);
|
|
494 |
}
|
|
495 |
else {
|
|
496 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
|
|
497 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
498 |
|
|
499 |
QTest::qWait(WaitTimeForUi);
|
|
500 |
QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
|
|
501 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
|
|
502 |
QTest::qWait(WaitTimeForUi);
|
|
503 |
}
|
|
504 |
|
|
505 |
QCOMPARE(verifySummaryPage(
|
|
506 |
ssid,
|
|
507 |
networkMode,
|
|
508 |
hidden,
|
|
509 |
securityMode,
|
|
510 |
true,
|
|
511 |
hbTrId("txt_occ_dblist_destination_val_internet")),true);
|
|
512 |
|
|
513 |
calledMethods.clear();
|
|
514 |
calledMethods << "createIap" << "activeIap" << "connectIap";
|
|
515 |
QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
516 |
QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true);
|
|
517 |
QTest::qWait(WaitTimeForUi);
|
|
518 |
|
|
519 |
QCOMPARE( mouseClickFinish(), true );
|
|
520 |
QTest::qWait(WaitTimeForUi);
|
|
521 |
QCOMPARE( verifyStatus(WizardStatusSignalFinished, 2), true);
|
|
522 |
}
|
|
523 |
|
|
524 |
/*!
|
|
525 |
* Helpper test case for testing success case with combinations of provided
|
|
526 |
* parameters.
|
|
527 |
*/
|
|
528 |
void TestWlanWizardConnect::tc_network_error_codes(
|
|
529 |
const QString &ssid,
|
|
530 |
int networkMode,
|
|
531 |
int securityMode,
|
|
532 |
bool hidden,
|
|
533 |
QString key,
|
|
534 |
const QString &errorString,
|
|
535 |
int errorCode)
|
|
536 |
{
|
|
537 |
mWlanQtUtilsContext->setCreateWlanIapResult(2);
|
|
538 |
mWlanQtUtilsContext->setConnectionSuccessed(false);
|
|
539 |
mWlanQtUtilsContext->setSignalWlanNetworkClosed(2, errorCode);
|
|
540 |
mWlanQtUtilsContext->setActiveWlanIapResult(1);
|
|
541 |
mView->mWizard->setParameters(
|
|
542 |
ssid,
|
60
|
543 |
ssid.toUtf8(),
|
53
|
544 |
networkMode,
|
|
545 |
securityMode,
|
|
546 |
true,
|
|
547 |
false);
|
|
548 |
|
|
549 |
WlanQtUtilsAp ap;
|
|
550 |
ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode);
|
|
551 |
ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode);
|
60
|
552 |
ap.setValue(WlanQtUtilsAp::ConfIdName, ssid);
|
|
553 |
ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid.toUtf8());
|
53
|
554 |
ap.setValue(WlanQtUtilsAp::ConfIdHidden, false);
|
|
555 |
ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, hidden);
|
|
556 |
|
|
557 |
// Default values
|
|
558 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString());
|
|
559 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true );
|
|
560 |
ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 );
|
|
561 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString());
|
|
562 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString());
|
|
563 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString());
|
|
564 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString());
|
|
565 |
|
|
566 |
QStringList calledMethods;
|
|
567 |
calledMethods << "WlanQtUtils";
|
|
568 |
QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
569 |
|
|
570 |
mView->showWizard();
|
|
571 |
if (securityMode == CMManagerShim::WlanSecModeWep || securityMode
|
|
572 |
== CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) {
|
|
573 |
// Key query short pwd
|
|
574 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true );
|
|
575 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
|
|
576 |
QTest::qWait(WaitTimeForUi);
|
|
577 |
|
|
578 |
QCOMPARE( mouseClickObject("lineEditKey"), true );
|
|
579 |
QTest::qWait(WaitTimeForUi);
|
|
580 |
|
|
581 |
if (securityMode == CMManagerShim::WlanSecModeWep) {
|
|
582 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key);
|
|
583 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key);
|
|
584 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key);
|
|
585 |
ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key);
|
|
586 |
ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1);
|
|
587 |
QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true );
|
|
588 |
}
|
|
589 |
else {
|
|
590 |
QCOMPARE( insertTextToObject("lineEditKey", "password"), true );
|
|
591 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key);
|
|
592 |
ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true);
|
|
593 |
}
|
|
594 |
QCOMPARE( mouseClickObject("dialog"), true );
|
|
595 |
|
|
596 |
QTest::qWait(WaitTimeForUi);
|
|
597 |
QCOMPARE( mouseClickNext(), true );
|
|
598 |
|
|
599 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
|
|
600 |
QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
601 |
QTest::qWait(WaitTimeForUi);
|
|
602 |
|
|
603 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true );
|
|
604 |
QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
605 |
QTest::qWait(WaitTimeForUi);
|
|
606 |
}
|
|
607 |
else {
|
|
608 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
|
|
609 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
610 |
QTest::qWait(WaitTimeForUi);
|
|
611 |
|
|
612 |
QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true );
|
|
613 |
QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
|
|
614 |
QTest::qWait(WaitTimeForUi);
|
|
615 |
}
|
|
616 |
|
|
617 |
calledMethods.clear();
|
|
618 |
calledMethods
|
|
619 |
<< "createIap"
|
|
620 |
<< "activeIap"
|
|
621 |
<< "disconnectIap"
|
|
622 |
<< "connectIap";
|
|
623 |
QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods);
|
|
624 |
QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true);
|
|
625 |
QTest::qWait(WaitTimeForUi);
|
|
626 |
}
|