wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h
branchRCL_3
changeset 25 f28ada11abbf
parent 24 63be7eb3fc78
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
     1 /*
       
     2 * Copyright (c) 2009-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 * This is the header file for testing Wlan Qt Utilities library.
       
    16 */
       
    17 
       
    18 #ifndef TESTWLANQTUTILS_H
       
    19 #define TESTWLANQTUTILS_H
       
    20 
       
    21 #include <QObject>
       
    22 
       
    23 class QSignalSpy;
       
    24 class WlanQtUtils;
       
    25 class WlanQtUtilsAp;
       
    26 
       
    27 class TestWlanQtUtils: public QObject
       
    28 {
       
    29     Q_OBJECT
       
    30     
       
    31 private slots:
       
    32 
       
    33     // Functions from QTest framework.
       
    34     void initTestCase();
       
    35     void cleanupTestCase();
       
    36     void init();
       
    37     void cleanup();
       
    38 
       
    39     // Test functions for public interface.
       
    40     
       
    41     // scanWlans()
       
    42     void testAvailableWlan();
       
    43     void testAvailableWlanDuplicates();
       
    44     void testAvailableWlanSecModes();
       
    45     void testAvailableWlanSsids();
       
    46     void testAvailableWlanWithIaps();
       
    47     void testAvailableWlanSequence();
       
    48     void testAvailableWlanScanEmpty();
       
    49     void testAvailableWlanScanError();
       
    50     
       
    51     // scanWlanAps()
       
    52     void testAvailableWlanAps();
       
    53     void testAvailableWlanApsScanEmpty();
       
    54     void testStopWlanApScan();
       
    55     void testWlanApScanError();
       
    56     void testAvailableWlanApsSpecialChars();
       
    57     
       
    58     // scanWlanDirect()
       
    59     void testDirectScanBasic();
       
    60     void testDirectScanEmpty();
       
    61     void testDirectScanStop();
       
    62     void testDirectScanError();
       
    63 
       
    64     void testCreateIapOk();
       
    65     void testCreateIapErr();
       
    66     void testCreateIapWepKeys();
       
    67     
       
    68     void testUpdateIapOk();
       
    69     void testUpdateIapErr();
       
    70     
       
    71     void testDeleteIapOk();
       
    72     void testDeleteIapErr();
       
    73     
       
    74     void testConnectIapOk();
       
    75     void testConnectIapErr();
       
    76     
       
    77     void testDisconnectIapOk();
       
    78     void testDisconnectIapIgnored();
       
    79 
       
    80     void testConnectionStatus();
       
    81     
       
    82     void testIapNameFound();
       
    83     void testIapNameNotFound();
       
    84     
       
    85     void testActiveIapFound();
       
    86     void testActiveIapFoundConstructor();
       
    87     void testActiveIapNotFound();
       
    88 
       
    89     void testScanWlans();
       
    90     void testScanWlansIgnored();
       
    91     
       
    92     void testStopWlanScanOk();
       
    93     void testStopWlanScanIgnored();
       
    94 
       
    95     void testWlanNetworkOpened();
       
    96     void testWlanNetworkClosed();
       
    97 
       
    98     void testApCopyConstructor();
       
    99     
       
   100     // Test functions for private implementation (tested via public interface)
       
   101     void testConnectionTestOk();
       
   102     void testConnectionTestErr();
       
   103     void testConnectionTestHotspot();
       
   104 
       
   105     void testConnMonEventGprs();
       
   106     void testConnMonEventCreatedBeforeConstructor();
       
   107 
       
   108 private:
       
   109     
       
   110     // Helper functions, that is, sub test cases.
       
   111     void subTestSignalWaitAndTake(QSignalSpy *spy, QList<QVariant> *arguments);
       
   112     void subTestScanResultSignal(QSignalSpy* spy, int status);
       
   113     void subTestLoadCommsDatFile(QString newCommsdatFilename);
       
   114     void subTestNewWlanQtUtils();
       
   115     WlanQtUtilsAp *subTestNewAp();
       
   116 
       
   117     // Member variables.
       
   118     WlanQtUtils *wlanQtUtils_;
       
   119     QSignalSpy *mSignalScanReady;
       
   120     QSignalSpy *mSignalScanApReady;
       
   121     QSignalSpy *mSignalScanDirectReady;
       
   122     QSignalSpy *signalWlanNetworkOpened_;
       
   123     QSignalSpy *signalWlanNetworkClosed_;
       
   124     QSignalSpy *signalIctResult_;
       
   125     
       
   126     /* Default CommsDat file name
       
   127     SNAP ID=3: Internet:
       
   128         IAP ID = 1: packet data 1
       
   129         IAP ID = 3: packet data 2
       
   130         IAP ID = 4: packet data 3
       
   131         IAP ID = 5: WLAN IAP 1, EWlanSecModeOpen
       
   132         IAP ID = 6: WLAN IAP 2, EWlanSecModeWep, w2key
       
   133         IAP ID = 7: WLAN IAP 3, EWlanSecModeWpa, wlan3key
       
   134     SNAP ID = 4: Multimedia msg.
       
   135     SNAP ID = 5: WAP services
       
   136     SNAP ID = 6: My Snap:
       
   137         IAP ID = 8: Home WLAN, EWlanSecModeOpen
       
   138         IAP ID = 9: Streaming
       
   139      */
       
   140     static const QString commsDatDefault_;
       
   141 };
       
   142 
       
   143 #endif // TESTWLANQTUTILS_H
       
   144