wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.cpp
changeset 56 de27cc8389dd
parent 50 d4198dcb9983
child 58 301aeb18ae47
equal deleted inserted replaced
50:d4198dcb9983 56:de27cc8389dd
     1 /*
       
     2  * Copyright (c) 2009 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  */
       
    16 
       
    17 // System includes
       
    18 #include <QTest>
       
    19 #include <QDebug>
       
    20 #include <QList>
       
    21 #include <cmmanagerdefines_shim.h>
       
    22 #include <wlanerrorcodes.h>
       
    23 
       
    24 // User includes
       
    25 #include "testwlanwizardeap.h"
       
    26 #include "testwlanwizardeap_conf.h"
       
    27 #include "hbautotest.h"
       
    28 #include "wlanwizard.h"
       
    29 #include "wlanwizard_p.h"
       
    30 #include "wlanqtutils_context.h"
       
    31 #include "wlanqtutils.h"
       
    32 #include "wlanqtutilsap.h"
       
    33 #include "wlanwizardpageinternal.h"
       
    34 #include "eapwizardpage.h"
       
    35 #include "eapqtvalidator_stub.h"
       
    36 
       
    37 #include "eapqtconfiginterface_context.h"
       
    38 
       
    39 // External function prototypes
       
    40 
       
    41 // Local constants
       
    42 
       
    43 
       
    44 // ======== LOCAL FUNCTIONS ========
       
    45 
       
    46 // ======== MEMBER FUNCTIONS ========
       
    47 
       
    48 
       
    49 // ---------------------------------------------------------
       
    50 // TEST CASES
       
    51 // ---------------------------------------------------------
       
    52 void TestWlanWizardEap::tc_eap_outer_page_orientation_change()
       
    53 {
       
    54 #ifdef tc_eap_outer_page_orientation_change_enabled
       
    55    
       
    56     const QString ssid("tc_eap_outer_page_orientation_change");
       
    57     
       
    58     mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka);
       
    59     
       
    60     mView->mWizard->setParameters(
       
    61         ssid, 
       
    62         CMManagerShim::Infra,
       
    63         CMManagerShim::WlanSecModeWpa2, 
       
    64         false, false, false);
       
    65 
       
    66     mView->showWizard();
       
    67     
       
    68     verify_outertype(ButtonDisabled);
       
    69     
       
    70     mMainWindow->setOrientation(Qt::Horizontal, false);
       
    71     QTest::qWait(WaitTimeForUi);
       
    72 
       
    73     verify_outertype(ButtonDisabled);
       
    74     
       
    75     mMainWindow->setOrientation(Qt::Vertical, false);
       
    76     QTest::qWait(WaitTimeForUi);
       
    77     
       
    78     verify_outertype(ButtonDisabled);
       
    79 #endif
       
    80 }
       
    81 
       
    82 void TestWlanWizardEap::tc_eap_aka()
       
    83 {
       
    84 #ifdef tc_eap_aka_enabled
       
    85     tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka);
       
    86 #endif
       
    87 }
       
    88 
       
    89 void TestWlanWizardEap::tc_eap_sim()
       
    90 {
       
    91 #ifdef tc_eap_sim_enabled
       
    92     tc_eap_aka_sim(EapQtPluginHandle::PluginEapSim);
       
    93 #endif
       
    94 }
       
    95 
       
    96 void TestWlanWizardEap::tc_eap_leap()
       
    97 {
       
    98 #ifdef tc_eap_leap_enabled
       
    99     const QString username("user");
       
   100     const QString password("passwd");
       
   101     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   102     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
   103     mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
   104     mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
   105     
       
   106     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   107     mEapQtUtilsContext->createLeap(username,password);
       
   108     
       
   109     const QString ssid("tc_eap_leap");
       
   110     
       
   111     mView->mWizard->setParameters(
       
   112         ssid, 
       
   113         CMManagerShim::Infra,
       
   114         CMManagerShim::WlanSecModeWpa, 
       
   115         false, false, false);
       
   116 
       
   117     mView->showWizard();
       
   118     
       
   119     verify_outertype_select_first(ButtonDisabled);
       
   120     verify_username_password_click_next(EapQtPluginHandle::PluginLeap, username, password);
       
   121     
       
   122     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true );
       
   123     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   124     QTest::qWait(WaitTimeForUi);
       
   125 
       
   126     QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
       
   127     QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
       
   128     QTest::qWait(WaitTimeForUi);
       
   129     
       
   130     QCOMPARE( verifySummaryPage(
       
   131         ssid,
       
   132         CMManagerShim::Infra,
       
   133         false, 
       
   134         CMManagerShim::WlanSecModeWpa, 
       
   135         false,
       
   136         hbTrId("txt_occ_dblist_destination_val_internet"),
       
   137         EapQtPluginHandle::PluginLeap),true);
       
   138     
       
   139     QTest::qWait(WaitTimeForUi);
       
   140 #endif
       
   141 }
       
   142 
       
   143 void TestWlanWizardEap::tc_eap_peap_gtc()
       
   144 {
       
   145 #ifdef tc_eap_peap_gtc_enabled
       
   146     tc_eap_peap_ttls(
       
   147         EapQtPluginHandle::PluginPeap, 
       
   148         EapQtPluginHandle::PluginEapGtc);
       
   149 #endif
       
   150 }
       
   151 
       
   152 void TestWlanWizardEap::tc_eap_peap_mschapv2()
       
   153 {
       
   154 #ifdef tc_eap_peap_mschapv2_enabled
       
   155     tc_eap_peap_ttls(
       
   156         EapQtPluginHandle::PluginPeap, 
       
   157         EapQtPluginHandle::PluginEapMschapv2);
       
   158 #endif
       
   159 }
       
   160 
       
   161 void TestWlanWizardEap::tc_eap_ttls_mschapv2()
       
   162 {
       
   163 #ifdef tc_eap_ttls_mschapv2_enabled
       
   164     tc_eap_peap_ttls(
       
   165         EapQtPluginHandle::PluginEapTtls, 
       
   166         EapQtPluginHandle::PluginPlainMschapv2);
       
   167 #endif
       
   168 }
       
   169 
       
   170 void TestWlanWizardEap::tc_eap_ttls_pap()
       
   171 {
       
   172 #ifdef tc_eap_ttls_pap_enabled
       
   173     tc_eap_peap_ttls(
       
   174         EapQtPluginHandle::PluginEapTtls, 
       
   175         EapQtPluginHandle::PluginPap);
       
   176 #endif
       
   177 }
       
   178 
       
   179 void TestWlanWizardEap::tc_eap_ttls_gtc()
       
   180 {
       
   181 #ifdef tc_eap_ttls_gtc_enabled
       
   182     tc_eap_peap_ttls(
       
   183         EapQtPluginHandle::PluginEapTtls, 
       
   184         EapQtPluginHandle::PluginEapGtc);
       
   185 #endif
       
   186 }
       
   187 
       
   188 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserRejected()
       
   189 {
       
   190 #ifdef tc_eap_aka_connect_KErrWlanUserRejected_enabled
       
   191     tc_eap_aka_connect_error(
       
   192         KErrWlanUserRejected,
       
   193         hbTrId("txt_occ_dialog_1_auth_failed_user_cert_rej").arg(
       
   194             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   195 #endif
       
   196 }
       
   197 
       
   198 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserCertificateExpired()
       
   199 {
       
   200 #ifdef tc_eap_aka_connect_KErrWlanUserCertificateExpired_enabled
       
   201     tc_eap_aka_connect_error(
       
   202         KErrWlanUserCertificateExpired,
       
   203         hbTrId("txt_occ_dialog_1_auth_failed_user_cert_exp").arg(
       
   204             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   205 #endif
       
   206 }
       
   207 
       
   208 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanServerCertificateExpired()
       
   209 {
       
   210 #ifdef tc_eap_aka_connect_KErrWlanServerCertificateExpired_enabled
       
   211     tc_eap_aka_connect_error(
       
   212         KErrWlanServerCertificateExpired,
       
   213         hbTrId("txt_occ_dialog_1_authentication_failed_server_ce").arg(
       
   214             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   215 #endif
       
   216 }
       
   217 
       
   218 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanCerficateVerifyFailed()
       
   219 {
       
   220 #ifdef tc_eap_aka_connect_KErrWlanCerficateVerifyFailed_enabled
       
   221     tc_eap_aka_connect_error(
       
   222         KErrWlanCerficateVerifyFailed,
       
   223         hbTrId("txt_occ_dialog_1_authentication_failed_could_not").arg(
       
   224             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   225 #endif    
       
   226 }
       
   227 
       
   228 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoCipherSuite()
       
   229 {
       
   230 #ifdef tc_eap_aka_connect_KErrWlanNoCipherSuite_enabled
       
   231     tc_eap_aka_connect_error(
       
   232         KErrWlanNoCipherSuite,
       
   233         hbTrId("txt_occ_dialog_1_authentication_failed_cipher_su").arg(
       
   234             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   235 #endif     
       
   236 }
       
   237 
       
   238 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanSimNotInstalled()
       
   239 {
       
   240 #ifdef tc_eap_aka_connect_KErrWlanSimNotInstalled_enabled
       
   241     tc_eap_aka_connect_error(
       
   242         KErrWlanSimNotInstalled,
       
   243         hbTrId("txt_occ_dialog_1_authentication_failed_check_sim").arg(
       
   244             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   245 #endif      
       
   246 }
       
   247 
       
   248 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted()
       
   249 {
       
   250 #ifdef tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted_enabled
       
   251     tc_eap_aka_connect_error(
       
   252         KErrWlanEapFastPacStoreCorrupted,
       
   253         hbTrId("txt_occ_dialog_1_authentication_failed_reset_pac").arg(
       
   254             eapTypeToString(EapQtPluginHandle::PluginEapFast)));
       
   255 #endif      
       
   256 }
       
   257 
       
   258 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapSimFailed()
       
   259 {
       
   260 #ifdef tc_eap_aka_connect_KErrWlanEapSimFailed_enabled
       
   261     tc_eap_aka_connect_error(
       
   262         KErrWlanEapSimFailed,
       
   263         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   264             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   265 #endif      
       
   266 }
       
   267 
       
   268 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNotSubscribed()
       
   269 {
       
   270 #ifdef tc_eap_aka_connect_KErrWlanNotSubscribed_enabled
       
   271     tc_eap_aka_connect_error(
       
   272         KErrWlanNotSubscribed,
       
   273         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   274             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   275 #endif      
       
   276 }
       
   277 
       
   278 void TestWlanWizardEap::tc_eap_aka_connect_KErrCancel()
       
   279 {
       
   280 #ifdef tc_eap_aka_connect_KErrCancel_enabled
       
   281     tc_eap_aka_connect_error(
       
   282         KErrCancel,
       
   283         hbTrId("txt_occ_dialog_connection_failed"));
       
   284 #endif       
       
   285 }
       
   286 
       
   287 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTlsFailed()
       
   288 {
       
   289 #ifdef tc_eap_aka_connect_KErrWlanEapTlsFailed_enabled
       
   290     tc_eap_aka_connect_error(
       
   291         KErrWlanEapTlsFailed,
       
   292         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   293             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   294 #endif
       
   295 }
       
   296 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapPeapFailed()
       
   297 {
       
   298 #ifdef tc_eap_aka_connect_KErrWlanEapPeapFailed_enabled
       
   299     tc_eap_aka_connect_error(
       
   300         KErrWlanEapPeapFailed,
       
   301         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   302             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   303 #endif
       
   304 }
       
   305 
       
   306 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapAkaFailed()
       
   307 {
       
   308 #ifdef tc_eap_aka_connect_KErrWlanEapAkaFailed_enabled
       
   309     tc_eap_aka_connect_error(
       
   310         KErrWlanEapAkaFailed,
       
   311         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   312             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   313 #endif
       
   314 }
       
   315 
       
   316 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTtlsFailed()
       
   317 {
       
   318 #ifdef tc_eap_aka_connect_KErrWlanEapTtlsFailed_enabled
       
   319     tc_eap_aka_connect_error(
       
   320         KErrWlanEapTtlsFailed,
       
   321         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   322             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   323 #endif
       
   324 }
       
   325 
       
   326 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanLeapFailed()
       
   327 {
       
   328 #ifdef tc_eap_aka_connect_KErrWlanLeapFailed_enabled
       
   329     tc_eap_aka_connect_error(
       
   330         KErrWlanLeapFailed,
       
   331         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   332             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   333 #endif
       
   334 }
       
   335 
       
   336 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoUserCertificate()
       
   337 {
       
   338 #ifdef tc_eap_aka_connect_KErrWlanNoUserCertificate_enabled 
       
   339     tc_eap_aka_connect_error(
       
   340         KErrWlanNoUserCertificate,
       
   341         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   342             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   343 #endif
       
   344 }
       
   345 
       
   346 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError()
       
   347 {
       
   348 #ifdef tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError_enabled
       
   349     tc_eap_aka_connect_error(
       
   350         KErrWlanEapFastTunnelCompromiseError,
       
   351         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   352             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   353 #endif
       
   354 }
       
   355 
       
   356 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged()
       
   357 {
       
   358 #ifdef tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged_enabled
       
   359     tc_eap_aka_connect_error(
       
   360         KErrWlanEapFastUnexpextedTlvExhanged,
       
   361         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   362             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   363 #endif
       
   364 }
       
   365 
       
   366 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled()
       
   367 {
       
   368 #ifdef tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled_enabled
       
   369     tc_eap_aka_connect_error(
       
   370         KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled,
       
   371         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   372             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   373 #endif
       
   374 }
       
   375 
       
   376 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid()
       
   377 {
       
   378 #ifdef tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid_enabled
       
   379     tc_eap_aka_connect_error(
       
   380         KErrWlanEapFastNoMatchingPacForAid,
       
   381         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   382             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   383 #endif
       
   384 }
       
   385 
       
   386 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastAuthFailed()
       
   387 {
       
   388 #ifdef tc_eap_aka_connect_KErrWlanEapFastAuthFailed_enabled
       
   389     tc_eap_aka_connect_error(
       
   390         KErrWlanEapFastAuthFailed,
       
   391         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   392             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   393 #endif
       
   394 }
       
   395 
       
   396 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccessBarred()
       
   397 {
       
   398 #ifdef tc_eap_aka_connect_KErrWlanAccessBarred_enabled
       
   399     tc_eap_aka_connect_error(
       
   400         KErrWlanAccessBarred,
       
   401         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   402             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   403 #endif
       
   404 }
       
   405 
       
   406 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanPasswordExpired()
       
   407 {
       
   408 #ifdef tc_eap_aka_connect_KErrWlanPasswordExpired_enabled
       
   409     tc_eap_aka_connect_error(
       
   410         KErrWlanPasswordExpired,
       
   411         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   412             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   413 #endif
       
   414 }
       
   415 
       
   416 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoDialinPermissions()
       
   417 {
       
   418 #ifdef tc_eap_aka_connect_KErrWlanNoDialinPermissions_enabled
       
   419     tc_eap_aka_connect_error(
       
   420         KErrWlanNoDialinPermissions,
       
   421         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   422             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   423 #endif
       
   424 }
       
   425 
       
   426 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccountDisabled()
       
   427 {
       
   428 #ifdef tc_eap_aka_connect_KErrWlanAccountDisabled_enabled
       
   429     tc_eap_aka_connect_error(
       
   430         KErrWlanAccountDisabled,
       
   431         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   432             eapTypeToString(EapQtPluginHandle::PluginEapAka)));
       
   433 #endif
       
   434 }
       
   435 
       
   436 void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanRestrictedLogonHours()
       
   437 {
       
   438 #ifdef tc_eap_aka_connect_KErrWlanRestrictedLogonHours_enabled
       
   439     tc_eap_aka_connect_error(
       
   440         KErrWlanRestrictedLogonHours,
       
   441         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   442             eapTypeToString(EapQtPluginHandle::PluginEapAka)));    
       
   443 #endif
       
   444 }
       
   445 
       
   446 void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed()
       
   447 {
       
   448 #ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed_enabled
       
   449     tc_eap_peap_ttls(
       
   450         EapQtPluginHandle::PluginEapTtls, 
       
   451         EapQtPluginHandle::PluginPlainMschapv2,
       
   452         KErrWlanEapGtcFailed,
       
   453         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   454             eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2)));
       
   455 #endif
       
   456 }
       
   457 
       
   458 void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2()
       
   459 {
       
   460 #ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2_enabled
       
   461     tc_eap_peap_ttls(
       
   462         EapQtPluginHandle::PluginEapTtls, 
       
   463         EapQtPluginHandle::PluginPlainMschapv2,
       
   464         KErrWlanEapMsChapv2,
       
   465         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   466             eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2)));
       
   467 #endif
       
   468 }
       
   469 
       
   470 void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed()
       
   471 {
       
   472 #ifdef tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed_enabled
       
   473     tc_eap_peap_ttls(
       
   474         EapQtPluginHandle::PluginEapTtls, 
       
   475         EapQtPluginHandle::PluginPlainMschapv2,
       
   476         KErrWlanNotSubscribed,
       
   477         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   478             eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2)));
       
   479 #endif
       
   480 }
       
   481 
       
   482 void TestWlanWizardEap::tc_eap_ttls_gtc_back_and_forward()
       
   483 {
       
   484 #ifdef tc_eap_ttls_gtc_back_and_forward_enabled
       
   485     tc_eap_peap_ttls(
       
   486         EapQtPluginHandle::PluginEapTtls, 
       
   487         EapQtPluginHandle::PluginEapGtc,
       
   488         KErrWlanNotSubscribed,
       
   489         hbTrId("txt_occ_dialog_1_authentication_failed").arg(
       
   490             eapTypeToString(EapQtPluginHandle::PluginEapGtc)));
       
   491     
       
   492     // Go back to outertype selection page
       
   493     QCOMPARE(mouseClickPrevious(), true);
       
   494     QTest::qWait(WaitTimeForUi);
       
   495     verify_username_password(EapQtPluginHandle::PluginEapGtc);
       
   496 
       
   497     QCOMPARE(mouseClickPrevious(), true);
       
   498     QTest::qWait(WaitTimeForUi);
       
   499     verify_innertype(
       
   500         EapQtPluginHandle::PluginEapTtls,
       
   501         ButtonEnabled);
       
   502 
       
   503     QCOMPARE(mouseClickPrevious(), true);
       
   504     QTest::qWait(WaitTimeForUi);
       
   505     verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls));
       
   506     
       
   507     QCOMPARE(mouseClickPrevious(), true);
       
   508     QTest::qWait(WaitTimeForUi);
       
   509     verify_ca_cert_page();
       
   510     
       
   511     QCOMPARE(mouseClickPrevious(), true);
       
   512     QTest::qWait(WaitTimeForUi);
       
   513     verify_outertype(ButtonEnabled);
       
   514     
       
   515     // Go forward to username & password page
       
   516     QCOMPARE(mouseClickNext(), true);
       
   517     QTest::qWait(WaitTimeForUi);
       
   518     verify_ca_cert_page();
       
   519     
       
   520     // Create new validators
       
   521     mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTtls);
       
   522     mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapGtc);
       
   523     
       
   524     QCOMPARE(mouseClickNext(), true);
       
   525     QTest::qWait(WaitTimeForUi);
       
   526     verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls));
       
   527     
       
   528     QCOMPARE(mouseClickNext(), true);
       
   529     QTest::qWait(WaitTimeForUi);
       
   530     verify_innertype(
       
   531         EapQtPluginHandle::PluginEapTtls,
       
   532         ButtonEnabled);
       
   533     
       
   534     QCOMPARE(mouseClickNext(), true);
       
   535     QTest::qWait(WaitTimeForUi);
       
   536     verify_username_password(EapQtPluginHandle::PluginEapGtc);
       
   537 #endif
       
   538 }
       
   539 
       
   540 void TestWlanWizardEap::tc_eap_aka_set_outer_type_fails()
       
   541 {
       
   542 #ifdef tc_eap_aka_set_outer_type_fails_enabled
       
   543     const QString ssid("tc_eap_aka_set_outer_type_fails");
       
   544     
       
   545     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   546     mWlanQtUtilsContext->setConnectionSuccessed(false);
       
   547     mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel);
       
   548     
       
   549     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   550     mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka);
       
   551     mEapQtUtilsContext->setSelectectedOuterTypesReturn(false);
       
   552     
       
   553     mView->mWizard->setParameters(
       
   554         ssid, 
       
   555         CMManagerShim::Infra,
       
   556         CMManagerShim::WlanSecModeWpa2, 
       
   557         false, false, false);
       
   558 
       
   559     mView->showWizard();
       
   560     
       
   561     verify_outertype_select_first(ButtonDisabled);
       
   562     
       
   563     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
       
   564     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   565     QCOMPARE( 
       
   566         verifyCurrentPageWithInfo(
       
   567             WlanWizardPageInternal::PageGenericError, 
       
   568             hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true );
       
   569     
       
   570     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   571 #endif
       
   572 }
       
   573 
       
   574 void TestWlanWizardEap::tc_eap_aka_save_outer_configuration_fails()
       
   575 {
       
   576 #ifdef tc_eap_aka_save_outer_configuration_fails_enabled
       
   577     const QString ssid("tc_eap_aka_save_outer_configuration_fails");
       
   578     
       
   579     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   580     mWlanQtUtilsContext->setConnectionSuccessed(false);
       
   581     mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel);
       
   582     
       
   583     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   584     mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka);
       
   585     mEapQtUtilsContext->setOuterConfigReturn(false);
       
   586     
       
   587     mView->mWizard->setParameters(
       
   588         ssid, 
       
   589         CMManagerShim::Infra,
       
   590         CMManagerShim::WlanSecModeWpa2, 
       
   591         false, false, false);
       
   592 
       
   593     mView->showWizard();
       
   594     
       
   595     verify_outertype_select_first(ButtonDisabled);
       
   596     
       
   597     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
       
   598     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   599     QCOMPARE( 
       
   600         verifyCurrentPageWithInfo(
       
   601             WlanWizardPageInternal::PageGenericError, 
       
   602             hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true );
       
   603     
       
   604     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   605 #endif
       
   606 }
       
   607 
       
   608 void TestWlanWizardEap::tc_eap_aka_set_configuration_reference_fails()
       
   609 {
       
   610 #ifdef tc_eap_aka_set_configuration_reference_fails_enabled
       
   611     const QString ssid("tc_eap_aka_set_configuration_reference_fails");
       
   612     
       
   613     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   614     mWlanQtUtilsContext->setConnectionSuccessed(false);
       
   615     mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel);
       
   616     
       
   617     mEapQtUtilsContext->setConfigurationReference(3, false);
       
   618     mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka);
       
   619     
       
   620     mView->mWizard->setParameters(
       
   621         ssid, 
       
   622         CMManagerShim::Infra,
       
   623         CMManagerShim::WlanSecModeWpa2, 
       
   624         false, false, false);
       
   625 
       
   626     mView->showWizard();
       
   627     
       
   628     verify_outertype_select_first(ButtonDisabled);
       
   629     
       
   630     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
       
   631     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   632     QCOMPARE( 
       
   633         verifyCurrentPageWithInfo(
       
   634             WlanWizardPageInternal::PageGenericError, 
       
   635             hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true );
       
   636     
       
   637     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   638 #endif
       
   639 }
       
   640 
       
   641 void TestWlanWizardEap::tc_eap_peap_gtc_save_inner_configuration_fails()
       
   642 {
       
   643 #ifdef tc_eap_peap_gtc_save_inner_configuration_fails_enabled
       
   644     tc_eap_peap_ttls(
       
   645         EapQtPluginHandle::PluginEapTtls, 
       
   646         EapQtPluginHandle::PluginEapGtc,
       
   647         KErrGeneral, // Not used directly in sub test case
       
   648         hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"),
       
   649         false );
       
   650 #endif
       
   651 }
       
   652 
       
   653 
       
   654 void TestWlanWizardEap::tc_eap_peap_identity_validators()
       
   655 {
       
   656 #ifdef tc_eap_peap_identity_validators_enabled
       
   657     const QString ssid("tc_eap_peap_identity_validators");
       
   658     const QString username("u");
       
   659     const QString password("p");
       
   660     const QString usernameIdentity("identity");
       
   661     const QString realm("realm.com");
       
   662     EapQtPluginHandle::Plugin outerType(EapQtPluginHandle::PluginPeap);
       
   663     EapQtPluginHandle::Plugin innerType(EapQtPluginHandle::PluginEapGtc);
       
   664     
       
   665     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   666     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
   667     mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
   668     mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
   669 
       
   670     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   671     mEapQtUtilsContext->createEapTtlsPeap(
       
   672         outerType,
       
   673         true,
       
   674         true,
       
   675         usernameIdentity,
       
   676         true,
       
   677         realm,
       
   678         innerType );
       
   679 
       
   680     EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator(
       
   681         EapQtExpandedEapType::TypePeap, EapQtConfig::Username);
       
   682     EapQtValidatorStub* validatorRealm = (EapQtValidatorStub*)mEapQtUtilsContext->validator(
       
   683         EapQtExpandedEapType::TypePeap,EapQtConfig::Realm);
       
   684     
       
   685     mView->mWizard->setParameters(
       
   686         ssid, 
       
   687         CMManagerShim::Infra,
       
   688         CMManagerShim::WlanSecModeWpa, 
       
   689         false, false, false);
       
   690 
       
   691     mView->showWizard();
       
   692     
       
   693     verify_outertype_select_first(ButtonDisabled);
       
   694     verify_ca_cert_page_select_and_click_next(true);
       
   695     
       
   696     QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, eapTypeToString(outerType)), true );
       
   697     // Check box checked next enabled
       
   698     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
   699     QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true);
       
   700     QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true);
       
   701 
       
   702     // 1. Username validator returns false, checkbox not checked
       
   703     validatorUser->setReturnValue(EapQtValidator::StatusInvalid);
       
   704     validatorRealm->setReturnValue(EapQtValidator::StatusOk);
       
   705     
       
   706     QCOMPARE(selectCheckBoxState("setlabel_53_val", false), true);
       
   707     QTest::qWait(WaitTimeForUi);
       
   708     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   709   
       
   710     // 2. Username validator returns true, checkbox not checked
       
   711     validatorUser->setReturnValue(EapQtValidator::StatusOk);
       
   712     validatorRealm->setReturnValue(EapQtValidator::StatusOk);
       
   713     QCOMPARE( mouseClickObject("lineEditUsername"), true );
       
   714     QTest::qWait(WaitTimeForUi);
       
   715     QCOMPARE( insertTextToObject("lineEditUsername", username), true );
       
   716     QTest::qWait(WaitTimeForUi);
       
   717     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );    
       
   718 
       
   719     // 3. back to valid state, checkboc checked
       
   720     QCOMPARE(selectCheckBoxState("setlabel_53_val", true), true);
       
   721     QTest::qWait(WaitTimeForUi);
       
   722     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
   723 
       
   724     // 4. Realm validator returns false, checkbox not checked
       
   725     validatorUser->setReturnValue(EapQtValidator::StatusOk);
       
   726     validatorRealm->setReturnValue(EapQtValidator::StatusInvalid);
       
   727 
       
   728     QCOMPARE(selectCheckBoxState("setlabel_54_val", false), true);
       
   729     QTest::qWait(WaitTimeForUi);
       
   730     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   731     
       
   732     // 5. Realm validator returns true, checkbox not checked
       
   733     validatorUser->setReturnValue(EapQtValidator::StatusOk);
       
   734     validatorRealm->setReturnValue(EapQtValidator::StatusOk);
       
   735     QCOMPARE( mouseClickObject("lineEditRealm"), true );
       
   736     QTest::qWait(WaitTimeForUi);
       
   737     QCOMPARE( insertTextToObject("lineEditRealm", username), true );
       
   738     QTest::qWait(WaitTimeForUi);
       
   739     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );    
       
   740 
       
   741     // 6. back to valid state, checkboc checked
       
   742     QCOMPARE(selectCheckBoxState("setlabel_54_val", true), true);
       
   743     QTest::qWait(WaitTimeForUi);
       
   744     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
   745 #endif
       
   746 }
       
   747 
       
   748 void TestWlanWizardEap::tc_eap_leap_user_password_validators()
       
   749 {
       
   750 #ifdef tc_eap_leap_user_password_validators_enabled
       
   751     const QString ssid("tc_eap_leap_user_password_validators");
       
   752     const QString username("u");
       
   753     const QString password("p");
       
   754     
       
   755     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   756     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
   757     mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
   758     mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
   759     
       
   760     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   761     mEapQtUtilsContext->createLeap(username,password);
       
   762     
       
   763     EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator(
       
   764         EapQtExpandedEapType::TypeLeap, EapQtConfig::Username);
       
   765     EapQtValidatorStub* validatorPassword = (EapQtValidatorStub*)mEapQtUtilsContext->validator(
       
   766         EapQtExpandedEapType::TypeLeap, EapQtConfig::Password);
       
   767     validatorUser->setReturnValue(EapQtValidator::StatusInvalid);
       
   768     validatorPassword->setReturnValue(EapQtValidator::StatusInvalid);
       
   769 
       
   770     mView->mWizard->setParameters(
       
   771         ssid, 
       
   772         CMManagerShim::Infra,
       
   773         CMManagerShim::WlanSecModeWpa, 
       
   774         false, false, false);
       
   775 
       
   776     mView->showWizard();
       
   777     
       
   778     verify_outertype_select_first(ButtonDisabled);
       
   779 
       
   780     // 1. By default both validator return invalid
       
   781     QCOMPARE( 
       
   782         verifyCurrentPageWithInfo(
       
   783             EapWizardPage::PageUsernamePassword, 
       
   784             eapTypeToString(EapQtPluginHandle::PluginLeap)), true );
       
   785     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   786     
       
   787     // 2. User return ok, password invalid 
       
   788     validatorUser->setReturnValue(EapQtValidator::StatusOk);
       
   789     QCOMPARE( mouseClickObject("lineEditUsername"), true );
       
   790     QTest::qWait(WaitTimeForUi);
       
   791     QCOMPARE( insertTextToObject("lineEditUsername", username), true );
       
   792     QTest::qWait(WaitTimeForUi);
       
   793     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   794     
       
   795     // 3. User return ok, password ok
       
   796     validatorPassword->setReturnValue(EapQtValidator::StatusOk);
       
   797     QCOMPARE( mouseClickObject("lineEditPassword"), true );
       
   798     QTest::qWait(WaitTimeForUi);
       
   799     QCOMPARE( insertTextToObject("lineEditPassword", password), true );
       
   800     QTest::qWait(WaitTimeForUi);
       
   801     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
   802 #endif
       
   803 }
       
   804 
       
   805 void TestWlanWizardEap::tc_eap_tls_no_user_certificate()
       
   806 {
       
   807 #ifdef tc_eap_tls_no_user_certificate_enabled
       
   808     
       
   809     const QString ssid("tc_eap_tls_no_user_certificate");
       
   810     
       
   811     QList<EapQtCertificateInfo> caCerts;
       
   812     QList<EapQtCertificateInfo> userCerts;
       
   813     
       
   814     EapQtCertificateInfo caCert;
       
   815     caCert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super Cert 1");
       
   816     caCerts.append(caCert);
       
   817     
       
   818     mEapQtUtilsContext->createEapTls(
       
   819         caCerts,
       
   820         0,
       
   821         userCerts,
       
   822         -1);
       
   823     
       
   824     mView->mWizard->setParameters(
       
   825         ssid, 
       
   826         CMManagerShim::Infra,
       
   827         CMManagerShim::WlanSecModeWpa2, 
       
   828         false, false, false);
       
   829 
       
   830     mView->showWizard();
       
   831     
       
   832     verify_outertype_select_first(ButtonDisabled);
       
   833     verify_ca_cert_page_select_and_click_next(false);
       
   834     verify_user_cert_page_select_and_click_next(ButtonDisabled, -1);
       
   835 
       
   836 #endif
       
   837 }
       
   838 
       
   839 void TestWlanWizardEap::tc_eap_tls_one_user_certificate_with_ca_selection()
       
   840 {
       
   841 #ifdef tc_eap_tls_one_user_certificate_with_ca_selection_enabled
       
   842     const QString ssid("tc_eap_tls_one_user_certificate_with_ca_selection");
       
   843     
       
   844     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   845     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
   846     mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
   847     mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
   848     
       
   849     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   850     
       
   851     QList<EapQtCertificateInfo> caCerts;
       
   852     QList<EapQtCertificateInfo> userCerts;
       
   853     
       
   854     EapQtCertificateInfo cert;
       
   855     cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert");
       
   856     caCerts.append(cert);
       
   857     
       
   858     cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert");
       
   859     userCerts.append(cert);
       
   860     
       
   861     mEapQtUtilsContext->createEapTls(
       
   862         caCerts,
       
   863         0,
       
   864         userCerts,
       
   865         0);
       
   866     
       
   867     mView->mWizard->setParameters(
       
   868         ssid, 
       
   869         CMManagerShim::Infra,
       
   870         CMManagerShim::WlanSecModeWpa2, 
       
   871         false, false, false);
       
   872 
       
   873     mView->showWizard();
       
   874     
       
   875     verify_outertype_select_first(ButtonDisabled);
       
   876     verify_ca_cert_page_select_and_click_next(false);
       
   877     verify_user_cert_page_select_and_click_next(ButtonEnabled, 0);
       
   878     verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls));
       
   879     
       
   880     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true );
       
   881     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   882 
       
   883     QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
       
   884     QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
       
   885     
       
   886     QCOMPARE( verifySummaryPage(
       
   887         ssid,
       
   888         CMManagerShim::Infra,
       
   889         false, 
       
   890         CMManagerShim::WlanSecModeWpa2, 
       
   891         false,
       
   892         hbTrId("txt_occ_dblist_destination_val_internet"),
       
   893         EapQtPluginHandle::PluginEapTls),true);
       
   894     
       
   895 #endif
       
   896 }
       
   897 
       
   898 void TestWlanWizardEap::tc_eap_tls_two_user_certificates()
       
   899 {
       
   900 #ifdef tc_eap_tls_two_user_certificates_enabled
       
   901     const QString ssid("tc_eap_tls_two_user_certificates");
       
   902     
       
   903     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   904     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
   905     mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
   906     mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
   907     
       
   908     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   909     
       
   910     QList<EapQtCertificateInfo> caCerts;
       
   911     QList<EapQtCertificateInfo> userCerts;
       
   912     
       
   913     EapQtCertificateInfo cert;
       
   914     cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert");
       
   915     caCerts.append(cert);
       
   916     cert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super CA Cert");
       
   917     caCerts.append(cert);
       
   918     
       
   919     cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert");
       
   920     userCerts.append(cert);
       
   921     cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert Second");
       
   922     userCerts.append(cert);
       
   923     
       
   924     mEapQtUtilsContext->createEapTls(
       
   925         caCerts,
       
   926         0,
       
   927         userCerts,
       
   928         1);
       
   929     
       
   930     mView->mWizard->setParameters(
       
   931         ssid, 
       
   932         CMManagerShim::Infra,
       
   933         CMManagerShim::WlanSecModeWpa2, 
       
   934         false, false, false);
       
   935 
       
   936     mView->showWizard();
       
   937     
       
   938     verify_outertype_select_first(ButtonDisabled);
       
   939     verify_ca_cert_page_select_and_click_next(false);
       
   940     verify_user_cert_page_select_and_click_next(ButtonDisabled, 1);
       
   941     verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls));
       
   942     
       
   943     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true );
       
   944     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
   945 
       
   946     QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
       
   947     QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
       
   948     
       
   949     QCOMPARE( verifySummaryPage(
       
   950         ssid,
       
   951         CMManagerShim::Infra,
       
   952         false, 
       
   953         CMManagerShim::WlanSecModeWpa2, 
       
   954         false,
       
   955         hbTrId("txt_occ_dblist_destination_val_internet"),
       
   956         EapQtPluginHandle::PluginEapTls),true);
       
   957     
       
   958 #endif 
       
   959 }
       
   960 
       
   961 void TestWlanWizardEap::tc_eap_tls_back_and_forward_certs_with_cert_update()
       
   962 {
       
   963 #ifdef tc_eap_tls_back_and_forward_certs_with_cert_update_enabled
       
   964     const QString ssid("tc_eap_tls_two_user_certificates");
       
   965     
       
   966     const QString caCert1("My CA Cert");
       
   967     const QString caCert2("My CA Cert Second");
       
   968 
       
   969     const QString userCert1("My User Cert");
       
   970     const QString userCert2("My User Cert Second");
       
   971     
       
   972     QList<EapQtCertificateInfo> caCerts;
       
   973     QList<EapQtCertificateInfo> userCerts;
       
   974     
       
   975     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
   976     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
   977     mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
   978     mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
   979     
       
   980     mEapQtUtilsContext->setConfigurationReference(3, true);
       
   981     
       
   982     EapQtCertificateInfo cert;
       
   983     cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert1);
       
   984     caCerts.append(cert);
       
   985     
       
   986     cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert1);
       
   987     userCerts.append(cert);
       
   988     
       
   989     mEapQtUtilsContext->createEapTls(
       
   990         caCerts,
       
   991         0,
       
   992         userCerts,
       
   993         0);
       
   994     
       
   995     mView->mWizard->setParameters(
       
   996         ssid, 
       
   997         CMManagerShim::Infra,
       
   998         CMManagerShim::WlanSecModeWpa2, 
       
   999         false, false, false);
       
  1000 
       
  1001     mView->showWizard();
       
  1002     verify_outertype_select_first(ButtonDisabled);
       
  1003     verify_ca_cert_page_select_and_click_next(true);
       
  1004     verify_user_cert_page_select_and_click_next(ButtonEnabled, 0);
       
  1005     verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTls));
       
  1006 
       
  1007     // backwards
       
  1008     QCOMPARE(mouseClickPrevious(), true);
       
  1009     QTest::qWait(WaitTimeForUi);
       
  1010     verify_user_cert_page(ButtonEnabled, userCert1, 0 );
       
  1011 
       
  1012     QCOMPARE(mouseClickPrevious(), true);
       
  1013     QTest::qWait(WaitTimeForUi);
       
  1014     verify_ca_cert_page();
       
  1015 
       
  1016     QCOMPARE(mouseClickPrevious(), true);
       
  1017     QTest::qWait(WaitTimeForUi);
       
  1018     verify_outertype(ButtonEnabled);
       
  1019 
       
  1020     cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert2);
       
  1021     caCerts.append(cert);
       
  1022     mEapQtUtilsContext->setCertsCa(caCerts);
       
  1023     
       
  1024     cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert2);
       
  1025     userCerts.append(cert);
       
  1026     mEapQtUtilsContext->setCertsUser(userCerts);
       
  1027 
       
  1028     mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTls);
       
  1029     
       
  1030     // Forward
       
  1031     QCOMPARE(mouseClickNext(), true);
       
  1032     verify_ca_cert_page_select_and_click_next(false);
       
  1033     verify_user_cert_page(ButtonDisabled);
       
  1034 
       
  1035     // backwards
       
  1036     QCOMPARE(mouseClickPrevious(), true);
       
  1037     QTest::qWait(WaitTimeForUi);
       
  1038     verify_ca_cert_page(caCert1, 1);
       
  1039 
       
  1040     QCOMPARE(mouseClickPrevious(), true);
       
  1041     QTest::qWait(WaitTimeForUi);
       
  1042     verify_outertype(ButtonEnabled);
       
  1043 
       
  1044     QCOMPARE(mouseClickNext(), true);
       
  1045     verify_ca_cert_page(caCert1, 1);
       
  1046 
       
  1047     QCOMPARE(mouseClickNext(), true);
       
  1048     verify_user_cert_page_select_and_click_next(ButtonDisabled, 0);
       
  1049 
       
  1050     verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls));        
       
  1051 
       
  1052     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true );
       
  1053     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1054 
       
  1055     QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
       
  1056     QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
       
  1057     
       
  1058     QCOMPARE( verifySummaryPage(
       
  1059         ssid,
       
  1060         CMManagerShim::Infra,
       
  1061         false, 
       
  1062         CMManagerShim::WlanSecModeWpa2, 
       
  1063         false,
       
  1064         hbTrId("txt_occ_dblist_destination_val_internet"),
       
  1065         EapQtPluginHandle::PluginEapTls),true);
       
  1066     
       
  1067 #endif 
       
  1068 }
       
  1069 
       
  1070 void TestWlanWizardEap::tc_eap_sim_finish()
       
  1071 {
       
  1072 #ifdef tc_eap_sim_finish_enabled
       
  1073     tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka);
       
  1074     
       
  1075     QCOMPARE( mouseClickFinish(), true );
       
  1076     QTest::qWait(WaitTimeForUi);
       
  1077     QCOMPARE( verifyStatus(WizardStatusSignalFinished, 3), true);
       
  1078 #endif
       
  1079 }
       
  1080 
       
  1081 void TestWlanWizardEap::tc_eap_sim_cancel()
       
  1082 {
       
  1083 #ifdef tc_eap_sim_cancel_enabled
       
  1084     tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka);
       
  1085     
       
  1086     QCOMPARE( mouseClickCancel(), true );
       
  1087     QTest::qWait(WaitTimeForUi);
       
  1088     QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true);
       
  1089 #endif
       
  1090 }
       
  1091 
       
  1092 void TestWlanWizardEap::tc_eap_fast_confirmed()
       
  1093 {
       
  1094 #ifdef tc_eap_fast_confirmed_enabled
       
  1095     tc_eap_fast(
       
  1096         EapQtPacStoreConfig::PacStoreStatePasswordStored,
       
  1097         true);
       
  1098 #endif
       
  1099 }
       
  1100 
       
  1101 void TestWlanWizardEap::tc_eap_fast_new_store()
       
  1102 {
       
  1103 #ifdef tc_eap_fast_new_store_enabled
       
  1104     tc_eap_fast(
       
  1105         EapQtPacStoreConfig::PacStoreStateStoreNotExists,
       
  1106         true);
       
  1107 #endif
       
  1108 }
       
  1109 
       
  1110 void TestWlanWizardEap::tc_eap_fast_new_store_save_fails()
       
  1111 {
       
  1112 #ifdef tc_eap_fast_new_store_save_fails_enabled
       
  1113     tc_eap_fast(
       
  1114         EapQtPacStoreConfig::PacStoreStateStoreNotExists,
       
  1115         false);
       
  1116 #endif
       
  1117 }
       
  1118 
       
  1119 void TestWlanWizardEap::tc_eap_fast_new_store_and_validators()
       
  1120 {
       
  1121 #ifdef tc_eap_fast_new_store_and_validators_enabled
       
  1122     const QString ssid("tc_eap_fast_new_store_and_validators");
       
  1123     const QString username("user");
       
  1124 
       
  1125     mWlanQtUtilsContext->setCreateWlanIapResult(4);
       
  1126     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
  1127     mWlanQtUtilsContext->setSignalWlanNetworkOpened(4);
       
  1128     mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed);
       
  1129 
       
  1130     mEapQtUtilsContext->setConfigurationReference(4, true);
       
  1131     mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists);
       
  1132     mEapQtUtilsContext->createInner(
       
  1133         EapQtPluginHandle::PluginEapFast,
       
  1134         EapQtPluginHandle::PluginEapMschapv2,
       
  1135         "u",
       
  1136         "p");
       
  1137     
       
  1138     mView->mWizard->setParameters(
       
  1139         ssid, 
       
  1140         CMManagerShim::Infra,
       
  1141         CMManagerShim::WlanSecModeWpa, 
       
  1142         false, false, false);
       
  1143 
       
  1144     mView->showWizard();
       
  1145     EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore(
       
  1146         EapQtPacStoreConfig::PacStorePassword);
       
  1147     validator->setReturnValue(EapQtValidator::StatusInvalid);
       
  1148     
       
  1149     verify_outertype_select_first(ButtonDisabled);
       
  1150     verify_new_pac_store_password_page(ButtonDisabled);
       
  1151     
       
  1152     QCOMPARE( mouseClickObject("lineEditUsername"), true );
       
  1153     QTest::qWait(WaitTimeForUi);
       
  1154     QCOMPARE( insertTextToObject("lineEditUsername", username), true );
       
  1155     QTest::qWait(WaitTimeForUi);
       
  1156     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1157     
       
  1158     validator->setReturnValue(EapQtValidator::StatusOk);
       
  1159     
       
  1160     QCOMPARE( mouseClickObject("lineEditPassword"), true );
       
  1161     QTest::qWait(WaitTimeForUi);
       
  1162     QCOMPARE( insertTextToObject("lineEditPassword", username), true );
       
  1163     QTest::qWait(WaitTimeForUi);
       
  1164     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1165     
       
  1166     QCOMPARE( mouseClickNext(), true );
       
  1167     verify_username_password(EapQtPluginHandle::PluginEapMschapv2);
       
  1168 
       
  1169 #endif
       
  1170 }
       
  1171 
       
  1172 
       
  1173 void TestWlanWizardEap::tc_eap_fast_new_store_back_and_forwards()
       
  1174 {
       
  1175 #ifdef tc_eap_fast_new_store_back_and_forwards_enabled
       
  1176     const QString ssid("tc_eap_fast_new_store_back_and_forwards");
       
  1177     const QString username("u");
       
  1178     const QString password("p");
       
  1179 
       
  1180     mWlanQtUtilsContext->setCreateWlanIapResult(4);
       
  1181     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
  1182     mWlanQtUtilsContext->setSignalWlanNetworkOpened(4);
       
  1183     mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed);
       
  1184 
       
  1185     mEapQtUtilsContext->setConfigurationReference(4, true);
       
  1186     mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists);
       
  1187     mEapQtUtilsContext->createInner(
       
  1188         EapQtPluginHandle::PluginEapFast,
       
  1189         EapQtPluginHandle::PluginEapMschapv2,
       
  1190         username,
       
  1191         password);
       
  1192     
       
  1193     mView->mWizard->setParameters(
       
  1194         ssid, 
       
  1195         CMManagerShim::Infra,
       
  1196         CMManagerShim::WlanSecModeWpa, 
       
  1197         false, false, false);
       
  1198 
       
  1199     mView->showWizard();
       
  1200     
       
  1201     verify_outertype_select_first(ButtonDisabled);
       
  1202     verify_new_pac_store_password_page(ButtonEnabled);
       
  1203     QCOMPARE( mouseClickNext(), true );
       
  1204     verify_username_password(EapQtPluginHandle::PluginEapMschapv2);
       
  1205     
       
  1206     // backwards
       
  1207     QCOMPARE( mouseClickPrevious(), true );
       
  1208     verify_new_pac_store_password_page(ButtonEnabled);
       
  1209     QCOMPARE( mouseClickPrevious(), true );
       
  1210     
       
  1211     mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2);
       
  1212     
       
  1213     // forwards
       
  1214     verify_outertype_select_first(ButtonEnabled);
       
  1215     verify_new_pac_store_password_page(ButtonEnabled);
       
  1216     QCOMPARE( mouseClickNext(), true );
       
  1217     verify_username_password(EapQtPluginHandle::PluginEapMschapv2);
       
  1218 #endif
       
  1219 }
       
  1220 
       
  1221 void TestWlanWizardEap::tc_eap_fast_new_store_read_config_fail()
       
  1222 {
       
  1223 #ifdef tc_eap_fast_new_store_read_config_fail_enabled
       
  1224     tc_eap_fast(
       
  1225         EapQtPacStoreConfig::PacStoreStateStoreNotExists,
       
  1226         true,
       
  1227         false);
       
  1228 #endif
       
  1229 }
       
  1230 
       
  1231 void TestWlanWizardEap::tc_eap_fast_confirm_store()
       
  1232 {
       
  1233 #ifdef tc_eap_fast_confirm_store_enabled
       
  1234     tc_eap_fast(
       
  1235         EapQtPacStoreConfig::PacStoreStatePasswordRequired,
       
  1236         true);
       
  1237 #endif
       
  1238 }
       
  1239 
       
  1240 void TestWlanWizardEap::tc_eap_fast_confirm_store_and_validators()
       
  1241 {
       
  1242 #ifdef tc_eap_fast_confirm_store_and_validators_enabled
       
  1243     const QString ssid("tc_eap_fast_confirm_store_and_validators");
       
  1244     const QString username_invalid("invalid");
       
  1245     const QString username_valid("valid");
       
  1246 
       
  1247     mWlanQtUtilsContext->setCreateWlanIapResult(4);
       
  1248     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
  1249     mWlanQtUtilsContext->setSignalWlanNetworkOpened(4);
       
  1250     mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed);
       
  1251 
       
  1252     mEapQtUtilsContext->setConfigurationReference(4, true);
       
  1253     mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired);
       
  1254     mEapQtUtilsContext->createInner(
       
  1255         EapQtPluginHandle::PluginEapFast,
       
  1256         EapQtPluginHandle::PluginEapMschapv2,
       
  1257         "u",
       
  1258         "p");
       
  1259     
       
  1260     mView->mWizard->setParameters(
       
  1261         ssid, 
       
  1262         CMManagerShim::Infra,
       
  1263         CMManagerShim::WlanSecModeWpa, 
       
  1264         false, false, false);
       
  1265 
       
  1266     mView->showWizard();
       
  1267     EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore(
       
  1268         EapQtPacStoreConfig::PacStorePasswordConfirmation);
       
  1269     validator->setReturnValue(EapQtValidator::StatusInvalid);
       
  1270     
       
  1271     verify_outertype_select_first(ButtonDisabled);
       
  1272     verify_confirm_pac_store_password_page(ButtonEnabled);
       
  1273     
       
  1274     QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true );
       
  1275     QTest::qWait(WaitTimeForUi);
       
  1276     QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_invalid), true );
       
  1277     QCOMPARE( mouseClickObject("labelError"), true );
       
  1278     QTest::qWait(WaitTimeForUi);
       
  1279     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1280     
       
  1281     QCOMPARE( mouseClickNext(), true );
       
  1282     verify_confirm_pac_store_password_page(ButtonEnabled);
       
  1283     QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), true);
       
  1284 
       
  1285 
       
  1286     validator->setReturnValue(EapQtValidator::StatusOk);
       
  1287     
       
  1288     QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true );
       
  1289     QTest::qWait(WaitTimeForUi);
       
  1290     QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_valid), true );
       
  1291     QCOMPARE( mouseClickObject("labelError"), true );
       
  1292     QTest::qWait(WaitTimeForUi);
       
  1293     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1294     QTest::qWait(WaitTimeForUi);
       
  1295     QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), false);
       
  1296     
       
  1297     QCOMPARE( mouseClickNext(), true );
       
  1298     verify_username_password(EapQtPluginHandle::PluginEapMschapv2);
       
  1299 
       
  1300 #endif
       
  1301 }
       
  1302 
       
  1303 void TestWlanWizardEap::tc_eap_fast_confirm_store_back_and_forwards()
       
  1304 {
       
  1305 #ifdef tc_eap_fast_confirm_store_back_and_forwards_enabled
       
  1306     const QString ssid("tc_eap_fast_confirm_store_back_and_forwards");
       
  1307     const QString username("u");
       
  1308     const QString password("p");
       
  1309 
       
  1310     mWlanQtUtilsContext->setCreateWlanIapResult(4);
       
  1311     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
  1312     mWlanQtUtilsContext->setSignalWlanNetworkOpened(4);
       
  1313     mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed);
       
  1314 
       
  1315     mEapQtUtilsContext->setConfigurationReference(4, true);
       
  1316     mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired);
       
  1317     mEapQtUtilsContext->createInner(
       
  1318         EapQtPluginHandle::PluginEapFast,
       
  1319         EapQtPluginHandle::PluginEapMschapv2,
       
  1320         username,
       
  1321         password);
       
  1322     
       
  1323     mView->mWizard->setParameters(
       
  1324         ssid, 
       
  1325         CMManagerShim::Infra,
       
  1326         CMManagerShim::WlanSecModeWpa, 
       
  1327         false, false, false);
       
  1328 
       
  1329     mView->showWizard();
       
  1330     
       
  1331     verify_outertype_select_first(ButtonDisabled);
       
  1332     verify_confirm_pac_store_password_page(ButtonEnabled);
       
  1333     QCOMPARE( mouseClickNext(), true );
       
  1334     verify_username_password(EapQtPluginHandle::PluginEapMschapv2);
       
  1335     
       
  1336     // backwards
       
  1337     QCOMPARE( mouseClickPrevious(), true );
       
  1338     verify_confirm_pac_store_password_page(ButtonEnabled);
       
  1339     QCOMPARE( mouseClickPrevious(), true );
       
  1340     
       
  1341     mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2);
       
  1342     
       
  1343     // forwards
       
  1344     verify_outertype_select_first(ButtonEnabled);
       
  1345     verify_confirm_pac_store_password_page(ButtonEnabled);
       
  1346     QCOMPARE( mouseClickNext(), true );
       
  1347     verify_username_password(EapQtPluginHandle::PluginEapMschapv2);
       
  1348 #endif
       
  1349 }
       
  1350 
       
  1351 
       
  1352 // ---------------------------------------------------------
       
  1353 // HELPPER VERIFICATORS & NAVIGATORS
       
  1354 // ---------------------------------------------------------
       
  1355 
       
  1356 void TestWlanWizardEap::verify_outertype_select_first(
       
  1357     TestWlanWizardContext::ButtonStatus nextButtonStatus)
       
  1358 {
       
  1359     verify_outertype(nextButtonStatus);
       
  1360     
       
  1361     QCOMPARE( selectRadioButton( "list", 0 ), true );
       
  1362     QTest::qWait(WaitTimeForUi);
       
  1363     QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1364     QCOMPARE( mouseClickNext(), true );
       
  1365 }
       
  1366 
       
  1367 void TestWlanWizardEap::verify_outertype(
       
  1368     TestWlanWizardContext::ButtonStatus nextButtonStatus)
       
  1369 {
       
  1370     QCOMPARE( verifyCurrentPage(EapWizardPage::PageOuterType), true );
       
  1371     QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, nextButtonStatus, ButtonHidden), true );
       
  1372 }
       
  1373 
       
  1374 void TestWlanWizardEap::verify_innertype_select_first(
       
  1375     int outerType,
       
  1376     TestWlanWizardContext::ButtonStatus nextButtonStatus)
       
  1377 {
       
  1378     verify_innertype(outerType, nextButtonStatus);
       
  1379     
       
  1380     QCOMPARE( selectRadioButton( "list", 0 ), true );
       
  1381     QTest::qWait(WaitTimeForUi);
       
  1382     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1383     QCOMPARE( mouseClickNext(), true );
       
  1384 }
       
  1385 
       
  1386 void TestWlanWizardEap::verify_innertype(
       
  1387     int outerType, 
       
  1388     TestWlanWizardContext::ButtonStatus nextButtonStatus)
       
  1389 {
       
  1390     int pageId;
       
  1391     if (outerType == EapQtPluginHandle::PluginPeap){
       
  1392         pageId = EapWizardPage::PageInnerTypePeap;
       
  1393         
       
  1394     } else {
       
  1395         Q_ASSERT(outerType == EapQtPluginHandle::PluginEapTtls);
       
  1396         pageId = EapWizardPage::PageInnerTypeEapTtls;
       
  1397     }
       
  1398     QCOMPARE( verifyCurrentPageWithInfo(pageId, eapTypeToString(outerType)), true );
       
  1399     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true );
       
  1400 }
       
  1401 
       
  1402 void TestWlanWizardEap::verify_username_password_click_next(
       
  1403     int type, 
       
  1404     const QString &username, 
       
  1405     const QString &password)
       
  1406 {
       
  1407     verify_username_password(type);
       
  1408     
       
  1409     QCOMPARE( mouseClickObject("lineEditUsername"), true );
       
  1410     QTest::qWait(WaitTimeForUi);
       
  1411     QCOMPARE( insertTextToObject("lineEditUsername", username), true );
       
  1412     QTest::qWait(WaitTimeForUi);
       
  1413 
       
  1414     QCOMPARE( mouseClickObject("lineEditPassword"), true );
       
  1415     QTest::qWait(WaitTimeForUi);
       
  1416     QCOMPARE( insertTextToObject("lineEditPassword", password), true );
       
  1417     QTest::qWait(WaitTimeForUi);
       
  1418     
       
  1419     QCOMPARE( mouseClickObject("setlabel_56"), true );
       
  1420     QCOMPARE( mouseClickNext(), true );
       
  1421 }
       
  1422 
       
  1423 void TestWlanWizardEap::verify_username_password(int type)
       
  1424 {
       
  1425     QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageUsernamePassword, eapTypeToString(type)), true );
       
  1426     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1427 }
       
  1428 
       
  1429 void TestWlanWizardEap::verify_ca_cert_page_select_and_click_next(bool automatic)
       
  1430 {
       
  1431     verify_ca_cert_page();
       
  1432     
       
  1433     int index = 0;
       
  1434     if (automatic == false) {
       
  1435         index = 1;
       
  1436     }
       
  1437     QCOMPARE( selectRadioButton( "list", index ), true );
       
  1438     QTest::qWait(WaitTimeForUi);
       
  1439     
       
  1440     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1441     QCOMPARE( mouseClickNext(), true );
       
  1442 }
       
  1443 
       
  1444 
       
  1445 void TestWlanWizardEap::verify_ca_cert_page()
       
  1446 {
       
  1447     QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true );
       
  1448     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1449  
       
  1450     QCOMPARE( verifyRadioButtonState(
       
  1451         "list", 
       
  1452         0, 
       
  1453         hbTrId("txt_occ_setlabel_val_select_automatically")), true);
       
  1454 }
       
  1455 
       
  1456 void TestWlanWizardEap::verify_ca_cert_page(const QString &text, int index)
       
  1457 {
       
  1458     QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true );
       
  1459     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1460     
       
  1461     QCOMPARE( verifyRadioButtonState("list", index, text), true);
       
  1462 }
       
  1463 
       
  1464 void TestWlanWizardEap::verify_user_cert_page_select_and_click_next(
       
  1465     ButtonStatus nextButtonStatus,
       
  1466     int index)
       
  1467 {
       
  1468     verify_user_cert_page(nextButtonStatus);
       
  1469 
       
  1470     if (index != -1){
       
  1471         QCOMPARE( selectRadioButton( "list", index ), true );
       
  1472         QTest::qWait(WaitTimeForUi);
       
  1473     
       
  1474         QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1475         QCOMPARE( mouseClickNext(), true );
       
  1476     } else {
       
  1477         QCOMPARE( 
       
  1478             verifyDialogText(
       
  1479                 "errorLabel",
       
  1480                 hbTrId("txt_occ_dialog_no_certificates_installed_wizard_c")), true);
       
  1481         QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1482     }
       
  1483 }
       
  1484 
       
  1485 void TestWlanWizardEap::verify_user_cert_page(ButtonStatus nextButtonStatus)
       
  1486 {
       
  1487     QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true );
       
  1488     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true );
       
  1489 }
       
  1490 
       
  1491 
       
  1492 void TestWlanWizardEap::verify_user_cert_page(
       
  1493     ButtonStatus nextButtonStatus,
       
  1494     const QString &text,
       
  1495     int index)
       
  1496 {
       
  1497     QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true );
       
  1498     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true );
       
  1499     
       
  1500     QCOMPARE( verifyRadioButtonState("list", index, text), true);
       
  1501 }
       
  1502 
       
  1503 void TestWlanWizardEap::verify_identity_modify_and_click_next(
       
  1504     const QString &outerType,
       
  1505     bool usernameAutomatic,
       
  1506     const QString &username,
       
  1507     bool realmAutomatic,
       
  1508     const QString &realm)
       
  1509 {
       
  1510     QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true );
       
  1511     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1512     QTest::qWait(WaitTimeForUi);
       
  1513     
       
  1514     QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true);
       
  1515     QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true);
       
  1516     
       
  1517     QCOMPARE(selectCheckBoxState("setlabel_53_val", usernameAutomatic), true);
       
  1518     QCOMPARE(selectCheckBoxState("setlabel_54_val", realmAutomatic), true);
       
  1519         
       
  1520     QTest::qWait(WaitTimeForUi);
       
  1521     
       
  1522     QCOMPARE(verifyCheckBoxState("setlabel_53_val", usernameAutomatic), true);
       
  1523     QCOMPARE(verifyCheckBoxState("setlabel_54_val", realmAutomatic), true);
       
  1524     
       
  1525     QCOMPARE( mouseClickObject("lineEditUsername"), true );
       
  1526     QTest::qWait(WaitTimeForUi);
       
  1527     QCOMPARE( insertTextToObject("lineEditUsername", username), true );
       
  1528     QTest::qWait(WaitTimeForUi);
       
  1529 
       
  1530     QCOMPARE( mouseClickObject("lineEditRealm"), true );
       
  1531     QTest::qWait(WaitTimeForUi);
       
  1532     QCOMPARE( insertTextToObject("lineEditRealm", realm), true );
       
  1533     QTest::qWait(WaitTimeForUi);
       
  1534     
       
  1535     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1536     QTest::qWait(WaitTimeForUi);
       
  1537     
       
  1538     QCOMPARE( mouseClickObject("setlabel_53"), true );
       
  1539     QCOMPARE( mouseClickNext(), true );
       
  1540 }
       
  1541 
       
  1542 void TestWlanWizardEap::verify_identity_and_click_next(const QString &outerType)
       
  1543 {
       
  1544     verify_identity_page(outerType);
       
  1545     
       
  1546     QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true);
       
  1547     QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true);
       
  1548     
       
  1549     QCOMPARE( mouseClickObject("setlabel_53"), true );
       
  1550     QCOMPARE( mouseClickNext(), true );
       
  1551 }
       
  1552 
       
  1553 void TestWlanWizardEap::verify_identity_page(const QString &outerType)
       
  1554 {
       
  1555     QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true );
       
  1556     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true );
       
  1557 }
       
  1558 
       
  1559 
       
  1560 void TestWlanWizardEap::verify_new_pac_store_password_page(
       
  1561     ButtonStatus nextButtonStatus )
       
  1562 {
       
  1563     QCOMPARE( verifyCurrentPage(EapWizardPage::PageNewPacStorePassword), true );
       
  1564     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true );
       
  1565 }
       
  1566 
       
  1567 
       
  1568 void TestWlanWizardEap::verify_confirm_pac_store_password_page(
       
  1569     ButtonStatus nextButtonStatus)
       
  1570 {
       
  1571     QCOMPARE( verifyCurrentPage(EapWizardPage::PagePromptPacStorePassword), true );
       
  1572     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true );
       
  1573 }
       
  1574 
       
  1575 // ---------------------------------------------------------
       
  1576 // SUBTEST CASES
       
  1577 // ---------------------------------------------------------
       
  1578 
       
  1579 
       
  1580 void TestWlanWizardEap::tc_eap_aka_sim(int type)
       
  1581 {
       
  1582     // TODO: verify IAP settings
       
  1583     // TODO: verify call stack
       
  1584     
       
  1585     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
  1586     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
  1587     mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
  1588     mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
  1589     
       
  1590     mEapQtUtilsContext->setConfigurationReference(3, true);
       
  1591     mEapQtUtilsContext->createEapAkaSim(type);
       
  1592     
       
  1593     const QString ssid("tc_eap_aka_sim");
       
  1594     
       
  1595     mView->mWizard->setParameters(
       
  1596         ssid, 
       
  1597         CMManagerShim::Infra,
       
  1598         CMManagerShim::WlanSecMode802_1x, 
       
  1599         false, false, false);
       
  1600 
       
  1601     mView->showWizard();
       
  1602     
       
  1603     verify_outertype_select_first(ButtonDisabled);
       
  1604 
       
  1605     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true );
       
  1606     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1607 
       
  1608     QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
       
  1609     QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
       
  1610     
       
  1611     QCOMPARE( verifySummaryPage(
       
  1612         ssid,
       
  1613         CMManagerShim::Infra,
       
  1614         false, 
       
  1615         CMManagerShim::WlanSecMode802_1x, 
       
  1616         true,
       
  1617         hbTrId("txt_occ_dblist_destination_val_internet"),
       
  1618         type),true);
       
  1619 }
       
  1620 
       
  1621 void TestWlanWizardEap::tc_eap_peap_ttls(
       
  1622     int outerType, 
       
  1623     int innerType,
       
  1624     int errorCode,
       
  1625     const QString &errorString,
       
  1626     bool saveInnerConfReturn )
       
  1627 {
       
  1628     // TODO: verify IAP settings
       
  1629     // TODO: verify call stack
       
  1630     const QString ssid("tc_eap_peap_ttls");
       
  1631     const QString username("u");
       
  1632     const QString password("p");
       
  1633 
       
  1634     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
  1635     
       
  1636     if (errorCode == KErrNone) {
       
  1637         mWlanQtUtilsContext->setConnectionSuccessed(true);
       
  1638         mWlanQtUtilsContext->setSignalWlanNetworkOpened(3);
       
  1639         mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed);
       
  1640     } else {
       
  1641         mWlanQtUtilsContext->setConnectionSuccessed(false);
       
  1642         mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode);
       
  1643     }
       
  1644     mEapQtUtilsContext->setConfigurationReference(3, true);
       
  1645     mEapQtUtilsContext->createEapTtlsPeap(
       
  1646         (EapQtPluginHandle::Plugin)outerType,
       
  1647         true,
       
  1648         true,
       
  1649         QString(), //usernameIdentity,
       
  1650         true,
       
  1651         QString(), //realm,
       
  1652         (EapQtPluginHandle::Plugin)innerType );
       
  1653 
       
  1654     mEapQtUtilsContext->createInner(
       
  1655         (EapQtPluginHandle::Plugin)outerType,
       
  1656         (EapQtPluginHandle::Plugin)innerType,
       
  1657         username,
       
  1658         password);
       
  1659     
       
  1660     mEapQtUtilsContext->setInnerConfigReturn(saveInnerConfReturn);
       
  1661     
       
  1662     mView->mWizard->setParameters(
       
  1663         ssid, 
       
  1664         CMManagerShim::Infra,
       
  1665         CMManagerShim::WlanSecModeWpa, 
       
  1666         false, false, false);
       
  1667 
       
  1668     mView->showWizard();
       
  1669     
       
  1670     verify_outertype_select_first(ButtonDisabled);
       
  1671     verify_ca_cert_page_select_and_click_next(true);
       
  1672     verify_identity_and_click_next(eapTypeToString((EapQtPluginHandle::Plugin)outerType));
       
  1673     verify_innertype_select_first(
       
  1674         (EapQtPluginHandle::Plugin)outerType,
       
  1675         ButtonDisabled);
       
  1676     
       
  1677     verify_username_password_click_next(innerType, username, password);
       
  1678     
       
  1679     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true );
       
  1680     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1681 
       
  1682     if (errorCode == KErrNone){
       
  1683         QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
       
  1684         QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
       
  1685         
       
  1686         QCOMPARE( verifySummaryPage(
       
  1687             ssid,
       
  1688             CMManagerShim::Infra,
       
  1689             false, 
       
  1690             CMManagerShim::WlanSecModeWpa, 
       
  1691             false,
       
  1692             hbTrId("txt_occ_dblist_destination_val_internet"),
       
  1693             (EapQtPluginHandle::Plugin)outerType,
       
  1694             (EapQtPluginHandle::Plugin)innerType),true);
       
  1695         
       
  1696     } else {
       
  1697         QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true );
       
  1698         QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1699     }
       
  1700 }
       
  1701 
       
  1702 void TestWlanWizardEap::tc_eap_aka_connect_error(
       
  1703     int errorCode, 
       
  1704     const QString &errorString)
       
  1705 {
       
  1706     // TODO: verify IAP settings
       
  1707     // TODO: verify call stack
       
  1708     
       
  1709     const QString ssid(errorString);
       
  1710     
       
  1711     mWlanQtUtilsContext->setCreateWlanIapResult(3);
       
  1712     mWlanQtUtilsContext->setConnectionSuccessed(false);
       
  1713     mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode);
       
  1714     
       
  1715     mEapQtUtilsContext->setConfigurationReference(3, true);
       
  1716     mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka);
       
  1717     
       
  1718     mView->mWizard->setParameters(
       
  1719         ssid, 
       
  1720         CMManagerShim::Infra,
       
  1721         CMManagerShim::WlanSecModeWpa2, 
       
  1722         false, false, false);
       
  1723 
       
  1724     mView->showWizard();
       
  1725     
       
  1726     verify_outertype_select_first(ButtonDisabled);
       
  1727     
       
  1728     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true );
       
  1729     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1730 
       
  1731     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true );
       
  1732     QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1733 }
       
  1734 
       
  1735 
       
  1736 void TestWlanWizardEap::tc_eap_fast(
       
  1737     int pacStoreState, 
       
  1738     bool savePacStoreReturn,
       
  1739     bool readPacStoreReturn)
       
  1740 {
       
  1741     // TODO: verify IAP settings
       
  1742     // TODO: verify call stack
       
  1743     
       
  1744     const QString ssid("tc_eap_fast");
       
  1745     const QString username("u");
       
  1746     const QString password("p");
       
  1747 
       
  1748     mWlanQtUtilsContext->setCreateWlanIapResult(4);
       
  1749     mWlanQtUtilsContext->setConnectionSuccessed(true);
       
  1750     mWlanQtUtilsContext->setSignalWlanNetworkOpened(4);
       
  1751     mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed);
       
  1752 
       
  1753     mEapQtUtilsContext->setConfigurationReference(4, true);
       
  1754     mEapQtUtilsContext->createEapFast(pacStoreState);
       
  1755     mEapQtUtilsContext->setPacStoreConfigSaveReturn(savePacStoreReturn);
       
  1756     mEapQtUtilsContext->setPacStoreConfigReadReturn(readPacStoreReturn);
       
  1757     
       
  1758     if (!readPacStoreReturn) {
       
  1759         EapQtPacStoreConfig pacStoreConfig;
       
  1760         pacStoreConfig.setValue(
       
  1761             EapQtPacStoreConfig::PacStoreReset, 
       
  1762             true);
       
  1763         
       
  1764         mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true);
       
  1765     }
       
  1766     
       
  1767     mEapQtUtilsContext->createInner(
       
  1768         EapQtPluginHandle::PluginEapFast,
       
  1769         EapQtPluginHandle::PluginEapMschapv2,
       
  1770         username,
       
  1771         password);
       
  1772     
       
  1773     mView->mWizard->setParameters(
       
  1774         ssid, 
       
  1775         CMManagerShim::Infra,
       
  1776         CMManagerShim::WlanSecModeWpa, 
       
  1777         false, false, false);
       
  1778 
       
  1779     mView->showWizard();
       
  1780     
       
  1781     verify_outertype_select_first(ButtonDisabled);
       
  1782     
       
  1783     if (!readPacStoreReturn) {
       
  1784         EapQtPacStoreConfig pacStoreConfig;
       
  1785         
       
  1786         pacStoreConfig.setValue(
       
  1787             EapQtPacStoreConfig::PacStorePassword, 
       
  1788             "");
       
  1789         
       
  1790         pacStoreConfig.setValue(
       
  1791             EapQtPacStoreConfig::PacStoreSavePassword, 
       
  1792             true);
       
  1793 
       
  1794         
       
  1795         mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true);
       
  1796     }
       
  1797     
       
  1798     switch (pacStoreState){
       
  1799     case EapQtPacStoreConfig::PacStoreStateStoreNotExists:
       
  1800         verify_new_pac_store_password_page(ButtonEnabled);
       
  1801         QCOMPARE( mouseClickNext(), true );
       
  1802         break;
       
  1803         
       
  1804     case EapQtPacStoreConfig::PacStoreStatePasswordRequired:
       
  1805         verify_confirm_pac_store_password_page(ButtonEnabled);
       
  1806         QCOMPARE( mouseClickNext(), true );
       
  1807         break;
       
  1808     }
       
  1809 
       
  1810     verify_username_password_click_next(EapQtPluginHandle::PluginEapMschapv2,username,password);
       
  1811     
       
  1812     QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true );
       
  1813     QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );
       
  1814 
       
  1815     if (savePacStoreReturn) {
       
  1816         
       
  1817         QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true );
       
  1818         QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true );
       
  1819         
       
  1820         QCOMPARE( verifySummaryPage(
       
  1821             ssid,
       
  1822             CMManagerShim::Infra,
       
  1823             false, 
       
  1824             CMManagerShim::WlanSecModeWpa, 
       
  1825             false,
       
  1826             hbTrId("txt_occ_dblist_destination_val_internet"),
       
  1827             EapQtPluginHandle::PluginEapFast,
       
  1828             EapQtPluginHandle::PluginEapMschapv2,
       
  1829             true) ,true);
       
  1830     } else {
       
  1831         QCOMPARE( 
       
  1832             verifyCurrentPageWithInfo(
       
  1833                 WlanWizardPageInternal::PageGenericError, 
       
  1834                 hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true );
       
  1835         QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true );        
       
  1836     }
       
  1837 }