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