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