# HG changeset patch # User hgs # Date 1282559409 -10800 # Node ID bdc64aa9b9545d185b17336a516e6b97cb611379 # Parent fb81b597edf16aeb3c7136bd3c5d08e0aa7dc60d 201033 diff -r fb81b597edf1 -r bdc64aa9b954 hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h --- a/hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h Fri Aug 06 18:38:57 2010 +0300 +++ b/hsfw_plat/hotspot_framework_client_api/inc/hssiapsettings.h Mon Aug 23 13:30:09 2010 +0300 @@ -81,7 +81,7 @@ { public: - THssIapSettings(); + TBuf Name; EHssConnectionMode iConnectionMode; diff -r fb81b597edf1 -r bdc64aa9b954 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r fb81b597edf1 -r bdc64aa9b954 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,1 @@ + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/cpwlansettingsplugin.pro --- a/wlanutilities/cpwlansettingsplugin/cpwlansettingsplugin.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/cpwlansettingsplugin.pro Mon Aug 23 13:30:09 2010 +0300 @@ -41,10 +41,15 @@ -lecom \ -lxqsettingsmanager +# Temporary solution to fix tracecompiler +# When tracecompiler is fixed, this can be removed +symbian: { + MMP_RULES += "USERINCLUDE traces" +} + symbian: { TARGET.EPOCALLOWDLLDATA = 1 TARGET.UID3 = 0x2002DC79 - SYMBIAN_PLATFORMS = WINSCW ARMV5 BLD_INF_RULES.prj_exports += "rom/cpwlansettingsplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(cpwlansettingsplugin.iby)" BLD_INF_RULES.prj_exports += "rom/cpwlansettingsplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(cpwlansettingsplugin_resources.iby)" diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsgroupitemdata.h --- a/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsgroupitemdata.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsgroupitemdata.h Mon Aug 23 13:30:09 2010 +0300 @@ -58,6 +58,8 @@ void scanValueChanged(int value); void scanSliderReleased(); + + void devicePowerSavingChanged(); private: @@ -65,6 +67,8 @@ void createScanIntervalItem(); + void removeScanIntervalItem(); + void initialise(); void createWlanSettingItems(); @@ -78,9 +82,14 @@ CpItemDataHelper &mItemDataHelper; - int mScanInterval; + /*! + User defined scan interval. Not in use, while "Automatic" is + selected, but remembered so that it can be restored when + "User defined" mode is selected again. + */ + int mUserDefinedScanInterval; - //WlanSettings *mWlanSettings; + //! For loading and saving Wlan settings QScopedPointer mWlanSettings; }; diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsplugin.h --- a/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsplugin.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/inc/cpwlansettingsplugin.h Mon Aug 23 13:30:09 2010 +0300 @@ -21,39 +21,56 @@ // System includes #include -#include +#include #include // User includes // Forward declarations +class HbTranslator; + // External data types // Constants // Class declaration -class CpWlanSettingsPlugin - : public QObject, - public CpPluginInterface +class CpWlanSettingsPlugin : public QObject, public CpPluginInterface { Q_OBJECT Q_INTERFACES(CpPluginInterface) + public: + + // Data types + CpWlanSettingsPlugin(); + virtual ~CpWlanSettingsPlugin(); - virtual QList createSettingFormItemData(CpItemDataHelper &itemDataHelper) const; + + virtual QList createSettingFormItemData( + CpItemDataHelper &itemDataHelper) const; + +signals: + +public slots: + +protected: + +protected slots: private: Q_DISABLE_COPY(CpWlanSettingsPlugin) -private: //data +private slots: + +private: // data - QTranslator *translator; - + QScopedPointer mTranslator; //!< Translator for localisation + + // Friend classes }; - #endif /* WLANSETTINGSPLUGIN_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/inc/wlansettings.h --- a/wlanutilities/cpwlansettingsplugin/inc/wlansettings.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/inc/wlansettings.h Mon Aug 23 13:30:09 2010 +0300 @@ -24,9 +24,10 @@ // User includes -#include "wlansettings_s60_p.h" +// Forward declarations -// Forward declarations +class CWlanSettingsPrivate; +class XQSettingsManager; // External data types @@ -40,11 +41,17 @@ public: + // Data types + enum ScanNetworkType { EScanNetworkAuto = 0, EScanNetworkUserDefined }; + static const uint ScanNetworkAuto = 0xFFFFFFFF; + static const uint ScanNetworkMin = 1; + static const uint ScanNetworkMax = 30; + WlanSettings(); ~WlanSettings(); @@ -61,27 +68,47 @@ int setJoinWlanMode(int mode); - int isPowerSavingEnabled() const; + bool isWlanPowerSavingEnabled() const; - int isPsmEnabled() const; + bool isDevicePowerSavingEnabled(); int setWlanPowerSaving(int powerSavingOption); int setWlanScanInterval(uint scanInterval); +signals: + + void devicePowerSavingUpdated(); + +public slots: + +protected: + +protected slots: + private: - - void readPsmKey(); - + Q_DISABLE_COPY(WlanSettings) + + void readDevicePowerSavingKey(); + +private slots: + + void devicePowerSavingKeyChanged(); + +private: // data + + //! Private Symbian specific implementation. + CWlanSettingsPrivate *d_ptr; -private: //data + //! Settings manager for platform settings reading & status changes. + XQSettingsManager *mSettingsManager; - CWlanSettingsPrivate *mImpl; + //! Device Power Saving Mode. + int mDevicePowerSavingMode; - int mPsmKeyValue; - + //! Is mDevicePowerSavingMode up to date, or do we need to read it again? + bool mDevicePowerSavingModeUpToDate; }; - #endif /* WLANSETTINGS_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/inc/wlansettings_s60_p.h --- a/wlanutilities/cpwlansettingsplugin/inc/wlansettings_s60_p.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/inc/wlansettings_s60_p.h Mon Aug 23 13:30:09 2010 +0300 @@ -31,18 +31,11 @@ // Forward declarations +class WlanSettings; + // External data types // Constants -/** Value for automatic scanning. */ -LOCAL_D const TUint KWlanSettingsScanNetworkAuto = 0xFFFFFFFF; - -/** Default "Scan Networks" setting. */ -LOCAL_D const TUint KWlanSettingsDefaultScanNetwork = - KWlanSettingsScanNetworkAuto; - -/** Default "Power saving" setting. */ -LOCAL_D const TBool KWlanSettingsDefaultPowerSaving = ETrue; // Class declaration @@ -60,7 +53,7 @@ EWlanScanInterval }; - static CWlanSettingsPrivate* NewL(int psmKeyValue); + static CWlanSettingsPrivate* NewL(WlanSettings *q_ptr); ~CWlanSettingsPrivate(); @@ -80,28 +73,24 @@ void SetPowerSaving(TBool powerSavingOption); - TBool IsPsmEnabled(); - private: - CWlanSettingsPrivate(int psmKeyValue); + CWlanSettingsPrivate(WlanSettings *q_ptr); void ConstructL(); - void CheckPsmModeL(); - void LoadJoinWlanSettingL(); private: //data + //! Pointer to public implementation. + WlanSettings *q_ptr; + CommsDat::CMDBSession *mSession; //Wlan management CWlanMgmtClient *mWlanMgmtClient; - // Full or partial PSM mode. - TBool mPsmMode; - // Power saving. TBool mPowerSaving; @@ -112,9 +101,6 @@ //Struct to hold current settings TCmGenConnSettings mCmSettings; - - int mPsmKeyMode; - }; #endif /* WLANSETTINGS_S60_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp --- a/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsgroupitemdata.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -18,11 +18,6 @@ // System includes -#include -#include -#include -#include -#include #include #include @@ -45,16 +40,16 @@ // External function prototypes // Local constants -/** Maximum Value for Scan Interval. */ -const int KMaximumScanInterval = 30; -/** Minimum Value for Scan Interval. */ -const int KMinimumScanInterval = 0; -/** To Enable the setting of a widget propery. */ -const int KEnableOption = 1; -/** Maximum widgets allowed for this Item Data. */ -const int KMaxWidgets = 4; -/** Index of Slider widget for Scan Interval. */ -const int KSliderIndex = 2; + +//! To Enable the setting of a widget propery. */ +static const int KEnableOption = 1; +//! Maximum widgets allowed for this Item Data. */ +static const int KMaxWidgets = 4; +//! Index of Slider widget for Scan Interval. */ +static const int KSliderIndex = 2; +//! Default value for user defined scan interval +static const int KDefaultUserDefinedScanInterval = 5; + // ======== MEMBER FUNCTIONS ======== @@ -68,13 +63,12 @@ "txt_occ_subhead_wlan_settings")), mItemDataHelper(itemDataHelper) { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY, this); - + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY ); + initialise(); - createWlanSettingItems(); - - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT, this); + + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT ); } /*! @@ -83,8 +77,8 @@ CpWlanSettingsGroupItemData::~CpWlanSettingsGroupItemData() { - OstTraceFunctionEntry1(DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY, this); - OstTraceFunctionExit1(DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT, this); + OstTraceFunctionEntry0( DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_ENTRY ); + OstTraceFunctionExit0( DUP1_CPWLANSETTINGSGROUPITEMDATA_CPWLANSETTINGSGROUPITEMDATA_EXIT ); } /*! @@ -93,19 +87,27 @@ void CpWlanSettingsGroupItemData::initialise() { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_INITIALISE_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_INITIALISE_ENTRY ); mWlanSettings.reset(new WlanSettings); + bool connectStatus = connect( + mWlanSettings.data(), + SIGNAL(devicePowerSavingUpdated()), + this, + SLOT(devicePowerSavingChanged())); + Q_ASSERT(connectStatus); + //Error needs to be handled. int error = mWlanSettings->init(); //Error needs to be handled. error = mWlanSettings->loadSettings(); - + + mUserDefinedScanInterval = KDefaultUserDefinedScanInterval; mUserDefinedItem = NULL; - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_INITIALISE_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_INITIALISE_EXIT ); } /*! @@ -114,7 +116,7 @@ void CpWlanSettingsGroupItemData::createWlanSettingItems() { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINITEMS_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINGITEMS_ENTRY ); mJoinWlanItem = new CpSettingFormItemData( HbDataFormModelItem::ComboBoxItem, @@ -172,11 +174,17 @@ mScanNetworkItem->setContentWidgetData("currentIndex", scanType); - if (scanType == WlanSettings::EScanNetworkUserDefined) { + //In case of PSM mode for device user-defined value is not + //allowed,make it automatic forcefully. + if (mWlanSettings->isDevicePowerSavingEnabled()) { + mScanNetworkItem->setContentWidgetData( + "currentIndex", + WlanSettings::EScanNetworkAuto); + mScanNetworkItem->setContentWidgetData("enabled", false); + } else if (scanType == WlanSettings::EScanNetworkUserDefined) { createScanIntervalItem(); - this->appendChild(mUserDefinedItem); } - + mPowerSavingItem = new CpSettingFormItemData( HbDataFormModelItem::ComboBoxItem, hbTrId("txt_occ_setlabel_power_saving")); @@ -195,7 +203,7 @@ mPowerSavingItem->setContentWidgetData( "currentIndex", - mWlanSettings->isPowerSavingEnabled()); + mWlanSettings->isWlanPowerSavingEnabled()); mItemDataHelper.addConnection( mPowerSavingItem, @@ -205,7 +213,7 @@ this->appendChild(mPowerSavingItem); - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINITEMS_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_CREATEWLANSETTINGITEMS_EXIT ); } /*! @@ -214,143 +222,204 @@ void CpWlanSettingsGroupItemData::createScanIntervalItem() { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_ENTRY ); - mUserDefinedItem = new CpSettingFormItemData( - HbDataFormModelItem::SliderItem, - hbTrId("txt_occ_setlabel_scan_interval_minutes")); - - mUserDefinedItem->setContentWidgetData("maximum", KMaximumScanInterval); - mUserDefinedItem->setContentWidgetData("minimum", KMinimumScanInterval); - mUserDefinedItem->setContentWidgetData("toolTipVisible", KEnableOption); - mUserDefinedItem->setContentWidgetData("tracking", KEnableOption); - - mItemDataHelper.addConnection( - mUserDefinedItem, - SIGNAL(valueChanged (int)), - this, - SLOT(scanValueChanged (int))); + //Add Scan Interval Slider, if it doesn't already exist. + if (this->childCount() < KMaxWidgets) { + mUserDefinedItem = new CpSettingFormItemData( + HbDataFormModelItem::SliderItem, + hbTrId("txt_occ_setlabel_scan_interval_minutes")); + + mUserDefinedItem->setContentWidgetData("maximum", WlanSettings::ScanNetworkMax); + mUserDefinedItem->setContentWidgetData("minimum", WlanSettings::ScanNetworkMin); + mUserDefinedItem->setContentWidgetData("toolTipVisible", KEnableOption); + mUserDefinedItem->setContentWidgetData("tracking", KEnableOption); - mItemDataHelper.addConnection( - mUserDefinedItem, - SIGNAL(sliderReleased ()), - this, - SLOT(scanSliderReleased ())); + mItemDataHelper.addConnection( + mUserDefinedItem, + SIGNAL(valueChanged (int)), + this, + SLOT(scanValueChanged (int))); + + mItemDataHelper.addConnection( + mUserDefinedItem, + SIGNAL(sliderReleased ()), + this, + SLOT(scanSliderReleased ())); + + mItemDataHelper.addConnection( + mUserDefinedItem, + SIGNAL(sliderPressed ()), + this, + SLOT(scanSliderPressed ())); + + int interval = mWlanSettings->scanInterval(); + if (interval == WlanSettings::ScanNetworkAuto) { + interval = mUserDefinedScanInterval; + } + mUserDefinedItem->setContentWidgetData("value", interval); - mItemDataHelper.addConnection( - mUserDefinedItem, - SIGNAL(sliderPressed ()), - this, - SLOT(scanSliderPressed ())); + this->insertChild(KSliderIndex, mUserDefinedItem); + } - mScanInterval = mWlanSettings->scanInterval(); - - mUserDefinedItem->setContentWidgetData("value", mScanInterval); - - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_CREATESCANINTERVALITEM_EXIT ); } /*! - Slot for handling pressed singal of scan interval slider widget. + Removes the slider widget, if it exists. +*/ + +void CpWlanSettingsGroupItemData::removeScanIntervalItem() +{ + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_REMOVESCANINTERVALITEM_ENTRY ); + + if (KMaxWidgets == this->childCount()) { + this->removeChild(KSliderIndex); + mUserDefinedItem = NULL; //removeChild() will delete the item. + } + + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_REMOVESCANINTERVALITEM_EXIT ); +} + +/*! + Slot for handling pressed signal of scan interval slider widget. */ void CpWlanSettingsGroupItemData::scanSliderPressed() { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_ENTRY ); + + int interval = mWlanSettings->scanInterval(); + if (interval == WlanSettings::ScanNetworkAuto) { + interval = mUserDefinedScanInterval; + } + mUserDefinedItem->setContentWidgetData( + "text", + QString("%1").arg(interval)); - mUserDefinedItem->setContentWidgetData("text",QString("%1").arg(mScanInterval)); - - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERPRESSED_EXIT ); } /*! - Slot for handling value changed singal of scan interval slider widget. + Slot for handling value changed signal of scan interval slider widget. */ void CpWlanSettingsGroupItemData::scanValueChanged(int value) { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_ENTRY ); mUserDefinedItem->setContentWidgetData("text",QString("%1").arg(value)); - mScanInterval = value; + mUserDefinedScanInterval = value; - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANVALUECHANGED_EXIT ); } /*! - Slot for handling Released singal of scan interval slider widget. + Slot for handling Released signal of scan interval slider widget. Current value will be commited to database. */ void CpWlanSettingsGroupItemData::scanSliderReleased() { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_ENTRY ); - mWlanSettings->setWlanScanInterval(mScanInterval); + mWlanSettings->setWlanScanInterval(mUserDefinedScanInterval); - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANSLIDERRELEASED_EXIT ); } /*! - Slot for handling item changed singal of Scan for network combo box widget. + Slot for handling item changed signal of Scan for network combo box widget. */ void CpWlanSettingsGroupItemData::scanItemChanged(const QString &text) { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_ENTRY ); if (hbTrId("txt_occ_setlabel_scan_for_networks_val_userdefine") == text) { - //In case of PSM mode for device user-defined value is not - //allowed,make it automatic forcefully. - if (mWlanSettings->isPsmEnabled()) { - //Need to check for dimming of the combobox option. - mScanNetworkItem->setContentWidgetData("currentIndex", - WlanSettings::EScanNetworkAuto); - } - else { - //Add Scan Interval Slider, if it was not added. - if (this->childCount() < KMaxWidgets) { - createScanIntervalItem(); - this->insertChild(KSliderIndex,mUserDefinedItem); - mWlanSettings->setWlanScanInterval(mWlanSettings->scanInterval()); - } - } - } - else { - //Remove Scan Interval slider, if user selects automatic option - //for Scan network setting and if slider was added earlier. - if (KMaxWidgets == this->childCount()) { - this->removeChild(KSliderIndex); - mUserDefinedItem = NULL; //removeChild() will delete the item. - mWlanSettings->setWlanScanInterval(KWlanSettingsScanNetworkAuto); - } + // User defined mode + mWlanSettings->setWlanScanInterval(mUserDefinedScanInterval); + createScanIntervalItem(); + } else { + // Automatic mode + removeScanIntervalItem(); + mWlanSettings->setWlanScanInterval(WlanSettings::ScanNetworkAuto); } - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_SCANITEMCHANGED_EXIT ); } /*! - Slot for handling item changed singal of Power saving combo box widget. + Slot for handling item changed signal of Power saving combo box widget. */ void CpWlanSettingsGroupItemData::powerSavingItemChanged(int index) { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_ENTRY ); mWlanSettings->setWlanPowerSaving(index); - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_POWERSAVINGITEMCHANGED_EXIT ); } /*! - Slot for handling item changed singal of Join WLAN networks combo box widget. + Slot for handling item changed signal of Join WLAN networks combo box widget. */ void CpWlanSettingsGroupItemData::joinWlanItemChanged(int index) { - OstTraceFunctionEntry1(CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_ENTRY ); mWlanSettings->setJoinWlanMode(index); - OstTraceFunctionExit1(CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_JOINWLANITEMCHANGED_EXIT ); } + +/*! + Slot for handling device power saving mode update signal. +*/ + +void CpWlanSettingsGroupItemData::devicePowerSavingChanged() +{ + OstTraceFunctionEntry0( CPWLANSETTINGSGROUPITEMDATA_DEVICEPOWERSAVINGCHANGED_ENTRY ); + + // Disconnect the handling of currentIndexChanged, because + // we will programmatically update the index in this function. + mItemDataHelper.removeConnection( + mScanNetworkItem, + SIGNAL(currentIndexChanged (const QString &)), + this, + SLOT(scanItemChanged (const QString &))); + + if (mWlanSettings->isDevicePowerSavingEnabled()) { + // If device power saving mode is activated, force the scan + // setting to automatic, and disable the setting combo box + mScanNetworkItem->setContentWidgetData( + "currentIndex", + WlanSettings::EScanNetworkAuto); + mScanNetworkItem->setContentWidgetData("enabled", false); + removeScanIntervalItem(); + } else { + // If device power saving mode is deactivated, enable the + // setting combo box, and make sure the setting is in the + // same mode it was before power saving mode was activated + mScanNetworkItem->setContentWidgetData("enabled", true); + if (mWlanSettings->scanNetworkType() == + WlanSettings::EScanNetworkUserDefined) { + mScanNetworkItem->setContentWidgetData( + "currentIndex", + WlanSettings::EScanNetworkUserDefined); + createScanIntervalItem(); + } + } + + // Reconnect the handling of currentIndexChanged since we are + // done with the updates. + mItemDataHelper.addConnection( + mScanNetworkItem, + SIGNAL(currentIndexChanged (const QString &)), + this, + SLOT(scanItemChanged (const QString &))); + + OstTraceFunctionExit0( CPWLANSETTINGSGROUPITEMDATA_DEVICEPOWERSAVINGCHANGED_EXIT ); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/src/cpwlansettingsplugin.cpp --- a/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsplugin.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/src/cpwlansettingsplugin.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -17,8 +17,8 @@ // System includes -#include -#include +#include +#include #include #include @@ -49,13 +49,11 @@ */ CpWlanSettingsPlugin::CpWlanSettingsPlugin() : - QObject() + QObject(), + mTranslator(new HbTranslator("cpwlansettingsplugin")) { - OstTraceFunctionEntry1(CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY, this); - - translator = new QTranslator(this); - - OstTraceFunctionExit1(CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT, this); + OstTraceFunctionEntry0( CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY ); + OstTraceFunctionExit0( CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT ); } /*! @@ -64,9 +62,8 @@ CpWlanSettingsPlugin::~CpWlanSettingsPlugin() { - - OstTraceFunctionEntry1(DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY, this); - OstTraceFunctionExit1(DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT, this); + OstTraceFunctionEntry0( DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_ENTRY ); + OstTraceFunctionExit0( DUP1_CPWLANSETTINGSPLUGIN_CPWLANSETTINGSPLUGIN_EXIT ); } /*! @@ -76,18 +73,12 @@ QList CpWlanSettingsPlugin::createSettingFormItemData( CpItemDataHelper &itemDataHelper) const { - OstTraceFunctionEntry1(CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY, this); + OstTraceFunctionEntry0( CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY ); - // Locale - QString lang = QLocale::system().name(); - QString path = "Z:/resource/qt/translations/"; - translator->load("cpwlansettingsplugin_" + lang, path); - qApp->installTranslator(translator); - QList settingFormData; settingFormData.append(new CpWlanSettingsGroupItemData(itemDataHelper)); - OstTraceFunctionExit1(CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_EXIT, this); + OstTraceFunctionExit0( CPWLANSETTINGSPLUGIN_CREATESETTINGFORMITEMDATA_EXIT ); return settingFormData; } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp --- a/wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/src/wlansettings.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -20,9 +20,11 @@ #include #include #include +#include // User includes +#include "wlansettings_s60_p.h" #include "wlansettings.h" #include "OstTraceDefinitions.h" @@ -38,9 +40,13 @@ // External function prototypes // Local constants -/** Default value for Scan Interval. */ -const int KDefaultScanInterval = 5; +//! Device Power Saving Mode setting key +static const XQSettingsKey devicePowerSavingKey( + XQSettingsKey::TargetCentralRepository, + KCRUidPowerSaveMode.iUid, + KPsmCurrentMode); + // ======== MEMBER FUNCTIONS ======== /*! @@ -48,11 +54,13 @@ */ WlanSettings::WlanSettings() : - QObject(), mPsmKeyValue(0) + QObject(), + mSettingsManager(new XQSettingsManager(this)), + mDevicePowerSavingMode(0), + mDevicePowerSavingModeUpToDate(false) { - - OstTraceFunctionEntry1(WLANSETTINGS_WLANSETTINGS_ENTRY, this); - OstTraceFunctionExit1(WLANSETTINGS_WLANSETTINGS_EXIT, this); + OstTraceFunctionEntry0( WLANSETTINGS_WLANSETTINGS_ENTRY ); + OstTraceFunctionExit0( WLANSETTINGS_WLANSETTINGS_EXIT ); } /*! @@ -61,11 +69,11 @@ WlanSettings::~WlanSettings() { - OstTraceFunctionEntry1(DUP1_WLANSETTINGS_WLANSETTINGS_ENTRY, this); + OstTraceFunctionEntry0( DUP1_WLANSETTINGS_WLANSETTINGS_ENTRY ); - delete mImpl; + delete d_ptr; - OstTraceFunctionExit1(DUP1_WLANSETTINGS_WLANSETTINGS_EXIT, this); + OstTraceFunctionExit0( DUP1_WLANSETTINGS_WLANSETTINGS_EXIT ); } /*! @@ -75,32 +83,59 @@ int WlanSettings::init() { - OstTraceFunctionEntry1(WLANSETTINGS_INIT_ENTRY, this); - - readPsmKey(); + OstTraceFunctionEntry0( WLANSETTINGS_INIT_ENTRY ); - TRAPD(error,(mImpl = CWlanSettingsPrivate::NewL(mPsmKeyValue))); + // Listen for changes in the key value + bool connectStatus = connect( + mSettingsManager, + SIGNAL(valueChanged(XQSettingsKey, QVariant)), + this, + SLOT(devicePowerSavingKeyChanged())); + Q_ASSERT(connectStatus); + mSettingsManager->startMonitoring(devicePowerSavingKey); - OstTraceFunctionExit1(WLANSETTINGS_INIT_EXIT, this); + TRAPD(error,(d_ptr = CWlanSettingsPrivate::NewL(this))); + + OstTraceFunctionExit0( WLANSETTINGS_INIT_EXIT ); return error; } +/*! + Reads the value of the Device Power Saving Mode setting. +*/ -void WlanSettings::readPsmKey() +void WlanSettings::readDevicePowerSavingKey() { - OstTraceFunctionEntry1(WLANSETTINGS_READPSMKEY_ENTRY, this); + OstTraceFunctionEntry0( WLANSETTINGS_READDEVICEPOWERSAVINGKEY_ENTRY ); - QScopedPointer settingsManager; - settingsManager.reset(new XQSettingsManager()); + mDevicePowerSavingMode = + mSettingsManager->readItemValue(devicePowerSavingKey).toInt(); - XQSettingsKey key(XQSettingsKey::TargetCentralRepository, - KCRUidPowerSaveMode.iUid, KPsmCurrentMode); + mDevicePowerSavingModeUpToDate = true; + + OstTrace1( + TRACE_NORMAL, + WLANSETTINGS_READDEVICEPOWERSAVINGKEY, + "WlanSettings::readDevicePowerSavingKey;powerSaving=%d", + mDevicePowerSavingMode ); + + OstTraceFunctionExit0( WLANSETTINGS_READDEVICEPOWERSAVINGKEY_EXIT ); +} - QVariant keyValue = settingsManager->readItemValue(key); +/*! + Slot for handling updates in the Device Power Saving Mode setting. +*/ - mPsmKeyValue = keyValue.toInt(); +void WlanSettings::devicePowerSavingKeyChanged() +{ + OstTraceFunctionEntry0( WLANSETTINGS_DEVICEPOWERSAVINGKEYCHANGED_ENTRY ); - OstTraceFunctionExit1(WLANSETTINGS_READPSMKEY_EXIT, this); + // Remember that we need to read the setting value again before + // using it, and notify UI of the change. + mDevicePowerSavingModeUpToDate = false; + emit devicePowerSavingUpdated(); + + OstTraceFunctionExit0( WLANSETTINGS_DEVICEPOWERSAVINGKEYCHANGED_EXIT ); } /*! @@ -110,11 +145,17 @@ int WlanSettings::loadSettings() { - OstTraceFunctionEntry1(WLANSETTINGS_LOADSETTINGS_ENTRY, this); + OstTraceFunctionEntry0( WLANSETTINGS_LOADSETTINGS_ENTRY ); + + TRAPD(error, d_ptr->LoadDBSettingsL()); - TRAPD(error, mImpl->LoadDBSettingsL()); + OstTrace1( + TRACE_NORMAL, + WLANSETTINGS_LOADSETTINGS, + "WlanSettings::loadSettings;error=%d", + error ); - OstTraceFunctionExit1(WLANSETTINGS_LOADSETTINGS_EXIT, this); + OstTraceFunctionExit0( WLANSETTINGS_LOADSETTINGS_EXIT ); return error; } @@ -125,19 +166,22 @@ WlanSettings::ScanNetworkType WlanSettings::scanNetworkType() { - OstTraceFunctionEntry1(WLANSETTINGS_SCANNETWORKTYPE_ENTRY, this); + OstTraceFunctionEntry0( WLANSETTINGS_SCANNETWORKTYPE_ENTRY ); ScanNetworkType scanType; - uint scanInterval = mImpl->ScanInterval(); - - if (scanInterval == KWlanSettingsScanNetworkAuto) { + if (d_ptr->ScanInterval() == ScanNetworkAuto) { scanType = EScanNetworkAuto; - } - else { + } else { scanType = EScanNetworkUserDefined; } - OstTraceFunctionExit1(WLANSETTINGS_SCANNETWORKTYPE_EXIT, this); + OstTrace1( + TRACE_NORMAL, + WLANSETTINGS_SCANNETWORKTYPE, + "WlanSettings::scanNetworkType;scanType=%d", + scanType ); + + OstTraceFunctionExit0( WLANSETTINGS_SCANNETWORKTYPE_EXIT ); return scanType; } @@ -148,26 +192,30 @@ uint WlanSettings::scanInterval() { - OstTraceFunctionEntry1(WLANSETTINGS_SCANINTERVAL_ENTRY, this); + OstTraceFunctionEntry0( WLANSETTINGS_SCANINTERVAL_ENTRY ); - uint scanInterval = mImpl->ScanInterval(); + uint scanInterval = d_ptr->ScanInterval(); - if (scanInterval == KWlanSettingsScanNetworkAuto) { - scanInterval = KDefaultScanInterval; - } + OstTrace1( + TRACE_NORMAL, + WLANSETTINGS_SCANINTERVAL, + "WlanSettings::scanInterval;scanInterval=%u", + scanInterval ); - OstTraceFunctionExit1(WLANSETTINGS_SCANINTERVAL_EXIT, this); + OstTraceFunctionExit0( WLANSETTINGS_SCANINTERVAL_EXIT ); return scanInterval; } /*! - Function to get Power Saving Option. + Function to get Wlan Power Saving Option. \return True if Power Saving option is enabled, otherwise False. */ -int WlanSettings::isPowerSavingEnabled() const +bool WlanSettings::isWlanPowerSavingEnabled() const { - return mImpl->PowerSaving(); + OstTraceFunctionEntry0( WLANSETTINGS_ISWLANPOWERSAVINGENABLED_ENTRY ); + OstTraceFunctionExit0( WLANSETTINGS_ISWLANPOWERSAVINGENABLED_EXIT ); + return d_ptr->PowerSaving(); } /*! @@ -178,12 +226,12 @@ int WlanSettings::setWlanPowerSaving(int powerSavingOption) { - OstTraceFunctionEntry1(WLANSETTINGS_SETWLANPOWERSAVING_ENTRY, this); + OstTraceFunctionEntry0( WLANSETTINGS_SETWLANPOWERSAVING_ENTRY ); - mImpl->SetPowerSaving(powerSavingOption); - TRAPD(error, mImpl->SaveDBSettingsL(CWlanSettingsPrivate::EWlanPowerSaving)); + d_ptr->SetPowerSaving(powerSavingOption); + TRAPD(error, d_ptr->SaveDBSettingsL(CWlanSettingsPrivate::EWlanPowerSaving)); - OstTraceFunctionExit1(WLANSETTINGS_SETWLANPOWERSAVING_EXIT, this); + OstTraceFunctionExit0( WLANSETTINGS_SETWLANPOWERSAVING_EXIT ); return error; } @@ -195,12 +243,12 @@ int WlanSettings::setWlanScanInterval(uint scanInterval) { - OstTraceFunctionEntry1(WLANSETTINGS_SETWLANSCANINTERVAL_ENTRY, this); + OstTraceFunctionEntry0( WLANSETTINGS_SETWLANSCANINTERVAL_ENTRY ); - mImpl->SetScanInterval(scanInterval); - TRAPD(error, mImpl->SaveDBSettingsL(CWlanSettingsPrivate::EWlanScanInterval)); + d_ptr->SetScanInterval(scanInterval); + TRAPD(error, d_ptr->SaveDBSettingsL(CWlanSettingsPrivate::EWlanScanInterval)); - OstTraceFunctionExit1(WLANSETTINGS_SETWLANSCANINTERVAL_EXIT, this); + OstTraceFunctionExit0( WLANSETTINGS_SETWLANSCANINTERVAL_EXIT ); return error; } @@ -211,7 +259,9 @@ int WlanSettings::joinWlanMode() const { - return mImpl->JoinWlanMode(); + OstTraceFunctionEntry0( WLANSETTINGS_JOINWLANMODE_ENTRY ); + OstTraceFunctionExit0( WLANSETTINGS_JOINWLANMODE_EXIT ); + return d_ptr->JoinWlanMode(); } /*! @@ -222,11 +272,11 @@ int WlanSettings::setJoinWlanMode(int mode) { - OstTraceFunctionEntry1(WLANSETTINGS_SETJOINWLANMODE_ENTRY, this); + OstTraceFunctionEntry0( WLANSETTINGS_SETJOINWLANMODE_ENTRY ); - TRAPD(error, mImpl->SaveJoinWlanSettingL(mode)); + TRAPD(error, d_ptr->SaveJoinWlanSettingL(mode)); - OstTraceFunctionExit1(WLANSETTINGS_SETJOINWLANMODE_EXIT, this); + OstTraceFunctionExit0( WLANSETTINGS_SETJOINWLANMODE_EXIT ); return error; } @@ -235,7 +285,18 @@ \return True if Power Saving is enabled. */ -int WlanSettings::isPsmEnabled() const +bool WlanSettings::isDevicePowerSavingEnabled() { - return mImpl->IsPsmEnabled(); + OstTraceFunctionEntry0( WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_ENTRY ); + + if (!mDevicePowerSavingModeUpToDate) { + readDevicePowerSavingKey(); + } + if (mDevicePowerSavingMode == EPsmsrvModeNormal) { + OstTraceFunctionExit0( WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_EXIT ); + return false; + } else { + OstTraceFunctionExit0( DUP1_WLANSETTINGS_ISDEVICEPOWERSAVINGENABLED_EXIT ); + return true; + } } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/src/wlansettings_s60.cpp --- a/wlanutilities/cpwlansettingsplugin/src/wlansettings_s60.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/src/wlansettings_s60.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -18,11 +18,11 @@ // System includes #include -#include #include // User includes +#include "wlansettings.h" #include "wlansettings_s60_p.h" #include "OstTraceDefinitions.h" @@ -40,9 +40,12 @@ // Local constants /** Seconds per minute. */ -const TInt KWlanSettingsSecondsInMinute = 60; -/** Maximum value for scan interval in minutes. */ -const TInt KWlanSettingsScanNetworkMax = 30; +static const TInt KWlanSettingsSecondsInMinute = 60; +/** Default "Scan Networks" setting. */ +static const TUint KWlanSettingsDefaultScanNetwork = + WlanSettings::ScanNetworkAuto; +/** Default "Power saving" setting. */ +static const TBool KWlanSettingsDefaultPowerSaving = ETrue; // ======== MEMBER FUNCTIONS ======== @@ -51,17 +54,17 @@ \return Pointer to CWlanSettingsPrivate object. */ -CWlanSettingsPrivate* CWlanSettingsPrivate::NewL(int psmKeyValue) +CWlanSettingsPrivate* CWlanSettingsPrivate::NewL(WlanSettings *q_ptr) { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_NEWL_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_NEWL_ENTRY); - CWlanSettingsPrivate* impl = new ( ELeave ) CWlanSettingsPrivate(psmKeyValue); + CWlanSettingsPrivate* impl = new ( ELeave ) CWlanSettingsPrivate(q_ptr); CleanupStack::PushL( impl ); impl->ConstructL(); CleanupStack::Pop( impl ); - OstTraceFunctionExit1(CWLANSETINGPRIVATE_NEWL_EXIT, this); - return impl; + OstTraceFunctionExit0(CWLANSETINGPRIVATE_NEWL_EXIT); + return impl; } /*! @@ -70,7 +73,7 @@ void CWlanSettingsPrivate::ConstructL() { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_CONSTRUCTL_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_CONSTRUCTL_ENTRY); mSession = CMDBSession::NewL( KCDLatestVersion ); @@ -78,25 +81,20 @@ mWlanMgmtClient = CWlanMgmtClient::NewL(); #endif - CheckPsmModeL(); - - OstTraceFunctionExit1(CWLANSETINGPRIVATE_CONSTRUCTL_EXIT, this); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_CONSTRUCTL_EXIT); } /*! Constructor. */ -CWlanSettingsPrivate::CWlanSettingsPrivate(int psmKeyValue) : - mPsmMode( EFalse ), +CWlanSettingsPrivate::CWlanSettingsPrivate(WlanSettings *q_ptr) : + q_ptr(q_ptr), mPowerSaving(KWlanSettingsDefaultPowerSaving), - mScanInterval(KWlanSettingsDefaultScanNetwork), - mPsmKeyMode(psmKeyValue) + mScanInterval(KWlanSettingsDefaultScanNetwork) { - - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY, this); - OstTraceFunctionExit1(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT, this); - + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT); } /*! @@ -105,35 +103,14 @@ CWlanSettingsPrivate::~CWlanSettingsPrivate() { - OstTraceFunctionEntry1(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY, this); + OstTraceFunctionEntry0(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_ENTRY); delete mSession; #ifndef __WINS__ delete mWlanMgmtClient; #endif - OstTraceFunctionExit1(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT, this); -} - -/*! - Function to get the Power Saving mode of the device. -*/ - -void CWlanSettingsPrivate::CheckPsmModeL() -{ - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_CHECKPSMMODEL_ENTRY, this); - - TPsmsrvMode mode( EPsmsrvModeNormal ); - - mode = static_cast( mPsmKeyMode ); - if ( mode == EPsmsrvModePowerSave || mode == EPsmsrvPartialMode ) { - mPsmMode = ETrue; - } - else { - mPsmMode = EFalse; - } - - OstTraceFunctionExit1(CWLANSETINGPRIVATE_CHECKPSMMODEL_EXIT, this); + OstTraceFunctionExit0(DUP1_CWLANSETINGPRIVATE_CWLANSETINGPRIVATE_EXIT); } /*! @@ -142,7 +119,7 @@ void CWlanSettingsPrivate::LoadDBSettingsL() { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_LOADDBSETTINGSL_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_LOADDBSETTINGSL_ENTRY); TBool ownTransaction( EFalse ); if ( !mSession->IsInTransaction() ) { @@ -164,22 +141,31 @@ } // Read scan interval - - mScanInterval = record->iBgScanInterval; - //In Case of PSM mode Scan Interval should be set to Auto - if (mPsmMode) { - mScanInterval = KWlanSettingsScanNetworkAuto; - } - else { - mScanInterval = record->iSavedBgScanInterval; - //Safe check for scan interval, control should not come here. - if (mScanInterval > (KWlanSettingsScanNetworkMax - * KWlanSettingsSecondsInMinute)) { - mScanInterval = KWlanSettingsScanNetworkAuto; - } + OstTrace1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_LOADDBSETTINGSL_SCANINTERVAL, + "CWlanSettingsPrivate::LoadDBSettingsL ScanInterval;iBgScanInterval=%u", + record->iBgScanInterval ); + OstTrace1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_LOADDBSETTINGSL_SAVEDSCANINTERVAL, + "CWlanSettingsPrivate::LoadDBSettingsL SavedScanInterval;iSavedBgScanInterval=%u", + record->iSavedBgScanInterval ); + mScanInterval = record->iSavedBgScanInterval; + //Safe check for scan interval, control should not come here. + if (mScanInterval > (WlanSettings::ScanNetworkMax + * KWlanSettingsSecondsInMinute)) { + mScanInterval = WlanSettings::ScanNetworkAuto; } + // Read power saving mode mPowerSaving = record->iWlanPowerMode; + OstTraceExt1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_LOADDBSETTINGSL_POWERSAVE, + "CWlanSettingsPrivate::LoadDBSettingsL PowerSave;mPowerSaving=%hhu", + mPowerSaving ); + CleanupStack::PopAndDestroy( record ); if ( ownTransaction ) { @@ -190,7 +176,7 @@ //To Load CM Settings. LoadJoinWlanSettingL(); - OstTraceFunctionExit1(CWLANSETINGPRIVATE_LOADDBSETTINGSL_EXIT, this); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_LOADDBSETTINGSL_EXIT); } /*! @@ -199,7 +185,7 @@ void CWlanSettingsPrivate::LoadJoinWlanSettingL() { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_ENTRY); RCmManager CmManager; CmManager.CreateTablesAndOpenL(); @@ -207,7 +193,7 @@ CmManager.ReadGenConnSettingsL( mCmSettings ); CleanupStack::PopAndDestroy( 1 ); //CmManager - OstTraceFunctionExit1(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_EXIT, this); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_LOADJOINWLANSETTINGL_EXIT); } /*! @@ -216,7 +202,7 @@ void CWlanSettingsPrivate::SaveJoinWlanSettingL(TInt mode) { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_ENTRY); switch ( mode ) { case EJoinWlanKnown: @@ -237,7 +223,7 @@ CmManager.WriteGenConnSettingsL( mCmSettings ); CleanupStack::PopAndDestroy( 1 ); - OstTraceFunctionExit1(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_EXIT, this); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_SAVEJOINWLANSETTINGL_EXIT); } /*! @@ -247,7 +233,7 @@ TInt CWlanSettingsPrivate::JoinWlanMode() { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_JOINWLANMODE_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_JOINWLANMODE_ENTRY); TInt mode = 0; @@ -264,7 +250,7 @@ break; } - OstTraceFunctionExit1(CWLANSETINGPRIVATE_JOINWLANMODE_EXIT, this); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_JOINWLANMODE_EXIT); return mode; } @@ -274,7 +260,7 @@ void CWlanSettingsPrivate::SaveDBSettingsL(TInt option) { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_ENTRY); TBool ownTransaction( EFalse ); if ( !mSession->IsInTransaction() ) { @@ -298,13 +284,31 @@ switch (option) { case EWlanScanInterval: record->iBgScanInterval = mScanInterval; - if ( !mPsmMode ) { + if (!q_ptr->isDevicePowerSavingEnabled()) { record->iSavedBgScanInterval = mScanInterval; } + OstTrace1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_SAVEDBSETTINGSL_SCANINTERVAL, + "CWlanSettingsPrivate::SaveDBSettingsL ScanInterval;iBgScanInterval=%u", + record->iBgScanInterval ); + OstTrace1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_SAVEDBSETTINGSL_SAVEDSCANINTERVAL, + "CWlanSettingsPrivate::SaveDBSettingsL SavedScanInterval;iSavedBgScanInterval=%u", + record->iSavedBgScanInterval ); break; + case EWlanPowerSaving: + OstTraceExt1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_SAVEDBSETTINGSL_POWERSAVING, + "CWlanSettingsPrivate::SaveDBSettingsL PowerSaving;mPowerSaving=%hhu", + mPowerSaving ); + record->iWlanPowerMode = mPowerSaving; break; + default: break; } @@ -324,7 +328,7 @@ mWlanMgmtClient->NotifyChangedSettings(); #endif - OstTraceFunctionExit1(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_EXIT, this); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_SAVEDBSETTINGSL_EXIT); } /*! @@ -334,13 +338,21 @@ TUint CWlanSettingsPrivate::ScanInterval() { - if ( mScanInterval == KWlanSettingsScanNetworkAuto ) { - return mScanInterval; + TUint retVal; + if ( mScanInterval == WlanSettings::ScanNetworkAuto ) { + retVal = mScanInterval; + } else { + // Return scan time in minutes + retVal = mScanInterval / KWlanSettingsSecondsInMinute; } - else { - // Return scan time in minutes - return ( mScanInterval / KWlanSettingsSecondsInMinute ); - } + + OstTrace1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_SCANINTERVAL, + "CWlanSettingsPrivate::ScanInterval;retVal=%u", + retVal ); + + return retVal; } /*! @@ -350,6 +362,12 @@ TBool CWlanSettingsPrivate::PowerSaving() { + OstTraceExt1( + TRACE_NORMAL, + CWLANSETTINGSPRIVATE_POWERSAVING, + "CWlanSettingsPrivate::PowerSaving;mPowerSaving=%hhx", + mPowerSaving ); + return mPowerSaving; } @@ -360,9 +378,9 @@ void CWlanSettingsPrivate::SetScanInterval(TUint interval) { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SETSCANINTERVAL_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SETSCANINTERVAL_ENTRY); - if ( interval == KWlanSettingsScanNetworkAuto ) { + if ( interval == WlanSettings::ScanNetworkAuto ) { mScanInterval = interval; } else { @@ -370,7 +388,7 @@ mScanInterval = interval * KWlanSettingsSecondsInMinute; } - OstTraceFunctionExit1(CWLANSETINGPRIVATE_SETSCANINTERVAL_EXIT, this); + OstTraceFunctionExit0(CWLANSETINGPRIVATE_SETSCANINTERVAL_EXIT); } /*! @@ -380,19 +398,9 @@ void CWlanSettingsPrivate::SetPowerSaving(TBool powerSavingOption) { - OstTraceFunctionEntry1(CWLANSETINGPRIVATE_SETPOWERSAVING_ENTRY, this); + OstTraceFunctionEntry0(CWLANSETINGPRIVATE_SETPOWERSAVING_ENTRY); mPowerSaving = powerSavingOption; - - OstTraceFunctionExit1(CWLANSETINGPRIVATE_SETPOWERSAVING_EXIT, this); + + OstTraceFunctionExit0(CWLANSETINGPRIVATE_SETPOWERSAVING_EXIT); } - -/*! - Function to get Power Saving status of the device. - \return True if Power Saving is enabled. -*/ - -TBool CWlanSettingsPrivate::IsPsmEnabled() -{ - return mPsmMode; -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.cpp --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -111,7 +111,7 @@ { uint KDefaultScanInterval(5); - mScanIntervalAuto = KWlanSettingsScanNetworkAuto; + mScanIntervalAuto = WlanSettings::ScanNetworkAuto; //Set the Auto Interval int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalAuto); @@ -159,7 +159,7 @@ QVERIFY(setError == KErrNone); //Verify Power saving mode parameter - int powerSavingMode = mSecuritySettings->isPowerSavingEnabled(); + int powerSavingMode = mSecuritySettings->isWlanPowerSavingEnabled(); QVERIFY(powerSavingMode == wlanPowerSavingMode); } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.h --- a/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/cpwlansettingsplugin/tsrc/wlansettingstest.h Mon Aug 23 13:30:09 2010 +0300 @@ -21,7 +21,7 @@ #include #include -#include "WlanSettings.h" +#include "wlansettings.h" class WlanSettingsTest: public QObject { diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/eapwizard/eapwizard.pro --- a/wlanutilities/eapwizard/eapwizard.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/eapwizard/eapwizard.pro Mon Aug 23 13:30:09 2010 +0300 @@ -30,6 +30,13 @@ RESOURCES += resources/eapwizard_resource.qrc +DOCML += \ + resources/occ_eap_wizard_01_02_04.docml \ + resources/occ_eap_wizard_03.docml \ + resources/occ_eap_wizard_05_07.docml \ + resources/occ_eap_wizard_06.docml \ + resources/occ_eap_wizard_08.docml + TRANSLATIONS = eapwizard.ts HEADERS += \ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/eapwizard/resources/eapwizard_resource.qrc --- a/wlanutilities/eapwizard/resources/eapwizard_resource.qrc Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/eapwizard/resources/eapwizard_resource.qrc Mon Aug 23 13:30:09 2010 +0300 @@ -1,9 +1,9 @@ - occ_eap_wizard_01_02_04.docml - occ_eap_wizard_03.docml - occ_eap_wizard_05_07.docml - occ_eap_wizard_06.docml - occ_eap_wizard_08.docml + occ_eap_wizard_01_02_04.docml.bin + occ_eap_wizard_03.docml.bin + occ_eap_wizard_05_07.docml.bin + occ_eap_wizard_06.docml.bin + occ_eap_wizard_08.docml.bin diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/eapwizard/src/eapwizardpagecertca.cpp --- a/wlanutilities/eapwizard/src/eapwizardpagecertca.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/eapwizard/src/eapwizardpagecertca.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -1,36 +1,39 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * EAP Wizard Page: Certificate Authority Selection. - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* EAP Wizard Page: Certificate Authority Selection. +*/ // System includes + #include #include #include #include #include + #include #include #include #include // User includes + #include "wlanwizardhelper.h" #include "eapwizard_p.h" #include "eapwizardpagecertca.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "eapwizardpagecertcaTraces.h" @@ -63,8 +66,8 @@ mTitle(NULL), mCertList(NULL) { - OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY ); - OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT ); + OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY); + OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT); } /*! @@ -72,8 +75,8 @@ */ EapWizardPageCertCa::~EapWizardPageCertCa() { - OstTraceFunctionEntry0( DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY ); - OstTraceFunctionExit0( DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT ); + OstTraceFunctionEntry0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_ENTRY); + OstTraceFunctionExit0(DUP1_EAPWIZARDPAGECERTCA_EAPWIZARDPAGECERTCA_EXIT); } /*! @@ -81,7 +84,8 @@ */ HbWidget* EapWizardPageCertCa::initializePage() { - OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_INITIALIZEPAGE_ENTRY ); + OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_ENTRY); + if (!mWidget) { mDocumentLoader.reset( new HbDocumentLoader( mWizard->wizardHelper()->mainWindow()) ); @@ -121,14 +125,8 @@ QStringList list; list << hbTrId("txt_occ_setlabel_val_select_automatically"); - for (int i = 0; i < mCerts.count(); ++i) { - // TODO: workaround for BBHA-863EJN - // graphics memory runs out for long lists and items - QString tmp(mCerts.at(i).value( - EapQtCertificateInfo::CertificateLabel).toString()); - tmp.truncate(10); - list << tmp; + list << mCerts.at(i).value(EapQtCertificateInfo::CertificateLabel).toString(); } // If certificate list has been changed update the content otherwise do not @@ -138,7 +136,8 @@ // Automatic is selected by default mCertList->setSelected(IndexForAutomatic); } - OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_INITIALIZEPAGE_EXIT ); + + OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_INITIALIZEPAGE_EXIT); return mWidget; } @@ -149,14 +148,16 @@ */ void EapWizardPageCertCa::loadDocmlSection(Qt::Orientation orientation) { - OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_ENTRY ); + OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_ENTRY); + EapWizardPage::loadDocmlSection( mDocumentLoader.data(), orientation, ":/docml/occ_eap_wizard_01_02_04.docml", "portrait_section", "landscape_section"); - OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_EXIT ); + + OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_LOADDOCMLSECTION_EXIT); } /*! @@ -168,7 +169,8 @@ */ int EapWizardPageCertCa::nextId() const { - OstTraceFunctionEntry0( EAPWIZARDPAGECERTCA_NEXTID_ENTRY ); + OstTraceFunctionEntry0(EAPWIZARDPAGECERTCA_NEXTID_ENTRY); + int id = WlanWizardPage::PageNone; bool ok; int type = mWizard->configurations(EapWizardPrivate::OuterType).toInt(&ok); @@ -177,20 +179,23 @@ if (type == EapQtPluginHandle::PluginEapTls) { id = EapWizardPage::PageCertificateUser; } else { - Q_ASSERT(type == EapQtPluginHandle::PluginEapTtls || + Q_ASSERT( + type == EapQtPluginHandle::PluginEapTtls || type == EapQtPluginHandle::PluginPeap); id = EapWizardPage::PageIdentity; } int selected = mCertList->selected(); if (selected == IndexForAutomatic) { - mWizard->setConfigurations(EapWizardPrivate::CertificateCa, QVariant()); + mWizard->setConfigurations( + EapWizardPrivate::CertificateCa, + QVariant()); } else { mWizard->setConfigurations( - EapWizardPrivate::CertificateCa, qVariantFromValue(mCerts.at( - selected - AmountOfNonCertItems))); + EapWizardPrivate::CertificateCa, + qVariantFromValue(mCerts.at(selected - AmountOfNonCertItems))); } - OstTraceFunctionExit0( EAPWIZARDPAGECERTCA_NEXTID_EXIT ); + OstTraceFunctionExit0(EAPWIZARDPAGECERTCA_NEXTID_EXIT); return id; } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/testwizard/resources/mainview.docml --- a/wlanutilities/testwizard/resources/mainview.docml Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/testwizard/resources/mainview.docml Mon Aug 23 13:30:09 2010 +0300 @@ -1,25 +1,26 @@ - - + + + - + - + - + @@ -29,11 +30,10 @@ - + - @@ -43,23 +43,19 @@ + - - - - - - + + - @@ -67,7 +63,6 @@ - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/testwizard/resources/resource.qrc --- a/wlanutilities/testwizard/resources/resource.qrc Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/testwizard/resources/resource.qrc Mon Aug 23 13:30:09 2010 +0300 @@ -1,5 +1,5 @@ - mainview.docml + mainview.docml.bin diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/testwizard/src/FirstView.cpp --- a/wlanutilities/testwizard/src/FirstView.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/testwizard/src/FirstView.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -1,20 +1,19 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Test application for wizards. - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Test application for wizards. +*/ #include #include @@ -57,9 +56,6 @@ mSecurityMode = qobject_cast (loader.findWidget("securityMode")); Q_ASSERT_X(mSecurityMode != 0, "TestEapWizard", "securityMode not found"); - mHidden = qobject_cast (loader.findWidget("isHidden")); - Q_ASSERT_X(mHidden != 0, "TestEapWizard", "isHidden not found"); - mUseWpaPsk = qobject_cast (loader.findWidget("useWpaPsk")); Q_ASSERT_X(mUseWpaPsk != 0, "TestEapWizard", "useWpaPsk not found"); @@ -94,7 +90,6 @@ mNetworkMode->currentIndex(), 1 << mSecurityMode->currentIndex(), mUseWpaPsk->isChecked(), - mHidden->isChecked(), mUseWps->isChecked()); } @@ -127,4 +122,3 @@ mStatus->setPlainText("Cancelled"); deleteWizard(); } - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/testwizard/testwizard.pro --- a/wlanutilities/testwizard/testwizard.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/testwizard/testwizard.pro Mon Aug 23 13:30:09 2010 +0300 @@ -40,6 +40,8 @@ RESOURCES = resources/resource.qrc +DOCML += resources/mainview.docml + symbian { # TODO: gain UID TARGET.UID3 = 0xE5C15256 diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp --- a/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -25,6 +25,7 @@ #include #endif #include +#include #include // This workaround can be removed when XQOP_WLAN_SNIFFER is correctly @@ -77,7 +78,7 @@ SIGNAL(statusUpdated()), this, SLOT(statusUpdate())); - Q_ASSERT(connectStatus == true); + Q_ASSERT(connectStatus); // Update to show initial WLAN status. statusUpdate(); @@ -124,8 +125,7 @@ // Window title needs to be set to "Control Panel" XQRequestInfo reqInfo; - // TODO: Start using the official define when available - reqInfo.setInfo("WindowTitle", hbTrId("txt_cp_title_control_panel")); + reqInfo.setInfo(XQINFO_KEY_WINDOW_TITLE, hbTrId("txt_cp_title_control_panel")); request->setInfo(reqInfo); bool status = request->send(); diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/inc/wlanlogindocumentloader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanlogindocumentloader.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Document loader of WLAN Login application +* +*/ + +#ifndef WLANLOGINDOCUMENTLOADER_H +#define WLANLOGINDOCUMENTLOADER_H + +// System includes +#include +#include + +// User includes + +// Forward declarations +class HbMainWindow; +class QString; + +// External data types + +// Constants + +// Class declaration +class WlanLoginDocumentLoader : public HbDocumentLoader +{ +public: + WlanLoginDocumentLoader(const HbMainWindow *window); + ~WlanLoginDocumentLoader(); +protected: + QObject *createObject(const QString& type, const QString &name); + +}; + +#endif // WLANLOGINDOCUMENTLOADER_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginengine.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginengine.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginengine.h Mon Aug 23 13:30:09 2010 +0300 @@ -70,7 +70,9 @@ OpeningNetworkSession, //!< Engine is opening network session NetworkSessionOpened, //!< Network session is opened by engine RunningIcts, //!< Internet connectivity test ongoing - IctsRan //!< Internet connectivity test has been ran + IctsFailed, //!< Internet connectivity test has failed + IctsOk, //!< Internet connectivity test has been ran successfully + WaitingForStopRequest, //!< Waiting for stop service request }; explicit WlanLoginEngine(QObject *parent = 0); @@ -103,7 +105,6 @@ void handleConnectivityTestResult(IctsWrapper::ConnectivityTestResult result, QUrl redirectUrl); void handleCancelTriggered(); void handleNextTriggered(); - void handleContinueTriggered(); private: // Data @@ -111,7 +112,7 @@ // Owned data EngineState mEngineState; //!< current state of the Engine - bool mServiceRequestCompleted; //!< Variable for storing service request state + bool mStartRequestCompleted; //!< Variable for storing service request state QNetworkConfigurationManager* mNetConfigurationManager; //!< pointer to network configuration manager WlanLoginNetworkAccessManager* mNetworkAccessManager; //!< pointer to network access manager QNetworkSession* mNetworkSession; //!< pointer to network session diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginmainwindow.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginmainwindow.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginmainwindow.h Mon Aug 23 13:30:09 2010 +0300 @@ -43,6 +43,7 @@ ~WlanLoginMainWindow(); WlanLoginView* loginView() const; + WlanLoginApplication* application() const; private: void addLoginView(); diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginview.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginview.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginview.h Mon Aug 23 13:30:09 2010 +0300 @@ -30,6 +30,7 @@ #include "ictsqtwrapper.h" // Forward declarations +class HbDocumentLoader; class HbProgressBar; class WlanLoginWebView; class QNetworkAccessManager; @@ -45,7 +46,7 @@ Q_OBJECT public: - WlanLoginView(WlanLoginApplication* appref); + WlanLoginView(WlanLoginMainWindow* mainWindow); virtual ~WlanLoginView(); /*! @@ -53,10 +54,11 @@ */ enum ActionType { Cancel, //!< "Cancel" button - Next, //!< "Next" button - Continue //!< "Continue" button + Next //!< "Next" button }; - void setActiveToolBarAction(ActionType newAction); + +private: + void loadDocml(); private slots: @@ -68,38 +70,32 @@ void handleLoadStarted(); void handleLoadProgress(int progressValue); void handleLoadFinished(bool status ); - void handleFormSubmitted(); void handleCancelAction(); void handleNextAction(); - void handleContinueAction(); - void handleIctsOk(); signals: void cancelTriggered(); void nextTriggered(); - void continueTriggered(); + void startIcts(); private: // Data // Not owned data - WlanLoginApplication* mAppRef; //!< pointer to application instance + WlanLoginMainWindow* mMainWindow; //!< pointer to main window instance // Owned data - QGraphicsLinearLayout* mMainLayout; //!< pointer to main layout - QGraphicsLinearLayout* mContentLayout; //!< pointer to scroall area content layout + QScopedPointer mDocLoader; //! Document loader for list view HbProgressBar* mProgressBar; //!< pointer to HB progressbar - HbScrollArea* mScrollArea; //!< pointer to HB scroll area - HbWidget* mScrollAreaContent; + HbWidget* mScrollAreaContent; //!< pointer to scroll are content WlanLoginWebView* mWebView; //!< pointer to web view - HbToolBar* mToolBar; //!< pointer to HB toolbar HbAction* mCancelAction; //!< pointer to "cancel" action HbAction* mNextAction; //!< pointer to "next" action - HbAction* mContinueAction; //!< pointer to "continue" action + bool mFirstIctsOkResult; //!< Variable for controlling automatic background sending }; diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebview.h --- a/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebview.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/inc/wlanloginwebview.h Mon Aug 23 13:30:09 2010 +0300 @@ -36,7 +36,7 @@ Q_OBJECT public: - explicit WlanLoginWebView(QGraphicsWidget* parent = 0); + WlanLoginWebView(); ~WlanLoginWebView(); protected: diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/res/wlanlogin.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/res/wlanlogin.qrc Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,8 @@ + + + + wlanloginview.docml.bin + + + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/res/wlanloginview.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/res/wlanloginview.docml Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginapplication.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginapplication.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginapplication.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -121,13 +121,6 @@ Q_ASSERT(connectStatus == true); connectStatus = connect( - mMainWindow->loginView(), - SIGNAL(continueTriggered()), - mEngine, - SLOT(handleContinueTriggered())); - Q_ASSERT(connectStatus == true); - - connectStatus = connect( mMainWindow.data(), SIGNAL(orientationChanged(Qt::Orientation)), mMainWindow->loginView(), diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/src/wlanlogindocumentloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanlogindocumentloader.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Wlan Login document loader implementation +* +*/ + +// System includes +#include + +//User includes +#include "wlanloginwebview.h" +#include "wlanlogindocumentloader.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanlogindocumentloaderTraces.h" +#endif + +/*! + \class WlanLoginDocumentLoader + \brief WLAN Login document loader implementation. +*/ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor +*/ +WlanLoginDocumentLoader::WlanLoginDocumentLoader(const HbMainWindow *window) : HbDocumentLoader(window) +{ + OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_WLANLOGINDOCUMENTLOADER_ENTRY); + OstTraceFunctionExit0(WLANLOGINDOCUMENTLOADER_WLANLOGINDOCUMENTLOADER_EXIT); +} + +/*! + Destructor +*/ +WlanLoginDocumentLoader::~WlanLoginDocumentLoader() +{ + OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_DESTRUCTOR_ENTRY); + OstTraceFunctionExit0(WLANLOGINDOCUMENTLOADER_DESTRUCTOR_EXIT); +} + +/*! + This function returns WLAN Login UI specific objects from DocML +*/ +QObject* WlanLoginDocumentLoader::createObject(const QString& type, const QString &name) +{ + OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_CREATEOBJECT_ENTRY); + + QObject *res(NULL); + if( type == WlanLoginWebView::staticMetaObject.className() ) { + res = new WlanLoginWebView(); + res->setObjectName(name); + } + + if (!res) { + res = HbDocumentLoader::createObject(type, name); + } + OstTraceFunctionEntry0(WLANLOGINDOCUMENTLOADER_CREATEOBJECT_EXIT); + return res; +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginengine.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginengine.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginengine.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -58,7 +58,7 @@ WlanLoginEngine::WlanLoginEngine(QObject *parent): QObject(parent), mEngineState(WaitingForStart), - mServiceRequestCompleted(false), + mStartRequestCompleted(false), mNetConfigurationManager(new QNetworkConfigurationManager(this)), mNetworkAccessManager(new WlanLoginNetworkAccessManager(this)), mNetworkSession(NULL), @@ -103,7 +103,11 @@ */ WlanLoginNetworkAccessManager* WlanLoginEngine::networkAccessManager() const { + OstTraceFunctionEntry0(WLANLOGINENGINE_NETWORKACCESSMANAGER_ENTRY); + OstTraceFunctionExit0(WLANLOGINENGINE_NETWORKACCESSMANAGER_EXIT); + return mNetworkAccessManager; + } @@ -114,7 +118,10 @@ */ WlanLoginEngine::EngineState WlanLoginEngine::engineState() { - return mEngineState; + OstTraceFunctionEntry0(WLANLOGINENGINE_ENGINESTATE_ENTRY); + OstTraceFunctionExit0(WLANLOGINENGINE_ENGINESTATE_EXIT); + + return mEngineState; } @@ -125,7 +132,16 @@ */ void WlanLoginEngine::setEngineState(WlanLoginEngine::EngineState newState) { + OstTraceFunctionEntry0(WLANLOGINENGINE_SETENGINESTATE_ENTRY); + mEngineState = newState; + OstTrace1( + TRACE_NORMAL, + WLANLOGINENGINE_SETENGINESTATE_STATE_TRACE, + "WlanLoginEngine::setEngineState;mEngineState=%d", + mEngineState); + + OstTraceFunctionExit0(WLANLOGINENGINE_SETENGINESTATE_EXIT); } @@ -213,8 +229,11 @@ //States of the available configurations are now updated and //we can open the network session to provided IAP - openSession(); - + //Check that cancel has not been pressed + if (engineState() != WaitingForStopRequest) { + openSession(); + } + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLEUPDATECOMPLETED_EXIT); } @@ -312,9 +331,12 @@ { OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLESESSIONOPENED_ENTRY); - setEngineState(NetworkSessionOpened); - //Send indication to view that connection is ready - emit connectionReady(mRedirectionUrl); + //Check that cancel has not been pressed + if (engineState() != WaitingForStopRequest) { + setEngineState(NetworkSessionOpened); + //Send indication to view that connection is ready + emit connectionReady(mRedirectionUrl); + } OstTraceFunctionExit0(WLANLOGINENGINE_HANDLESESSIONOPENED_EXIT); } @@ -358,7 +380,8 @@ break; case NetworkSessionOpened: - case IctsRan: + case IctsOk: + case IctsFailed: if (error == QNetworkSession::SessionAbortedError ) { showConnectionDroppedMessageBox(); } @@ -421,11 +444,13 @@ Q_UNUSED(redirectUrl); - setEngineState(IctsRan); mIctsFirstRun = false; if (result == IctsWrapper::ConnectionOk){ + setEngineState(IctsOk); emit ictsOk(); + } else { + setEngineState(IctsFailed); } OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECONNECTIVITYTESTRESULT_EXIT); @@ -439,23 +464,41 @@ { OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_ENTRY); - //Stop ICTS if it is running: - if (engineState() == RunningIcts) { - stopIcts(); - if (mIctsFirstRun) { - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); - } else { - //Previous ICTS must have failed as cancel action can't be selected from UI if - //it has passed - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); - } - } else if (engineState() == IctsRan) { - //ICTS must have failed as cancel action can't be selected from UI if - //it has passed - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); + //Check if Qt Highway request is completed + if (mStartRequestCompleted == false){ + + switch (engineState()) { + + case UpdatingNetworkConfigurations: + case OpeningNetworkSession: + case NetworkSessionOpened: + setEngineState(WaitingForStopRequest); + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); + break; + + case RunningIcts: + stopIcts(); + setEngineState(WaitingForStopRequest); + if (mIctsFirstRun) { + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); + } else { + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); + } + break; + + case IctsFailed: + setEngineState(WaitingForStopRequest); + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusFailed); + break; + + default: + break; + } } else { - //ICTS not run yet - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusCancel); + //Check race condition + if(engineState() != WaitingForStopRequest) { + qApp->exit(); + } } OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECANCELTRIGGERED_EXIT); @@ -468,8 +511,10 @@ void WlanLoginEngine::handleNextTriggered() { OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLENEXTTRIGGERED_ENTRY); - - emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusNext); + + if (mStartRequestCompleted == false ) { + emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusNext); + } //put application to background: WlanLoginApplication* app = static_cast(this->parent()); @@ -479,21 +524,6 @@ } /*! - This slot handles continueTriggered signal from the view - - */ -void WlanLoginEngine::handleContinueTriggered() -{ - OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLECONTINUETRIGGERED_ENTRY); - - //put application to background: - WlanLoginApplication* app = static_cast(this->parent()); - app->mainWindow()->lower(); - - OstTraceFunctionExit0(WLANLOGINENGINE_HANDLECONTINUETRIGGERED_EXIT); -} - -/*! This function shows connection dropped message box to the user */ @@ -515,7 +545,7 @@ Q_UNUSED(action); - if (mServiceRequestCompleted == false ) { + if (mStartRequestCompleted == false ) { emitCompleteServiceRequest(WlanLoginService::WlanLoginStatusConnectionDropped); } else { @@ -523,7 +553,7 @@ qApp->exit(); } - OstTraceFunctionEntry0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_EXIT); + OstTraceFunctionExit0(WLANLOGINENGINE_HANDLEMESSAGEBOXCLOSED_EXIT); } /*! @@ -534,7 +564,7 @@ { OstTraceFunctionEntry0(WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_ENTRY); - mServiceRequestCompleted = true; + mStartRequestCompleted = true; OstTrace1( TRACE_BORDER, WLANLOGINENGINE_EMITCOMPLETESERVICEREQUEST_EMIT_TRACE, diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginmainwindow.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginmainwindow.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginmainwindow.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -70,7 +70,7 @@ { OstTraceFunctionEntry0(WLANLOGINMAINWINDOW_ADDLOGINVIEW_ENTRY); - mLoginView = new WlanLoginView(mAppRef); + mLoginView = new WlanLoginView(this); addView(mLoginView); OstTraceFunctionExit0(WLANLOGINMAINWINDOW_ADDLOGINVIEW_EXIT); @@ -87,3 +87,15 @@ return mLoginView; } + +/*! + This function returns pointer to application instance + */ +WlanLoginApplication* WlanLoginMainWindow::application() const +{ + OstTraceFunctionEntry0(WLANLOGINMAINWINDOW_APPLICATION_ENTRY); + OstTraceFunctionExit0(WLANLOGINMAINWINDOW_APPLICATION_EXIT); + + return mAppRef; +} + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginview.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginview.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginview.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -21,15 +21,16 @@ #include // System includes -#include #include #include #include #include #include #include +#include // User includes +#include "wlanlogindocumentloader.h" #include "wlanloginview.h" #include "wlanloginwebview.h" #include "wlanloginwebpage.h" @@ -50,6 +51,8 @@ // External function prototypes // Local constants +//! WLAN Login view docml file +static const QString wlanLoginViewDocml(":/docml/wlanloginview.docml"); // ======== LOCAL FUNCTIONS ======== @@ -58,75 +61,29 @@ /*! Constructor */ -WlanLoginView::WlanLoginView(WlanLoginApplication* appRef): - mAppRef(appRef), - mMainLayout(NULL), - mContentLayout(NULL), +WlanLoginView::WlanLoginView(WlanLoginMainWindow* mainWindow): + mMainWindow(mainWindow), + mDocLoader(new WlanLoginDocumentLoader(mainWindow)), mProgressBar(NULL), - mScrollArea(NULL), mScrollAreaContent(NULL), mWebView(NULL), - mToolBar(NULL), - mCancelAction(NULL), mNextAction(NULL), - mContinueAction(NULL) + mFirstIctsOkResult(true) { OstTraceFunctionEntry0(WLANLOGINVIEW_WLANLOGINVIEW_ENTRY); + loadDocml(); + setTitleBarVisible(false); setStatusBarVisible(false); - mMainLayout = new QGraphicsLinearLayout(Qt::Vertical); - mMainLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mMainLayout->setContentsMargins(0,0,0,0); - setLayout(mMainLayout); - - mScrollArea = new HbScrollArea(); - mScrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); - mScrollArea->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff); - mScrollArea->setScrollDirections(Qt::Vertical | Qt::Horizontal); - mScrollArea->setClampingStyle( HbScrollArea::StrictClamping ); - mScrollArea->setScrollingStyle( HbScrollArea::PanWithFollowOn ); - mMainLayout->addItem(mScrollArea); - - mScrollAreaContent = new HbWidget(); - mScrollAreaContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mContentLayout = new QGraphicsLinearLayout(Qt::Vertical); - mContentLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mContentLayout->setContentsMargins(0,0,0,0); - mScrollAreaContent->setLayout(mContentLayout); - mScrollArea->setContentWidget(mScrollAreaContent); - // Set white background to content widget QPixmap pixmap(10,10); pixmap.fill(Qt::white); QGraphicsPixmapItem *pixmapItem = new QGraphicsPixmapItem(pixmap); mScrollAreaContent->setBackgroundItem(pixmapItem); - //Note: Progress bar is added to layout when loadStarted signal is handled and - //removed when loadFinished signal is handled - mProgressBar = new HbProgressBar(); - mProgressBar->setRange( 0,100); - mProgressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mProgressBar->setVisible(false); - - mWebView = new WlanLoginWebView(); - mContentLayout->addItem(mWebView); - mWebView->page()->setNetworkAccessManager(appRef->engine()->networkAccessManager()); - - //Create tool bar - mToolBar = new HbToolBar(); - mCancelAction = mToolBar->addAction(HbIcon("qtg_mono_exit"),""); - mNextAction = mToolBar->addAction(HbIcon("qtg_mono_arrow_right"),""); - mContinueAction = mToolBar->addAction(HbIcon("qtg_mono_tick"),""); - - setToolBar(mToolBar); - setActiveToolBarAction(Cancel); - - mToolBar->show(); - mWebView->show(); - mScrollArea->show(); + mWebView->page()->setNetworkAccessManager(mMainWindow->application()->engine()->networkAccessManager()); bool connectStatus = connect( mWebView, @@ -177,18 +134,55 @@ SLOT(handleNextAction())); Q_ASSERT(connectStatus == true); - connectStatus = connect( - mContinueAction, - SIGNAL(triggered()), - this, - SLOT(handleContinueAction())); - Q_ASSERT(connectStatus == true); - show(); OstTraceFunctionExit0(WLANLOGINVIEW_WLANLOGINVIEW_EXIT); } +/*! + Loads widgets and objects from the docml file. + */ +void WlanLoginView::loadDocml() +{ + OstTraceFunctionEntry0( WLANLOGINVIEW_LOADDOCML_ENTRY ); + + setObjectName(QString("wlanLoginView")); + QObjectList objectList; + objectList.append(this); + mDocLoader->setObjectTree(objectList); + + bool ok = false; + + mDocLoader->load(wlanLoginViewDocml, &ok); + Q_ASSERT(ok); + + //Fetch pointer for progress bar + mProgressBar = reinterpret_cast( + mDocLoader->findObject("progressBar")); + Q_ASSERT(mProgressBar); + + //Fetch pointer for scroll area content + mScrollAreaContent = reinterpret_cast( + mDocLoader->findObject("scrollAreaContent")); + Q_ASSERT(mScrollAreaContent); + + //Fetch pointer for Web View + mWebView = reinterpret_cast( + mDocLoader->findObject("webView")); + Q_ASSERT(mWebView); + + //Fetch pointer for cancel action + mCancelAction = qobject_cast ( + mDocLoader->findObject("cancelAction")); + Q_ASSERT(mCancelAction != NULL); + + //Fetch pointer for next action + mNextAction = qobject_cast ( + mDocLoader->findObject("nextAction")); + Q_ASSERT(mNextAction != NULL); + + OstTraceFunctionExit0( WLANLOGINVIEW_LOADDOCML_EXIT ); +} /*! Destructor @@ -197,12 +191,6 @@ { OstTraceFunctionEntry0(WLANLOGINVIEW_DESTRUCTOR_ENTRY); - //delete progress bar here as it is not on the layout all the time and - //thus may not have a parent at all. - if (mProgressBar) { - delete mProgressBar; - } - OstTraceFunctionExit0(WLANLOGINVIEW_DESTRUCTOR_EXIT); } @@ -243,7 +231,7 @@ OstTraceFunctionEntry0( WLANLOGINVIEW_ADJUSTVIEWSIZE_ENTRY ); //Store current screen size - QSizeF screenSize = mAppRef->mainWindow()->layoutRect().size(); + QSizeF screenSize = mMainWindow->layoutRect().size(); //Store current content size QSize contentSize = mWebView->page()->mainFrame()->contentsSize(); @@ -275,7 +263,7 @@ //Set preferred content size to current screen size - mWebView->page()->setPreferredContentsSize(mAppRef->mainWindow()->layoutRect().size().toSize()); + mWebView->page()->setPreferredContentsSize(mMainWindow->layoutRect().size().toSize()); OstTraceFunctionEntry0( WLANLOGINVIEW_ADJUSTVIEWSIZE_EXIT ); } @@ -312,7 +300,6 @@ { OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLELOADSTARTED_ENTRY); - mContentLayout->insertItem(0, mProgressBar); mProgressBar->setVisible(true); OstTraceFunctionExit0(WLANLOGINVIEW_HANDLELOADSTARTED_EXIT); @@ -349,7 +336,6 @@ } mProgressBar->setVisible(false); - mContentLayout->removeItem(mProgressBar); OstTraceFunctionExit0(WLANLOGINVIEW_HANDLELOADFINISHED_EXIT); } @@ -362,8 +348,6 @@ void WlanLoginView::handleFormSubmitted() { OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLEFORMSUBMITTED_ENTRY); - - //TODO: Check why QWebPage sends this signal to times in a row when user pushes submit button in a web page //User has submitted credentials, let's start internet connectivity test emit startIcts(); @@ -380,6 +364,7 @@ { OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLECANCELACTION_ENTRY); + mWebView->stop(); emit cancelTriggered(); OstTraceFunctionExit0(WLANLOGINVIEW_HANDLECANCELACTION_EXIT); @@ -395,29 +380,12 @@ OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLENEXTACTION_ENTRY); emit nextTriggered(); - - //Change toolabr action to "Continue" as we are going to background - setActiveToolBarAction(Continue); OstTraceFunctionExit0(WLANLOGINVIEW_HANDLENEXTACTION_EXIT); } /*! - This function handles triggered signal from "continue" button - - */ -void WlanLoginView::handleContinueAction() -{ - OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLECONTINUEACTION_ENTRY); - - emit continueTriggered(); - - OstTraceFunctionExit0(WLANLOGINVIEW_HANDLECONTINUEACTION_EXIT); -} - - -/*! This function handles ictsOk signal from engine */ @@ -425,58 +393,15 @@ { OstTraceFunctionEntry0(WLANLOGINVIEW_HANDLEICTSRESULT_ENTRY); - setActiveToolBarAction(Next); + mNextAction->setEnabled(true); + + //Send application to background automatically only in first successfull login + //as in other cases WLAN Wizard won't exist in the underneath + if (mFirstIctsOkResult) { + mFirstIctsOkResult = false; + emit nextTriggered(); + } OstTraceFunctionExit0(WLANLOGINVIEW_HANDLEICTSRESULT_EXIT); } -/*! - This function sets active action to the toolbar and hides other actions - - @param [in] newAction Action to be set to toolbar - */ -void WlanLoginView::setActiveToolBarAction(ActionType newAction) -{ - OstTraceFunctionEntry0( WLANLOGINVIEW_SETACTIVETOOLBARACTION_ENTRY ); - - switch (newAction) { - case Cancel: - mNextAction->setEnabled(false); - mNextAction->setVisible(false); - - mContinueAction->setEnabled(false); - mContinueAction->setVisible(false); - - mCancelAction->setVisible(true); - mCancelAction->setEnabled(true); - break; - - case Next: - mCancelAction->setEnabled(false); - mCancelAction->setVisible(false); - - mContinueAction->setEnabled(false); - mContinueAction->setVisible(false); - - mNextAction->setVisible(true); - mNextAction->setEnabled(true); - break; - - case Continue: - mCancelAction->setEnabled(false); - mCancelAction->setVisible(false); - - mNextAction->setEnabled(false); - mNextAction->setVisible(false); - - mContinueAction->setVisible(true); - mContinueAction->setEnabled(true); - break; - - default: - break; - - } - - OstTraceFunctionExit0( WLANLOGINVIEW_SETACTIVETOOLBARACTION_EXIT ); -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp --- a/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/src/wlanloginwebview.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -43,8 +43,8 @@ /*! Constructor */ -WlanLoginWebView::WlanLoginWebView(QGraphicsWidget* parent): - QGraphicsWebView(parent), +WlanLoginWebView::WlanLoginWebView(): + QGraphicsWebView(), mWebPage(NULL), mMousePressed(false) { diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanlogin/wlanloginapp/wlanloginapp.pro --- a/wlanutilities/wlanlogin/wlanloginapp/wlanloginapp.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanlogin/wlanloginapp/wlanloginapp.pro Mon Aug 23 13:30:09 2010 +0300 @@ -26,7 +26,7 @@ LIBS += -lxqservice -lxqserviceutil -lictsqtwrapper -lqtsysteminfo -CONFIG += hb service mobility +CONFIG += hb service mobility no_icon MOBILITY += bearer QT += \ @@ -42,6 +42,7 @@ src/main.cpp \ src/wlanloginapplication.cpp \ src/wlanloginengine.cpp \ + src/wlanlogindocumentloader.cpp \ src/wlanloginmainwindow.cpp \ src/wlanloginnetworkaccessmanager.cpp \ src/wlanloginservice.cpp \ @@ -52,6 +53,7 @@ HEADERS += \ inc/wlanloginapplication.h \ inc/wlanloginengine.h \ + inc/wlanlogindocumentloader.h \ inc/wlanloginmainwindow.h \ inc/wlanloginnetworkaccessmanager.h \ inc/wlanloginservice.h \ @@ -59,6 +61,10 @@ inc/wlanloginwebpage.h \ inc/wlanloginwebview.h \ traces/OstTraceDefinitions.h + +DOCML += res/wlanloginview.docml + +RESOURCES = res/wlanlogin.qrc TRANSLATIONS = wlanlogin.ts diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutils_p.h Mon Aug 23 13:30:09 2010 +0300 @@ -111,6 +111,9 @@ private slots: + void updateAvailableWlanIaps( + QList< QSharedPointer > &availableIaps); + void updateAvailableWlanAps( QList< QSharedPointer > &availableWlans); @@ -164,6 +167,9 @@ //! Current WLAN scan mode. ScanMode mScanMode; + + //! List of available WLAN IAPs according to the latest scan. + QList< QSharedPointer > mIapScanList; //! List of available WLAN APs according to the latest scan. QList< QSharedPointer > mWlanScanList; diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/base/inc/wlanqtutilsap.h --- a/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsap.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/base/inc/wlanqtutilsap.h Mon Aug 23 13:30:09 2010 +0300 @@ -53,8 +53,6 @@ /*! Configuration IDs that can be read and set in this class. - Remember to update traces/trace.properties file when modifying - this enum (tracing is also the cause for fixing the enum values). ConfID's available for scan results: - ConfIdSsid @@ -78,6 +76,7 @@ - ConfIdWpaPskUse - ConfIdWpaPsk (Empty if not used) - ConfIdHidden + - ConfIdWlanScanSSID */ enum ConfId { //! QString: WLAN Network Name (SSID) @@ -113,10 +112,12 @@ ConfIdWepKey4 = 10, //! int: (CMManagerShim::WlanWepKeyIndex): Default WEP Key index ConfIdWepDefaultIndex = 11, - //! bool: Is WLAN hidden (CMManager::ECmHidden). + //! bool: Is WLAN hidden (CMManagerShim::CmHidden). ConfIdHidden = 12, + //! bool: Does WLAN AP need explicit scanning (CMManagerShim::WlanScanSSID) + ConfIdWlanScanSSID = 13, //! bool: true - Wifi Protected setup is supported, false - not - ConfIdWpsSupported = 13 + ConfIdWpsSupported = 14 }; /*! diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutils_p.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -67,6 +67,7 @@ mEsockWrapper(new WlanQtUtilsEsockWrapper(this)), mIctService(), mScanMode(ScanModeNone), + mIapScanList(), mWlanScanList(), mToBeTestedIapId(WlanQtUtils::IapIdNone), mConnectingIapId(WlanQtUtils::IapIdNone), @@ -76,6 +77,13 @@ // Make all connections. bool connectStatus = connect( + mScanWrapper, + SIGNAL(availableWlanIaps(QList< QSharedPointer > &)), + this, + SLOT(updateAvailableWlanIaps(QList< QSharedPointer > &))); + Q_ASSERT(connectStatus); + + connectStatus = connect( mScanWrapper, SIGNAL(availableWlanAps(QList< QSharedPointer >&)), this, @@ -145,9 +153,9 @@ // Scanning while there is an ongoing scan is not supported Q_ASSERT(mScanMode == ScanModeNone); - // Just forward the request to wrapper, which triggers a broadcast WLAN scan + // Starting with an IAP scan, and continuing with AP scan mScanMode = ScanModeAvailableWlans; - mScanWrapper->scanWlanAps(); + mScanWrapper->scanWlanIaps(); OstTraceFunctionExit1(WLANQTUTILSPRIVATE_SCANWLANS_EXIT, this); } @@ -225,19 +233,16 @@ QList< QSharedPointer > configuredIapList; mSettings->fetchIaps(configuredIapList); - // Match IAPs against WLAN scan results - foreach (QSharedPointer iap, configuredIapList) { - foreach (QSharedPointer scanAp, mWlanScanList) { - if (WlanQtUtilsAp::compare(iap.data(), scanAp.data()) == 0) { - // IAP found, add it to caller's list of known IAPs - // (signal strength needs to be updated manually since - // the IAP in our list does not have that information yet) - iap->setValue( - WlanQtUtilsAp::ConfIdSignalStrength, - scanAp->value(WlanQtUtilsAp::ConfIdSignalStrength)); - wlanIapList.append(iap); - break; - } + // Update the list of available IAPs + foreach (QSharedPointer iapIter, mIapScanList) { + int iapId = iapIter->value(WlanQtUtilsIap::ConfIdIapId).toInt(); + QSharedPointer iap(mSettings->fetchIap(iapId)); + if (iap) { + // Only add the IAP if we (still) have the settings for it + iap->setValue( + WlanQtUtilsAp::ConfIdSignalStrength, + iapIter->value(WlanQtUtilsAp::ConfIdSignalStrength)); + wlanIapList.append(iap); } } @@ -506,7 +511,28 @@ } /*! - Slot for handling WLAN scan result event from wrapper. Results are + Slot for handling WLAN IAP scan result event from wrapper. Results are + stored in a member variable. + + @param [in] availableIaps Available WLAN IAP's found in scan. +*/ + +void WlanQtUtilsPrivate::updateAvailableWlanIaps( + QList< QSharedPointer > &availableIaps) +{ + OstTraceFunctionEntry0(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANIAPS_ENTRY); + + // Store the new IAP list + mIapScanList = availableIaps; + + // Continue with AP scan (which should come immediately from WLAN's scan cache) + mScanWrapper->scanWlanAps(); + + OstTraceFunctionExit0(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANIAPS_EXIT); +} + +/*! + Slot for handling WLAN AP scan result event from wrapper. Results are stored in member variable (possible duplicates are removed). @param [in] availableWlanList WLAN networks found in scan. @@ -519,6 +545,7 @@ // Old results are removed mWlanScanList.clear(); + // Copy available WLANs to scan result list (duplicates are removed) for (int i = 0; i < availableWlanList.count(); i++) { bool duplicate = false; @@ -537,10 +564,10 @@ // The information is forwarded to the client reportScanResult(WlanQtUtils::ScanStatusOk); - + // Scan is complete mScanMode = ScanModeNone; - + OstTraceFunctionExit1(WLANQTUTILSPRIVATE_UPDATEAVAILABLEWLANAPS_EXIT, this); } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/base/src/wlanqtutilsiapsettings.cpp --- a/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiapsettings.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/base/src/wlanqtutilsiapsettings.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -404,6 +404,12 @@ iap->setIntAttribute( CMManagerShim::WlanConnectionMode, wlanAp->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt()); + iap->setBoolAttribute( + CMManagerShim::CmHidden, + wlanAp->value(WlanQtUtilsAp::ConfIdHidden).toBool()); + iap->setBoolAttribute( + CMManagerShim::WlanScanSSID, + wlanAp->value(WlanQtUtilsAp::ConfIdWlanScanSSID).toBool()); // Store the WEP settings storeWepKey( diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/stubs/stub_wlanmgmtclient.cpp --- a/wlanutilities/wlanqtutilities/stubs/stub_wlanmgmtclient.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/stubs/stub_wlanmgmtclient.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -20,7 +20,7 @@ #include "wlanmgmtclient.h" // --------------------------------------------------------- -// CWlanScanRequest::NewL +// CWlanMgmtClient::NewL // --------------------------------------------------------- // CWlanMgmtClient* CWlanMgmtClient::NewL() @@ -30,7 +30,7 @@ } // --------------------------------------------------------- -// CWlanScanRequest::~CWlanMgmtClient +// CWlanMgmtClient::~CWlanMgmtClient // --------------------------------------------------------- // CWlanMgmtClient::~CWlanMgmtClient() @@ -38,7 +38,7 @@ } // --------------------------------------------------------- -// CWlanScanRequest::CWlanMgmtClient +// CWlanMgmtClient::CWlanMgmtClient // --------------------------------------------------------- // CWlanMgmtClient::CWlanMgmtClient() @@ -46,7 +46,7 @@ } // --------------------------------------------------------- -// CWlanScanRequest::GetScanResults +// CWlanMgmtClient::GetScanResults // --------------------------------------------------------- // void CWlanMgmtClient::GetScanResults( @@ -62,7 +62,7 @@ } // --------------------------------------------------------- -// CWlanScanRequest::GetScanResults +// CWlanMgmtClient::GetScanResults // --------------------------------------------------------- // void CWlanMgmtClient::GetScanResults( @@ -70,19 +70,49 @@ TRequestStatus& aStatus, CWlanScanInfo& aResults ) { + (void)aSsid; + (void)aResults; + // Complete the request immediately TRequestStatus *status = &aStatus; User::RequestComplete(status, KErrNone); // Results are returned when asked per AP - (void)aSsid; - (void)aResults; } // --------------------------------------------------------- -// CWlanScanRequest::CancelGetScanResults +// CWlanMgmtClient::CancelGetScanResults // --------------------------------------------------------- // void CWlanMgmtClient::CancelGetScanResults() { } + +// --------------------------------------------------------- +// CWlanMgmtClient::GetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtClient::GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TBool aFilteredResults, + TRequestStatus& aStatus, + RArray& aAvailableIaps ) + { + (void)aCacheLifetime; + (void)aMaxDelay; + (void)aFilteredResults; + (void)aAvailableIaps; + + // Complete the request immediately + TRequestStatus *status = &aStatus; + User::RequestComplete(status, KErrNone); + } + +// --------------------------------------------------------- +// CWlanMgmtClient::CancelGetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtClient::CancelGetAvailableIaps() + { + } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/stubs/wlanmgmtclient.h --- a/wlanutilities/wlanqtutilities/stubs/wlanmgmtclient.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/stubs/wlanmgmtclient.h Mon Aug 23 13:30:09 2010 +0300 @@ -71,6 +71,41 @@ * Cancel an outstanding scan request. */ void CancelGetScanResults(); + + /** + * Get the available WLAN IAPs. + * + * @param aCacheLifetime Defines how many seconds old cached results the client + * is willing to accept. The valid is range is from 0 to + * 60 seconds. The value of -1 means the system default will + * be used. The aCacheLifetime parameter has a meaning only + * when the aMaxDelay parameter is zero. + * Value will be changed to the actual value used by the + * system. + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the availability results. The valid range is from 0 to 1200 + * seconds or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay + * will never cause a scan, but the request will be + * completed when any other broadcast scan request is completed. + * Value will be changed to the actual value used by the system. + * @param aFilteredResults Whether availability is filtered based on signal strength. + * ETrue if filtering is allowed, EFalse if not. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aAvailableIaps Array of IAPs available. + */ + void GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TBool aFilteredResults, + TRequestStatus& aStatus, + RArray& aAvailableIaps ); + + /** + * Cancel an outstanding IAP availability request. + */ + void CancelGetAvailableIaps(); private: // Data diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.cpp --- a/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -25,6 +25,7 @@ #include "wlanqtutils.h" #include "wlanqtutilstestcontext.h" #include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" #include "wlanqtutilsconnection.h" // --------------------------------------------------------- @@ -138,27 +139,77 @@ WlanQtUtilsWlanScan::WlanQtUtilsWlanScan() : mScanResultIterator(0), - mWlanScanResultList(), - mCompleteWlanScan(true), - mScanRetValue(KErrNone) + mWlanScanIapResultList(), + mWlanScanApResultList(), + mCompleteWlanIapScan(true), + mCompleteWlanApScan(true), + mIapScanRetValue(KErrNone), + mApScanRetValue(KErrNone) { } WlanQtUtilsWlanScan::~WlanQtUtilsWlanScan() { - clearWlanScanResultList(); + clearWlanScanIapResultList(); + clearWlanScanApResultList(); } void WlanQtUtilsWlanScan::initialize() { - clearWlanScanResultList(); - mCompleteWlanScan = true; - mScanRetValue = KErrNone; + clearWlanScanIapResultList(); + clearWlanScanApResultList(); + mCompleteWlanIapScan = true; + mCompleteWlanApScan = true; + mIapScanRetValue = KErrNone; + mApScanRetValue = KErrNone; +} + +void WlanQtUtilsWlanScan::createDefaultWlanScanIapResultList(int numberOfWlanIaps) +{ + clearWlanScanIapResultList(); + + for (int i = 0; i < numberOfWlanIaps; i++) { + QSharedPointer iap(new WlanQtUtilsIap()); + iap->setValue(WlanQtUtilsIap::ConfIdIapId, i); + iap->setValue(WlanQtUtilsIap::ConfIdName, "TestWlanAp" + QString::number(i + 1)); + // ConfIdNetworkId? + iap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); + iap->setValue(WlanQtUtilsAp::ConfIdSignalStrength, 20); + iap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + iap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + iap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + mWlanScanIapResultList.append(iap); + } } -void WlanQtUtilsWlanScan::createDefaultWlanScanResultList(int numberOfWlanAps) +void WlanQtUtilsWlanScan::clearWlanScanIapResultList() +{ + mWlanScanIapResultList.clear(); +} + +void WlanQtUtilsWlanScan::verifyWlanScanIapResultList( + QList< QSharedPointer > wlanIapList) { - clearWlanScanResultList(); + QCOMPARE(wlanIapList.count(), mWlanScanIapResultList.count()); + + for (int i = 0; i < mWlanScanIapResultList.count(); i++) { + QCOMPARE( + wlanIapList[i]->value(WlanQtUtilsIap::ConfIdIapId), + mWlanScanIapResultList[i]->value(WlanQtUtilsIap::ConfIdIapId)); + QCOMPARE( + wlanIapList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), + mWlanScanIapResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); + //QCOMPARE( + // wlanIapList[i]->value(WlanQtUtilsAp::ConfIdSsid), + // mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); + } +} + + +void WlanQtUtilsWlanScan::createDefaultWlanScanApResultList(int numberOfWlanAps) +{ + clearWlanScanApResultList(); + for (int i = 0; i < numberOfWlanAps; i++) { QSharedPointer ap(new WlanQtUtilsAp()); ap->setValue(WlanQtUtilsAp::ConfIdSsid, "TestWlanAp" + QString::number(i + 1)); @@ -168,42 +219,42 @@ ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); ap->setValue(WlanQtUtilsAp::ConfIdWpsSupported, false); - mWlanScanResultList.append(ap); + mWlanScanApResultList.append(ap); } } -void WlanQtUtilsWlanScan::clearWlanScanResultList() +void WlanQtUtilsWlanScan::clearWlanScanApResultList() { - mWlanScanResultList.clear(); + mWlanScanApResultList.clear(); } -void WlanQtUtilsWlanScan::verifyWlanScanResultList( +void WlanQtUtilsWlanScan::verifyWlanScanApResultList( QList< QSharedPointer > wlanApList) { - QCOMPARE(wlanApList.count(), mWlanScanResultList.count()); + QCOMPARE(wlanApList.count(), mWlanScanApResultList.count()); - for (int i = 0; i < mWlanScanResultList.count(); i++) { + for (int i = 0; i < mWlanScanApResultList.count(); i++) { QCOMPARE( wlanApList[i]->value(WlanQtUtilsAp::ConfIdSsid), - mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); + mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSsid)); QCOMPARE( wlanApList[i]->value(WlanQtUtilsAp::ConfIdBssid), - mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdBssid)); + mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdBssid)); QCOMPARE( wlanApList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength), - mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); + mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSignalStrength)); QCOMPARE( wlanApList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode), - mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); + mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdConnectionMode)); QCOMPARE( wlanApList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode), - mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); + mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdSecurityMode)); QCOMPARE( wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse), - mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); + mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdWpaPskUse)); QCOMPARE( wlanApList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported), - mWlanScanResultList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported)); + mWlanScanApResultList[i]->value(WlanQtUtilsAp::ConfIdWpsSupported)); } } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.h --- a/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/context/wlanqtutilstestcontext.h Mon Aug 23 13:30:09 2010 +0300 @@ -147,11 +147,27 @@ void initialize(); /** + * Creates a list of WLAN IAPs for scan results. + * + * @param[in] numberOfWlanIaps Number of WLAN IAPs that are created. + */ + void createDefaultWlanScanIapResultList(int numberOfWlanIaps); + + /** + * Verifies that the given WLAN IAP list returned by the real application matches + * with the one in the context. + * + * @param[in] wlanIapList WLAN IAPs that are verified against the context. + */ + void verifyWlanScanIapResultList( + QList< QSharedPointer > wlanIapList); + + /** * Creates a list of WLAN APs for scan results. * * @param[in] numberOfWlanAps Number of WLAN APs that are created. */ - void createDefaultWlanScanResultList(int numberOfWlanAps); + void createDefaultWlanScanApResultList(int numberOfWlanAps); /** * Verifies that the given WLAN AP list returned by the real application matches @@ -159,30 +175,47 @@ * * @param[in] wlanApList WLAN APs that are verified against the context. */ - void verifyWlanScanResultList( + void verifyWlanScanApResultList( QList< QSharedPointer > wlanApList); // TODO: Maybe boolean return value // Scan result list iterator. Holds the current index, starting from zero (0). int mScanResultIterator; + // List of WLAN IAPs that WLAN Management API stub will return when + // requesting for wlan IAP scan results. + QList< QSharedPointer > mWlanScanIapResultList; + // List of WLAN access points that WLAN Management API stub will return when // requesting for wlan scan results. - QList< QSharedPointer > mWlanScanResultList; + QList< QSharedPointer > mWlanScanApResultList; /** - * Should scan be completed immediately or not? + * Should IAP scan be completed immediately or not? + */ + bool mCompleteWlanIapScan; + + /** + * Should AP scan be completed immediately or not? */ - bool mCompleteWlanScan; + bool mCompleteWlanApScan; - /** Return value of scan request. */ - int mScanRetValue; + /** Return value of IAP scan request. */ + int mIapScanRetValue; + + /** Return value of AP scan request. */ + int mApScanRetValue; private: /** + * Destroys and clears the list of WLAN IAPs. + */ + void clearWlanScanIapResultList(); + + /** * Destroys and clears the list of WLAN APs. */ - void clearWlanScanResultList(); + void clearWlanScanApResultList(); }; /** diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanmgmtclient.cpp --- a/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanmgmtclient.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanmgmtclient.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -20,14 +20,18 @@ #include "wlanmgmtclient.h" #include "wlanqtutilstestcontext.h" +#include "wlanqtutilsiap.h" extern WlanQtUtilsTestContext testContext; -// Request status for canceling stubbed async request -static TRequestStatus* iStubRequestStatus = 0; +// Request status for canceling stubbed GetScanResults async request +static TRequestStatus* iGetScanResultsStatus = 0; + +// Request status for canceling stubbed GetAvailableIaps async request +static TRequestStatus* iGetAvailableIapsStatus = 0; // --------------------------------------------------------- -// CWlanScanRequest::NewL +// CWlanMgmtClient::NewL // --------------------------------------------------------- // CWlanMgmtClient* CWlanMgmtClient::NewL() @@ -37,7 +41,7 @@ } // --------------------------------------------------------- -// CWlanScanRequest::~CWlanMgmtClient +// CWlanMgmtClient::~CWlanMgmtClient // --------------------------------------------------------- // CWlanMgmtClient::~CWlanMgmtClient() @@ -45,7 +49,7 @@ } // --------------------------------------------------------- -// CWlanScanRequest::CWlanMgmtClient +// CWlanMgmtClient::CWlanMgmtClient // --------------------------------------------------------- // CWlanMgmtClient::CWlanMgmtClient() @@ -53,29 +57,30 @@ } // --------------------------------------------------------- -// CWlanScanRequest::GetScanResults +// CWlanMgmtClient::GetScanResults // --------------------------------------------------------- // void CWlanMgmtClient::GetScanResults( TRequestStatus& aStatus, CWlanScanInfo& aResults ) { - if (testContext.mScan.mCompleteWlanScan) { + (void)aResults; + + if (testContext.mScan.mCompleteWlanApScan) { // Complete the request immediately TRequestStatus *status = &aStatus; User::RequestComplete( status, - testContext.mScan.mScanRetValue); + testContext.mScan.mApScanRetValue); } else { - iStubRequestStatus = &aStatus; + iGetScanResultsStatus = &aStatus; } // Results are returned when asked per AP - (void)aResults; } // --------------------------------------------------------- -// CWlanScanRequest::GetScanResults +// CWlanMgmtClient::GetScanResults // --------------------------------------------------------- // void CWlanMgmtClient::GetScanResults( @@ -83,27 +88,79 @@ TRequestStatus& aStatus, CWlanScanInfo& aResults ) { - if (testContext.mScan.mCompleteWlanScan) { + (void)aSsid; + (void)aResults; + + if (testContext.mScan.mCompleteWlanApScan) { // Complete the request immediately TRequestStatus *status = &aStatus; User::RequestComplete( status, - testContext.mScan.mScanRetValue); + testContext.mScan.mApScanRetValue); } else { - iStubRequestStatus = &aStatus; + iGetScanResultsStatus = &aStatus; } // Results are returned when asked per AP - (void)aSsid; - (void)aResults; } // --------------------------------------------------------- -// CWlanScanRequest::CancelGetScanResults +// CWlanMgmtClient::CancelGetScanResults // --------------------------------------------------------- // void CWlanMgmtClient::CancelGetScanResults() { - User::RequestComplete(iStubRequestStatus, KErrCancel); - iStubRequestStatus = 0; + if (iGetScanResultsStatus) { + User::RequestComplete(iGetScanResultsStatus, KErrCancel); + iGetScanResultsStatus = NULL; + } } + +// --------------------------------------------------------- +// CWlanMgmtClient::GetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtClient::GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TBool aFilteredResults, + TRequestStatus& aStatus, + RArray& aAvailableIaps ) + { + (void)aCacheLifetime; + (void)aMaxDelay; + (void)aFilteredResults; + (void)aAvailableIaps; + + if (testContext.mScan.mCompleteWlanIapScan) { + // Form results as defined in context + aAvailableIaps.Reset(); + for (int i=0; i < testContext.mScan.mWlanScanIapResultList.count(); i++) { + QSharedPointer iap(testContext.mScan.mWlanScanIapResultList[i]); + TWlanIapAvailabilityData data; + data.iIapId = (TUint)iap->value(WlanQtUtilsIap::ConfIdIapId).toInt(); + data.iRssi = (TUint)iap->value(WlanQtUtilsAp::ConfIdSignalStrength).toInt(); + aAvailableIaps.AppendL(data); + } + + // Complete the request immediately + TRequestStatus *status = &aStatus; + User::RequestComplete( + status, + testContext.mScan.mIapScanRetValue); + } else { + iGetAvailableIapsStatus = &aStatus; + } + } + +// --------------------------------------------------------- +// CWlanMgmtClient::CancelGetAvailableIaps +// --------------------------------------------------------- +// +void CWlanMgmtClient::CancelGetAvailableIaps() + { + if (iGetAvailableIapsStatus) { + User::RequestComplete(iGetAvailableIapsStatus, KErrCancel); + iGetAvailableIapsStatus = 0; + } + } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanscaninfo.cpp --- a/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanscaninfo.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/stub_wlanscaninfo.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -83,7 +83,7 @@ // Iterating is complete when iterator is one past the last item if (testContext.mScan.mScanResultIterator >= - testContext.mScan.mWlanScanResultList.count()) { + testContext.mScan.mWlanScanApResultList.count()) { result = ETrue; } @@ -159,11 +159,12 @@ (void)aIE; // Cypy the SSID + ssidBuffer.SetLength(0); QString ssid = ap->value(WlanQtUtilsAp::ConfIdSsid).toString(); - QByteArray ssidData(ssid.toUtf8()); - ssidBuffer.Copy( - (TUint8*)ssidData.data(), - ssidData.length()); + for (int i = 0; i < ssid.length(); i++) { + QChar character = ssid[i]; + ssidBuffer.Append((TUint8)(character.unicode() & 0x000000FF)); + } // Give reference to the buffer to the caller *aData = ssidBuffer.Ptr(); @@ -279,7 +280,7 @@ // Get the currently iterated AP QSharedPointer ap( - testContext.mScan.mWlanScanResultList[ + testContext.mScan.mWlanScanApResultList[ testContext.mScan.mScanResultIterator]); return ap; diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/stubs/wlanmgmtclient.h --- a/wlanutilities/wlanqtutilities/tsrc/stubs/wlanmgmtclient.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/stubs/wlanmgmtclient.h Mon Aug 23 13:30:09 2010 +0300 @@ -71,6 +71,41 @@ * Cancel an outstanding scan request. */ void CancelGetScanResults(); + + /** + * Get the available WLAN IAPs. + * + * @param aCacheLifetime Defines how many seconds old cached results the client + * is willing to accept. The valid is range is from 0 to + * 60 seconds. The value of -1 means the system default will + * be used. The aCacheLifetime parameter has a meaning only + * when the aMaxDelay parameter is zero. + * Value will be changed to the actual value used by the + * system. + * @param aMaxDelay Maximum amount of seconds the client is willing to wait for + * the availability results. The valid range is from 0 to 1200 + * seconds or KWlanInfiniteScanDelay. KWlanInfiniteScanDelay + * will never cause a scan, but the request will be + * completed when any other broadcast scan request is completed. + * Value will be changed to the actual value used by the system. + * @param aFilteredResults Whether availability is filtered based on signal strength. + * ETrue if filtering is allowed, EFalse if not. + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aAvailableIaps Array of IAPs available. + */ + void GetAvailableIaps( + TInt& aCacheLifetime, + TUint& aMaxDelay, + TBool aFilteredResults, + TRequestStatus& aStatus, + RArray& aAvailableIaps ); + + /** + * Cancel an outstanding IAP availability request. + */ + void CancelGetAvailableIaps(); private: // Data diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.cpp --- a/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -150,7 +150,7 @@ */ void TestWlanQtUtils::testAvailableWlan() { - testContext.mScan.createDefaultWlanScanResultList(4); + testContext.mScan.createDefaultWlanScanApResultList(4); // Request a scan to get result signal wlanQtUtils_->scanWlans(); @@ -163,7 +163,7 @@ QList< QSharedPointer > aps; wlanQtUtils_->availableWlans(iaps, aps); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); aps.clear(); } @@ -178,20 +178,20 @@ */ void TestWlanQtUtils::testAvailableWlanDuplicates() { - testContext.mScan.createDefaultWlanScanResultList(11); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); - testContext.mScan.mWlanScanResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); - testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); - testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); - testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeOpen); - testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); - testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); - testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); - testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); - testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Adhoc); + testContext.mScan.createDefaultWlanScanApResultList(11); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); + testContext.mScan.mWlanScanApResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); + testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); + testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID, different SecMode"); + testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeOpen); + testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); + testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID & SecMode diff Psk"); + testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); + testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdSsid, "Same SSID"); + testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Adhoc); // Request a scan to get result signal wlanQtUtils_->scanWlans(); @@ -205,8 +205,8 @@ wlanQtUtils_->availableWlans(iaps, aps); // First remove AP that has duplicate SSID. - testContext.mScan.mWlanScanResultList.removeAt(2); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.mWlanScanApResultList.removeAt(2); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); aps.clear(); } @@ -217,25 +217,25 @@ */ void TestWlanQtUtils::testAvailableWlanSecModes() { - testContext.mScan.createDefaultWlanScanResultList(11); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Adhoc); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); - testContext.mScan.mWlanScanResultList[2]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); - testContext.mScan.mWlanScanResultList[3]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecMode802_1x); - testContext.mScan.mWlanScanResultList[4]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanResultList[7]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanResultList[8]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); - testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); + testContext.mScan.createDefaultWlanScanApResultList(11); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Adhoc); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); + testContext.mScan.mWlanScanApResultList[2]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWep); + testContext.mScan.mWlanScanApResultList[3]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecMode802_1x); + testContext.mScan.mWlanScanApResultList[4]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanApResultList[7]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanApResultList[8]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); + testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWapi); // Let's trick the stub to return WapiPsk by putting WpaPskUse on * - testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); - testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - testContext.mScan.mWlanScanResultList[10]->setValue(WlanQtUtilsAp::ConfIdWpsSupported, true); + testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa2); + testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + testContext.mScan.mWlanScanApResultList[10]->setValue(WlanQtUtilsAp::ConfIdWpsSupported, true); // Request a scan to get result signal wlanQtUtils_->scanWlans(); @@ -249,8 +249,8 @@ wlanQtUtils_->availableWlans(iaps, aps); // Remove the trick *. WapiPsk and Wapi both map to just Wapi - testContext.mScan.mWlanScanResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,false); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.mWlanScanApResultList[9]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,false); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); aps.clear(); } @@ -261,12 +261,12 @@ */ void TestWlanQtUtils::testAvailableWlanSsids() { - testContext.mScan.createDefaultWlanScanResultList(6); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, " "); - testContext.mScan.mWlanScanResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, " whitespace around ssid "); - testContext.mScan.mWlanScanResultList[3]->setValue(WlanQtUtilsAp::ConfIdSsid, QString(QChar())); - testContext.mScan.mWlanScanResultList[4]->setValue(WlanQtUtilsAp::ConfIdSsid, "maximum length ssid that is 32 c"); - testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "A"); + testContext.mScan.createDefaultWlanScanApResultList(6); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, " "); + testContext.mScan.mWlanScanApResultList[2]->setValue(WlanQtUtilsAp::ConfIdSsid, " whitespace around ssid "); + testContext.mScan.mWlanScanApResultList[3]->setValue(WlanQtUtilsAp::ConfIdSsid, QString(QChar())); + testContext.mScan.mWlanScanApResultList[4]->setValue(WlanQtUtilsAp::ConfIdSsid, "maximum length ssid that is 32 c"); + testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "A"); // Request a scan to get result signal wlanQtUtils_->scanWlans(); @@ -280,11 +280,10 @@ wlanQtUtils_->availableWlans(iaps, aps); // Empty ssids are removed from results - testContext.mScan.mWlanScanResultList.removeAt(3); - testContext.mScan.mWlanScanResultList.removeAt(1); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.mWlanScanApResultList.removeAt(3); + testContext.mScan.mWlanScanApResultList.removeAt(1); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); - aps.clear(); } /** @@ -292,15 +291,22 @@ */ void TestWlanQtUtils::testAvailableWlanWithIaps() { - testContext.mScan.createDefaultWlanScanResultList(7); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 3"); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); - testContext.mScan.mWlanScanResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 1"); + // Form WLAN IAP scan result list + testContext.mScan.createDefaultWlanScanIapResultList(3); + testContext.mScan.mWlanScanIapResultList.removeAt(1); + testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdIapId, 5); + testContext.mScan.mWlanScanIapResultList[1]->setValue(WlanQtUtilsIap::ConfIdIapId, 7); + + // Form WLAN AP scan result list + testContext.mScan.createDefaultWlanScanApResultList(7); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 3"); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); + testContext.mScan.mWlanScanApResultList[5]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 1"); // SSID is found in Internet Snap, but security mode does not match: - testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 2"); - testContext.mScan.mWlanScanResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); - + testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSsid, "WLAN IAP 2"); + testContext.mScan.mWlanScanApResultList[6]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + // Request a scan to get result signal wlanQtUtils_->scanWlans(); @@ -312,20 +318,15 @@ QList< QSharedPointer > aps; wlanQtUtils_->availableWlans(iaps, aps); + // Verify WLAN IAP list + testContext.mScan.verifyWlanScanIapResultList(iaps); + // Verify WLAN AP list. First, remove scan results that will not appear // because they are WLAN IAPs. - testContext.mScan.mWlanScanResultList.removeAt(5); - testContext.mScan.mWlanScanResultList.removeAt(1); - testContext.mScan.verifyWlanScanResultList(aps); - - // Verify WLAN IAP list - QCOMPARE(iaps.count(), 2); - QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdIapId).toInt(), 5); - QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdName).toString(), QString("WLAN IAP 1")); - QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdSsid).toString(), QString("WLAN IAP 1")); - QCOMPARE(iaps[1]->value(WlanQtUtilsIap::ConfIdIapId).toInt(), 7); - QCOMPARE(iaps[1]->value(WlanQtUtilsIap::ConfIdName).toString(), QString("WLAN IAP 3")); - QCOMPARE(iaps[1]->value(WlanQtUtilsAp::ConfIdSsid).toString(), QString("WLAN IAP 3")); + testContext.mScan.mWlanScanApResultList.removeAt(5); + testContext.mScan.mWlanScanApResultList.removeAt(1); + testContext.mScan.verifyWlanScanApResultList(aps); + iaps.clear(); aps.clear(); } @@ -345,7 +346,7 @@ // **************** 1st scan ******************** // 6 APs are required for this scan - testContext.mScan.createDefaultWlanScanResultList(6); + testContext.mScan.createDefaultWlanScanApResultList(6); wlanQtUtils_->scanWlans(); subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); @@ -353,13 +354,13 @@ // Get the results for the 1st scan wlanQtUtils_->availableWlans(iaps, aps); // Verify the results for the scan - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); aps.clear(); // **************** 2nd scan ******************** // 2 APs are required for this scan - testContext.mScan.createDefaultWlanScanResultList(2); + testContext.mScan.createDefaultWlanScanApResultList(2); wlanQtUtils_->scanWlans(); subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); @@ -367,13 +368,13 @@ // Get the results for the 2nd scan wlanQtUtils_->availableWlans(iaps, aps); // Verify the results for the scan - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); aps.clear(); // **************** 3rd scan ******************** // 4 APs are required for the 3rd scan - testContext.mScan.createDefaultWlanScanResultList(4); + testContext.mScan.createDefaultWlanScanApResultList(4); wlanQtUtils_->scanWlans(); subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); @@ -381,7 +382,7 @@ // Get the results for the 3rd scan wlanQtUtils_->availableWlans(iaps, aps); // Verify the results for the scan - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); aps.clear(); } @@ -392,7 +393,7 @@ void TestWlanQtUtils::testAvailableWlanScanEmpty() { // Form result list - testContext.mScan.createDefaultWlanScanResultList(0); + testContext.mScan.createDefaultWlanScanApResultList(0); // Request a direct scan to get result signal wlanQtUtils_->scanWlans(); @@ -404,7 +405,7 @@ QList< QSharedPointer > iaps; QList< QSharedPointer > aps; wlanQtUtils_->availableWlans(iaps, aps); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); QCOMPARE(iaps.count(), 0); } @@ -414,7 +415,7 @@ void TestWlanQtUtils::testAvailableWlanScanError() { // Set the scan to fail - testContext.mScan.mScanRetValue = KErrGeneral; + testContext.mScan.mApScanRetValue = KErrGeneral; // Start the scan wlanQtUtils_->scanWlans(); @@ -428,7 +429,7 @@ */ void TestWlanQtUtils::testAvailableWlanAps() { - testContext.mScan.createDefaultWlanScanResultList(4); + testContext.mScan.createDefaultWlanScanApResultList(4); // Request a scan to get result signal wlanQtUtils_->scanWlanAps(); @@ -440,7 +441,7 @@ QList< QSharedPointer > aps; wlanQtUtils_->availableWlanAps(aps); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); aps.clear(); } @@ -450,7 +451,7 @@ void TestWlanQtUtils::testAvailableWlanApsScanEmpty() { // Form result list - testContext.mScan.createDefaultWlanScanResultList(0); + testContext.mScan.createDefaultWlanScanApResultList(0); // Request a direct scan to get result signal wlanQtUtils_->scanWlanAps(); @@ -461,7 +462,7 @@ // Get and verify the list of available WLAN APs. QList< QSharedPointer > aps; wlanQtUtils_->availableWlanAps(aps); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); } /** @@ -470,7 +471,7 @@ void TestWlanQtUtils::testStopWlanApScan() { // Do not complete scan request immediately - testContext.mScan.mCompleteWlanScan = false; + testContext.mScan.mCompleteWlanApScan = false; // Start the scan wlanQtUtils_->scanWlanAps(); @@ -487,7 +488,7 @@ void TestWlanQtUtils::testWlanApScanError() { // Set the scan to fail - testContext.mScan.mScanRetValue = KErrGeneral; + testContext.mScan.mApScanRetValue = KErrGeneral; // Start the scan wlanQtUtils_->scanWlanAps(); @@ -497,17 +498,48 @@ } /** + * Test WLAN AP scan with special characters. + */ +void TestWlanQtUtils::testAvailableWlanApsSpecialChars() +{ + testContext.mScan.createDefaultWlanScanApResultList(3); + // Set SSID's to include special characters + testContext.mScan.mWlanScanApResultList[0]->setValue( + WlanQtUtilsAp::ConfIdSsid, + "\x57\x41\x50\x49\xBD\xA7\xA4\xE4\xF6"); + testContext.mScan.mWlanScanApResultList[1]->setValue( + WlanQtUtilsAp::ConfIdSsid, + "\x01\x02\x03\xAB\x43\x52\x41\x50\xBB\xA7\xA4\xFE\xFF"); + testContext.mScan.mWlanScanApResultList[2]->setValue( + WlanQtUtilsAp::ConfIdSsid, + "12345678901234567890123456789012"); // Maximum SSID length of 32 bytes + + // Request a scan to get result signal + wlanQtUtils_->scanWlanAps(); + + // Let active object run and verify signal. + subTestScanResultSignal(mSignalScanApReady, WlanQtUtils::ScanStatusOk); + + // Get and verify the list of available WLAN APs. + QList< QSharedPointer > aps; + wlanQtUtils_->availableWlanAps(aps); + + testContext.mScan.verifyWlanScanApResultList(aps); + aps.clear(); +} + +/** * Test a basic direct scan. */ void TestWlanQtUtils::testDirectScanBasic() { // Form result list - testContext.mScan.createDefaultWlanScanResultList(2); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdBssid, "654321"); - testContext.mScan.mWlanScanResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); + testContext.mScan.createDefaultWlanScanApResultList(2); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSsid, "testssid"); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdBssid, "654321"); + testContext.mScan.mWlanScanApResultList[1]->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); // Request a direct scan to get result signal wlanQtUtils_->scanWlanDirect(QString("testssid")); @@ -519,7 +551,7 @@ QList< QSharedPointer > aps; wlanQtUtils_->availableWlanAps(aps); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); aps.clear(); } @@ -529,7 +561,7 @@ void TestWlanQtUtils::testDirectScanEmpty() { // Form result list - testContext.mScan.createDefaultWlanScanResultList(0); + testContext.mScan.createDefaultWlanScanApResultList(0); // Request a direct scan to get result signal wlanQtUtils_->scanWlanDirect(QString("notavailable")); @@ -540,7 +572,7 @@ // Get and verify the list of available WLAN APs. QList< QSharedPointer > aps; wlanQtUtils_->availableWlanAps(aps); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); } /** @@ -549,7 +581,7 @@ void TestWlanQtUtils::testDirectScanStop() { // Do not complete scan request immediately - testContext.mScan.mCompleteWlanScan = false; + testContext.mScan.mCompleteWlanApScan = false; // Start the scan wlanQtUtils_->scanWlanDirect(QString("testssid")); @@ -566,7 +598,7 @@ void TestWlanQtUtils::testDirectScanError() { // Set the scan to fail - testContext.mScan.mScanRetValue = KErrGeneral; + testContext.mScan.mApScanRetValue = KErrGeneral; // Start the scan wlanQtUtils_->scanWlanDirect(QString("boundtofail")); @@ -585,14 +617,18 @@ */ void TestWlanQtUtils::testCreateIapOk() { - testContext.mScan.createDefaultWlanScanResultList(1); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testCreateIapOk"); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); - testContext.mScan.mWlanScanResultList[0]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); + // Form WLAN AP scan result list + testContext.mScan.createDefaultWlanScanApResultList(1); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSsid, "testCreateIapOk"); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdSecurityMode,CMManagerShim::WlanSecModeWpa); + testContext.mScan.mWlanScanApResultList[0]->setValue(WlanQtUtilsAp::ConfIdWpaPskUse,true); + + // Form WLAN IAP scan result list + testContext.mScan.createDefaultWlanScanIapResultList(0); // Request a scan to get result signal wlanQtUtils_->scanWlans(); - + // Let active object run and verify signal. subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); @@ -602,7 +638,7 @@ wlanQtUtils_->availableWlans(iaps, aps); QCOMPARE(iaps.count(), 0); - testContext.mScan.verifyWlanScanResultList(aps); + testContext.mScan.verifyWlanScanApResultList(aps); // Execute createIap() function QScopedPointer wlanAp(subTestNewAp()); @@ -613,16 +649,22 @@ int iapId = wlanQtUtils_->createIap(wlanAp.data()); QVERIFY(iapId != WlanQtUtils::IapIdNone); + // Form WLAN IAP scan result list + testContext.mScan.createDefaultWlanScanIapResultList(1); + testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdIapId, iapId); + testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdName, QString("testCreateIapOk")); + testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdSsid, QString("testCreateIapOk")); + testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdSecurityMode, (int)(CMManagerShim::WlanSecModeWpa)); + testContext.mScan.mWlanScanIapResultList[0]->setValue(WlanQtUtilsIap::ConfIdWpaPskUse, true); + + // Re-execute the scan so that scan lists get updated due to the IAP creation + wlanQtUtils_->scanWlans(); + subTestScanResultSignal(mSignalScanReady, WlanQtUtils::ScanStatusOk); + // Verify that created IAP is in the IAP list and AP list is empty. wlanQtUtils_->availableWlans(iaps, aps); - QCOMPARE(iaps.count(), 1); - QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdIapId).toInt(), iapId); - QCOMPARE(iaps[0]->value(WlanQtUtilsIap::ConfIdName).toString(), QString("testCreateIapOk")); - QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdSsid).toString(), QString("testCreateIapOk")); - QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), (int)(CMManagerShim::WlanSecModeWpa)); - QCOMPARE(iaps[0]->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(), true); + testContext.mScan.verifyWlanScanIapResultList(iaps); QCOMPARE(aps.count(), 0); - iaps.clear(); } /** @@ -1004,7 +1046,7 @@ void TestWlanQtUtils::testScanWlansIgnored() { // Do not complete scan request immediately - testContext.mScan.mCompleteWlanScan = false; + testContext.mScan.mCompleteWlanApScan = false; // Execute function under test wlanQtUtils_->scanWlans(); @@ -1018,7 +1060,7 @@ void TestWlanQtUtils::testStopWlanScanOk() { // Do not complete scan request immediately - testContext.mScan.mCompleteWlanScan = false; + testContext.mScan.mCompleteWlanApScan = false; // Start a scan wlanQtUtils_->scanWlans(); // Execute function under test @@ -1527,6 +1569,7 @@ ap->setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); ap->setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); ap->setValue(WlanQtUtilsAp::ConfIdHidden, false); + ap->setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, false); return ap; } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h --- a/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.h Mon Aug 23 13:30:09 2010 +0300 @@ -53,6 +53,7 @@ void testAvailableWlanApsScanEmpty(); void testStopWlanApScan(); void testWlanApScanError(); + void testAvailableWlanApsSpecialChars(); // scanWlanDirect() void testDirectScanBasic(); diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.pro --- a/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/tsrc/testwlanqtutils.pro Mon Aug 23 13:30:09 2010 +0300 @@ -33,6 +33,11 @@ MMP_RULES += "USERINCLUDE traces" } +# Stub headers must be used instead of real ones +symbian { + MMP_RULES += "USERINCLUDE stubs" +} + #BUILD_DLL macro is used to define export macro DEFINES += BUILD_WLANQTUTILITIES_DLL @@ -77,7 +82,8 @@ ../wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h \ ../wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h \ ../wrapper/inc/wlanqtutilsesockwrapper_symbian.h \ - ../wrapper/inc/wlanqtutilsscan_symbian.h \ + ../wrapper/inc/wlanqtutilsscanap_symbian.h \ + ../wrapper/inc/wlanqtutilsscaniap_symbian.h \ stubs/ictswlanlogininterface.h \ stubs/wlanmgmtclient.h \ stubs/wlanscaninfo.h @@ -86,7 +92,8 @@ ../wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp \ ../wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp \ ../wrapper/src/wlanqtutilsesockwrapper_symbian.cpp \ - ../wrapper/src/wlanqtutilsscan_symbian.cpp \ + ../wrapper/src/wlanqtutilsscanap_symbian.cpp \ + ../wrapper/src/wlanqtutilsscaniap_symbian.cpp \ stubs/stub_connmon.cpp \ stubs/stub_esock.cpp \ stubs/stub_ictswlanlogininterface.cpp \ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wlanqtutilities.pro --- a/wlanutilities/wlanqtutilities/wlanqtutilities.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/wlanqtutilities.pro Mon Aug 23 13:30:09 2010 +0300 @@ -68,12 +68,14 @@ wrapper/inc/wlanqtutilsconmonwrapperdisconnect_symbian.h \ wrapper/inc/wlanqtutilsconmonwrapperinfo_symbian.h \ wrapper/inc/wlanqtutilsesockwrapper_symbian.h \ - wrapper/inc/wlanqtutilsscan_symbian.h + wrapper/inc/wlanqtutilsscanap_symbian.h \ + wrapper/inc/wlanqtutilsscaniap_symbian.h SOURCES += \ wrapper/src/wlanqtutilsconmonwrapperdisconnect_symbian.cpp \ wrapper/src/wlanqtutilsconmonwrapperinfo_symbian.cpp \ wrapper/src/wlanqtutilsesockwrapper_symbian.cpp \ - wrapper/src/wlanqtutilsscan_symbian.cpp + wrapper/src/wlanqtutilsscanap_symbian.cpp \ + wrapper/src/wlanqtutilsscaniap_symbian.cpp TARGET.CAPABILITY = CAP_GENERAL_DLL TARGET.EPOCALLOWDLLDATA = 1 diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan.h Mon Aug 23 13:30:09 2010 +0300 @@ -26,11 +26,12 @@ // User includes -#include "wlanqtutilsap.h" +#include "wlanqtutilsiap.h" // Forward declarations -class WlanQtUtilsScanPrivate; +class WlanQtUtilsScanIapPrivate; +class WlanQtUtilsScanApPrivate; // External data types @@ -50,6 +51,8 @@ ~WlanQtUtilsScan(); + void scanWlanIaps(); + void scanWlanAps(); void scanWlanDirect(const QString &ssid); @@ -59,8 +62,16 @@ signals: /*! + Signal indicating available WLAN IAP's. + + @param [in] availableIaps Available WLAN IAP's found in scan. + */ + void availableWlanIaps( + QList< QSharedPointer > &availableIaps); + + /*! Signal indicating available WLAN access points. - + @param [in] availableWlans Available WLAN access points found in scan. */ void availableWlanAps( @@ -89,8 +100,11 @@ // Owned data - //! Private implementation of scan interface - WlanQtUtilsScanPrivate *d_ptr; + //! Private implementation of IAP scan interface + WlanQtUtilsScanIapPrivate *d_ptrIap; + + //! Private implementation of AP scan interface + WlanQtUtilsScanApPrivate *d_ptrAp; // Not owned data @@ -98,7 +112,8 @@ // Needed to be able to emit public signals directly from // private implementation. - friend class WlanQtUtilsScanPrivate; + friend class WlanQtUtilsScanIapPrivate; + friend class WlanQtUtilsScanApPrivate; }; #endif // WLANQTUTILSSCAN_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan_symbian.h --- a/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscan_symbian.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Symbian platform specific implementation of WLAN scanning. -*/ - -#ifndef WLANQTUTILSSCAN_SYMBIAN_H -#define WLANQTUTILSSCAN_SYMBIAN_H - -// System includes - -#include -#include -#include - -// User includes - -#include "wlanqtutilsap.h" - -// Forward declarations - -class CWlanMgmtClient; -class CWlanScanInfo; -class WlanQtUtilsScan; - -// External data types - -// Constants - -// Class declaration - -class WlanQtUtilsScanPrivate : public CActive -{ - -public: - - // Data types - - static WlanQtUtilsScanPrivate *NewL(WlanQtUtilsScan *q_ptr); - - ~WlanQtUtilsScanPrivate(); - - void Scan(); - - void Scan(const QString &ssid); - - void StopScan(); - -protected: - - void RunL(); - - void DoCancel(); - -private: - - explicit WlanQtUtilsScanPrivate(WlanQtUtilsScan *q_ptr); - - void ConstructL(); - - void ExtractScanResults( - QList< QSharedPointer > &scanResults); - - QString ExtractSsid(); - - QByteArray ExtractBssid(); - - void StoreSecMode( - QSharedPointer ap, - TUint wlanSecMode); - -private: // data - - //! Public implementation reference - WlanQtUtilsScan *q_ptr; - - // Owned data - - //! WLAN Management Client - CWlanMgmtClient *mWlanMgmtClient; - - //! Scanned SSID - TWlanSsid mWlanSsid; - - //! Scan results - CWlanScanInfo *mResults; - - // Not owned data - - // Friend classes -}; - -#endif // WLANQTUTILSSCAN_SYMBIAN_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscanap_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscanap_symbian.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Symbian platform specific implementation of WLAN AP scanning. +*/ + +#ifndef WLANQTUTILSSCANAP_SYMBIAN_H +#define WLANQTUTILSSCANAP_SYMBIAN_H + +// System includes + +#include +#include +#include + +// User includes + +#include "wlanqtutilsap.h" + +// Forward declarations + +class CWlanMgmtClient; +class CWlanScanInfo; +class WlanQtUtilsScan; + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsScanApPrivate : public CActive +{ + +public: + + // Data types + + static WlanQtUtilsScanApPrivate *NewL(WlanQtUtilsScan *wrapper); + + ~WlanQtUtilsScanApPrivate(); + + void Scan(); + + void Scan(const QString &ssid); + + void StopScan(); + +protected: + + void RunL(); + + void DoCancel(); + +private: + + explicit WlanQtUtilsScanApPrivate(WlanQtUtilsScan *wrapper); + + void ConstructL(); + + void ExtractScanResults( + QList< QSharedPointer > &scanResults); + + QString ExtractSsid(); + + QByteArray ExtractBssid(); + + void StoreSecMode( + QSharedPointer ap, + TUint wlanSecMode); + +private: // data + + //! Public implementation reference + WlanQtUtilsScan *q_ptr; + + // Owned data + + //! WLAN Management Client + CWlanMgmtClient *mWlanMgmtClient; + + //! Scanned SSID + TWlanSsid mWlanSsid; + + //! Scan results + CWlanScanInfo *mResults; + + // Not owned data + + // Friend classes +}; + +#endif // WLANQTUTILSSCANAP_SYMBIAN_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscaniap_symbian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/inc/wlanqtutilsscaniap_symbian.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Symbian platform specific implementation of WLAN IAP scanning. +*/ + +#ifndef WLANQTUTILSSCANIAP_SYMBIAN_H +#define WLANQTUTILSSCANIAP_SYMBIAN_H + +// System includes + +#include +#include + +// User includes + +#include "wlanqtutilsiap.h" + +// Forward declarations + +class CWlanMgmtClient; +class WlanQtUtilsScan; + +// External data types + +// Constants + +// Class declaration + +class WlanQtUtilsScanIapPrivate : public CActive +{ + +public: + + // Data types + + static WlanQtUtilsScanIapPrivate *NewL(WlanQtUtilsScan *wrapper); + + ~WlanQtUtilsScanIapPrivate(); + + void ScanIaps(); + + void StopScan(); + +protected: + + void RunL(); + + void DoCancel(); + +private: + + explicit WlanQtUtilsScanIapPrivate(WlanQtUtilsScan *wrapper); + + void ConstructL(); + + void ExtractScanResults( + QList< QSharedPointer > &scanResults); + +private: // data + + //! Public implementation reference + WlanQtUtilsScan *q_ptr; + + // Owned data + + //! WLAN Management Client + CWlanMgmtClient *mWlanMgmtClient; + + //! Accepted cache lifetime + TInt mCacheLifetime; + + //! Accepted maximum delay + TUint mMaxDelay; + + //! Scan results + RArray mAvailableIaps; + + // Not owned data + + // Friend classes +}; + +#endif // WLANQTUTILSSCANIAP_SYMBIAN_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -19,7 +19,8 @@ // User includes -#include "wlanqtutilsscan_symbian.h" +#include "wlanqtutilsscaniap_symbian.h" +#include "wlanqtutilsscanap_symbian.h" #include "wlanqtutilsscan.h" /*! @@ -47,7 +48,9 @@ WlanQtUtilsScan::WlanQtUtilsScan(QObject *parent) : QObject(parent) { - QT_TRAP_THROWING(d_ptr = WlanQtUtilsScanPrivate::NewL(this)); + QT_TRAP_THROWING( + d_ptrIap = WlanQtUtilsScanIapPrivate::NewL(this); + d_ptrAp = WlanQtUtilsScanApPrivate::NewL(this)); } /*! @@ -56,7 +59,17 @@ WlanQtUtilsScan::~WlanQtUtilsScan() { - delete d_ptr; + delete d_ptrIap; + delete d_ptrAp; +} + +/*! + Scans available WLAN IAP's, including hidden ones. +*/ + +void WlanQtUtilsScan::scanWlanIaps() +{ + d_ptrIap->ScanIaps(); } /*! @@ -65,7 +78,7 @@ void WlanQtUtilsScan::scanWlanAps() { - d_ptr->Scan(); + d_ptrAp->Scan(); } /*! @@ -76,7 +89,7 @@ void WlanQtUtilsScan::scanWlanDirect(const QString &ssid) { - d_ptr->Scan(ssid); + d_ptrAp->Scan(ssid); } /*! @@ -85,5 +98,6 @@ void WlanQtUtilsScan::stopScan() { - d_ptr->StopScan(); + d_ptrIap->StopScan(); + d_ptrAp->StopScan(); } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan_symbian.cpp --- a/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscan_symbian.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,418 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Symbian platform specific implementation of WLAN scanning. -*/ - -// System includes - -#include -#include -#include - -// User includes - -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" -#include "wlanqtutilsscan.h" -#include "wlanqtutilsscan_symbian.h" - -#include "OstTraceDefinitions.h" -#ifdef OST_TRACE_COMPILER_IN_USE -#include "wlanqtutilsscan_symbianTraces.h" -#endif - - -/*! - \class WlanQtUtilsScanPrivate - \brief Symbian platform specific implementation of WLAN scanning. - - Symbian platform specific implementation of WLAN scanning. -*/ - - -// External function prototypes - -// Local constants - -// Information Element ID for SSID as specified in 802.11. -static const TUint8 KWlan802Dot11SsidIE = 0; - -// Bit mask for Capability info field to get type (Infra/AdHoc). -static const TUint8 KWlan802Dot11CapabilityEssMask = 0x0001; - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -/*! - Static factory constructor. - - @param [in,out] wrapper Public implementation class reference. - - @return New instance of the class. -*/ - -WlanQtUtilsScanPrivate *WlanQtUtilsScanPrivate::NewL(WlanQtUtilsScan *wrapper) -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_NEWL_ENTRY); - - WlanQtUtilsScanPrivate *self = new (ELeave) WlanQtUtilsScanPrivate(wrapper); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_NEWL_EXIT); - return self; -} - -/*! - Destructor. -*/ - -WlanQtUtilsScanPrivate::~WlanQtUtilsScanPrivate() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_ENTRY); - - Cancel(); - delete mWlanMgmtClient; - mWlanMgmtClient = NULL; - delete mResults; - mResults = NULL; - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_EXIT); -} - -/*! - Starts a broadcast scan of available access points. -*/ - -void WlanQtUtilsScanPrivate::Scan() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_SCAN_ENTRY); - - // Scanning while previous scan is not complete is not supported - Q_ASSERT(!IsActive()); - - // Make the scan - mWlanMgmtClient->GetScanResults(iStatus, *mResults); - SetActive(); - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_SCAN_EXIT); -} - -/*! - Starts a direct scan of available access points having given SSID. - - @param ssid SSID to scan. -*/ - -void WlanQtUtilsScanPrivate::Scan(const QString &ssid) -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_SCAN_SSID_ENTRY); - - // Scanning while previous scan is not complete is not supported - Q_ASSERT(!IsActive()); - - // Convert from QString to TBuf8 - TBuf buffer(ssid.utf16()); - TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8(mWlanSsid, buffer); - qt_symbian_throwIfError(error); - - OstTraceExt1( - TRACE_NORMAL, - WLANQTUTILSSCANPRIVATE_SCAN_SSID, - "WlanQtUtilsScanPrivate::Scan;mWlanSsid=%s", - mWlanSsid); - - // Make the scan - mWlanMgmtClient->GetScanResults(mWlanSsid, iStatus, *mResults); - SetActive(); - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_SCAN_SSID_EXIT); -} - -/*! - Stops an ongoing scan. -*/ - -void WlanQtUtilsScanPrivate::StopScan() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_STOPSCAN_ENTRY); - - Cancel(); - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_STOPSCAN_EXIT); -} - -/*! - Scan results handler. -*/ - -void WlanQtUtilsScanPrivate::RunL() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_RUNL_ENTRY); - - QT_TRYCATCH_LEAVING( - if (iStatus != KErrNone) { - emit q_ptr->scanFailed(WlanQtUtils::ScanStatusError); - } else { - QList< QSharedPointer > scanResults; - ExtractScanResults(scanResults); - - // Inform about the results - emit q_ptr->availableWlanAps(scanResults); - } - ); - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_RUNL_EXIT); -} - -/*! - Cancels an outstanding request. -*/ - -void WlanQtUtilsScanPrivate::DoCancel() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_DOCANCEL_ENTRY); - - mWlanMgmtClient->CancelGetScanResults(); - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_DOCANCEL_EXIT); -} - -/*! - Constructor. - - @param [in,out] wrapper Public implementation class reference. -*/ - -WlanQtUtilsScanPrivate::WlanQtUtilsScanPrivate(WlanQtUtilsScan *wrapper) : - CActive(EPriorityStandard), - q_ptr(wrapper), - mWlanMgmtClient(NULL), - mResults(NULL) -{ - OstTraceFunctionEntry0(DUP1_WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_ENTRY); - OstTraceFunctionExit0(DUP1_WLANQTUTILSSCANPRIVATE_WLANQTUTILSSCANPRIVATE_EXIT); -} - -/*! - Second phase constructor. -*/ - -void WlanQtUtilsScanPrivate::ConstructL() -{ - OstTraceFunctionEntry0(WLANQTUTILSSCANPRIVATE_CONSTRUCTL_ENTRY); - - CActiveScheduler::Add(this); - mWlanMgmtClient = CWlanMgmtClient::NewL(); - mResults = CWlanScanInfo::NewL(); - - OstTraceFunctionExit0(WLANQTUTILSSCANPRIVATE_CONSTRUCTL_EXIT); -} - -/* - Extracts scan results and stores them into the given AP list. - - @param [out] scanResults Scan result list. -*/ - -void WlanQtUtilsScanPrivate::ExtractScanResults( - QList< QSharedPointer > &scanResults) -{ - for (mResults->First(); !mResults->IsDone(); mResults->Next()) { - // Create an access point for each result - QSharedPointer ap(new WlanQtUtilsAp()); - - // SSID - QString ssid = ExtractSsid(); - - // Skip over hidden networks. There is no spec for what - // their names will contain, but at least names with only - // null characters and whitespace characters are seen - // in real life. - if (ssid.trimmed().isEmpty()) { - continue; - } - ap->setValue(WlanQtUtilsAp::ConfIdSsid, ssid); - - // BSSID - QByteArray bssid = ExtractBssid(); - ap->setValue(WlanQtUtilsAp::ConfIdBssid, bssid); - - // Signal strength - ap->setValue( - WlanQtUtilsAp::ConfIdSignalStrength, - (int)mResults->RXLevel()); - - // Connection Mode - CMManagerShim::WlanConnMode connMode; - if (mResults->Capability() & KWlan802Dot11CapabilityEssMask) { - connMode = CMManagerShim::Infra; - } else { - connMode = CMManagerShim::Adhoc; - } - ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, (int)connMode); - - // Security Mode parameters - StoreSecMode(ap, mResults->ExtendedSecurityMode()); - - // Hidden attribute - // These scan results do not tell if the AP is hidden or not - ap->setValue(WlanQtUtilsAp::ConfIdHidden, false); - - // WPS support - TBool wpsSupported = mResults->IsProtectedSetupSupported(); - ap->setValue( - WlanQtUtilsAp::ConfIdWpsSupported, - (wpsSupported == EFalse) ? false : true); - - // Append the AP to scan result list - scanResults.append(ap); - } -} - -/*! - Extracts and cleans up the WLAN SSID from current scan result element. - - @return SSID string. -*/ - -QString WlanQtUtilsScanPrivate::ExtractSsid() -{ - // Get the SSID in raw data format - TUint8 ieLen; - const TUint8* ieData; - TInt ret = mResults->InformationElement(KWlan802Dot11SsidIE, ieLen, &ieData); - - // Convert into QString - QString ssid; - if (ret == KErrNone && ieLen > 0) { - // Trace the buffer as data to ease low level debugging - OstTraceData( - TRACE_DUMP, - WLANQTUTILSSCANPRIVATE_EXTRACTSSID_DATA, - "WlanQtUtilsScanPrivate::ExtractSsid data 0x%{hex8[]}", - ieData, - ieLen); - - ssid = QString::fromUtf8((char *)ieData, ieLen); - -#ifdef OST_TRACE_COMPILER_IN_USE - TPtrC16 string(ssid.utf16(), ssid.length()); - OstTraceExt1( - TRACE_DUMP, - WLANQTUTILSSCANPRIVATE_EXTRACTSSID_STRING, - "WlanQtUtilsScanPrivate::ExtractSsid string;ssid=%S", - string); -#endif - } - - // Remove nul characters - ssid.remove(QChar()); - - return ssid; -} - -/*! - Extracts the WLAN BSSID from current scan result element. - - @return BSSID array. -*/ - -QByteArray WlanQtUtilsScanPrivate::ExtractBssid() -{ - TWlanBssid wlanBssid; - mResults->Bssid(wlanBssid); - QByteArray bssid; - for (int i = 0; i < (int)wlanBssid.Length(); i++) { - bssid[i] = (char)wlanBssid[i]; - } - -#ifdef OST_TRACE_COMPILER_IN_USE - QString bssidHex(bssid.toHex()); - TPtrC16 string(bssidHex.utf16(), bssidHex.length()); - - OstTraceExt1( - TRACE_DUMP, - WLANQTUTILSSCANPRIVATE_EXTRACTBSSID, - "WlanQtUtilsScanPrivate::ExtractBssid;bssid=%S", - string); -#endif - - return bssid; -} - -/*! - Stores Security mode parameters to \a ap class. - - @param [in,out] ap Access Point object to where the configuration is stored. - @param [in] secMode Security mode to store. -*/ - -void WlanQtUtilsScanPrivate::StoreSecMode( - QSharedPointer ap, - TUint wlanSecMode) -{ - CMManagerShim::WlanSecMode secMode = CMManagerShim::WlanSecModeOpen; - ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); - - switch (wlanSecMode) { - case EWlanConnectionExtentedSecurityModeWepOpen: - case EWlanConnectionExtentedSecurityModeWepShared: - secMode = CMManagerShim::WlanSecModeWep; - break; - - case EWlanConnectionExtentedSecurityMode802d1x: - secMode = CMManagerShim::WlanSecMode802_1x; - break; - - case EWlanConnectionExtentedSecurityModeWpa: - secMode = CMManagerShim::WlanSecModeWpa; - break; - - case EWlanConnectionExtentedSecurityModeWpaPsk: - secMode = CMManagerShim::WlanSecModeWpa; - ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - break; - - case EWlanConnectionExtentedSecurityModeWpa2: - secMode = CMManagerShim::WlanSecModeWpa2; - break; - - case EWlanConnectionExtentedSecurityModeWpa2Psk: - secMode = CMManagerShim::WlanSecModeWpa2; - ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - break; - - case EWlanConnectionExtentedSecurityModeWapi: - case EWlanConnectionExtentedSecurityModeWapiPsk: - secMode = CMManagerShim::WlanSecModeWapi; - break; - - case EWlanConnectionExtentedSecurityModeOpen: - secMode = CMManagerShim::WlanSecModeOpen; - break; - -#ifndef QT_NO_DEBUG - default: - // Invalid security mode detected - Q_ASSERT(0); - break; -#endif - } - - ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscanap_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscanap_symbian.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,428 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Symbian platform specific implementation of WLAN AP scanning. +*/ + +// System includes + +#include +#include +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanqtutilsscan.h" +#include "wlanqtutilsscanap_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsscanap_symbianTraces.h" +#endif + + +/*! + \class WlanQtUtilsScanApPrivate + \brief Symbian platform specific implementation of WLAN AP scanning. + + Symbian platform specific implementation of WLAN AP scanning. +*/ + + +// External function prototypes + +// Local constants + +// Information Element ID for SSID as specified in 802.11. +static const TUint8 KWlan802Dot11SsidIE = 0; + +// Bit mask for Capability info field to get type (Infra/AdHoc). +static const TUint8 KWlan802Dot11CapabilityEssMask = 0x0001; + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Static factory constructor. + + @param [in,out] wrapper Public implementation class reference. + + @return New instance of the class. +*/ + +WlanQtUtilsScanApPrivate *WlanQtUtilsScanApPrivate::NewL(WlanQtUtilsScan *wrapper) +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_NEWL_ENTRY); + + WlanQtUtilsScanApPrivate *self = new (ELeave) WlanQtUtilsScanApPrivate(wrapper); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_NEWL_EXIT); + return self; +} + +/*! + Destructor. +*/ + +WlanQtUtilsScanApPrivate::~WlanQtUtilsScanApPrivate() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_ENTRY); + + Cancel(); + delete mWlanMgmtClient; + mWlanMgmtClient = NULL; + delete mResults; + mResults = NULL; + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_EXIT); +} + +/*! + Starts a broadcast scan of available access points. +*/ + +void WlanQtUtilsScanApPrivate::Scan() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_SCAN_ENTRY); + + // Scanning while previous scan is not complete is not supported + Q_ASSERT(!IsActive()); + + // Make the scan + mWlanMgmtClient->GetScanResults(iStatus, *mResults); + SetActive(); + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_SCAN_EXIT); +} + +/*! + Starts a direct scan of available access points having given SSID. + + @param ssid SSID to scan. +*/ + +void WlanQtUtilsScanApPrivate::Scan(const QString &ssid) +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_SCAN_SSID_ENTRY); + + // Scanning while previous scan is not complete is not supported + Q_ASSERT(!IsActive()); + + // Convert from QString to TBuf8 + TBuf buffer(ssid.utf16()); + TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8(mWlanSsid, buffer); + qt_symbian_throwIfError(error); + + OstTraceExt1( + TRACE_NORMAL, + WLANQTUTILSSCANAPPRIVATE_SCAN_SSID, + "WlanQtUtilsScanApPrivate::Scan;mWlanSsid=%s", + mWlanSsid); + + // Make the scan + mWlanMgmtClient->GetScanResults(mWlanSsid, iStatus, *mResults); + SetActive(); + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_SCAN_SSID_EXIT); +} + +/*! + Stops an ongoing scan. +*/ + +void WlanQtUtilsScanApPrivate::StopScan() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_STOPSCAN_ENTRY); + + Cancel(); + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_STOPSCAN_EXIT); +} + +/*! + Scan results handler. +*/ + +void WlanQtUtilsScanApPrivate::RunL() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_RUNL_ENTRY); + + QT_TRYCATCH_LEAVING( + if (iStatus != KErrNone) { + // Scan failed + emit q_ptr->scanFailed(WlanQtUtils::ScanStatusError); + } else { + // Scan succeeded + QList< QSharedPointer > scanResults; + ExtractScanResults(scanResults); + + // Inform about the results + emit q_ptr->availableWlanAps(scanResults); + } + ); + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_RUNL_EXIT); +} + +/*! + Cancels an outstanding request. +*/ + +void WlanQtUtilsScanApPrivate::DoCancel() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_DOCANCEL_ENTRY); + + mWlanMgmtClient->CancelGetScanResults(); + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_DOCANCEL_EXIT); +} + +/*! + Constructor. + + @param [in,out] wrapper Public implementation class reference. +*/ + +WlanQtUtilsScanApPrivate::WlanQtUtilsScanApPrivate(WlanQtUtilsScan *wrapper) : + CActive(EPriorityStandard), + q_ptr(wrapper), + mWlanMgmtClient(NULL), + mResults(NULL) +{ + OstTraceFunctionEntry0(DUP1_WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_ENTRY); + OstTraceFunctionExit0(DUP1_WLANQTUTILSSCANAPPRIVATE_WLANQTUTILSSCANAPPRIVATE_EXIT); +} + +/*! + Second phase constructor. +*/ + +void WlanQtUtilsScanApPrivate::ConstructL() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANAPPRIVATE_CONSTRUCTL_ENTRY); + + CActiveScheduler::Add(this); + mWlanMgmtClient = CWlanMgmtClient::NewL(); + mResults = CWlanScanInfo::NewL(); + + OstTraceFunctionExit0(WLANQTUTILSSCANAPPRIVATE_CONSTRUCTL_EXIT); +} + +/* + Extracts scan results and stores them into the given AP list. + + @param [out] scanResults Scan result list. +*/ + +void WlanQtUtilsScanApPrivate::ExtractScanResults( + QList< QSharedPointer > &scanResults) +{ + for (mResults->First(); !mResults->IsDone(); mResults->Next()) { + // Create an access point for each result + QSharedPointer ap(new WlanQtUtilsAp()); + + // SSID + QString ssid = ExtractSsid(); + + // Skip over hidden networks. There is no spec for what + // their names will contain, but at least names with only + // null characters and whitespace characters are seen + // in real life. + if (ssid.trimmed().isEmpty()) { + continue; + } + ap->setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + + // BSSID + QByteArray bssid = ExtractBssid(); + ap->setValue(WlanQtUtilsAp::ConfIdBssid, bssid); + + // Signal strength + ap->setValue( + WlanQtUtilsAp::ConfIdSignalStrength, + (int)mResults->RXLevel()); + + // Connection Mode + CMManagerShim::WlanConnMode connMode; + if (mResults->Capability() & KWlan802Dot11CapabilityEssMask) { + connMode = CMManagerShim::Infra; + } else { + connMode = CMManagerShim::Adhoc; + } + ap->setValue(WlanQtUtilsAp::ConfIdConnectionMode, (int)connMode); + + // Security Mode parameters + StoreSecMode(ap, mResults->ExtendedSecurityMode()); + + // Hidden attribute + // These scan results do not tell if the AP is hidden or not + ap->setValue(WlanQtUtilsAp::ConfIdHidden, false); + ap->setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, false); + + // WPS support + TBool wpsSupported = mResults->IsProtectedSetupSupported(); + ap->setValue( + WlanQtUtilsAp::ConfIdWpsSupported, + (wpsSupported == EFalse) ? false : true); + + // Append the AP to scan result list + scanResults.append(ap); + } +} + +/*! + Extracts and cleans up the WLAN SSID from current scan result element. + + @return SSID string. +*/ + +QString WlanQtUtilsScanApPrivate::ExtractSsid() +{ + // Get the SSID in raw data format + TUint8 ieLen; + const TUint8* ieData; + TInt ret = mResults->InformationElement(KWlan802Dot11SsidIE, ieLen, &ieData); + + // Convert into QString + QString ssid; + if (ret == KErrNone && ieLen > 0) { + // Trace the buffer as data to ease low level debugging + OstTraceData( + TRACE_DUMP, + WLANQTUTILSSCANAPPRIVATE_EXTRACTSSID_DATA, + "WlanQtUtilsScanApPrivate::ExtractSsid data 0x%{hex8[]}", + ieData, + ieLen); + + // The IEEE 802.11-2007 section 7.3.2.1 only specifies that + // the SSID is 0-32 octets, leaving the format of the octets + // completely open. + // To support a bit wider character set than 7-bit ASCII, we + // treat the raw SSID bytes as the lowest octets of Unicode. + for (int i = 0; i < ieLen; i++) { + ssid.append(QChar((uint)ieData[i])); + } + +#ifdef OST_TRACE_COMPILER_IN_USE + TPtrC16 string(ssid.utf16(), ssid.length()); + OstTraceExt1( + TRACE_DUMP, + WLANQTUTILSSCANAPPRIVATE_EXTRACTSSID_STRING, + "WlanQtUtilsScanApPrivate::ExtractSsid string;ssid=%S", + string); +#endif + } + + // Remove nul characters + ssid.remove(QChar()); + + return ssid; +} + +/*! + Extracts the WLAN BSSID from current scan result element. + + @return BSSID array. +*/ + +QByteArray WlanQtUtilsScanApPrivate::ExtractBssid() +{ + TWlanBssid wlanBssid; + mResults->Bssid(wlanBssid); + QByteArray bssid; + for (int i = 0; i < (int)wlanBssid.Length(); i++) { + bssid[i] = (char)wlanBssid[i]; + } + +#ifdef OST_TRACE_COMPILER_IN_USE + QString bssidHex(bssid.toHex()); + TPtrC16 string(bssidHex.utf16(), bssidHex.length()); + + OstTraceExt1( + TRACE_DUMP, + WLANQTUTILSSCANAPPRIVATE_EXTRACTBSSID, + "WlanQtUtilsScanApPrivate::ExtractBssid;bssid=%S", + string); +#endif + + return bssid; +} + +/*! + Stores Security mode parameters to \a ap class. + + @param [in,out] ap Access Point object to where the configuration is stored. + @param [in] secMode Security mode to store. +*/ + +void WlanQtUtilsScanApPrivate::StoreSecMode( + QSharedPointer ap, + TUint wlanSecMode) +{ + CMManagerShim::WlanSecMode secMode = CMManagerShim::WlanSecModeOpen; + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, false); + + switch (wlanSecMode) { + case EWlanConnectionExtentedSecurityModeWepOpen: + case EWlanConnectionExtentedSecurityModeWepShared: + secMode = CMManagerShim::WlanSecModeWep; + break; + + case EWlanConnectionExtentedSecurityMode802d1x: + secMode = CMManagerShim::WlanSecMode802_1x; + break; + + case EWlanConnectionExtentedSecurityModeWpa: + secMode = CMManagerShim::WlanSecModeWpa; + break; + + case EWlanConnectionExtentedSecurityModeWpaPsk: + secMode = CMManagerShim::WlanSecModeWpa; + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + break; + + case EWlanConnectionExtentedSecurityModeWpa2: + secMode = CMManagerShim::WlanSecModeWpa2; + break; + + case EWlanConnectionExtentedSecurityModeWpa2Psk: + secMode = CMManagerShim::WlanSecModeWpa2; + ap->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + break; + + case EWlanConnectionExtentedSecurityModeWapi: + case EWlanConnectionExtentedSecurityModeWapiPsk: + secMode = CMManagerShim::WlanSecModeWapi; + break; + + case EWlanConnectionExtentedSecurityModeOpen: + secMode = CMManagerShim::WlanSecModeOpen; + break; + +#ifndef QT_NO_DEBUG + default: + // Invalid security mode detected + Q_ASSERT(0); + break; +#endif + } + + ap->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscaniap_symbian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanqtutilities/wrapper/src/wlanqtutilsscaniap_symbian.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Symbian platform specific implementation of WLAN IAP scanning. +*/ + +// System includes + +#include +#include + +// User includes + +#include "wlanqtutils.h" +#include "wlanqtutilsiap.h" +#include "wlanqtutilsscan.h" +#include "wlanqtutilsscaniap_symbian.h" + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "wlanqtutilsscaniap_symbianTraces.h" +#endif + + +/*! + \class WlanQtUtilsScanIapPrivate + \brief Symbian platform specific implementation of WLAN IAP scanning. + + Symbian platform specific implementation of WLAN IAP scanning. +*/ + + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Static factory constructor. + + @param [in,out] wrapper Public implementation class reference. + + @return New instance of the class. +*/ + +WlanQtUtilsScanIapPrivate *WlanQtUtilsScanIapPrivate::NewL(WlanQtUtilsScan *wrapper) +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_NEWL_ENTRY); + + WlanQtUtilsScanIapPrivate *self = new (ELeave) WlanQtUtilsScanIapPrivate(wrapper); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_NEWL_EXIT); + return self; +} + +/*! + Destructor. +*/ + +WlanQtUtilsScanIapPrivate::~WlanQtUtilsScanIapPrivate() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_ENTRY); + + Cancel(); + delete mWlanMgmtClient; + mWlanMgmtClient = NULL; + mAvailableIaps.Close(); + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_EXIT); +} + +/*! + Starts a scan to see currently available WLAN IAPs. +*/ + +void WlanQtUtilsScanIapPrivate::ScanIaps() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_SCANIAPS_ENTRY); + + // Scanning while previous scan is not complete is not supported + Q_ASSERT(!IsActive()); + + // Make the scan + mAvailableIaps.Reset(); + mWlanMgmtClient->GetAvailableIaps( + mCacheLifetime, + mMaxDelay, + EFalse, + iStatus, + mAvailableIaps); + SetActive(); + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_SCANIAPS_EXIT); +} + +/*! + Stops an ongoing scan. +*/ + +void WlanQtUtilsScanIapPrivate::StopScan() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_STOPSCAN_ENTRY); + + Cancel(); + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_STOPSCAN_EXIT); +} + +/*! + Scan results handler. +*/ + +void WlanQtUtilsScanIapPrivate::RunL() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_RUNL_ENTRY); + + QT_TRYCATCH_LEAVING( + if (iStatus != KErrNone) { + // Scan failed + emit q_ptr->scanFailed(WlanQtUtils::ScanStatusError); + } else { + // Scan succeeded + QList< QSharedPointer > scanResults; + ExtractScanResults(scanResults); + + // Inform about the results + emit q_ptr->availableWlanIaps(scanResults); + } + ); + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_RUNL_EXIT); +} + +/*! + Cancels an outstanding request. +*/ + +void WlanQtUtilsScanIapPrivate::DoCancel() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_DOCANCEL_ENTRY); + + mWlanMgmtClient->CancelGetAvailableIaps(); + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_DOCANCEL_EXIT); +} + +/*! + Constructor. + + @param [in,out] wrapper Public implementation class reference. +*/ + +WlanQtUtilsScanIapPrivate::WlanQtUtilsScanIapPrivate(WlanQtUtilsScan *wrapper) : + CActive(EPriorityStandard), + q_ptr(wrapper), + mWlanMgmtClient(NULL), + mCacheLifetime(0), + mMaxDelay(0), + mAvailableIaps() +{ + OstTraceFunctionEntry0(DUP1_WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_ENTRY); + OstTraceFunctionExit0(DUP1_WLANQTUTILSSCANIAPPRIVATE_WLANQTUTILSSCANIAPPRIVATE_EXIT); +} + +/*! + Second phase constructor. +*/ + +void WlanQtUtilsScanIapPrivate::ConstructL() +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_CONSTRUCTL_ENTRY); + + CActiveScheduler::Add(this); + mWlanMgmtClient = CWlanMgmtClient::NewL(); + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_CONSTRUCTL_EXIT); +} + +/* + Extracts scan results and stores them into the given AP list. + + @param [out] scanResults Scan result list. +*/ + +void WlanQtUtilsScanIapPrivate::ExtractScanResults( + QList< QSharedPointer > &scanResults) +{ + OstTraceFunctionEntry0(WLANQTUTILSSCANIAPPRIVATE_EXTRACTSCANRESULTS_ENTRY); + + for (int i=0; i < mAvailableIaps.Count(); i++) { + // Create an IAP for each result + QSharedPointer iap(new WlanQtUtilsIap()); + + // IAP ID + iap->setValue( + WlanQtUtilsIap::ConfIdIapId, + (int)mAvailableIaps[i].iIapId); + + // Signal strength + iap->setValue( + WlanQtUtilsIap::ConfIdSignalStrength, + (int)mAvailableIaps[i].iRssi); + + // Append the IAP to scan result list + scanResults.append(iap); + } + + OstTraceFunctionExit0(WLANQTUTILSSCANIAPPRIVATE_EXTRACTSCANRESULTS_EXIT); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistview.h --- a/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistview.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/inc/wlansnifferlistview.h Mon Aug 23 13:30:09 2010 +0300 @@ -20,11 +20,12 @@ // System includes +#include +#include + #include #include #include -#include -#include // User includes diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlansniffer/wlansnifferapplication/res/wlansniffer.qrc --- a/wlanutilities/wlansniffer/wlansnifferapplication/res/wlansniffer.qrc Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/res/wlansniffer.qrc Mon Aug 23 13:30:09 2010 +0300 @@ -1,7 +1,7 @@ - wlansnifferlistview.docml + wlansnifferlistview.docml.bin diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferengine.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferengine.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferengine.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -216,7 +216,11 @@ SIGNAL(wlanScanReady(int)), this, SLOT(handleWlanScanReady(int))); - + + // Stop the scan + mWlanQtUtils->stopWlanScan(); + + // Stop periodic scan timer if (mScanTimerId != 0) { killTimer(mScanTimerId); mScanTimerId = 0; diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistview.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistview.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferlistview.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -62,6 +63,9 @@ //! WLAN Sniffer list view docml file location static const QString WlanSnifferListViewDocml(":/docml/wlansnifferlistview.docml"); +//! WLAN Sniffer list view object name +static const QString WlanSnifferListViewName("occ_list"); + // ======== LOCAL FUNCTIONS ======== // ======== MEMBER FUNCTIONS ======== @@ -75,7 +79,8 @@ WlanSnifferListView::WlanSnifferListView( WlanSnifferEngine *engine, - WlanSnifferMainWindow *mainWindow) : + WlanSnifferMainWindow *mainWindow) : + HbView(), mDocLoader(new HbDocumentLoader(mainWindow)), mWlanListWidget(), mContextMenu(), @@ -208,9 +213,16 @@ void WlanSnifferListView::loadDocml(bool isEmbedded) { OstTraceFunctionEntry0(WLANSNIFFERLISTVIEW_LOADDOCML_ENTRY); - + + // Pass the view to the document loader. Document loader uses this view + // when docml is parsed, instead of creating a new view. + setObjectName(WlanSnifferListViewName); + QObjectList objectList; + objectList.append(this); + mDocLoader->setObjectTree(objectList); + + // First load the common section bool ok = false; - // First load the common section mDocLoader->load(WlanSnifferListViewDocml, &ok); Q_ASSERT(ok); @@ -223,10 +235,8 @@ Q_ASSERT(ok); // Load the view by name from the xml file - QGraphicsWidget *widget = mDocLoader->findWidget("occ_list"); + QGraphicsWidget *widget = mDocLoader->findWidget(WlanSnifferListViewName); Q_ASSERT(widget); - // Set the WlanListView view to be the widget that was loaded from the xml - setWidget(widget); // Set view menu HbMenu *viewMenu = qobject_cast(mDocLoader->findWidget("viewMenu")); diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffermainwindow.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffermainwindow.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansniffermainwindow.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -165,7 +165,6 @@ ap->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(), ap->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(), ap->value(WlanQtUtilsAp::ConfIdWpaPskUse).toInt(), - ap->value(WlanQtUtilsAp::ConfIdHidden).toBool(), ap->value(WlanQtUtilsAp::ConfIdWpsSupported).toBool()); } // else: Add WLAN IAP manually diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp --- a/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -20,6 +20,7 @@ // User includes #include "wlansnifferservice.h" +#include #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE @@ -117,8 +118,7 @@ Q_ASSERT(info.isValid()); // Extract the title - // TODO: Start using the official define when available - QVariant titleInfo = info.info("WindowTitle"); + QVariant titleInfo = info.info(XQINFO_KEY_WINDOW_TITLE); QString title = titleInfo.toString(); OstTraceFunctionExit0(WLANSNIFFERSERVICE_TITLE_EXIT); diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlansniffer/wlansnifferapplication/wlansnifferapplication.pro --- a/wlanutilities/wlansniffer/wlansnifferapplication/wlansnifferapplication.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlansniffer/wlansnifferapplication/wlansnifferapplication.pro Mon Aug 23 13:30:09 2010 +0300 @@ -61,6 +61,8 @@ RESOURCES = res/wlansniffer.qrc +DOCML += res/wlansnifferlistview.docml + SERVICE.FILE = res/service_conf.xml SERVICE.OPTIONS = embeddable diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/bwins/wlanwizardu.def --- a/wlanutilities/wlanwizard/bwins/wlanwizardu.def Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/bwins/wlanwizardu.def Mon Aug 23 13:30:09 2010 +0300 @@ -1,6 +1,6 @@ EXPORTS ?qt_metacall@WlanWizard@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int WlanWizard::qt_metacall(enum QMetaObject::Call, int, void * *) - ?setParameters@WlanWizard@@QAEXABVQString@@HH_N11@Z @ 2 NONAME ; void WlanWizard::setParameters(class QString const &, int, int, bool, bool, bool) + ?setParameters@WlanWizard@@QAEXABVQString@@HH_N1@Z @ 2 NONAME ; void WlanWizard::setParameters(class QString const &, int, int, bool, bool) ?metaObject@WlanWizard@@UBEPBUQMetaObject@@XZ @ 3 NONAME ; struct QMetaObject const * WlanWizard::metaObject(void) const ?trUtf8@WlanWizard@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString WlanWizard::trUtf8(char const *, char const *) ?tr@WlanWizard@@SA?AVQString@@PBD0H@Z @ 5 NONAME ; class QString WlanWizard::tr(char const *, char const *, int) diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/eabi/wlanwizardu.def --- a/wlanutilities/wlanwizard/eabi/wlanwizardu.def Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/eabi/wlanwizardu.def Mon Aug 23 13:30:09 2010 +0300 @@ -1,7 +1,7 @@ EXPORTS _ZN10WlanWizard11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME _ZN10WlanWizard11qt_metacastEPKc @ 2 NONAME - _ZN10WlanWizard13setParametersERK7QStringiibbb @ 3 NONAME + _ZN10WlanWizard13setParametersERK7QStringiibb @ 3 NONAME _ZN10WlanWizard16staticMetaObjectE @ 4 NONAME DATA 16 _ZN10WlanWizard19getStaticMetaObjectEv @ 5 NONAME _ZN10WlanWizard4showEv @ 6 NONAME diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/inc/wlanwizard.h --- a/wlanutilities/wlanwizard/inc/wlanwizard.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/inc/wlanwizard.h Mon Aug 23 13:30:09 2010 +0300 @@ -1,20 +1,19 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * WLAN Wizard API - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard API +*/ #ifndef WLANWIZARD_H #define WLANWIZARD_H @@ -47,15 +46,14 @@ Q_OBJECT public: - explicit WlanWizard(HbMainWindow *mainWindow ); - virtual ~WlanWizard(); + explicit WlanWizard(HbMainWindow *mainWindow); + ~WlanWizard(); void setParameters( const QString &ssid, int networkMode, int securityMode, bool usePsk, - bool hidden, bool wps); signals: @@ -85,4 +83,4 @@ /*! @} */ -#endif /* WLANWIZARD_H_ */ +#endif // WLANWIZARD_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/inc/wlanwizard_p.h --- a/wlanutilities/wlanwizard/inc/wlanwizard_p.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/inc/wlanwizard_p.h Mon Aug 23 13:30:09 2010 +0300 @@ -66,7 +66,6 @@ int networkMode, int securityMode, bool usePsk, - bool hidden, bool wps); void show(); diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/inc/wlanwizardhelper.h --- a/wlanutilities/wlanwizard/inc/wlanwizardhelper.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/inc/wlanwizardhelper.h Mon Aug 23 13:30:09 2010 +0300 @@ -76,8 +76,8 @@ ConfIapId = 10, //! bool: true if connection was established successfully ConfConnected = 11, - //! bool: if true hidden WLAN - ConfHiddenWlan = 12, + //! bool: WLAN AP explicit scanning need + ConfWlanScanSSID = 12, //! bool: if true use psk, if false use EAP ConfUsePsk = 13, //! bool: if true processing connection page is required. diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/resources/occ_wlan_wizard_main.docml --- a/wlanutilities/wlanwizard/resources/occ_wlan_wizard_main.docml Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/resources/occ_wlan_wizard_main.docml Mon Aug 23 13:30:09 2010 +0300 @@ -14,6 +14,7 @@ + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/resources/resource.qrc --- a/wlanutilities/wlanwizard/resources/resource.qrc Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/resources/resource.qrc Mon Aug 23 13:30:09 2010 +0300 @@ -1,11 +1,11 @@ - occ_wlan_wizard_main.docml - occ_add_wlan_05.docml - occ_add_wlan_06.docml - occ_add_wlan_02_03.docml - occ_add_wlan_01_04.docml - occ_add_wlan_error.docml + occ_wlan_wizard_main.docml.bin + occ_add_wlan_05.docml.bin + occ_add_wlan_06.docml.bin + occ_add_wlan_02_03.docml.bin + occ_add_wlan_01_04.docml.bin + occ_add_wlan_error.docml.bin custom.css diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/src/wlanwizard.cpp --- a/wlanutilities/wlanwizard/src/wlanwizard.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/src/wlanwizard.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -1,20 +1,19 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * WLAN Wizard: API. - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard: API. +*/ // System includes @@ -31,8 +30,10 @@ MyClass::createWizard() { mWizard = new WlanWizard(mainWindow()); connect( - mWizard, SIGNAL(finished(int, bool)), - this, SLOT(finished(int, bool))); + mWizard, + SIGNAL(finished(int, bool)), + this, + SLOT(finished(int, bool))); connect(mWizard, SIGNAL(cancelled()), this, SLOT(cancelled())); // If client know the parameters for WLAN Access Point call following @@ -41,8 +42,7 @@ CmManagerShim::Infra, CmManagerShim::WlanSecModeWpa, true, // WPA-PSK - false, // Non-Hidden - false ); // Non-Wifi Protected Setup + false); // Non-Wifi Protected Setup // and execute wizard mWizard->show(); @@ -141,7 +141,6 @@ @param [in] networkMode Network mode of known access point @param [in] securityMode Security mode of known access point @param [in] usePsk used only with WPA or WPA2 \a securityMode - @param [in] hidden if true WLAN is hidden. @param [in] wps is Wifi Protected Setup supported? */ void WlanWizard::setParameters( @@ -149,10 +148,9 @@ int networkMode, int securityMode, bool usePsk, - bool hidden, bool wps) { - d_ptr->setParameters(ssid, networkMode, securityMode, usePsk, hidden, wps); + d_ptr->setParameters(ssid, networkMode, securityMode, usePsk, wps); } /*! diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/src/wlanwizard_p.cpp --- a/wlanutilities/wlanwizard/src/wlanwizard_p.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/src/wlanwizard_p.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -16,11 +16,12 @@ */ // System includes -#include + #include #include #include #include + #include #include #include @@ -31,6 +32,7 @@ #include // User includes + #include "eapwizard.h" #include "wpswizard.h" #include "wlanqtutils.h" @@ -100,15 +102,18 @@ mPageFinished(false), mClosed(false) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_WLANWIZARDPRIVATE, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_WLANWIZARDPRIVATE, "WlanWizardPrivate::WlanWizardPrivate;this=%x", - this ); + this); // Set initial values for configurations setConfiguration(ConfIapId, WlanQtUtils::IapIdNone); setConfiguration(ConfConnected, false); - setConfiguration(ConfHiddenWlan, false); + setConfiguration(ConfWlanScanSSID, false); setConfiguration(ConfProcessSettings, false); setConfiguration(ConfIctStatus, false); @@ -133,11 +138,15 @@ // setParameters(), which decides the first page.. mFirstPageId = WlanWizardPageInternal::PageSsid; - OstTraceExt2( TRACE_BORDER, WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_DONE, + OstTraceExt2( + TRACE_BORDER, + WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_DONE, "WlanWizardPrivate::WlanWizardPrivate - done;" "this=%x;mFirstPageId=%{PageIds}", - ( unsigned )this, mFirstPageId ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_EXIT ); + (unsigned)this, + mFirstPageId); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_EXIT); } /*! @@ -145,10 +154,13 @@ */ WlanWizardPrivate::~WlanWizardPrivate() { - OstTraceFunctionEntry0( DUP1_WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE, + OstTraceFunctionEntry0(DUP1_WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE, "WlanWizardPrivate::~WlanWizardPrivate;this=%x", - this ); + this); // Remove wizard pages from stackedwidgets, since stackedwidget owns the // objects and all pages are deleted below. @@ -178,35 +190,48 @@ // Remove the pointer from QScopedPointer to prevent double deallocation mDialog.take(); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_DWLANWIZARDPRIVATE_DONE, "WlanWizardPrivate::~WlanWizardPrivate-Done;this=%x", - this ); - OstTraceFunctionExit0( DUP1_WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_EXIT ); + this); + + OstTraceFunctionExit0(DUP1_WLANWIZARDPRIVATE_WLANWIZARDPRIVATE_EXIT); } /*! See WlanWizard::setParameters(). */ void WlanWizardPrivate::setParameters( - const QString &ssid, - int networkMode, + const QString &ssid, + int networkMode, int securityMode, bool usePsk, - bool hidden, bool wps) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_SETPARAMETERS_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SETPARAMETERS, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SETPARAMETERS_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_SETPARAMETERS, "WlanWizardPrivate::setParameters;this=%x", - this ); + this); mFirstPageId = getNextPageId( - ssid, networkMode, securityMode, usePsk, hidden, wps); + ssid, + networkMode, + securityMode, + usePsk, + false, + wps); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SETPARAMETERS_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_SETPARAMETERS_DONE, "WlanWizardPrivate::setParameters - Done;this=%x", - this ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_SETPARAMETERS_EXIT ); + this); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_SETPARAMETERS_EXIT); } /*! @@ -214,19 +239,26 @@ */ void WlanWizardPrivate::show() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_SHOW_ENTRY ); - OstTraceExt2( TRACE_BORDER, WLANWIZARDPRIVATE_SHOW, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SHOW_ENTRY); + + OstTraceExt2( + TRACE_BORDER, + WLANWIZARDPRIVATE_SHOW, "WlanWizardPrivate::show;this=%x;mFirstPageId=%{PageIds}", - ( unsigned )this, mFirstPageId ); + (unsigned)this, + mFirstPageId); Q_ASSERT(mClosed == false); showPage(mFirstPageId, false); mDialog->show(); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_SHOW_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_SHOW_DONE, "WlanWizardPrivate::show - Done;this=%x;", - (unsigned)this ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_SHOW_EXIT ); + (unsigned)this); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_SHOW_EXIT); } /*! @@ -244,18 +276,22 @@ bool hidden, bool wps) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_GETNEXTPAGEID_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_GETNEXTPAGEID_ENTRY); + setConfiguration(ConfProcessSettings, true); setConfiguration(ConfSsid, ssid); setConfiguration(ConfNetworkMode, networkMode); setConfiguration(ConfSecurityMode, securityMode); setConfiguration(ConfUsePsk, usePsk); - setConfiguration(ConfHiddenWlan, hidden); + setConfiguration(ConfWlanScanSSID, hidden); - OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_GETNEXTPAGEID, + OstTrace1( + TRACE_NORMAL, + WLANWIZARDPRIVATE_GETNEXTPAGEID, "WlanWizardPrivate::getNextPageId;wps=%u", - wps ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_GETNEXTPAGEID_EXIT ); + wps); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_GETNEXTPAGEID_EXIT); return nextPageId(wps); } @@ -266,9 +302,11 @@ */ WlanQtUtils* WlanWizardPrivate::wlanQtUtils() const { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_WLANQTUTILS_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_WLANQTUTILS_ENTRY); + Q_ASSERT(mWlanQtUtils.data()); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_WLANQTUTILS_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_WLANQTUTILS_EXIT); return mWlanQtUtils.data(); } @@ -279,7 +317,8 @@ */ WlanWizardPlugin* WlanWizardPrivate::wlanWizardPlugin() const { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_WLANWIZARDPLUGIN_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_WLANWIZARDPLUGIN_ENTRY); + WlanWizardPlugin* plugin = NULL; if (isEapEnabled()) { @@ -287,11 +326,13 @@ Q_ASSERT(plugin); } - OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_WLANWIZARDPLUGIN, + OstTrace1( + TRACE_NORMAL, + WLANWIZARDPRIVATE_WLANWIZARDPLUGIN, "WlanWizardPrivate::wlanWizardPlugin;plugin=%x", - plugin ); + plugin); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_WLANWIZARDPLUGIN_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPRIVATE_WLANWIZARDPLUGIN_EXIT); return plugin; } @@ -303,7 +344,8 @@ */ bool WlanWizardPrivate::isEapEnabled() const { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_ISEAPENABLED_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ISEAPENABLED_ENTRY); + bool ret = false; int secMode = configuration(ConfSecurityMode).toInt(); @@ -314,11 +356,13 @@ ret = true; } - OstTrace1( TRACE_NORMAL, WLANWIZARDPRIVATE_ISEAPENABLED, + OstTrace1( + TRACE_NORMAL, + WLANWIZARDPRIVATE_ISEAPENABLED, "WlanWizardPrivate::isEapEnabled;ret=%u", - ret ); + ret); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_ISEAPENABLED_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPRIVATE_ISEAPENABLED_EXIT); return ret; } @@ -329,9 +373,12 @@ */ bool WlanWizardPrivate::handleIap() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_HANDLEIAP_ENTRY ); - OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP, - "WlanWizardPrivate::handleIap" ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_HANDLEIAP_ENTRY); + + OstTrace0( + TRACE_FLOW, + WLANWIZARDPRIVATE_HANDLEIAP, + "WlanWizardPrivate::handleIap"); bool ret = true; bool usePsk = true; @@ -349,11 +396,13 @@ // Set configuration wlanAp.setValue(WlanQtUtilsAp::ConfIdSsid, configuration(ConfSsid)); - wlanAp.setValue(WlanQtUtilsAp::ConfIdConnectionMode, + wlanAp.setValue( + WlanQtUtilsAp::ConfIdConnectionMode, configuration(ConfNetworkMode)); - wlanAp.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode ); - wlanAp.setValue(WlanQtUtilsAp::ConfIdHidden, configuration(ConfHiddenWlan)); - + wlanAp.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); + wlanAp.setValue(WlanQtUtilsAp::ConfIdHidden, false); + wlanAp.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, configuration(ConfWlanScanSSID)); + switch (securityMode) { case CMManagerShim::WlanSecModeWep: wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey1, configuration(ConfKeyWep1)); @@ -384,8 +433,10 @@ // Create IAP if does not exists or update the existing IAP int referenceId = configuration(ConfIapId).toInt(); if (referenceId == WlanQtUtils::IapIdNone) { - OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_CREATE, - "WlanWizardPrivate::handleIap: Create IAP" ); + OstTrace0( + TRACE_FLOW, + WLANWIZARDPRIVATE_HANDLEIAP_CREATE, + "WlanWizardPrivate::handleIap: Create IAP"); referenceId = mWlanQtUtils->createIap(&wlanAp); setConfiguration(ConfIapId, referenceId); @@ -394,8 +445,10 @@ ret = false; } } else { - OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_UPDATE, - "WlanWizardPrivate::handleIap: Update IAP" ); + OstTrace0( + TRACE_FLOW, + WLANWIZARDPRIVATE_HANDLEIAP_UPDATE, + "WlanWizardPrivate::handleIap: Update IAP"); ret = mWlanQtUtils->updateIap(referenceId, &wlanAp); } @@ -404,18 +457,22 @@ // Store Wizard plugin specific settings here. WlanWizardPlugin* plugin = wlanWizardPlugin(); if (plugin) { - OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_PLUGIN, - "WlanWizardPrivate::handleIap: Plugin" ); + OstTrace0( + TRACE_FLOW, + WLANWIZARDPRIVATE_HANDLEIAP_PLUGIN, + "WlanWizardPrivate::handleIap: Plugin"); // Plugin gets the IAP ID from configuration ret = plugin->storeSettings(); } } - OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_HANDLEIAP_DONE, + OstTrace1( + TRACE_FLOW, + WLANWIZARDPRIVATE_HANDLEIAP_DONE, "WlanWizardPrivate::handleIap: Done;ret=%d", - ret ); - - OstTraceFunctionExit0( WLANWIZARDPRIVATE_HANDLEIAP_EXIT ); + ret); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_HANDLEIAP_EXIT); return ret; } @@ -424,7 +481,8 @@ */ QVariant WlanWizardPrivate::configuration(ConfigurationId confId) const { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_CONFIGURATION_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CONFIGURATION_ENTRY); + Q_ASSERT(mConfigurations.contains(confId)); #ifdef OST_TRACE_COMPILER_IN_USE @@ -433,12 +491,15 @@ tmpStream << mConfigurations[confId]; TPtrC16 string( tmp.utf16(), tmp.length() ); - OstTraceExt2( TRACE_NORMAL, WLANWIZARDPRIVATE_CONFIGURATIONS, + OstTraceExt2( + TRACE_NORMAL, + WLANWIZARDPRIVATE_CONFIGURATIONS, "WlanWizardPrivate::configuration;confId=%{ConfigurationId};string=%S", - (uint)confId, string ); + (uint)confId, + string); #endif - OstTraceFunctionExit0( WLANWIZARDPRIVATE_CONFIGURATION_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPRIVATE_CONFIGURATION_EXIT); return mConfigurations[confId]; } @@ -449,21 +510,26 @@ ConfigurationId confId, const QVariant &value) { -OstTraceFunctionEntry0( WLANWIZARDPRIVATE_SETCONFIGURATION_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SETCONFIGURATION_ENTRY); + #ifdef OST_TRACE_COMPILER_IN_USE QString tmp; QDebug tmpStream(&tmp); tmpStream << value; TPtrC16 string( tmp.utf16(), tmp.length() ); - OstTraceExt2( TRACE_NORMAL, WLANWIZARDPRIVATE_SETCONFIGURATION, + OstTraceExt2( + TRACE_NORMAL, + WLANWIZARDPRIVATE_SETCONFIGURATION, "WlanWizardPrivate::setConfiguration;" "confId=%{ConfigurationId};string=%S", - (uint)confId, string ); + (uint)confId, + string); #endif mConfigurations[confId] = value; - OstTraceFunctionExit0( WLANWIZARDPRIVATE_SETCONFIGURATION_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_SETCONFIGURATION_EXIT); } /*! @@ -471,13 +537,17 @@ */ void WlanWizardPrivate::clearConfiguration(ConfigurationId confId) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_CLEARCONFIGURATION_ENTRY ); - OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_CLEARCONFIGURATION, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CLEARCONFIGURATION_ENTRY); + + OstTrace1( + TRACE_FLOW, + WLANWIZARDPRIVATE_CLEARCONFIGURATION, "WlanWizardPrivate::clearConfiguration;confId=%{ConfigurationId}", - (uint)confId ); + (uint)confId); mConfigurations.remove(confId); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_CLEARCONFIGURATION_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_CLEARCONFIGURATION_EXIT); } /*! @@ -485,11 +555,15 @@ */ bool WlanWizardPrivate::configurationExists(ConfigurationId confId) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_CONFIGURATIONEXISTS_ENTRY ); - OstTrace1( TRACE_DUMP, WLANWIZARDPRIVATE_CONFIGURATIONEXISTS, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CONFIGURATIONEXISTS_ENTRY); + + OstTrace1( + TRACE_DUMP, + WLANWIZARDPRIVATE_CONFIGURATIONEXISTS, "WlanWizardPrivate::configurationExists;confId=%{ConfigurationId}", - (uint)confId ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_CONFIGURATIONEXISTS_EXIT ); + (uint)confId); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_CONFIGURATIONEXISTS_EXIT); return mConfigurations[confId].isValid(); } @@ -498,12 +572,17 @@ */ void WlanWizardPrivate::enableNextButton(bool enable) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_ENABLENEXTBUTTON_ENTRY ); - OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_ENABLENEXTBUTTON, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ENABLENEXTBUTTON_ENTRY); + + OstTraceExt2( + TRACE_FLOW, + WLANWIZARDPRIVATE_ENABLENEXTBUTTON, "WlanWizardPrivate::enableNextButton;this=%x;enable=%x", - (unsigned)this, (uint)enable ); + (unsigned)this, + (uint)enable); mActionNext->setEnabled(enable); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_ENABLENEXTBUTTON_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_ENABLENEXTBUTTON_EXIT); } /*! @@ -511,14 +590,20 @@ */ void WlanWizardPrivate::addPage(int pageId, WlanWizardPage *page) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_ADDPAGE_ENTRY ); - OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_ADDPAGE, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ADDPAGE_ENTRY); + + OstTraceExt3( + TRACE_FLOW, + WLANWIZARDPRIVATE_ADDPAGE, "WlanWizardPrivate::addPage;this=%x;pageId=%{PageIds};page=%x", - (unsigned)this, pageId, (uint)(page) ); + (unsigned)this, + pageId, + (uint)(page)); Q_ASSERT(!mPages.contains(pageId)); mPages[pageId] = page; - OstTraceFunctionExit0( WLANWIZARDPRIVATE_ADDPAGE_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_ADDPAGE_EXIT); } /*! @@ -526,14 +611,18 @@ */ void WlanWizardPrivate::nextPage() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_NEXTPAGE_ENTRY ); - OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_NEXTPAGE, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_NEXTPAGE_ENTRY); + + OstTrace1( + TRACE_FLOW, + WLANWIZARDPRIVATE_NEXTPAGE, "WlanWizardPrivate::nextPage;this=%x", - this ); + this); mPageFinished = true; toNextPage(); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_NEXTPAGE_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_NEXTPAGE_EXIT); } /*! @@ -541,8 +630,8 @@ */ HbMainWindow* WlanWizardPrivate::mainWindow() const { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_MAINWINDOW_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_MAINWINDOW_EXIT ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_MAINWINDOW_ENTRY); + OstTraceFunctionExit0(WLANWIZARDPRIVATE_MAINWINDOW_EXIT); return mMainWindow; } @@ -551,17 +640,21 @@ */ bool WlanWizardPrivate::isCurrentPage(const HbWidget *page) const { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_ISCURRENTPAGE_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ISCURRENTPAGE_ENTRY); + bool ret = false; if (mStackedWidget->currentWidget() == page) { ret = true; } - OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_ISCURRENTPAGE, + OstTraceExt2( + TRACE_FLOW, + WLANWIZARDPRIVATE_ISCURRENTPAGE, "WlanWizardPrivate::isCurrentPage;page=%x;ret=%d", - (uint)page, ret); + (uint)page, + ret); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_ISCURRENTPAGE_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPRIVATE_ISCURRENTPAGE_EXIT); return ret; } @@ -570,7 +663,8 @@ */ int WlanWizardPrivate::nextPageId(bool useWps) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_NEXTPAGEID_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_NEXTPAGEID_ENTRY); + int ret; if (useWps) { ret = WlanWizardPage::PageWpsStart; @@ -605,11 +699,15 @@ } } - OstTraceExt3( TRACE_NORMAL, WLANWIZARDPRIVATE_NEXTPAGEID, + OstTraceExt3( + TRACE_NORMAL, + WLANWIZARDPRIVATE_NEXTPAGEID, "WlanWizardPrivate::nextPageId;this=%x;useWps=%x;ret=%{PageIds}", - ( unsigned )this, ( TUint )( useWps ), ret ); + (unsigned)this, + (TUint)(useWps), + ret); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_NEXTPAGEID_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPRIVATE_NEXTPAGEID_EXIT); return ret; } @@ -622,10 +720,13 @@ */ void WlanWizardPrivate::cancelTriggered() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_CANCELTRIGGERED_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CANCELTRIGGERED_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_CANCELTRIGGERED, "WlanWizardPrivate::cancelTriggered;this=%x", - this ); + this); // Disconnect receiving more signals from any actions disconnectActions(); @@ -650,14 +751,20 @@ closeViews(); Q_ASSERT(q_ptr); - OstTrace0( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED_EMIT, - "WlanWizardPrivate::cancelTriggered - emit cancelled()" ); + OstTrace0( + TRACE_BORDER, + WLANWIZARDPRIVATE_CANCELTRIGGERED_EMIT, + "WlanWizardPrivate::cancelTriggered - emit cancelled()"); emit q_ptr->cancelled(); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_CANCELTRIGGERED_DONE, - "WlanWizardPrivate::cancelTriggered - Done;this=%x", this ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_CANCELTRIGGERED_EXIT ); + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_CANCELTRIGGERED_DONE, + "WlanWizardPrivate::cancelTriggered - Done;this=%x", + this); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_CANCELTRIGGERED_EXIT); } /*! @@ -667,10 +774,13 @@ */ void WlanWizardPrivate::previousTriggered() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_PREVIOUSTRIGGERED, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_PREVIOUSTRIGGERED, "WlanWizardPrivate::previousTriggered;this=%x", - this ); + this); mPageTimer->stop(); @@ -697,10 +807,13 @@ updateFrame(mPages.key(page)); enableNextButton(page->showPage()); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_DONE, "WlanWizardPrivate::previousTriggered - Done;this=%x", - this ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_EXIT ); + this); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_PREVIOUSTRIGGERED_EXIT); } /*! @@ -709,10 +822,13 @@ */ void WlanWizardPrivate::nextTriggered() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_NEXTTRIGGERED_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_NEXTTRIGGERED, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_NEXTTRIGGERED_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_NEXTTRIGGERED, "WlanWizardPrivate::nextTriggered;this=%x", - this ); + this); mPageTimer->stop(); @@ -723,10 +839,13 @@ int pageId = mPageMapper[widget]->nextId(removeFromStack); showPage(pageId, removeFromStack); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_NEXTTRIGGERED_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_NEXTTRIGGERED_DONE, "WlanWizardPrivate::nextTriggered - Done;this=%x", - this ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_NEXTTRIGGERED_EXIT ); + this); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_NEXTTRIGGERED_EXIT); } /*! @@ -735,10 +854,13 @@ */ void WlanWizardPrivate::finishTriggered() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_FINISHTRIGGERED_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_FINISHTRIGGERED, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_FINISHTRIGGERED_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_FINISHTRIGGERED, "WlanWizardPrivate::finishTriggered;this=%x", - this ); + this); // Disconnect receiving more signals from any actions disconnectActions(); @@ -751,10 +873,13 @@ configuration(ConfIapId).toInt(), configuration(ConfConnected).toBool()); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_FINISHTRIGGERED_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_FINISHTRIGGERED_DONE, "WlanWizardPrivate::finishTriggered - Done;this=%x", - this ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_FINISHTRIGGERED_EXIT ); + this); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_FINISHTRIGGERED_EXIT); } /*! @@ -763,17 +888,23 @@ */ void WlanWizardPrivate::onTimeOut() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_ONTIMEOUT_ENTRY ); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_ONTIMEOUT, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_ONTIMEOUT_ENTRY); + + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_ONTIMEOUT, "WlanWizardPrivate::onTimeOut;this=%x", - this ); + this); toNextPage(); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_ONTIMEOUT_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_ONTIMEOUT_DONE, "WlanWizardPrivate::onTimeOut - Done;this=%x", - this ); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_ONTIMEOUT_EXIT ); + this); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_ONTIMEOUT_EXIT); } /*! @@ -782,12 +913,15 @@ */ void WlanWizardPrivate::startPageOperation() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_STARTPAGEOPERATION_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_STARTPAGEOPERATION_ENTRY); + // Process this if wizard has not been closed if (mClosed == false) { - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_STARTPAGEOPERATION, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_STARTPAGEOPERATION, "WlanWizardPrivate::startPageOperation;this=%x", - this ); + this); HbWidget *widget = qobject_cast(mStackedWidget->currentWidget()); @@ -796,11 +930,14 @@ mPageTimer->start(PageTimeout); mPageMapper[widget]->startOperation(); - OstTrace1( TRACE_BORDER, WLANWIZARDPRIVATE_STARTPAGEOPERATION_DONE, + OstTrace1( + TRACE_BORDER, + WLANWIZARDPRIVATE_STARTPAGEOPERATION_DONE, "WlanWizardPrivate::startPageOperation - DONE;this=%x", - this ); + this); } - OstTraceFunctionExit0( WLANWIZARDPRIVATE_STARTPAGEOPERATION_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_STARTPAGEOPERATION_EXIT); } /*! @@ -809,17 +946,21 @@ */ void WlanWizardPrivate::toNextPage() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_TONEXTPAGE_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_TONEXTPAGE_ENTRY); + if (mPageFinished && !(mPageTimer->isActive())) { - OstTrace1( TRACE_FLOW, WLANWIZARDPRIVATE_TONEXTPAGE, + OstTrace1( + TRACE_FLOW, + WLANWIZARDPRIVATE_TONEXTPAGE, "WlanWizardPrivate::toNextPage;this=%x", - this ); + this); // process this asynchronous. Main purpose is to release the current // call stack and process the page change using new call stack QMetaObject::invokeMethod(this, "nextTriggered", Qt::QueuedConnection); } - OstTraceFunctionExit0( WLANWIZARDPRIVATE_TONEXTPAGE_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_TONEXTPAGE_EXIT); } /*! @@ -834,16 +975,21 @@ */ void WlanWizardPrivate::showPage(int pageId, bool removeFromStack) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_SHOWPAGE_ENTRY ); - OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE, + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_SHOWPAGE_ENTRY); + + OstTraceExt3( + TRACE_FLOW, + WLANWIZARDPRIVATE_SHOWPAGE, "WlanWizardPrivate::showPage;this=%x;" "pageId=%{PageIds};removeFromStack=%x", - ( unsigned )this, pageId, ( TUint )( removeFromStack ) ); + (unsigned)this, + pageId, + (TUint)(removeFromStack)); // PageNone is returned by wizard pages when some validation of page content // has not passed and the page does not want to process wizard to next page if (pageId == WlanWizardPage::PageNone) { - OstTraceFunctionExit0( WLANWIZARDPRIVATE_SHOWPAGE_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPRIVATE_SHOWPAGE_EXIT); return; } @@ -864,10 +1010,13 @@ ConfGenericErrorPageStepsBackwards, WlanWizardPage::OneStepBackwards); } - OstTraceExt2( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE_UPDATE, + OstTraceExt2( + TRACE_FLOW, + WLANWIZARDPRIVATE_SHOWPAGE_UPDATE, "WlanWizardPrivate::showPage - change page;this=%x;" "pageId=%{PageIds}", - ( unsigned )this, pageId); + (unsigned)this, + pageId); } } @@ -901,12 +1050,15 @@ // before any operation takes place in wizard page. This is important for // timer protected pages. Makes wizard to work smother from UI perspective if (page->requiresStartOperation()) { - OstTrace0( TRACE_FLOW, WLANWIZARDPRIVATE_SHOWPAGE_INVOKE, - "WlanWizardPrivate::showPage - Invoke startOperation" ); + OstTrace0( + TRACE_FLOW, + WLANWIZARDPRIVATE_SHOWPAGE_INVOKE, + "WlanWizardPrivate::showPage - Invoke startOperation"); QMetaObject::invokeMethod(this, "startPageOperation", Qt::QueuedConnection); } - OstTraceFunctionExit0( DUP1_WLANWIZARDPRIVATE_SHOWPAGE_EXIT ); + + OstTraceFunctionExit0(DUP1_WLANWIZARDPRIVATE_SHOWPAGE_EXIT); } /*! @@ -915,7 +1067,8 @@ */ void WlanWizardPrivate::createPages() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_CREATEPAGES_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CREATEPAGES_ENTRY); + OstTrace0( TRACE_NORMAL, WLANWIZARDPRIVATE_CREATEPAGES, @@ -952,7 +1105,8 @@ addPage( WlanWizardPageInternal::PageNetworkSecurity, new WlanWizardPageSecurityMode(this)); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_CREATEPAGES_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_CREATEPAGES_EXIT); } /*! @@ -962,10 +1116,12 @@ */ void WlanWizardPrivate::closeViews() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_CLOSEVIEWS_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_CLOSEVIEWS_ENTRY); + mDialog->hide(); mClosed = true; - OstTraceFunctionExit0( WLANWIZARDPRIVATE_CLOSEVIEWS_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_CLOSEVIEWS_EXIT); } /*! @@ -977,12 +1133,17 @@ */ void WlanWizardPrivate::updateFrame(int pageId) { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_UPDATEFRAME_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_UPDATEFRAME_ENTRY); + int currentIndex = mStackedWidget->currentIndex(); - OstTraceExt3( TRACE_FLOW, WLANWIZARDPRIVATE_UPDATEFRAME, + OstTraceExt3( + TRACE_FLOW, + WLANWIZARDPRIVATE_UPDATEFRAME, "WlanWizardPrivate::updateFrame;this=%x;pageId=%{PageIds};currentIndex=%d", - (unsigned)this, pageId, (uint)(currentIndex) ); + (unsigned)this, + pageId, + (uint)(currentIndex)); // For last page (summary) show Finish instead of Next button if (pageId == WlanWizardPageInternal::PageSummary) { @@ -1010,7 +1171,8 @@ } } } - OstTraceFunctionExit0( WLANWIZARDPRIVATE_UPDATEFRAME_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_UPDATEFRAME_EXIT); } /*! @@ -1018,7 +1180,8 @@ */ void WlanWizardPrivate::loadDocml() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_LOADDOCML_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_LOADDOCML_ENTRY); + bool ok = true; mDocLoader->load(":/docml/occ_wlan_wizard_main.docml", &ok); @@ -1066,23 +1229,31 @@ Q_ASSERT(ok); ok = connect( - mActionNext, SIGNAL(triggered()), - this, SLOT(nextTriggered())); + mActionNext, + SIGNAL(triggered()), + this, + SLOT(nextTriggered())); Q_ASSERT(ok); ok = connect( - mActionPrevious, SIGNAL(triggered()), - this, SLOT(previousTriggered())); + mActionPrevious, + SIGNAL(triggered()), + this, + SLOT(previousTriggered())); Q_ASSERT(ok); ok = connect( - mActionFinish, SIGNAL(triggered()), - this, SLOT(finishTriggered())); + mActionFinish, + SIGNAL(triggered()), + this, + SLOT(finishTriggered())); Q_ASSERT(ok); ok = connect( - mActionCancel, SIGNAL(triggered()), - this, SLOT(cancelTriggered())); + mActionCancel, + SIGNAL(triggered()), + this, + SLOT(cancelTriggered())); Q_ASSERT(ok); // TODO: workaround for full screen dialog, with docml it is possible to @@ -1090,7 +1261,8 @@ // is changed. See TSW Error: MTAA-854DK8 ok = HbStyleLoader::registerFilePath(":/css/custom.css"); Q_ASSERT(ok); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_LOADDOCML_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_LOADDOCML_EXIT); } /*! @@ -1098,21 +1270,31 @@ */ void WlanWizardPrivate::disconnectActions() { - OstTraceFunctionEntry0( WLANWIZARDPRIVATE_DISCONNECTACTIONS_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPRIVATE_DISCONNECTACTIONS_ENTRY); + disconnect( - mActionNext, SIGNAL(triggered()), - this, SLOT(nextTriggered())); + mActionNext, + SIGNAL(triggered()), + this, + SLOT(nextTriggered())); disconnect( - mActionPrevious, SIGNAL(triggered()), - this, SLOT(previousTriggered())); + mActionPrevious, + SIGNAL(triggered()), + this, + SLOT(previousTriggered())); disconnect( - mActionFinish, SIGNAL(triggered()), - this, SLOT(finishTriggered())); + mActionFinish, + SIGNAL(triggered()), + this, + SLOT(finishTriggered())); disconnect( - mActionCancel, SIGNAL(triggered()), - this, SLOT(cancelTriggered())); - OstTraceFunctionExit0( WLANWIZARDPRIVATE_DISCONNECTACTIONS_EXIT ); + mActionCancel, + SIGNAL(triggered()), + this, + SLOT(cancelTriggered())); + + OstTraceFunctionExit0(WLANWIZARDPRIVATE_DISCONNECTACTIONS_EXIT); } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/src/wlanwizardpagenetworkmode.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagenetworkmode.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagenetworkmode.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -1,20 +1,19 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * WLAN Wizard Page: Network mode Selection. - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard Page: Network mode Selection. +*/ // System includes #include @@ -141,13 +140,16 @@ setting.hidden = mIsHidden.at(index); setting.wpsSupported = mWpsSupported.at(index); - mWizard->setConfiguration(WlanWizardPrivate::ConfNetworkMode, + mWizard->setConfiguration( + WlanWizardPrivate::ConfNetworkMode, setting.mode); - mWizard->setConfiguration(WlanWizardPrivate::ConfHiddenWlan, + mWizard->setConfiguration( + WlanWizardPrivate::ConfWlanScanSSID, setting.hidden); - mWizard->setConfiguration(WlanWizardPrivate::ConfWpsSupported, + mWizard->setConfiguration( + WlanWizardPrivate::ConfWpsSupported, setting.wpsSupported); if (mWizard->configurationExists(WlanWizardPrivate::ConfAvailableNetworkOptions)) { @@ -317,4 +319,3 @@ OstTraceFunctionExit0( DUP1_WLANWIZARDPAGENETWORKMODE_SELECTNEXTPAGE_EXIT ); return nextPage; } - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -468,7 +468,7 @@ // may be skipped and the next page is set to security mode query. WlanNetworkSetting setting = networkOptions.getNetModes().at(0); mWizard->setConfiguration(WlanWizardHelper::ConfNetworkMode, setting.mode); - mWizard->setConfiguration(WlanWizardHelper::ConfHiddenWlan, setting.hidden); + mWizard->setConfiguration(WlanWizardHelper::ConfWlanScanSSID, setting.hidden); mWizard->setConfiguration(WlanWizardHelper::ConfWpsSupported, setting.wpsSupported); nextPage = WlanWizardPageInternal::PageNetworkSecurity; } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -1,34 +1,37 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * WLAN Wizard Page: Security mode Selection. - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard Page: Security mode Selection. +*/ // System includes + #include #include #include #include #include + #include // User includes + #include "wlanwizard_p.h" #include "wlanwizard.h" #include "wlanwizardpagesecuritymode.h" #include "wlanwizardscanlist.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "wlanwizardpagesecuritymodeTraces.h" @@ -47,8 +50,8 @@ mLoader(NULL), mValid(false) { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT ); + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY); + OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT); } /*! @@ -57,9 +60,11 @@ */ WlanWizardPageSecurityMode::~WlanWizardPageSecurityMode() { - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY ); + OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY); + delete mLoader; - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT ); + + OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT); } /*! @@ -68,9 +73,12 @@ */ HbWidget* WlanWizardPageSecurityMode::initializePage() { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_ENTRY ); - OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE, - "WlanWizardPageSecurityMode::initializePage" ); + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_ENTRY); + + OstTrace0( + TRACE_NORMAL, + WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE, + "WlanWizardPageSecurityMode::initializePage"); if (mWidget==NULL) { @@ -113,7 +121,7 @@ // Create contents to the security mode radio button list. populateSecModeList(); - OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_EXIT); return mWidget; } @@ -126,19 +134,23 @@ */ int WlanWizardPageSecurityMode::nextId(bool &removeFromStack) const { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_NEXTID_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_NEXTID_ENTRY); + removeFromStack = false; // The configuration is selected from the mSecModes list, which is ordered // during the page initialization. - mWizard->setConfiguration( WlanWizardPrivate::ConfSecurityMode, - mSecModes.at( mList->selected() ) ); + mWizard->setConfiguration( + WlanWizardPrivate::ConfSecurityMode, + mSecModes.at(mList->selected())); // The configuration is selected from the mUsePsk list, which is ordered // during the page initialization. - mWizard->setConfiguration( WlanWizardPrivate::ConfUsePsk, - mUsePsk.at( mList->selected() ) ); - OstTraceFunctionExit0( LANWIZARDPAGESECURITYMODE_NEXTID_EXIT ); + mWizard->setConfiguration( + WlanWizardPrivate::ConfUsePsk, + mUsePsk.at(mList->selected())); + + OstTraceFunctionExit0(LANWIZARDPAGESECURITYMODE_NEXTID_EXIT); return mPageIds.at( mList->selected() ); } @@ -149,8 +161,8 @@ */ bool WlanWizardPageSecurityMode::showPage() { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_SHOWPAGE_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_SHOWPAGE_EXIT ); + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_ENTRY); + OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_EXIT); return mValid; } @@ -160,13 +172,17 @@ */ void WlanWizardPageSecurityMode::itemSelected() { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_ENTRY ); - OstTrace0( TRACE_BORDER, WLANWIZARDPAGESECURITYMODE_ITEMSELECTED, - "WlanWizardPageSecurityMode::itemSelected" ); + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_ENTRY); + + OstTrace0( + TRACE_BORDER, + WLANWIZARDPAGESECURITYMODE_ITEMSELECTED, + "WlanWizardPageSecurityMode::itemSelected"); mValid = true; mWizard->enableNextButton(mValid); - OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_EXIT); } /*! @@ -177,10 +193,13 @@ */ void WlanWizardPageSecurityMode::loadDocmlSection(Qt::Orientation orientation) { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_ENTRY ); - OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESECURITYMODE_LOADDOCML, + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_ENTRY); + + OstTrace1( + TRACE_NORMAL, + WLANWIZARDPAGESECURITYMODE_LOADDOCML, "WlanWizardPageSecurityMode::loadDocml - orientation;orientation=%x", - ( TUint )( orientation ) ); + (TUint)orientation); WlanWizardPageInternal::loadDocmlSection( mLoader, @@ -188,7 +207,8 @@ ":/docml/occ_add_wlan_02_03.docml", "portrait_section", "landscape_section"); - OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_EXIT); } /*! @@ -196,7 +216,8 @@ */ void WlanWizardPageSecurityMode::populateSecModeList() { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_ENTRY); + QStringList items; mSecModes.clear(); @@ -211,12 +232,16 @@ // Create the radio button list to correspond to correct security mode // identifiers and page identifiers. // Populate the list according to network mode selection. - addToList(items, hbTrId("txt_occ_list_open"), + addToList( + items, + hbTrId("txt_occ_list_open"), CMManagerShim::WlanSecModeOpen, WlanWizardPage::PageProcessSettings, false); - addToList(items, hbTrId("txt_occ_list_wep_1"), + addToList( + items, + hbTrId("txt_occ_list_wep_1"), CMManagerShim::WlanSecModeWep, WlanWizardPageInternal::PageKeyQuery, true); @@ -225,17 +250,23 @@ if (mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt() != CMManagerShim::Adhoc) { - addToList(items, hbTrId("txt_occ_list_wpa_with_password"), + addToList( + items, + hbTrId("txt_occ_list_wpa_with_password"), CMManagerShim::WlanSecModeWpa, WlanWizardPageInternal::PageKeyQuery, true); - addToList(items, hbTrId("txt_occ_list_wpa_with_eap"), + addToList( + items, + hbTrId("txt_occ_list_wpa_with_eap"), CMManagerShim::WlanSecModeWpa, WlanWizardPage::PageEapStart, false); - addToList(items, hbTrId("txt_occ_list_8021x_1"), + addToList( + items, + hbTrId("txt_occ_list_8021x_1"), CMManagerShim::WlanSecMode802_1x, WlanWizardPage::PageEapStart, false); @@ -243,7 +274,7 @@ mList->setItems(items); - OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_EXIT); } /*! @@ -258,14 +289,19 @@ * @param [in] page is the id of the next wizard page when this item is selected. * @param [in] psk indicates whether password needs to be queried. */ -void WlanWizardPageSecurityMode::addToList(QStringList &list, - const QString &item, int mode, int page, bool psk) +void WlanWizardPageSecurityMode::addToList( + QStringList &list, + const QString &item, + int mode, + int page, + bool psk) { - OstTraceFunctionEntry0( WLANWIZARDPAGESECURITYMODE_ADDTOLIST_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_ADDTOLIST_ENTRY); + if (mWizard->configurationExists(WlanWizardHelper::ConfAvailableNetworkOptions)) { WlanNetworkSetting netMode; netMode.mode = mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt(); - netMode.hidden = mWizard->configuration(WlanWizardPrivate::ConfHiddenWlan).toBool(); + netMode.hidden = mWizard->configuration(WlanWizardPrivate::ConfWlanScanSSID).toBool(); netMode.wpsSupported = mWizard->configuration(WlanWizardPrivate::ConfWpsSupported).toBool(); WlanWizardScanList networkOptions = mWizard->configuration( WlanWizardHelper::ConfAvailableNetworkOptions).value(); @@ -287,5 +323,6 @@ mPageIds.append(page); mUsePsk.append(psk); } - OstTraceFunctionExit0( WLANWIZARDPAGESECURITYMODE_ADDTOLIST_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_ADDTOLIST_EXIT); } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp --- a/wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/src/wlanwizardpagesummary.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -1,22 +1,22 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Wlan Wizard Page: Summary - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Wlan Wizard Page: Summary +*/ // System includes + #include #include #include @@ -25,11 +25,13 @@ #include // User includes + #include "wlanqtutils.h" #include "wlanwizard_p.h" #include "wlanwizardplugin.h" #include "wlanwizardsummaryviewitem.h" #include "wlanwizardpagesummary.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "wlanwizardpagesummaryTraces.h" @@ -61,8 +63,8 @@ WlanWizardPageInternal(parent), mListWidget(NULL) { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY ); - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY); + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT); } /*! @@ -70,11 +72,13 @@ */ WlanWizardPageSummary::~WlanWizardPageSummary() { - OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY ); + OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_ENTRY); + HbStyleLoader::unregisterFilePath(WlanWizardPageSummaryLayout); // Wizard framework deletes the visualization (owns mListWidget). - OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT ); + + OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESUMMARY_WLANWIZARDPAGESUMMARY_EXIT); } /*! @@ -82,7 +86,8 @@ */ HbWidget* WlanWizardPageSummary::initializePage() { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_ENTRY); + // Note that from summary page it is not possible to step back // this means that it is not possible that this method is called twice. Q_ASSERT(!mListWidget); @@ -103,7 +108,7 @@ addDynamicItems(row); - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_EXIT ); + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_INITIALIZEPAGE_EXIT); return qobject_cast(mListWidget); } @@ -112,7 +117,8 @@ */ void WlanWizardPageSummary::loadDocml() { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_LOADDOCML_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_LOADDOCML_ENTRY); + bool ok; HbDocumentLoader docLoader(mWizard->mainWindow()); @@ -132,7 +138,8 @@ // Register the location of hblistviewitem.css and hblistviewitem.widgetml ok = HbStyleLoader::registerFilePath(WlanWizardPageSummaryLayout); Q_ASSERT(ok); - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_LOADDOCML_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_LOADDOCML_EXIT); } /*! @@ -143,7 +150,8 @@ */ QString WlanWizardPageSummary::networkModeText() const { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_ENTRY); + QString ret; int mode = mWizard->configuration( WlanWizardPrivate::ConfNetworkMode).toInt(); @@ -155,14 +163,15 @@ default: Q_ASSERT(mode == CMManagerShim::Infra); - if (mWizard->configuration(WlanWizardPrivate::ConfHiddenWlan).toBool()) { + if (mWizard->configuration(WlanWizardPrivate::ConfWlanScanSSID).toBool()) { ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); } else { ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); } break; - } - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_EXIT ); + } + + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_NETWORKMODETEXT_EXIT); return ret; } @@ -174,7 +183,8 @@ */ QString WlanWizardPageSummary::securityModeText() const { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_ENTRY); + QString ret; int mode = mWizard->configuration(WlanWizardPrivate::ConfSecurityMode).toInt(); switch (mode) { @@ -207,7 +217,8 @@ ret = hbTrId("txt_occ_dblist_security_mode_val_open"); break; } - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_SECURITYMODETEXT_EXIT); return ret; } @@ -218,7 +229,8 @@ */ void WlanWizardPageSummary::addDynamicItems(int &row) { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_ENTRY); + if (mWizard->isEapEnabled()) { appendToListPluginInfo(WlanWizardPlugin::SummaryEapOuterType, row); appendToListPluginInfo(WlanWizardPlugin::SummaryEapInnerType, row); @@ -244,7 +256,8 @@ // Add nothing to list. break; } - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_ADDDYNAMICITEMS_EXIT); } /*! @@ -259,12 +272,14 @@ const QString title, const QString value) { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_APPENDTOLIST_ENTRY); + HbListWidgetItem *item = new HbListWidgetItem(); item->setText(title); item->setSecondaryText(value); mListWidget->insertItem(row++, item); - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLIST_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_APPENDTOLIST_EXIT); } /*! @@ -274,9 +289,11 @@ @param [in,out] row number to where the item is inserted */ void WlanWizardPageSummary::appendToListPluginInfo( - WlanWizardPlugin::Summary id, int &row ) + WlanWizardPlugin::Summary id, + int &row) { - OstTraceFunctionEntry0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_ENTRY ); + OstTraceFunctionEntry0(WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_ENTRY); + QString title; QString value; WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin(); @@ -284,5 +301,6 @@ if (plugin->summary(id, title, value)) { appendToList(row, title, value ); } - OstTraceFunctionExit0( WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_EXIT ); + + OstTraceFunctionExit0(WLANWIZARDPAGESUMMARY_APPENDTOLISTPLUGININFO_EXIT); } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/make_ctc.bat --- a/wlanutilities/wlanwizard/t_wlanwizard/make_ctc.bat Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -:: All rights reserved. -:: This component and the accompanying materials are made available -:: under the terms of "Eclipse Public License v1.0" -:: which accompanies this distribution, and is available -:: at the URL "http://www.eclipse.org/legal/epl-v10.html". -:: -:: Initial Contributors: -:: Nokia Corporation - initial contribution. -:: -:: Contributors: -:: -:: Description: -:: Batch file to instrument and run test cases with CTC. - -@echo off -call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\src\*.cpp -C NO_EXCLUDE+..\..\eapwizard\src\*.cpp -C NO_EXCLUDE+..\..\wpswizard\src\*.cpp -i fd -v -2comp sbs -c winscw_udeb diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/make_ctc_post.bat --- a/wlanutilities/wlanwizard/t_wlanwizard/make_ctc_post.bat Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -:: All rights reserved. -:: This component and the accompanying materials are made available -:: under the terms of "Eclipse Public License v1.0" -:: which accompanies this distribution, and is available -:: at the URL "http://www.eclipse.org/legal/epl-v10.html". -:: -:: Initial Contributors: -:: Nokia Corporation - initial contribution. -:: -:: Contributors: -:: -:: Description: -:: Batch file to create coverage reports from CTC results. - -call ctcpost -p profile.txt -call ctc2html -i profile.txt diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/make_ctc_with_clean.bat --- a/wlanutilities/wlanwizard/t_wlanwizard/make_ctc_with_clean.bat Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -:: All rights reserved. -:: This component and the accompanying materials are made available -:: under the terms of "Eclipse Public License v1.0" -:: which accompanies this distribution, and is available -:: at the URL "http://www.eclipse.org/legal/epl-v10.html". -:: -:: Initial Contributors: -:: Nokia Corporation - initial contribution. -:: -:: Contributors: -:: -:: Description: -:: Batch file to instrument and run test cases with CTC. - -@echo off -del MON.* -del profile.txt -rmdir /S /Q CTCHTML -call sbs clean -call sbs reallyclean -call make distclean -call qmake "CONFIG-=debug" -call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\src\*.cpp -C NO_EXCLUDE+..\..\eapwizard\src\*.cpp -C NO_EXCLUDE+..\..\wpswizard\src\*.cpp -i fd -v -2comp sbs -c winscw_udeb diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Stub file for eapwizard!! - * - */ - -#ifndef EAPQTCERTIFICATEINFO_H -#define EAPQTCERTIFICATEINFO_H - -#include -#include -#include - -class EapQtCertificateInfoPrivate; - -class EapQtCertificateInfo -{ -public: - - enum ItemId - { - /*! QString */ - SubjectName, - /*! QString */ - IssuerName, - /*! QString */ - SerialNumber, - /*! QByteArray */ - SubjectKeyId, - /*! QString */ - ThumbPrint, - /*! QString */ - CertificateLabel, - /*! marker for the last item */ - ItemIdLast - }; - -public: - - EapQtCertificateInfo(); - ~EapQtCertificateInfo(); - - EapQtCertificateInfo(const EapQtCertificateInfo &certInfo); - EapQtCertificateInfo &operator=(const EapQtCertificateInfo &certInfo); - - QVariant value(ItemId id) const; - void setValue(ItemId id, QVariant newValue); - -public: // FOR TESTING PURPOSE - bool operator==(const EapQtCertificateInfo & rhs ) const; - -private: - QScopedPointer d_ptr; -}; - -// Make the class known to QMetaType to support using QVariant -Q_DECLARE_METATYPE(EapQtCertificateInfo) - -#endif /* EAPQTCERTIFICATEINFO_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtcertificateinfo_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Certificate information data structure for EAP QT configuration interface - * - */ - -/* - * %version: 2 % - */ - -#include "eapqtcertificateinfo.h" -#include -class EapQtCertificateInfoPrivate -{ - friend class EapQtCertificateInfo; -public: - - EapQtCertificateInfoPrivate() {}; - ~EapQtCertificateInfoPrivate() {}; - - // copy constructor - EapQtCertificateInfoPrivate(const EapQtCertificateInfoPrivate &certInfo) - { - mCerts = certInfo.mCerts; - } - - QVariant value(int id); - void setValue(int id, QVariant newValue); - -private: - // disable assignment - EapQtCertificateInfoPrivate &operator=(const EapQtCertificateInfoPrivate&); - QHash mCerts; - -}; - - -//---------------------------------------------------------------------------- -// EapQtCertificateInfo -//---------------------------------------------------------------------------- - - -EapQtCertificateInfo::EapQtCertificateInfo() : - d_ptr(new EapQtCertificateInfoPrivate) -{ -} - -EapQtCertificateInfo::~EapQtCertificateInfo() -{ - // scoped pointer deleted automatically -} - -EapQtCertificateInfo::EapQtCertificateInfo(const EapQtCertificateInfo &certInfo) : - d_ptr(new EapQtCertificateInfoPrivate(*(certInfo.d_ptr))) -{ -} - -EapQtCertificateInfo& EapQtCertificateInfo::operator=(const EapQtCertificateInfo &certInfo) -{ - // check if assigning to myself - if (this != &certInfo) { - d_ptr.reset(new EapQtCertificateInfoPrivate(*(certInfo.d_ptr))); - } - return *this; -} - -QVariant EapQtCertificateInfo::value(ItemId id) const -{ - // check for valid range, otherwise memory is consumed for no reason - if(id >= ItemIdLast) { - qDebug("ERROR: EapQtCertificateInfo::value - invalid id!"); - return QVariant::Invalid; - } - return d_ptr->mCerts[id]; -} - -void EapQtCertificateInfo::setValue(ItemId id, QVariant newValue) -{ - // check for valid range, otherwise memory is consumed for no reason - if(id < ItemIdLast) { - d_ptr->mCerts[id] = newValue; - } else { - qDebug("ERROR: EapQtCertificateInfo::setValue - invalid id!"); - } - return; -} - -bool EapQtCertificateInfo::operator==(const EapQtCertificateInfo & rhs ) const -{ - bool ret = true; - if (d_ptr->mCerts.size() != rhs.d_ptr->mCerts.size()) { - qWarning("EapQtCertificateInfo::operator==(): size: expect %d, actual %d ", - d_ptr->mCerts.size(), - rhs.d_ptr->mCerts.size() ); - ret = false; - } - QHashIterator i(d_ptr->mCerts); - - while (i.hasNext()) { - i.next(); - if (!rhs.d_ptr->mCerts.contains(i.key())){ - qWarning("EapQtCertificateInfo::operator==(): key not found: %d", i.key()); - ret = false; - - } - if (i.value() != rhs.d_ptr->mCerts[i.key()]){ - qWarning("EapQtCertificateInfo::operator==(): values not match"); - qDebug() << "Expect: " << i.value(); - qDebug() << "Actual: " << i.value(); - ret = false; - } - } - return ret; -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * DUMMY: Stub for eapwizard testing - * - */ - -#ifndef EAPQTCONFIG_H -#define EAPQTCONFIG_H - -#include -#include -#include - -class EapQtConfigPrivate; - -class EapQtConfig -{ -public: - enum SettingsId - { - // see also EapSettings.h - - /*! bool */ - UsernameAutomatic, - /*! QString */ - Username, - /*! bool */ - PasswordPrompt, - /*! write-only: QString */ - Password, - /*! bool - * in read: defines if password already exists in settings database - * in write: when true, defines that password is not included in the provided - * configuration since it already exists in settings database, i.e. earlier - * set password remains unchanged */ - PasswordStored, - /*! write-only: bool - * true: clears the password from database - * false: does nothing - */ - PasswordClear, - /*! bool */ - RealmAutomatic, - /*! QString */ - Realm, - /*! bool */ - UsePseudonyms, - /*! bool */ - VerifyServerRealm, - /*! bool */ - ClientAuthenticationRequired, - /*! uint */ - SessionValidityTime, - /*! - * QList contains RFC numbers for activated ciphersuites - * - * Refer to RFC2246 chapter A.5 for the values. - * - * Supported CipherSuites by EAP Server default implementation: - * TLS_NULL_WITH_NULL_NULL = (0x0000), - * - No key exchange, no encryption and no authentication. - * TLS_RSA_WITH_RC4_128_MD5 = (0x0004), - * - RSA key exchange, RC4_128 encryption and MD5 authentication. - * NOTE this is included only because PEAP requires this cipher - * suite as a mandatory. Think carefully whether this meets your - * security requirements. - * TLS_RSA_WITH_RC4_128_SHA = (0x0005), - * - RSA key exchange, RC4_128 encryption and SHA1 authentication. - * NOTE this is included only because PEAP requires this cipher - * suite as a mandatory. Think carefully whether this meets your - * security - * requirements. - * TLS_RSA_WITH_3DES_EDE_CBC_SHA = (0x000a) - * - RSA key exchange, 3DES-EDE-CBC encryption and SHA1 - * authentication. - * TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = (0x0016) - * - Diffie-Helmann RSA key exchange, 3DES-EDE-CBC encryption and SHA1 - * authentication. - * TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = (0x0013) - * - Diffie-Helmann DSS key exchange, 3DES-EDE-CBC encryption and SHA1 - * authentication. - * TLS_RSA_WITH_AES_128_CBC_SHA = 0x002F - * - RSA key exchange, AES-128 encryption and SHA1 authentication. - * TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032 - * - Diffie-Helmann DSS key exchange, AES-128-CBC encryption and SHA1 - * authentication. - * TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033 - * - Diffie-Helmann RSA key exchange, AES-128-CBC encryption and SHA1 - * authentication. - * TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x0034, - * - Supported when EAP-FAST is supported - * - Diffie-Helmann anonymous key exchange, AES-128-CBC encryption and - * SHA1 authentication. - */ - CipherSuites, - /*! bool */ - PeapVersion0Allowed, - /*! bool */ - PeapVersion1Allowed, - /*! bool */ - PeapVersion2Allowed, - /*! QList< QVariant(EapQtCertificateInfo) > */ - AuthorityCertificate, - /*! QList< QVariant(EapQtCertificateInfo) > */ - UserCertificate, - /*! QList< QVariant(EapQtPluginHandle) > */ - InnerType, - /*! EapQtPluginHandle */ - OuterType, - /*! bool */ - ProvisioningModeAuthenticated, - /*! bool */ - ProvisioningModeUnauthenticated, - /*! QString */ - PACGroupReference, - /*! bool */ - WarnADHPNoPAC, - /*! bool */ - WarnADHPNoMatchingPAC, - /*! bool */ - WarnNotDefaultServer, - /*! bool */ - UseIdentityPrivacy, - /*! bool */ - AuthorityCertificateAutomatic, - /*! marker for the last entry */ - SettingsIdLast - }; - -public: - EapQtConfig(); - EapQtConfig(const EapQtConfig& other); - ~EapQtConfig(); - - QVariant value(SettingsId id); - void setValue(SettingsId id, QVariant newValue); - QList validate( - QList ids); - void clear(); - -public: // FOR TESTING PURPOSE - bool operator==(const EapQtConfig & rhs ) const; - -private: - QHash mSettings; -}; - -#endif diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfig_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * STUB: EAPWIZARD: EAP method QT configuration - * - */ - -/* - * %version: 3 % - */ - -#include "eapqtconfig.h" -#include -#include "eapqtcertificateinfo.h" -#include - -//---------------------------------------------------------------------------- -// EapQtConfig -//---------------------------------------------------------------------------- - -EapQtConfig::EapQtConfig() -{ -} - -EapQtConfig::EapQtConfig(const EapQtConfig &other) -{ - mSettings = other.mSettings; -} - -EapQtConfig::~EapQtConfig() -{ - // scoped pointer deleted automatically -} - -QVariant EapQtConfig::value(SettingsId id) -{ - // check for valid range, otherwise memory is consumed for no reason - if(id >= SettingsIdLast) { - qDebug("ERROR: EapQtConfig::value - invalid id!"); - return QVariant::Invalid; - } - return mSettings[id]; -} - -void EapQtConfig::setValue(SettingsId id, QVariant newValue) -{ - // check for valid range, otherwise memory is consumed for no reason - if(id < SettingsIdLast) { - mSettings[id] = newValue; - } else { - qDebug("ERROR: EapQtConfig::setValue - invalid id!"); - } - return; -} - -void EapQtConfig::clear() { - mSettings.clear(); - return; -} - -QList EapQtConfig::validate( - QList ids) -{ - Q_UNUSED(ids); - return QList(); -} - -bool EapQtConfig::operator==(const EapQtConfig & rhs ) const -{ - bool ret = true; - if (mSettings.size() != rhs.mSettings.size()) { - qWarning("EapQtConfig::operator==(): size: expect %d, actual %d ", - mSettings.size(), - rhs.mSettings.size() ); - ret = false; - } - QHashIterator i(mSettings); - - while (i.hasNext()) { - i.next(); - if (!rhs.mSettings.contains(i.key())){ - qWarning("EapQtConfig::operator==(): key not found: %d", i.key()); - ret = false; - - } - if (i.key() == EapQtConfig::InnerType) { - QList list1(mSettings[i.key()].toList()); - QList list2(rhs.mSettings[i.key()].toList()); - - if (list1.length() != 1 || list1.length() != list2.length()){ - qWarning("Invalid length in EapQtConfig::InnerType"); - ret = false; - } else { - EapQtPluginHandle handle1 = list1.at(0).value (); - EapQtPluginHandle handle2 = list2.at(0).value (); - if (handle1.pluginId() != handle2.pluginId()){ - qWarning("Outer: %d", handle1.pluginId()); - qWarning("Outer: %d", handle2.pluginId()); - ret = false; - } - } - } - else if (i.key() == EapQtConfig::OuterType) { - EapQtPluginHandle handle = mSettings[i.key()].value (); - EapQtPluginHandle handle2 = rhs.mSettings[i.key()].value (); - if (handle.pluginId() != handle2.pluginId()){ - qWarning("Outer: %d", handle.pluginId()); - qWarning("Outer: %d", handle2.pluginId()); - ret = false; - } - } - else if (i.key() == EapQtConfig::AuthorityCertificate || - i.key() == EapQtConfig::UserCertificate) { - QList list1(mSettings[i.key()].toList()); - QList list2(rhs.mSettings[i.key()].toList()); - - if (list1.length() != 1 || list1.length() != list2.length()) { - qWarning("Invalid length Certs %d", i.key()); - ret = false; - } else { - EapQtCertificateInfo cert1 = list1.at(0).value(); - EapQtCertificateInfo cert2 = list2.at(0).value(); - - if (!(cert1 == cert2)) { - ret = false; - qWarning("Invalid certs %d", i.key()); - } - } - } - else { - if (i.value() != rhs.mSettings[i.key()]){ - qWarning("EapQtConfig::operator==(): values does not match %d", i.key()); - qDebug() << "Expect: " << i.value(); - qDebug() << "Actual: " << rhs.mSettings[i.key()]; - ret = false; - } - } - } - return ret; -} - - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * EAP method configuration QT interface - * - */ - -/* - * %version: 5 % - */ - -#ifndef EAPQTCONFIGINTERFACE_H -#define EAPQTCONFIGINTERFACE_H - -#include -#include -#include -#include -#include -#include "eapqtconfig.h" -#include "eapqtpacstoreconfig.h" -#include "eapqtcertificateinfo.h" -#include "eapqtvalidator.h" - -class EapQtConfigInterfaceContext; -/*! - * @addtogroup group_eap_config_api - * @{ - */ - -/*! - */ -class EapQtConfigInterface -{ -public: - - enum EapBearerType - { - // EAP configuration interface for WLAN - EapBearerTypeWlan, - // EAP configuration interface for VPN - EapBearerTypeVpn, - }; - - static const int IapIdUndefined = -1; - -public: - EapQtConfigInterface(const EapBearerType bearerType, const int iapId); - ~EapQtConfigInterface(); - bool setConfigurationReference(const int iapId); - QList certificateAuthorityCertificates(); - QList userCertificates(); - - bool updateCertificates(); - - bool isSupportedOuterType(const EapQtPluginHandle& handle); - bool isSupportedInnerType(const EapQtPluginHandle& outerHandle, - const EapQtPluginHandle& innerHandle); - - bool setSelectedOuterTypes(const QList& outerHandles); - bool saveConfiguration(const EapQtPluginHandle& pluginHandle, EapQtConfig &config); - bool deleteConfiguration(); - EapQtValidator *validatorEap(EapQtExpandedEapType type, EapQtConfig::SettingsId id); - - bool readPacStoreConfiguration(EapQtPacStoreConfig &config); - bool savePacStoreConfiguration(EapQtPacStoreConfig &config); - EapQtValidator *validatorPacStore(EapQtPacStoreConfig::PacStoreSettings id); - -private: - Q_DISABLE_COPY(EapQtConfigInterface) - QStringList mCalledMethods; - - // setConfigurationReference - int mIapId; - bool mReturnSetConfigurationReference; - - // certificateAuthorityCertificates - QList mCertsCa; - - // userCertificates - QList mCertsUser; - - // isSupportedOuterType - QList mSupportedOuterTypes; - - // isSupportedInnerType - QList mSupportedInnerTypes; - int mSupportedInnerTypesOuterHandle; - - // setSelectedOuterTypes - QList mSetSelectectedOuterTypes; - bool mReturnSetSelectedOuterTypes; - - // saveConfiguration - EapQtPluginHandle::Plugin mOuterPlugin; - EapQtConfig mSaveConfigurationsOuter; - bool mReturnSaveConfigurationOuter; - EapQtPluginHandle::Plugin mInnerPlugin; - EapQtConfig mSaveConfigurationsInner; - bool mReturnSaveConfigurationInner; - - // validatorEap - QHash > mValidator; - - // readPacStoreConfiguration - EapQtPacStoreConfig mReadPacStoreConfiguration; - bool mReadPacStoreConfigurationReturn; - - // savePacStoreConfiguration - EapQtPacStoreConfig mSavePacStoreConfiguration; - bool mSavePacStoreConfigurationReturn; - - // validatorPacStore, key: EapQtPacStoreConfig::PacStoreSettings - QHash mValidatorPacStore; - - friend class EapQtConfigInterfaceContext; -}; - -/*! @} */ - -#endif - - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,422 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ -#include - -#include "eapqtconfiginterface_context.h" -#include "eapqtvalidator_stub.h" -#include "eapqtexpandedeaptype.h" - -EapQtConfigInterfaceContext::EapQtConfigInterfaceContext() : - mEapQtConfig(NULL) -{ -} - -EapQtConfigInterfaceContext::~EapQtConfigInterfaceContext() -{ - mEapQtConfig->mValidator.clear(); -} - -void EapQtConfigInterfaceContext::setObject(EapQtConfigInterface *eapQtConfig) -{ - mEapQtConfig = eapQtConfig; -} - -void EapQtConfigInterfaceContext::createEapAkaSim(int type) -{ - QList types; - types.append((EapQtPluginHandle::Plugin)type); - setSupportedOuterTypes(types); - - setSelectectedOuterTypes(types, true); - - EapQtConfig config; - config.setValue(EapQtConfig::UsernameAutomatic, true); - config.setValue(EapQtConfig::RealmAutomatic, true); - setOuterConfig((EapQtPluginHandle::Plugin)type, config, true); -} - -void EapQtConfigInterfaceContext::createLeap( - const QString& username, - const QString& passwd) -{ - QList types; - types.append(EapQtPluginHandle::PluginLeap); - setSupportedOuterTypes(types); - - setSelectectedOuterTypes(types, true); - - EapQtConfig config; - config.setValue(EapQtConfig::UsernameAutomatic, false); - config.setValue(EapQtConfig::Username, username); - config.setValue(EapQtConfig::PasswordPrompt, false); - config.setValue(EapQtConfig::Password, passwd); - setOuterConfig(EapQtPluginHandle::PluginLeap, config, true); - - // validators - createInnerTypeValidators(EapQtPluginHandle::PluginLeap); -} - -void EapQtConfigInterfaceContext::createEapIdentifyValidators(EapQtPluginHandle::Plugin outerType) -{ - EapQtPluginHandle typeHandle(outerType); - - EapQtValidatorStub *valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); - setValidator(typeHandle.type().type(), EapQtConfig::Username, valStub); - - valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); - setValidator(typeHandle.type().type(), EapQtConfig::Realm, valStub); -} - -void EapQtConfigInterfaceContext::createEapTtlsPeap( - EapQtPluginHandle::Plugin type, - bool automaticCert, - bool usernameAutomatic, - const QString &username, - bool realmAutomatic, - const QString &realm, - EapQtPluginHandle::Plugin innerType) -{ - EapQtPluginHandle typeHandle(type); - - QList types; - types.append(typeHandle); - setSupportedOuterTypes(types); - setSelectectedOuterTypes(types, true); - - // Certs - QList certs; - EapQtCertificateInfo caCert; - caCert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super Cert"); - certs.append(caCert); - setCertsCa(certs); - - // CREATE VALIDATOR - createEapIdentifyValidators(type); - - // CREATE CONFIGURATION FOR TTLS/PEAP - - EapQtConfig config; - config.setValue(EapQtConfig::UseIdentityPrivacy, false); - config.setValue(EapQtConfig::VerifyServerRealm, false); - config.setValue(EapQtConfig::ClientAuthenticationRequired, false); - - config.setValue(EapQtConfig::UsernameAutomatic, usernameAutomatic); - config.setValue(EapQtConfig::Username, username); - config.setValue(EapQtConfig::RealmAutomatic, realmAutomatic); - config.setValue(EapQtConfig::Realm, realm); - if (automaticCert){ - config.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); - } - else { - QList caCerts; - caCerts.append(qVariantFromValue(caCert)); - config.setValue(EapQtConfig::AuthorityCertificate, caCerts); - config.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); - } - if (type == EapQtPluginHandle::PluginPeap){ - if (innerType == EapQtPluginHandle::PluginEapMschapv2){ - config.setValue(EapQtConfig::PeapVersion0Allowed, true); - config.setValue(EapQtConfig::PeapVersion1Allowed, false); - } - else { - config.setValue(EapQtConfig::PeapVersion0Allowed, false); - config.setValue(EapQtConfig::PeapVersion1Allowed, true); - } - config.setValue(EapQtConfig::PeapVersion2Allowed, false); - } - QList innerTypeList; - EapQtPluginHandle inner(innerType); - innerTypeList.append(qVariantFromValue(inner)); - config.setValue(EapQtConfig::InnerType, innerTypeList); - - setOuterConfig(type, config, true); -} - -void EapQtConfigInterfaceContext::createEapTls( - QList &caCerts, - int indexForCaCert, - QList &userCerts, - int indexForUserCert) -{ - QList types; - types.append(EapQtPluginHandle::PluginEapTls); - setSupportedOuterTypes(types); - setSelectectedOuterTypes(types, true); - - // Certs - setCertsCa(caCerts); - setCertsUser(userCerts); - - // CREATE VALIDATOR - createEapIdentifyValidators(EapQtPluginHandle::PluginEapTls); - - // CREATE CONFIGURATION FOR TTLS/PEAP - - EapQtConfig config; - config.setValue(EapQtConfig::UseIdentityPrivacy, false); - config.setValue(EapQtConfig::VerifyServerRealm, false); - config.setValue(EapQtConfig::ClientAuthenticationRequired, true); - - config.setValue(EapQtConfig::UsernameAutomatic, true); - config.setValue(EapQtConfig::Username, QString()); - config.setValue(EapQtConfig::RealmAutomatic, true); - config.setValue(EapQtConfig::Realm, QString()); - - if (caCerts.length() == 0){ - config.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); - } else { - QList caCertsVariant; - caCertsVariant.append(qVariantFromValue(caCerts[indexForCaCert])); - config.setValue(EapQtConfig::AuthorityCertificate, caCertsVariant); - config.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); - } - - if (indexForUserCert != -1) { - QList certs; - certs.append(qVariantFromValue(userCerts[indexForUserCert])); - config.setValue(EapQtConfig::UserCertificate, certs); - } - - setOuterConfig(EapQtPluginHandle::PluginEapTls, config, true); -} - -void EapQtConfigInterfaceContext::createInner( - EapQtPluginHandle::Plugin outerType, - EapQtPluginHandle::Plugin innerType, - const QString &username, - const QString &password) -{ - EapQtPluginHandle innerHandle(innerType); - - QList types; - types.append(innerHandle); - setSupportedInnerTypes(outerType, types); - - EapQtConfig config; - EapQtPluginHandle outerTypeHandle(outerType); - config.setValue(EapQtConfig::OuterType, qVariantFromValue(outerTypeHandle)); - config.setValue(EapQtConfig::UsernameAutomatic, false); - config.setValue(EapQtConfig::Username, username); - config.setValue(EapQtConfig::PasswordPrompt, false); - config.setValue(EapQtConfig::Password, password); - setInnerConfig(innerType, config, true); - - createInnerTypeValidators(innerType); -} - -void EapQtConfigInterfaceContext::createInnerTypeValidators(EapQtPluginHandle::Plugin innerType) -{ - EapQtPluginHandle innerHandle(innerType); - - // validators - EapQtValidatorStub *valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); - setValidator(innerHandle.type().type(), EapQtConfig::Username, valStub); - - valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); - setValidator(innerHandle.type().type(), EapQtConfig::Password, valStub); -} - -void EapQtConfigInterfaceContext::createEapFast( - int pacState, const QString &password) -{ - QList types; - types.append(EapQtPluginHandle::PluginEapFast); - setSupportedOuterTypes(types); - setSelectectedOuterTypes(types, true); - - EapQtPacStoreConfig pacStoreConfig; - pacStoreConfig.setValue(EapQtPacStoreConfig::PacStoreState, pacState); - setPacStoreConfigRead(pacStoreConfig, true); - - if (pacState == EapQtPacStoreConfig::PacStoreStateStoreNotExists || - pacState == EapQtPacStoreConfig::PacStoreStatePasswordRequired) { - pacStoreConfig.clear(); - pacStoreConfig.setValue( - EapQtPacStoreConfig::PacStorePassword, - password); - - pacStoreConfig.setValue( - EapQtPacStoreConfig::PacStoreSavePassword, - true); - - setPacStoreConfigSave(pacStoreConfig, true); - } - - if (pacState == EapQtPacStoreConfig::PacStoreStateStoreNotExists) { - EapQtValidatorStub *validator = new EapQtValidatorStub(EapQtValidator::StatusOk); - setValidatorPacStore(EapQtPacStoreConfig::PacStorePassword, validator); - } - - if (pacState == EapQtPacStoreConfig::PacStoreStatePasswordRequired) { - EapQtValidatorStub *validator = new EapQtValidatorStub(EapQtValidator::StatusOk); - setValidatorPacStore(EapQtPacStoreConfig::PacStorePasswordConfirmation, validator); - } - - EapQtConfig config; - config.setValue(EapQtConfig::ProvisioningModeAuthenticated, false); - config.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true); - config.setValue(EapQtConfig::VerifyServerRealm, false); - config.setValue(EapQtConfig::UseIdentityPrivacy, false); - - QList innerTypeList; - EapQtPluginHandle inner(EapQtPluginHandle::PluginEapMschapv2); - innerTypeList.append(qVariantFromValue(inner)); - config.setValue(EapQtConfig::InnerType, innerTypeList); - - setOuterConfig(EapQtPluginHandle::PluginEapFast, config, true); -} - -QStringList EapQtConfigInterfaceContext::calledMethods() -{ - QStringList methods = mEapQtConfig->mCalledMethods; - mEapQtConfig->mCalledMethods.clear(); - return methods; -} - -void EapQtConfigInterfaceContext::setConfigurationReference( - int iapId, - bool retValue) -{ - mEapQtConfig->mIapId = iapId; - setConfigurationReferenceReturn(retValue); -} - -void EapQtConfigInterfaceContext::setConfigurationReferenceReturn(bool retValue) -{ - mEapQtConfig->mReturnSetConfigurationReference = retValue; -} - -void EapQtConfigInterfaceContext::setCertsCa( - QList &certs) -{ - mEapQtConfig->mCertsCa = certs; -} - -void EapQtConfigInterfaceContext::setCertsUser( - QList &certs) -{ - mEapQtConfig->mCertsUser = certs; -} - -void EapQtConfigInterfaceContext::setSupportedOuterTypes( - QList &outerTypes) -{ - mEapQtConfig->mSupportedOuterTypes = outerTypes; -} - -void EapQtConfigInterfaceContext::setSupportedInnerTypes( - EapQtPluginHandle outerHandle, - QList &innerTypes) -{ - mEapQtConfig->mSupportedInnerTypes = innerTypes; - mEapQtConfig->mSupportedInnerTypesOuterHandle = outerHandle.pluginId(); -} - -void EapQtConfigInterfaceContext::setSelectectedOuterTypes( - QList &types, - bool retValue) -{ - mEapQtConfig->mSetSelectectedOuterTypes = types; - setSelectectedOuterTypesReturn(retValue); -} - -void EapQtConfigInterfaceContext::setSelectectedOuterTypesReturn(bool retValue) -{ - mEapQtConfig->mReturnSetSelectedOuterTypes = retValue; -} - -void EapQtConfigInterfaceContext::setOuterConfig( - EapQtPluginHandle::Plugin handle, - EapQtConfig &config, - bool retValue) -{ - mEapQtConfig->mOuterPlugin = handle; - mEapQtConfig->mSaveConfigurationsOuter = config; - setOuterConfigReturn(retValue); -} - -void EapQtConfigInterfaceContext::setOuterConfigReturn(bool retValue) -{ - mEapQtConfig->mReturnSaveConfigurationOuter = retValue; -} - -void EapQtConfigInterfaceContext::setInnerConfig( - EapQtPluginHandle::Plugin handle, - EapQtConfig &config, - bool retValue) -{ - mEapQtConfig->mInnerPlugin = handle; - mEapQtConfig->mSaveConfigurationsInner = config; - setInnerConfigReturn(retValue); -} - -void EapQtConfigInterfaceContext::setInnerConfigReturn(bool retValue) -{ - mEapQtConfig->mReturnSaveConfigurationInner = retValue; -} - -void EapQtConfigInterfaceContext::setValidator( - EapQtExpandedEapType::Type eapType, - EapQtConfig::SettingsId id, - EapQtValidator *validator) -{ - QCOMPARE(mEapQtConfig->mValidator[eapType][id] == NULL, true); - mEapQtConfig->mValidator[eapType][id] = validator; -} - - -EapQtValidator *EapQtConfigInterfaceContext::validator( - EapQtExpandedEapType::Type eapType, - EapQtConfig::SettingsId id) -{ - return mEapQtConfig->mValidator[eapType][id]; -} - -void EapQtConfigInterfaceContext::setPacStoreConfigRead( - EapQtPacStoreConfig &config, - bool retValue) -{ - mEapQtConfig->mReadPacStoreConfiguration = config; - setPacStoreConfigReadReturn(retValue); -} - -void EapQtConfigInterfaceContext::setPacStoreConfigReadReturn(bool retValue) -{ - mEapQtConfig->mReadPacStoreConfigurationReturn = retValue; -} - -void EapQtConfigInterfaceContext::setPacStoreConfigSave( - EapQtPacStoreConfig &config, - bool retValue) -{ - mEapQtConfig->mSavePacStoreConfiguration = config; - setPacStoreConfigSaveReturn(retValue); -} - -void EapQtConfigInterfaceContext::setPacStoreConfigSaveReturn(bool retValue) -{ - mEapQtConfig->mSavePacStoreConfigurationReturn = retValue; -} - -void EapQtConfigInterfaceContext::setValidatorPacStore(int id, EapQtValidator * validator) -{ - mEapQtConfig->mValidatorPacStore[id] = validator; -} - -EapQtValidator *EapQtConfigInterfaceContext::validatorPacStore(int id) -{ - return mEapQtConfig->mValidatorPacStore[id]; -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_context.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -*/ - -#ifndef EAPQTCONFIGINTERFACE_CONTEXT_H -#define EAPQTCONFIGINTERFACE_CONTEXT_H - -#include "eapqtconfiginterface.h" -#include "eapqtpacstoreconfig.h" - -class EapQtConfigInterfaceContext -{ -public: - EapQtConfigInterfaceContext(); - ~EapQtConfigInterfaceContext(); - - void setObject(EapQtConfigInterface *eapQtConfig); - -public: // Helpper methods to create simple valid configurations - void createEapAkaSim(int pluginHandleEnum); - - void createLeap(const QString& username, const QString& passwd); - - void createEapIdentifyValidators(EapQtPluginHandle::Plugin outerType); - - void createEapTtlsPeap( - EapQtPluginHandle::Plugin type, - bool automaticCert, - bool usernameAutomatic, - const QString &username, - bool realmAutomatic, - const QString &realm, - EapQtPluginHandle::Plugin innerType); - - void createEapTls( - QList &caCerts, - int indexForCaCert, - QList &userCerts, - int indexForUserCert); - - void createInner( - EapQtPluginHandle::Plugin outerType, - EapQtPluginHandle::Plugin innerType, - const QString &username, - const QString &password); - - void createInnerTypeValidators(EapQtPluginHandle::Plugin innerType); - - void createEapFast(int pacState, const QString &password = QString()); - -public: // Methods to set the exact behavior of the interface - QStringList calledMethods(); - void setConfigurationReference(int iapId, bool retValue); - void setConfigurationReferenceReturn(bool retValue); - void setCertsCa(QList &certs); - void setCertsUser(QList &certs); - void setSupportedOuterTypes(QList &outerTypes); - void setSupportedInnerTypes(EapQtPluginHandle outerHandle, QList &innerTypes); - void setSelectectedOuterTypes(QList &types, bool retValue); - void setSelectectedOuterTypesReturn(bool retValue); - void setOuterConfig(EapQtPluginHandle::Plugin handle, EapQtConfig &config, bool retValue); - void setOuterConfigReturn(bool retValue); - void setInnerConfig(EapQtPluginHandle::Plugin handle, EapQtConfig &config, bool retValue); - void setInnerConfigReturn(bool retValue); - // Moved ownership to context - void setValidator( - EapQtExpandedEapType::Type eapType, - EapQtConfig::SettingsId, - EapQtValidator *validator); - - EapQtValidator *validator( - EapQtExpandedEapType::Type eapType, - EapQtConfig::SettingsId id); - - void setPacStoreConfigRead(EapQtPacStoreConfig &config, bool retValue); - void setPacStoreConfigReadReturn(bool retValue); - void setPacStoreConfigSave(EapQtPacStoreConfig &config, bool retValue); - void setPacStoreConfigSaveReturn(bool retValue); - void setValidatorPacStore(int id, EapQtValidator * validator); - - EapQtValidator *validatorPacStore(int id); - - -private: - EapQtConfigInterface* mEapQtConfig; -}; - -#endif /* EAPQTCONFIGINTERFACE_CONTEXT_H */ - -// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtconfiginterface_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Stub for EAP method configuration QT interface - * - */ - -/* - * %version: 5 % - */ - -#include -#include -#include -#include "eapqtconfiginterface.h" - -//---------------------------------------------------------------------------- -// EapQtConfigInterface -//---------------------------------------------------------------------------- - -EapQtConfigInterface::EapQtConfigInterface( - const EapBearerType bearerType, - const int iapId) -{ - mCalledMethods.append("EapQtConfigInterface"); - QCOMPARE(bearerType, EapQtConfigInterface::EapBearerTypeWlan); - QCOMPARE(iapId, EapQtConfigInterface::IapIdUndefined); -} - -EapQtConfigInterface::~EapQtConfigInterface() -{ - mCalledMethods.append("~EapQtConfigInterface"); -} - -bool EapQtConfigInterface::setConfigurationReference(const int iapId) -{ - mCalledMethods.append("setConfigurationReference"); - QCOMPARE(iapId, mIapId); - - return mReturnSetConfigurationReference; -} - -QList EapQtConfigInterface::certificateAuthorityCertificates() -{ - mCalledMethods.append("certificateAuthorityCertificates"); - return mCertsCa; -} - -QList EapQtConfigInterface::userCertificates() -{ - mCalledMethods.append("userCertificates"); - return mCertsUser; -} - - -bool EapQtConfigInterface::updateCertificates() -{ - mCalledMethods.append("updateCertificates"); - return true; -} - -bool EapQtConfigInterface::isSupportedOuterType(const EapQtPluginHandle& handle) -{ - mCalledMethods.append("isSupportedOuterType"); - return mSupportedOuterTypes.contains(handle); -} - -bool EapQtConfigInterface::isSupportedInnerType( - const EapQtPluginHandle& outerHandle, - const EapQtPluginHandle& innerHandle) -{ - mCalledMethods.append("isSupportedOuterType"); - QCOMPARE(mSupportedInnerTypesOuterHandle, (int)outerHandle.pluginId()); - return mSupportedInnerTypes.contains(innerHandle); -} - -bool EapQtConfigInterface::setSelectedOuterTypes( - const QList& outerHandles) -{ - mCalledMethods.append("setSelectedOuterTypes"); - QCOMPARE(mSetSelectectedOuterTypes, outerHandles); - return mReturnSetSelectedOuterTypes; -} - -bool EapQtConfigInterface::saveConfiguration( - const EapQtPluginHandle& pluginInfo, - EapQtConfig &config) -{ - mCalledMethods.append("saveConfiguration"); - - if (pluginInfo == mOuterPlugin) { - QCOMPARE(config == mSaveConfigurationsOuter, true); - return mReturnSaveConfigurationOuter; - } else { - QCOMPARE(pluginInfo == mInnerPlugin, true); - QCOMPARE(config == mSaveConfigurationsInner, true); - return mReturnSaveConfigurationInner; - } -} - -bool EapQtConfigInterface::deleteConfiguration() -{ - mCalledMethods.append("deleteConfiguration"); - return true; -} - -EapQtValidator *EapQtConfigInterface::validatorEap( - EapQtExpandedEapType type, - EapQtConfig::SettingsId id) -{ - mCalledMethods.append("validatorEap"); - - QCOMPARE(mValidator[type.type()][id] != NULL, true); - EapQtValidator *validator = mValidator[type.type()][id]; - mValidator[type.type()].remove(id); - return validator; -} - - -bool EapQtConfigInterface::readPacStoreConfiguration(EapQtPacStoreConfig &config) -{ - config = mReadPacStoreConfiguration; - return mReadPacStoreConfigurationReturn; -} - -bool EapQtConfigInterface::savePacStoreConfiguration(EapQtPacStoreConfig &config) -{ - QCOMPARE(config == mSavePacStoreConfiguration, true); - return mSavePacStoreConfigurationReturn; -} - -EapQtValidator *EapQtConfigInterface::validatorPacStore( - EapQtPacStoreConfig::PacStoreSettings id) -{ - mCalledMethods.append("validatorPacStore"); - - QCOMPARE(mValidatorPacStore.contains(id), true); - EapQtValidator *validator = mValidatorPacStore[id]; - mValidatorPacStore.remove(id); - return validator; -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * EAP-FAST PAC store configuration data - * - */ - -/* - * %version: 2 % - */ - -#ifndef EAPQTPACSTORECONFIG_H -#define EAPQTPACSTORECONFIG_H - -#include - -class EapQtPacStoreConfig -{ -public: - - // PAC store is global, i.e. only a single PAC store exists in a device - - enum PacStoreState - { - // PAC store does not exist and needs to be created - PacStoreStateStoreNotExists = 0, - // PAC store exists but the password has not been stored and - // is needed to access the PAC store - PacStoreStatePasswordRequired, - // PAC store password has been stored to settings database - // and is not needed to use the PAC store - PacStoreStatePasswordStored, - // TODO: remove? delete automatically if corrupted - // Existing PAC store is corrupted and should be reset - PacStoreStateCorrupted, - // marker for the last item - PacStoreStateLast - }; - - enum PacStoreSettings - { - /*! write-only: QString - * password to be used for accessing the PAC store - * - must be new password if the read PacStoreState is PacStoreStateStoreNotExists - * - must be password of the existing PAC store if the PacStoreState state is - * PacStoreStatePasswordRequired */ - PacStorePassword = 0, - /*! write-only: bool - * true: saves the password given in settings - * false: clears the earlier stored password from database, i.e. password - * will be prompted when needed, PAC store itself remains valid - * QVariant::Invalid: no actions */ - PacStoreSavePassword, - /*! write-only: bool - * true: deletes PAC store, i.e. clears everything related to the - * existing PAC store inlcuding saved password - * false/QVariant::Invalid: no actions */ - PacStoreReset, - /*! read-only: int (PacStoreState) */ - PacStoreState, - /*! no write nor read operation, for validator usage only - * - uses the validator to check if the given password - * can open the existing PAC store */ - PacStorePasswordConfirmation, - // marker for the last item - PacStoreLast - }; - -public: - EapQtPacStoreConfig(); - ~EapQtPacStoreConfig(); - - QVariant value(PacStoreSettings id); - void setValue(PacStoreSettings id, QVariant newValue); - void clear(); - -public: // FOR TESTING PURPOSE - bool operator==(const EapQtPacStoreConfig & rhs ) const; - bool operator=(const EapQtPacStoreConfig & rhs ); - -private: - QHash mPacStoreSettings; -}; - -#endif /* EAPQTPACSTORECONFIG_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtpacstoreconfig_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * EAP-FAST PAC store configuration data - * - */ - -/* - * %version: 2 % - */ -#include -#include - -EapQtPacStoreConfig::EapQtPacStoreConfig() -{ -} - -EapQtPacStoreConfig::~EapQtPacStoreConfig() -{ - // scoped pointer deleted automatically -} - -QVariant EapQtPacStoreConfig::value(PacStoreSettings id) -{ - // check for valid range, otherwise memory is consumed for no reason - if(id >= PacStoreLast) { - qDebug("ERROR: EapQtPacStoreConfig::value - invalid id!"); - return QVariant::Invalid; - } - return mPacStoreSettings[id]; -} - -void EapQtPacStoreConfig::setValue(PacStoreSettings id, QVariant newValue) -{ - // check for valid range, otherwise memory is consumed for no reason - if(id < PacStoreLast) { - mPacStoreSettings[id] = newValue; - } else { - qDebug("ERROR: EapQtPacStoreConfig::setValue - invalid id!"); - } -} - -void EapQtPacStoreConfig::clear() { - mPacStoreSettings.clear(); -} - -bool EapQtPacStoreConfig::operator==(const EapQtPacStoreConfig & rhs ) const -{ - bool ret = true; - if (mPacStoreSettings.size() != rhs.mPacStoreSettings.size()) { - qWarning("EapQtPacStoreConfig::operator==(): size: expect %d, actual %d ", - mPacStoreSettings.size(), - rhs.mPacStoreSettings.size() ); - ret = false; - } - QHashIterator i(mPacStoreSettings); - - while (i.hasNext()) { - i.next(); - if (!rhs.mPacStoreSettings.contains(i.key())){ - qWarning("EapQtPacStoreConfig::operator==(): key not found: %d", i.key()); - ret = false; - - } - if (i.value() != rhs.mPacStoreSettings[i.key()]){ - qWarning("EapQtPacStoreConfig::operator==(): values not match"); - qDebug() << "Expect: " << i.value(); - qDebug() << "Actual: " << rhs.mPacStoreSettings[i.key()]; - ret = false; - } - } - return ret; -} - - -bool EapQtPacStoreConfig::operator=(const EapQtPacStoreConfig & rhs ) -{ - mPacStoreSettings = rhs.mPacStoreSettings; -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Stub for EAP WIZARD testing: EAP QT configuration validator interface - * - */ - -/* - * %version: 2 % - */ - -#ifndef EAPQTVALIDATOR_H -#define EAPQTVALIDATOR_H - -#include -#include - -/*! - * @addtogroup group_eap_config_api - * @{ - */ - -class HbLineEdit; - -/*! - * Eap Qt Validator interface. This interface provides a method to configure - * the editor to use required constraints, hints, editor classes and so one - * depending on the EAP type and the configuration identifier. - * See updateEditor() method for further details. - * - * Another important method of this class is the validate() method. With - * that method you can check that the content and format is valid for - * given configuration compination. - * - * An instance of validator can be created with - * EapQtConfigInterface::validatorEap() method. - */ - -class EapQtValidator -{ -public: - - /*! - * Validation status. - */ - enum Status { - /// Ok - StatusOk, - /// Content is invalid - StatusInvalid, - /// The length is not valid - StatusInvalidLength, - /// Invalid characters detected - StatusInvalidCharacters, - /// Input is too short - StatusTooShort, - /// Input is too long - StatusTooLong, - }; - -public: - - EapQtValidator() {}; - virtual ~EapQtValidator() {}; - virtual Status validate(QVariant value) = 0; - virtual void updateEditor(HbLineEdit* edit) = 0; - -private: - - Q_DISABLE_COPY(EapQtValidator) -}; - -/*! @} */ - -#endif diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * EAP method validator: Stub or EapWizard testing - * - */ - -#include "eapqtvalidator_stub.h" - -EapQtValidatorStub::EapQtValidatorStub( - EapQtValidator::Status status) : - mStatus(status) -{ -} - -EapQtValidatorStub::~EapQtValidatorStub() -{ -} - -EapQtValidator::Status EapQtValidatorStub::validate(QVariant value) -{ - Q_UNUSED(value); - return mStatus; -} - -void EapQtValidatorStub::updateEditor(HbLineEdit *edit) -{ - Q_UNUSED(edit); -} - -void EapQtValidatorStub::setReturnValue(EapQtValidator::Status status) -{ - mStatus = status; -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/eapqtvalidator_stub.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Stub for EAP WIZARD testing: EAP QT configuration validator interface - * - */ - -/* - * %version: 2 % - */ - -#ifndef EAPQTVALIDATOR_STUB_H -#define EAPQTVALIDATOR_STUB_H - -#include - -/*! - * @addtogroup group_eap_config_api - * @{ - */ - -class HbLineEdit; - -class EapQtValidatorStub : public EapQtValidator -{ - -public: - - EapQtValidatorStub(EapQtValidator::Status status); - ~EapQtValidatorStub(); - virtual EapQtValidator::Status validate(QVariant value); - void updateEditor(HbLineEdit* edit ); - void setReturnValue(EapQtValidator::Status status); - -private: - EapQtValidator::Status mStatus; - Q_DISABLE_COPY(EapQtValidatorStub) -}; - -/*! @} */ - -#endif diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/stubs.pri --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/stubs.pri Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# -# Description: -# Stubs for Wlan wizard testing -# - -DEFINES += BUILD_WLANQTUTILITIES_DLL - -HEADERS += \ - stubs/eapqtcertificateinfo.h \ - stubs/eapqtconfig.h \ - stubs/eapqtconfiginterface.h \ - stubs/eapqtconfiginterface_context.h \ - stubs/eapqtpacstoreconfig.h \ - stubs/eapqtvalidator.h \ - stubs/eapqtvalidator_stub.h \ - stubs/wlanmgmtclient.h \ - stubs/wlanmgmtclient_context.h \ - stubs/wlanqtutils.h \ - stubs/wlanqtutils_context.h \ - stubs/wlanqtutilsap.h \ - stubs/wlanqtutilscommon.h - -SOURCES += \ - stubs/eapqtcertificateinfo_stub.cpp \ - stubs/eapqtconfig_stub.cpp \ - stubs/eapqtconfiginterface_stub.cpp \ - stubs/eapqtconfiginterface_context.cpp \ - stubs/eapqtpacstoreconfig_stub.cpp \ - stubs/eapqtvalidator_stub.cpp \ - stubs/wlanmgmtclient_stub.cpp \ - stubs/wlanmgmtclient_context.cpp \ - stubs/wlanqtutils_context.cpp \ - stubs/wlanqtutils_stub.cpp \ - stubs/wlanqtutilsap_stub.cpp diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* WLAN Management API stubbing for WLAN Qt Utilities. -*/ - -#ifndef WLANMGMTCLIENT_H -#define WLANMGMTCLIENT_H - -#include "wlanmgmtcommon.h" -#include "wlanscaninfo.h" - -class WlanMgmtClientContext; - -// CLASS DECLARATION - -class CWlanMgmtClient : public CBase - { - public: // Methods - - // Constructors and destructor - - /** - * Static constructor. - * @return Pointer to the constructed object. - */ - static CWlanMgmtClient* NewL(); - - /** - * Destructor. - */ - ~CWlanMgmtClient(); - - /** - * Start Protected Setup. - * - * @param aStatus Status of the calling active object. On successful - * completion contains KErrNone, otherwise one of the - * system-wide error codes. - * @param aSsid SSID of the network to configure. - * @param aWpsPin PIN value to be used. "00000000" (string of eight zeros) - * if push button method is used. - * @param aCredentials Results of a successful Protected Setup operation. - * @sa \link psetup Protected Setup-specific error codes \endlink. - */ - virtual void RunProtectedSetup( - TRequestStatus& aStatus, - const TWlanSsid& aSsid, - const TWlanWpsPin& aWpsPin, - CArrayFixSeg& aCredentials ); - - /** - * Cancel an outstanding Protected Setup operation. - */ - virtual void CancelProtectedSetup(); - - private: // Data - - CWlanMgmtClient(); - CArrayFixSeg *iResults; - TWlanSsid iSsid; - TInt iCompletionCode; - - friend class WlanMgmtClientContext; - }; - -#endif // WLANMGMTCLIENT_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ -#include - -#include "wlanmgmtclient_context.h" - -WlanMgmtClientContext::WlanMgmtClientContext() : - mWlanMgmtClient(NULL) -{ -} - -WlanMgmtClientContext::~WlanMgmtClientContext() -{ -} - -void WlanMgmtClientContext::setObject(CWlanMgmtClient *wlanMgmtClient) -{ - mWlanMgmtClient = wlanMgmtClient; -} - - -void WlanMgmtClientContext::setRunProtectedSetup(const QString &ssid, int completionCode) -{ - mWlanMgmtClient->iSsid.Copy((unsigned char*)ssid.toAscii().constData()); - mWlanMgmtClient->iCompletionCode = completionCode; -} - -void WlanMgmtClientContext::appendResult( - const QString &ssid, - int securityMode, - int operatingMode, - int defaultWepKeyIndex, - const QString &wepKey1, - const QString &wepKey2, - const QString &wepKey3, - const QString &wepKey4, - const QString &wpaKey) -{ - TWlanProtectedSetupCredentialAttribute attr; - - attr.iOperatingMode =(TWlanOperatingMode)operatingMode; - attr.iSecurityMode = (TWlanIapSecurityMode)securityMode; - - attr.iSsid.Copy( - (unsigned char*)ssid.toLatin1().constData(), - ssid.length()); - - attr.iWepKey1.Copy( - (unsigned char*)wepKey1.toLatin1().constData(), - wepKey1.length()); - - attr.iWepKey2.Copy( - (unsigned char*)wepKey2.toLatin1().constData(), - wepKey2.length()); - - attr.iWepKey3.Copy( - (unsigned char*)wepKey3.toLatin1().constData(), - wepKey3.length()); - - attr.iWepKey4.Copy( - (unsigned char*)wepKey4.toLatin1().constData(), - wepKey4.length()); - - attr.iWepDefaultKey = (TWlanDefaultWepKey)defaultWepKeyIndex; - - attr.iWpaPreSharedKey.Copy( - (unsigned char*)wpaKey.toLatin1().constData(), - wpaKey.length()); - - mWlanMgmtClient->iResults->AppendL(attr); -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_context.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -*/ - -#ifndef WLANMGMTCLIENT_CONTEXT_H -#define WLANMGMTCLIENT_CONTEXT_H - -#include "wlanmgmtclient.h" - -class WlanMgmtClientContext -{ -public: - WlanMgmtClientContext(); - ~WlanMgmtClientContext(); - - void setObject(CWlanMgmtClient *eapQtConfig); -public: - - void setRunProtectedSetup(const QString &ssid, int completionCode); - void appendResult( - const QString &ssid, - int securityMode, - int operatingMode, - int defaultWepKeyIndex, - const QString &wepKey1 = QString(), - const QString &wepKey2 = QString(), - const QString &wepKey3 = QString(), - const QString &wepKey4 = QString(), - const QString &wpaKey = QString()); - -private: - CWlanMgmtClient* mWlanMgmtClient; - -}; - -#endif /* WLANMGMTCLIENT_CONTEXT_H */ - -// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanmgmtclient_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* WLAN Management API stubbing for WLAN Qt Utilities. -*/ - -#include - -#include -#include -#include -#include "wlanmgmtclient.h" -#include "testwlanwizardcontext.h" - -// --------------------------------------------------------- -// CWlanScanRequest::NewL -// --------------------------------------------------------- -// -CWlanMgmtClient* CWlanMgmtClient::NewL() - { - CWlanMgmtClient* self = new CWlanMgmtClient; - - TestWlanWizardContext::setWlanMgmtClientObject(self); - return self; - } - -// --------------------------------------------------------- -// CWlanScanRequest::~CWlanMgmtClient -// --------------------------------------------------------- -// -CWlanMgmtClient::~CWlanMgmtClient() - { - delete iResults; - } - -// --------------------------------------------------------- -// CWlanScanRequest::CWlanMgmtClient -// --------------------------------------------------------- -// -CWlanMgmtClient::CWlanMgmtClient() - { - iResults = new (ELeave) CArrayFixSeg (4); - } - -// --------------------------------------------------------- -// CWlanScanRequest::RunProtectedSetup -// --------------------------------------------------------- -// -void CWlanMgmtClient::RunProtectedSetup( - TRequestStatus& aStatus, - const TWlanSsid& aSsid, - const TWlanWpsPin& aWpsPin, - CArrayFixSeg& aCredentials ) -{ - Q_UNUSED(aWpsPin); - QCOMPARE(aSsid, iSsid); - for (int i = 0 ; i < iResults->Count() ; ++i){ - aCredentials.AppendL(iResults->At(i)); - } - User::RequestComplete(&aStatus, iCompletionCode); -} - -// --------------------------------------------------------- -// CWlanScanRequest::CancelProtectedSetup -// --------------------------------------------------------- -// -void CWlanMgmtClient::CancelProtectedSetup() - { - // TODO - //User::RequestComplete(iStubRequestStatus, KErrCancel); - //iStubRequestStatus = 0; - } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -*/ - -#ifndef STUB_WLANQTUTILS_H -#define STUB_WLANQTUTILS_H - -#include -#include -#include -#include - -#include "wlanqtutilscommon.h" -#include "wlanqtutilsap.h" - -class WlanQtUtilsIap; -class WlanQtUtilsWlanIap; - -class WLANQTUTILITIESDLL_EXPORT WlanQtUtils : public QObject -{ - Q_OBJECT - friend class WlanQtUtilsContext; -public: - //! "None" IAP ID value (e.g. for "not found" cases) - static const int IapIdNone = -1; - - /*! - WLAN connection status. - Remember to update traces/trace.properties when modifying this enum. - */ - enum ConnStatus { - ConnStatusNone = 0, //!< Reserved. - ConnStatusConnecting, //!< Connecting. - ConnStatusConnected, //!< Connected. - ConnStatusDisconnected //!< Disconnected. - }; - - /*! - WLAN scan status - Remember to update traces/trace.properties when modifying this enum. - */ - enum ScanStatus { - ScanStatusOk = 0, //!< Scan succeeded. - ScanStatusCancelled, //!< Scan was cancelled. - ScanStatusError //!< Scan failed. - }; - - /*! - Internet Connectivity Test status. - Remember to update traces/trace.properties when modifying this enum. - */ - enum IctStatus { - IctPassed = 0, //!< Normal ICT passed. - IctHotspotPassed, //!< Hotspot ICT passed. - IctCancelled, //!< ICT was cancelled. - IctFailed //!< ICT failed. - }; - -public: - WlanQtUtils(); - - ~WlanQtUtils(); - - void availableWlanAps( QList > &wlanApList); - - int createIap(const WlanQtUtilsAp *wlanAp); - - bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp); - - void deleteIap(int iapId); - - void connectIap(int iapId, bool runIct = false); - - int connectedWlanId(); - - void disconnectIap(int iapId); - - int activeIap(); - - void scanWlanAps(); - - void scanWlanDirect(const QString &ssid); - - void stopWlanScan(); - -signals: - - void wlanScanApReady(int scanStatus); - - void wlanScanDirectReady(int scanStatus); - - void wlanNetworkOpened(int iapId); - - void wlanNetworkClosed(int iapId, int reason); - - void ictResult(int iapId, int result); - -private: // Return values for all methods. - - void emitScanApsReady(); - - QList > mScanWlanAps; - QList > mScanWlanDirect; - QList > *mScanResult; - QString mScanWlanDirectSsid; - int mCreateWlanIapReturn; - bool mUpdateWlanIapReturn; - - int mWlanNetworkOpenedIapId; - int mWlanNetworkActiveIapId; - int mWlanNetworkClosedIapId; - int mWlanNetworkClosedReason; - - int mActiveWlanIapReturn; - - int mIctResultIapId; - WlanQtUtils::IctStatus mIctResultResults; - - bool mConnectionSuccess; - - QStringList mCalledMethods; - - WlanQtUtilsAp *mWlanAp; - - bool mEmitScanApReady; - - int mScanApStatus; - int mScanDirectStatus; -}; - -#endif /* WLANQTUTILS_H */ - -// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -*/ - - -#include "wlanqtutils_context.h" -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" - -WlanQtUtilsContext::WlanQtUtilsContext(WlanQtUtils *utils ) -: mUtils(utils) -{ - - -} - -WlanQtUtilsContext::~WlanQtUtilsContext() -{ - -} - -void WlanQtUtilsContext::setScanWlanApsResult( - QList > result ) -{ - mUtils->mScanWlanAps = result; -} - -void WlanQtUtilsContext::setScanWlanDirectResult( QString ssid, - QList > result ) -{ - mUtils->mScanWlanDirectSsid = ssid; - mUtils->mScanWlanDirect = result; -} - -void WlanQtUtilsContext::setCreateWlanIapResult(int iapId) -{ - mUtils->mCreateWlanIapReturn = iapId; - mUtils->mActiveWlanIapReturn = iapId; -} - -void WlanQtUtilsContext::setActiveWlanIapResult(int iapId) -{ - mUtils->mActiveWlanIapReturn = iapId; -} - -void WlanQtUtilsContext::setUpdateWlanIapResult(bool returnValue) -{ - mUtils->mUpdateWlanIapReturn = returnValue; -} - -void WlanQtUtilsContext::setConnectionSuccessed(bool value) -{ - mUtils->mConnectionSuccess = value; -} - -void WlanQtUtilsContext::setSignalWlanNetworkOpened(int iapId) -{ - mUtils->mWlanNetworkOpenedIapId = iapId; -} - -void WlanQtUtilsContext::setSignalWlanNetworkClosed(int iapId, int reason) -{ - mUtils->mWlanNetworkClosedIapId = iapId; - mUtils->mWlanNetworkClosedReason = reason; -} - -void WlanQtUtilsContext::setSignalIctResult(int iapId, WlanQtUtils::IctStatus result) -{ - mUtils->mIctResultIapId = iapId; - mUtils->mIctResultResults = result; -} - -void WlanQtUtilsContext::setScanApStatus(int status) -{ - mUtils->mScanApStatus = status; -} - -void WlanQtUtilsContext::setScanDirectStatus(int status) -{ - mUtils->mScanDirectStatus = status; -} - -void WlanQtUtilsContext::setImmediateApScanResult(bool immediate) -{ - mUtils->mEmitScanApReady = immediate; -} - -void WlanQtUtilsContext::emitScanApReady() -{ - mUtils->emitScanApsReady(); -} - -QStringList WlanQtUtilsContext::calledMethods() -{ - QStringList methods = mUtils->mCalledMethods; - mUtils->mCalledMethods.clear(); - return methods; -} - -bool WlanQtUtilsContext::verifyWlanIapSettings(WlanQtUtilsAp &ref) -{ - bool ret = true; - if (!mUtils->mWlanAp){ - qWarning("WlanQtUtilsContext::verifyWlanIapSettings: iap not created"); - ret = false; - } - - if (!(*(mUtils->mWlanAp) == ref)){ - qWarning("WlanQtUtilsContext::verifyWlanIapSettings: settings does not match"); - ret = false; - } - return ret; -} - -void WlanQtUtilsContext::emitWlanNetworkOpened(int iapId) -{ - emit mUtils->wlanNetworkOpened(iapId); -} - -void WlanQtUtilsContext::emitWlanNetworkClosed(int iapId, int reason) -{ - emit mUtils->wlanNetworkClosed(iapId, reason); -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_context.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -*/ - -#ifndef WLANQTUTILS_CONTEXT_H -#define WLANQTUTILS_CONTEXT_H - -#include -#include - -#include "wlanqtutilscommon.h" -#include "wlanqtutils.h" - -class WlanQtUtilsWlanIap; -class WlanQtUtilsAp; - -class Q_DECL_EXPORT WlanQtUtilsContext: public QObject -{ - Q_OBJECT - -public: - WlanQtUtilsContext(WlanQtUtils *utils ); - ~WlanQtUtilsContext(); - -public: - void setScanWlanApsResult( QList > result ); - - void setScanWlanDirectResult( QString ssid, - QList > result ); - - void setCreateWlanIapResult(int iapId); - - void setActiveWlanIapResult(int iapId); - - void setUpdateWlanIapResult(bool returnValue); - - void setConnectionSuccessed(bool value); - - void setSignalWlanNetworkOpened(int iapId); - - void setSignalWlanNetworkClosed(int iapId, int reason); - - void setSignalIctResult(int iapId, WlanQtUtils::IctStatus result); - - void setImmediateApScanResult(bool immediate); - - void setScanApStatus(int status); - - void setScanDirectStatus(int status); - - void emitScanApReady(); - - QStringList calledMethods(); - - bool verifyWlanIapSettings(WlanQtUtilsAp &ref); - - void emitWlanNetworkOpened(int iapId); - void emitWlanNetworkClosed(int iapId, int reason); - -private: - WlanQtUtils* mUtils; -}; - -#endif /* WLANQTUTILS_CONTEXT_H */ - -// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutils_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#include "wlanqtutilsap.h" -#include "wlanqtutils.h" -#include - -WlanQtUtils::WlanQtUtils() : mWlanAp(NULL), mEmitScanApReady(true), -mScanApStatus(ScanStatusOk), mScanDirectStatus(ScanStatusOk) -{ - mWlanNetworkActiveIapId = -1; - mCalledMethods.append("WlanQtUtils"); -} - -WlanQtUtils::~WlanQtUtils() -{ - mCalledMethods.append("~WlanQtUtils"); - delete mWlanAp; -} - -void WlanQtUtils::availableWlanAps(QList > &wlanApList) -{ - wlanApList = *mScanResult; - mCalledMethods.append("availableWlanAps"); -} - -int WlanQtUtils::createIap(const WlanQtUtilsAp * wlanAp) -{ - mCalledMethods.append("createIap"); - delete mWlanAp; - mWlanAp = new WlanQtUtilsAp(*wlanAp); - return mCreateWlanIapReturn; -} - -bool WlanQtUtils::updateIap(int iapId, const WlanQtUtilsAp * wlanAp) -{ - mCalledMethods.append("updateIap"); - qDebug("updateWlanIap iapId = %d", iapId); - qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn); - delete mWlanAp; - mWlanAp = new WlanQtUtilsAp(*wlanAp); - QCOMPARE(iapId, mCreateWlanIapReturn); - return mUpdateWlanIapReturn; -} - -void WlanQtUtils::deleteIap(int iapId) -{ - mCalledMethods.append("deleteIap"); - QCOMPARE(iapId, mCreateWlanIapReturn); -} - -int WlanQtUtils::connectedWlanId() -{ - mCalledMethods.append("connectedWlanId"); - return mCreateWlanIapReturn; -} - -void WlanQtUtils::connectIap(int iapId, bool runIct) -{ - qDebug("connectIap iapId = %d", iapId); - qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn); - mCalledMethods.append("connectIap"); - QCOMPARE(iapId, mCreateWlanIapReturn); - QCOMPARE(runIct, true); - - if (mConnectionSuccess) { - mWlanNetworkActiveIapId = iapId; - emit wlanNetworkOpened(mWlanNetworkOpenedIapId); - emit ictResult(mIctResultIapId - 1, false); - emit ictResult(mIctResultIapId, mIctResultResults); - } else { - emit wlanNetworkClosed( - mWlanNetworkClosedIapId -1, - mWlanNetworkClosedReason ); - - emit wlanNetworkClosed( - mWlanNetworkClosedIapId, - mWlanNetworkClosedReason ); - } -} - -void WlanQtUtils::disconnectIap(int iapId) -{ - qDebug("disconnectIap iapId = %d", iapId); - qDebug("mActiveWlanIapReturn = %d", mActiveWlanIapReturn); - mCalledMethods.append("disconnectIap"); - QCOMPARE(iapId, mActiveWlanIapReturn); -} - -int WlanQtUtils::activeIap() -{ - mCalledMethods.append("activeIap"); - return mActiveWlanIapReturn; -} - -void WlanQtUtils::scanWlanAps() -{ - mCalledMethods.append("scanWlanAps"); - mScanResult = &mScanWlanAps; - - if(mEmitScanApReady) { - emit wlanScanApReady(mScanApStatus); - } -} - -void WlanQtUtils::scanWlanDirect(const QString &ssid) -{ - mCalledMethods.append("scanWlanDirect"); - QCOMPARE(ssid, mScanWlanDirectSsid); - mScanResult = &mScanWlanDirect; - - emit wlanScanDirectReady(mScanDirectStatus); -} - -void WlanQtUtils::stopWlanScan() -{ - mCalledMethods.append("stopWlanScan"); -} - -void WlanQtUtils::emitScanApsReady() -{ - emit wlanScanApReady(mScanApStatus); -} - - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the header file for WlanQtUtilsWlanAp class. -*/ - -#ifndef STUB_WLANQTUTILSWLANAP_H -#define STUB_WLANQTUTILSWLANAP_H - -#include -#include -#include -#include "cmmanagerdefines_shim.h" - -class QString; -class WlanQtUtilsApPrivate; - -/** - * This class represents WLAN access point (AP). - */ -class WlanQtUtilsAp : public QObject -{ -public: - /*! - * Scan Results: - * - ConfIdSsid - * - ConfIdBssid - * - ConfIdSignalStrength - * - ConfIdConnectionMode - * - ConfIdSecurityMode - * - ConfIdWpaPskUse - * - ConfIdWpsSupported - * - * IAP creation and updates: - * Mandatory for all security modes: - * - ConfIdSsid - * - ConfIdConnectionMode - * - ConfIdSecurityMode - * - ConfIdHidden - * - * Open: No extra configurations. - * 802.1x: No extra configurations. - * - * WEP: - * - ConfIdWepKey1 - * - ConfIdWepKey2 - * - ConfIdWepKey3 - * - ConfIdWepKey4 - * - ConfIdWepDefaultIndex - * - * WPA/WPA2: - * - ConfIdWpaPskUse - * - ConfIdWpaPsk - * - */ - enum ConfId{ - /// int: IAP ID, -1 for invalid IAP (WlanQtUtilsInvalidIapId) - ConfIdIapId, - /// QString: WLAN Network Name (SSID) - ConfIdSsid, - /// QString: Basic Service Set Identifier - ConfIdBssid, - /// int: signal strength in RSSI (dBm) - ConfIdSignalStrength, - /// int: (CMManagerShim::WlanNetMode) - ConfIdConnectionMode, - /// int: (CMManagerShim::WlanSecMode) - ConfIdSecurityMode, - /// bool: true - WPA PSK, false - WPA EAP - ConfIdWpaPskUse, - /// QString: Pre-Shared Key for WPA - /// Length: 8-63 - Ascii key - /// Length: 64 - Hex key - ConfIdWpaPsk, - /// QString: WEP Key for index 1: - /// HEX: - /// - 64 bit: allowed key length = 10 - /// - 128 bit: allowed key length = 26 - /// - /// ASCII: - /// - 64 bit: allowed key length = 5 - /// - 128 bit: allowed key length = 13 - ConfIdWepKey1, - /// QString: WEP Key for index 2 - ConfIdWepKey2, - /// QString: WEP Key for index 3 - ConfIdWepKey3, - /// QString: WEP Key for index 4 - ConfIdWepKey4, - /// int: (CMManagerShim::WlanWepKeyIndex): Default WEP Key index - ConfIdWepDefaultIndex, - /// bool: Is WLAN Hidden: true - hidden, false - not hidden. - ConfIdHidden, - /// bool: true - Wifi Protected setup is supported, false - not - ConfIdWpsSupported, - }; - -public: - WlanQtUtilsAp(); - WlanQtUtilsAp(const WlanQtUtilsAp &ref); - ~WlanQtUtilsAp(); - QVariant value(int identifier) const; - void setValue(int identifier, QVariant value ); - bool operator==(const WlanQtUtilsAp & rhs ) const; - - static int compare( - const WlanQtUtilsAp *ap1, - const WlanQtUtilsAp *ap2); - -private: - WlanQtUtilsApPrivate *d_ptr; - -}; - -Q_DECLARE_METATYPE(WlanQtUtilsAp) - -#endif /* WLANQTUTILSWLANIAP_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap_stub.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilsap_stub.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This is the source file for WlanQtUtilsAp class. - */ - -#include -#include -#include -#include -#include "wlanqtutilscommon.h" -#include "wlanqtutilsap.h" - -class WlanQtUtilsApPrivate -{ - friend class WlanQtUtilsAp; - -private: - QHash mConfigurations; -}; - -WlanQtUtilsAp::WlanQtUtilsAp() : - d_ptr(new WlanQtUtilsApPrivate()) -{ -} - -WlanQtUtilsAp::WlanQtUtilsAp(const WlanQtUtilsAp &ref) : - d_ptr(new WlanQtUtilsApPrivate()) -{ - d_ptr->mConfigurations = ref.d_ptr->mConfigurations; -} - -WlanQtUtilsAp::~WlanQtUtilsAp() -{ - d_ptr->mConfigurations.clear(); - delete d_ptr; -} - -QVariant WlanQtUtilsAp::value(int identifier) const -{ - return d_ptr->mConfigurations[identifier]; -} - -void WlanQtUtilsAp::setValue(int identifier, QVariant value) -{ - d_ptr->mConfigurations[identifier] = value; -} - -bool WlanQtUtilsAp::operator==(const WlanQtUtilsAp & rhs ) const -{ - bool ret = true; - if (d_ptr->mConfigurations.size() != rhs.d_ptr->mConfigurations.size()) { - qWarning("WlanQtUtilsAp::operator==(): size: expect %d, actual %d ", - d_ptr->mConfigurations.size(), - rhs.d_ptr->mConfigurations.size() ); - ret = false; - } - QHashIterator i(d_ptr->mConfigurations); - - while (i.hasNext()) { - i.next(); - if (!rhs.d_ptr->mConfigurations.contains(i.key())){ - qWarning("WlanQtUtilsAp::operator==(): key not found: %d", i.key()); - ret = false; - - } - if (i.value() != rhs.d_ptr->mConfigurations[i.key()]){ - qWarning("WlanQtUtilsAp::operator==(): values not match %d", i.key()); - qDebug() << "Expect: " << i.value(); - qDebug() << "Actual: " << rhs.d_ptr->mConfigurations[i.key()]; - ret = false; - } - } - return ret; -} - -/*! - AP comparison function. - - @param [in] ap1 First AP to compare. - @param [in] ap2 Second AP to compare. - - @return Zero(0), if APs are considered to be same. -*/ - -int WlanQtUtilsAp::compare( - const WlanQtUtilsAp *ap1, - const WlanQtUtilsAp *ap2) -{ - int equal = 1; // Not equal - - // SSID (case sensitive) and security mode (with or without PSK) - // are the values, which identify a unique access point. - if (ap1->value(WlanQtUtilsAp::ConfIdSsid) == - ap2->value(WlanQtUtilsAp::ConfIdSsid) - && ap1->value(WlanQtUtilsAp::ConfIdSecurityMode) == - ap2->value(WlanQtUtilsAp::ConfIdSecurityMode) - && ap1->value(WlanQtUtilsAp::ConfIdWpaPskUse) == - ap2->value(WlanQtUtilsAp::ConfIdWpaPskUse)) { - equal = 0; // Equal - } - - return equal; -} - - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilscommon.h --- a/wlanutilities/wlanwizard/t_wlanwizard/stubs/wlanqtutilscommon.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef STUB_WLANQTUTILSCOMMON_H -#define STUB_WLANQTUTILSCOMMON_H -/* -#ifdef BUILD_WLAN_QT_UTILS_STUBS -#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT -#else -#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT -#endif -*/ -#ifdef BUILD_WLANQTUTILITIES_DLL -#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT -#else -#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT -#endif -// Maximum length of WLAN SSID (limit also for number of characters for user input) -static const int KMaxSsidLen = 32; -// Maximum length of WEP key -static const int KMaxWEPKeyLen = 64; -// Maximum length of WPA key -static const int KMaxWPAKeyLen = 256; - -/** - * Bearer type. - */ -enum WlanQtUtilsBearerType { - WlanQtUtilsBearerTypeNone = 0, ///< None of the bearer types. - WlanQtUtilsBearerTypeCellular , ///< Cellular (2G, 3G, 3.5G) bearer type. - WlanQtUtilsBearerTypeWlan ///< WLAN bearer type. -}; - -/** - * Connection status. - */ -enum WlanQtUtilsConnectionStatus { - WlanQtUtilsConnectionStatusNone = 0, ///< None of the connection statuses. - WlanQtUtilsConnectionStatusConnecting, ///< Connecting. - WlanQtUtilsConnectionStatusConnected, ///< Connected. - WlanQtUtilsConnectionStatusDisconnected ///< Disconnected. -}; - -/** - * Signal strength category boundaries in dB (absolute value). - * Smaller value means better signal. - */ -// TODO: WLAN signal level values valid are copied from 08wk41 Sniffer. OK? -// (WINS emulator gives just 0 which is equal to "Absolute max"...) -enum -{ - WlanQtUtilsWlanSignalStrengthAbsoluteMax = 0, ///< Absolute maximum signal strength. - WlanQtUtilsWlanSignalStrengthMax = 60, ///< Maximum signal strength. - WlanQtUtilsWlanSignalStrengthGood = 74, ///< Good signal strength. - WlanQtUtilsWlanSignalStrengthLow = 87, ///< signal strength. - WlanQtUtilsWlanSignalStrengthMin = 100, ///< Minimum signal strength. - WlanQtUtilsWlanSignalUnavailable = 9999, ///< Signal is unavailable. -}; - -/** WLAN signal is unknown. */ -const int WlanQtUtilsWlanSignalUnknown = 1000000; - -/** WLAN transmit power is unknown. */ -const unsigned WlanQtUtilsWlanTransmitPowerUnknown = 0xFFFFFFFF; - -#endif // WLANQTUTILSCOMMON_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/t_wlanwizard.pro --- a/wlanutilities/wlanwizard/t_wlanwizard/t_wlanwizard.pro Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - -include(stubs/stubs.pri) -include(ut/ut.pri) - -QT += testlib -CONFIG += hb qtestlib - -TEMPLATE = app -TARGET = t_wlanwizard - -DEPENDPATH += . -MOC_DIR = build -RCC_DIR = build - -VERSION = 0.0.1 - -DEFINES += BUILD_WLAN_WIZARD_DLL -DEFINES += BUILD_EAP_WIZARD_DLL -DEFINES += BUILD_WPS_WIZARD_DLL - -RESOURCES += ../resources/resource.qrc -RESOURCES += ../../eapwizard/resources/eapwizard_resource.qrc -RESOURCES += ../../wpswizard/resources/wpswizard_resource.qrc - -INCLUDEPATH += \ - stubs - -# OST trace system requires traces directory to be in USERINCLUDES -MMP_RULES += "USERINCLUDE ../traces" - -# WLAN WIZARD HEADERS -HEADERS += \ - ../inc/wlanwizard.h \ - ../inc/wlanwizard_p.h \ - ../inc/wlanwizardscanlist.h \ - ../inc/wlanwizardpage.h \ - ../inc/wlanwizardhelper.h \ - ../inc/wlanwizardutils.h \ - ../inc/wlanwizardpageinternal.h \ - ../inc/wlanwizardpagekeyquery.h \ - ../inc/wlanwizardpageprocessingsettings.h \ - ../inc/wlanwizardpagesummary.h \ - ../inc/wlanwizardsummaryviewitem.h \ - ../inc/wlanwizardpagegenericerror.h \ - ../inc/wlanwizardpagenetworkmode.h \ - ../inc/wlanwizardpagescanning.h \ - ../inc/wlanwizardpagesecuritymode.h \ - ../inc/wlanwizardpagessid.h - -# WLAN WIZARD SOURCES -SOURCES += \ - ../src/wlanwizard.cpp \ - ../src/wlanwizard_p.cpp \ - ../src/wlanwizardscanlist.cpp \ - ../src/wlanwizardutils.cpp \ - ../src/wlanwizardpageinternal.cpp \ - ../src/wlanwizardpagekeyquery.cpp \ - ../src/wlanwizardpageprocessingsettings.cpp \ - ../src/wlanwizardpagesummary.cpp \ - ../src/wlanwizardsummaryviewitem.cpp \ - ../src/wlanwizardpagegenericerror.cpp \ - ../src/wlanwizardpagenetworkmode.cpp \ - ../src/wlanwizardpagescanning.cpp \ - ../src/wlanwizardpagesecuritymode.cpp \ - ../src/wlanwizardpagessid.cpp - -# EAP Wizard headers -HEADERS += \ - ../../eapwizard/inc/eapwizard.h \ - ../../eapwizard/inc/eapwizard_p.h \ - ../../eapwizard/inc/eapwizardpage.h \ - ../../eapwizard/inc/eapwizardpageoutertype.h \ - ../../eapwizard/inc/eapwizardpagecertca.h \ - ../../eapwizard/inc/eapwizardpagecertuser.h \ - ../../eapwizard/inc/eapwizardpageidentity.h \ - ../../eapwizard/inc/eapwizardpageinnertype.h \ - ../../eapwizard/inc/eapwizardpageusernamepassword.h \ - ../../eapwizard/inc/eapwizardpagenewpacstore.h \ - ../../eapwizard/inc/eapwizardpagepacstorepasswordconfirm.h - -# EAP Wizard sources -SOURCES += \ - ../../eapwizard/src/eapwizard.cpp \ - ../../eapwizard/src/eapwizard_p.cpp \ - ../../eapwizard/src/eapwizardpage.cpp \ - ../../eapwizard/src/eapwizardpageoutertype.cpp \ - ../../eapwizard/src/eapwizardpagecertca.cpp \ - ../../eapwizard/src/eapwizardpagecertuser.cpp \ - ../../eapwizard/src/eapwizardpageidentity.cpp \ - ../../eapwizard/src/eapwizardpageinnertype.cpp \ - ../../eapwizard/src/eapwizardpageusernamepassword.cpp \ - ../../eapwizard/src/eapwizardpagenewpacstore.cpp \ - ../../eapwizard/src/eapwizardpagepacstorepasswordconfirm.cpp - -# WPS Wizard sources -HEADERS += \ - ../../wpswizard/inc/wpswizard.h \ - ../../wpswizard/inc/wpswizard_p.h \ - ../../wpswizard/inc/wpswizardpage.h \ - ../../wpswizard/inc/wpswizardsteptwo.h \ - ../../wpswizard/inc/wpswizardstepthreebutton.h \ - ../../wpswizard/inc/wpswizardstepthreenumber.h \ - ../../wpswizard/inc/wpswizardstepfour.h \ - ../../wpswizard/inc/wpswizardstepfour_p.h \ - ../../wpswizard/inc/wpswizardstepfive.h \ - ../../wpswizard/inc/cwpsactiverunner.h \ - ../../wpswizard/inc/mwpsactiverunnercallback.h \ - -SOURCES += \ - ../../wpswizard/src/wpswizard.cpp \ - ../../wpswizard/src/wpswizard_p.cpp \ - ../../wpswizard/src/wpswizardpage.cpp \ - ../../wpswizard/src/wpswizardsteptwo.cpp \ - ../../wpswizard/src/wpswizardstepthreebutton.cpp \ - ../../wpswizard/src/wpswizardstepthreenumber.cpp \ - ../../wpswizard/src/wpswizardstepfour.cpp \ - ../../wpswizard/src/wpswizardstepfour_p.cpp \ - ../../wpswizard/src/wpswizardstepfive.cpp \ - ../../wpswizard/src/cwpsactiverunner.cpp - -LIBS += -leapqtplugininfo - -symbian: { - TARGET.CAPABILITY = ALL -TCB - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,835 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "hbautotest.h" -#include -#include - - -const qreal STEP = 4; //How many pixels to drag before sending an event - -//Init static members -bool HbAutoTest::pointerPressed = false; -QPointF HbAutoTest::pressPoint = QPointF(); - -void HbAutoTest::mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) -{ - if (delay!=-1) { - QTest::qWait(delay); - } - QPointF targetPoint=QPointF(); - if (pos==QPointF()) { - targetPoint = middlePointOfWidget(widget); - } else { - targetPoint = widget->mapToScene(pos); - } - if (pointerPressed) { - //Now we should drag an item - drag(window, targetPoint); - HbAutoTestMouseEvent me ( - QEvent::MouseMove, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::NoButton, - Qt::NoButton, - Qt::NoModifier); - QSpontaneKeyEvent::setSpontaneous(&me); - qApp->notify((window->viewport()), &me); - QCoreApplication::sendPostedEvents(); - QTest::qWait(1); - } else { - HbAutoTestMouseEvent me ( - QEvent::MouseMove, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::NoButton, - Qt::NoButton, - Qt::NoModifier); - QSpontaneKeyEvent::setSpontaneous(&me); - qApp->notify((window->viewport()), &me); - QCoreApplication::sendPostedEvents(); - QTest::qWait(1); - - } - QTest::qWait(1); - QTest::qWait(1); -} - -void HbAutoTest::mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) -{ - if (delay!=-1) { - QTest::qWait(delay); - } - pointerPressed=true; - QPointF targetPoint=QPointF(); - if (pos==QPointF()) { - targetPoint = middlePointOfWidget(widget); - } else { - targetPoint = widget->mapToScene(pos); - } - QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); - - pressPoint=targetPoint; - - HbAutoTestMouseEvent me ( - QEvent::MouseButtonPress, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::LeftButton, - Qt::LeftButton, - Qt::NoModifier); - - QSpontaneKeyEvent::setSpontaneous(&me); - qApp->notify((window->viewport()), &me); - QCoreApplication::sendPostedEvents(); - QCoreApplication::sendPostedEvents(); - QTest::qWait(1); -} - -void HbAutoTest::mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) -{ - if (delay!=-1) { - QTest::qWait(delay); - } - pointerPressed=false; - QPointF targetPoint=QPointF(); - if (pos==QPointF()) { - targetPoint = middlePointOfWidget(widget); - } else { - targetPoint = widget->mapToScene(pos); - } - QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); - pressPoint=QPointF(); - HbAutoTestMouseEvent me ( - QEvent::MouseButtonRelease, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::LeftButton, - Qt::NoButton, - Qt::NoModifier); - - QSpontaneKeyEvent::setSpontaneous(&me); - qApp->notify((window->viewport()), &me); - QCoreApplication::sendPostedEvents(); - - QTest::qWait(1); - QTest::qWait(1); -} - -void HbAutoTest::mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos, int delay) -{ - if (delay!=-1) { - QTest::qWait(delay); - } - QPointF targetPoint=QPointF(); - if (pos==QPointF()) { - targetPoint = middlePointOfWidget(widget); - } else { - targetPoint = widget->mapToScene(pos); - } - - QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); - - HbAutoTestMouseEvent me ( - QEvent::MouseButtonPress, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::LeftButton, - Qt::LeftButton, - Qt::NoModifier); - QSpontaneKeyEvent::setSpontaneous(&me); - qApp->notify((window->viewport()), &me); - QCoreApplication::sendPostedEvents(); - //QTime currentTime = QTime::currentTime(); - //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button down"; - QTest::qWait(1); - - if (delay!=-1) { - QTest::qWait(delay); - } - HbAutoTestMouseEvent me2 ( - QEvent::MouseButtonRelease, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::LeftButton, - Qt::NoButton, - Qt::NoModifier); - - QSpontaneKeyEvent::setSpontaneous(&me2); - qApp->notify((window->viewport()), &me2); - QCoreApplication::sendPostedEvents(); - //currentTime = QTime::currentTime(); - //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button up"; - - QTest::qWait(1); - QTest::qWait(1); -} - -QPointF HbAutoTest::middlePointOfWidget( const HbWidget* widget) -{ - QRectF widgetRect = widget->rect(); - QRectF widgetSceneRect = widget->mapRectToScene(widgetRect); - qreal middleX = ((widgetSceneRect.right() - widgetSceneRect.left())/2)+widgetSceneRect.left(); - qreal middleY = ((widgetSceneRect.bottom() - widgetSceneRect.top())/2)+widgetSceneRect.top(); - return QPointF(middleX,middleY); -} - - - -void HbAutoTest::drag(HbAutoTestMainWindow *window, QPointF targetPoint) -{ - qreal tempX = targetPoint.x() - pressPoint.x(); - qreal tempY = targetPoint.y() - pressPoint.y(); - qreal totalTrip = sqrt ((tempX * tempX) + (tempY * tempY)); - - int numberOfSteps = qRound(totalTrip / STEP); - HbAutoTestMouseEvent me ( - QEvent::MouseMove, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::NoButton , - Qt::LeftButton, - Qt::NoModifier); - - QPointF nextPanPoint=pressPoint; - for (int i=1; imapToGlobal(nextPanPoint.toPoint())); - - me = HbAutoTestMouseEvent (QEvent::MouseMove, - nextPanPoint.toPoint(), - window->viewport()->mapToGlobal(nextPanPoint.toPoint()), - Qt::NoButton, - Qt::LeftButton, - Qt::NoModifier); - - QSpontaneKeyEvent::setSpontaneous(&me); - qApp->notify((window->viewport()), &me); - QCoreApplication::sendPostedEvents(); - } - - QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); - - //One more (or the only one) step to the target - me = HbAutoTestMouseEvent (QEvent::MouseMove, - targetPoint.toPoint(), - window->viewport()->mapToGlobal(targetPoint.toPoint()), - Qt::NoButton, - Qt::LeftButton, - Qt::NoModifier); - QSpontaneKeyEvent::setSpontaneous(&me); - qApp->notify((window->viewport()), &me); - QCoreApplication::sendPostedEvents(); -} - - -void HbAutoTest::simulateEvent(QWidget *widget, bool press, int code, - Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - extern int Q_TESTLIB_EXPORT defaultKeyDelay(); - - if (delay == -1 || delay < 10) // defaultKeyDelay()) - delay = 10; //defaultKeyDelay(); - if(delay > 0) - QTest::qWait(delay); -// Q_UNUSED(delay); -// QTest::qWait(10); //TODO: Remove this and reveal above out-commented code - - HbAutoTestKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat); - QSpontaneKeyEvent::setSpontaneous(&a); - if (!qApp->notify(widget, &a)) - QTest::qWarn("Keyboard event not accepted by receiving widget"); - } - -void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, - QString text, Qt::KeyboardModifiers modifier, int delay) - { - QTEST_ASSERT(qApp); - - if (!widget) - widget = QWidget::keyboardGrabber(); - if (!widget) { - if (QWidget *apw = QApplication::activePopupWidget()) - widget = apw->focusWidget() ? apw->focusWidget() : apw; - else - widget = QApplication::focusWidget(); - } - if (!widget) - widget = QApplication::activeWindow(); - - QTEST_ASSERT(widget); - - if (action == QTest::Click) { - QPointer ptr(widget); - sendKeyEvent(QTest::Press, widget, code, text, modifier, delay); - if (!ptr) { - // if we send key-events to embedded widgets, they might be destroyed - // when the user presses Return - return; - } - sendKeyEvent(QTest::Release, widget, code, text, modifier, delay); - return; - } - - bool repeat = false; - - if (action == QTest::Press) { - if (modifier & Qt::ShiftModifier) - simulateEvent(widget, true, Qt::Key_Shift, 0, QString(), false, delay); - - if (modifier & Qt::ControlModifier) - simulateEvent(widget, true, Qt::Key_Control, modifier & Qt::ShiftModifier, QString(), false, delay); - - if (modifier & Qt::AltModifier) - simulateEvent(widget, true, Qt::Key_Alt, - modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); - if (modifier & Qt::MetaModifier) - simulateEvent(widget, true, Qt::Key_Meta, modifier & (Qt::ShiftModifier - | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); - simulateEvent(widget, true, code, modifier, text, repeat, delay); - } else if (action == QTest::Release) { - simulateEvent(widget, false, code, modifier, text, repeat, delay); - - if (modifier & Qt::MetaModifier) - simulateEvent(widget, false, Qt::Key_Meta, modifier, QString(), false, delay); - if (modifier & Qt::AltModifier) - simulateEvent(widget, false, Qt::Key_Alt, modifier & - (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); - - if (modifier & Qt::ControlModifier) - simulateEvent(widget, false, Qt::Key_Control, - modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); - - if (modifier & Qt::ShiftModifier) - simulateEvent(widget, false, Qt::Key_Shift, modifier & Qt::ShiftModifier, QString(), false, delay); - } - } - -void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, - char ascii, Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - QString text; - if (ascii) - text = QString(QChar::fromLatin1(ascii)); - sendKeyEvent(action, widget, code, text, modifier, delay); - } - -void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, char ascii, - Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - sendKeyEvent(action, widget, asciiToKey(ascii), ascii, modifier, delay); - } - -void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key, - Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - sendKeyEvent(action, widget, key, keyToAscii(key), modifier, delay); - } - -void HbAutoTest::keyClicks(QWidget *widget, const QString &sequence, - Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - for (int i=0; i < sequence.length(); i++) - keyEvent(QTest::Click, widget, sequence.at(i).toLatin1(), modifier, delay); - } - -void HbAutoTest::keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - keyEvent(QTest::Press, widget, key, modifier, delay); - } - -void HbAutoTest::keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - keyEvent(QTest::Release, widget, key, modifier, delay); - } - -void HbAutoTest::keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - keyEvent(QTest::Click, widget, key, modifier, delay); - } - -void HbAutoTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - keyEvent(QTest::Press, widget, key, modifier, delay); - } - -void HbAutoTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - keyEvent(QTest::Release, widget, key, modifier, delay); } - -void HbAutoTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) - { - Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); - keyEvent(QTest::Click, widget, key, modifier, delay); - } - -Qt::Key HbAutoTest::asciiToKey(char ascii) -{ - switch ((unsigned char)ascii) { - case 0x08: return Qt::Key_Backspace; - case 0x09: return Qt::Key_Tab; - case 0x0b: return Qt::Key_Backtab; - case 0x0d: return Qt::Key_Return; - case 0x1b: return Qt::Key_Escape; - case 0x20: return Qt::Key_Space; - case 0x21: return Qt::Key_Exclam; - case 0x22: return Qt::Key_QuoteDbl; - case 0x23: return Qt::Key_NumberSign; - case 0x24: return Qt::Key_Dollar; - case 0x25: return Qt::Key_Percent; - case 0x26: return Qt::Key_Ampersand; - case 0x27: return Qt::Key_Apostrophe; - case 0x28: return Qt::Key_ParenLeft; - case 0x29: return Qt::Key_ParenRight; - case 0x2a: return Qt::Key_Asterisk; - case 0x2b: return Qt::Key_Plus; - case 0x2c: return Qt::Key_Comma; - case 0x2d: return Qt::Key_Minus; - case 0x2e: return Qt::Key_Period; - case 0x2f: return Qt::Key_Slash; - case 0x30: return Qt::Key_0; - case 0x31: return Qt::Key_1; - case 0x32: return Qt::Key_2; - case 0x33: return Qt::Key_3; - case 0x34: return Qt::Key_4; - case 0x35: return Qt::Key_5; - case 0x36: return Qt::Key_6; - case 0x37: return Qt::Key_7; - case 0x38: return Qt::Key_8; - case 0x39: return Qt::Key_9; - case 0x3a: return Qt::Key_Colon; - case 0x3b: return Qt::Key_Semicolon; - case 0x3c: return Qt::Key_Less; - case 0x3d: return Qt::Key_Equal; - case 0x3e: return Qt::Key_Greater; - case 0x3f: return Qt::Key_Question; - case 0x40: return Qt::Key_At; - case 0x41: return Qt::Key_A; - case 0x42: return Qt::Key_B; - case 0x43: return Qt::Key_C; - case 0x44: return Qt::Key_D; - case 0x45: return Qt::Key_E; - case 0x46: return Qt::Key_F; - case 0x47: return Qt::Key_G; - case 0x48: return Qt::Key_H; - case 0x49: return Qt::Key_I; - case 0x4a: return Qt::Key_J; - case 0x4b: return Qt::Key_K; - case 0x4c: return Qt::Key_L; - case 0x4d: return Qt::Key_M; - case 0x4e: return Qt::Key_N; - case 0x4f: return Qt::Key_O; - case 0x50: return Qt::Key_P; - case 0x51: return Qt::Key_Q; - case 0x52: return Qt::Key_R; - case 0x53: return Qt::Key_S; - case 0x54: return Qt::Key_T; - case 0x55: return Qt::Key_U; - case 0x56: return Qt::Key_V; - case 0x57: return Qt::Key_W; - case 0x58: return Qt::Key_X; - case 0x59: return Qt::Key_Y; - case 0x5a: return Qt::Key_Z; - case 0x5b: return Qt::Key_BracketLeft; - case 0x5c: return Qt::Key_Backslash; - case 0x5d: return Qt::Key_BracketRight; - case 0x5e: return Qt::Key_AsciiCircum; - case 0x5f: return Qt::Key_Underscore; - case 0x60: return Qt::Key_QuoteLeft; - case 0x61: return Qt::Key_A; - case 0x62: return Qt::Key_B; - case 0x63: return Qt::Key_C; - case 0x64: return Qt::Key_D; - case 0x65: return Qt::Key_E; - case 0x66: return Qt::Key_F; - case 0x67: return Qt::Key_G; - case 0x68: return Qt::Key_H; - case 0x69: return Qt::Key_I; - case 0x6a: return Qt::Key_J; - case 0x6b: return Qt::Key_K; - case 0x6c: return Qt::Key_L; - case 0x6d: return Qt::Key_M; - case 0x6e: return Qt::Key_N; - case 0x6f: return Qt::Key_O; - case 0x70: return Qt::Key_P; - case 0x71: return Qt::Key_Q; - case 0x72: return Qt::Key_R; - case 0x73: return Qt::Key_S; - case 0x74: return Qt::Key_T; - case 0x75: return Qt::Key_U; - case 0x76: return Qt::Key_V; - case 0x77: return Qt::Key_W; - case 0x78: return Qt::Key_X; - case 0x79: return Qt::Key_Y; - case 0x7a: return Qt::Key_Z; - case 0x7b: return Qt::Key_BraceLeft; - case 0x7c: return Qt::Key_Bar; - case 0x7d: return Qt::Key_BraceRight; - case 0x7e: return Qt::Key_AsciiTilde; - - // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06 - case 0xa0: return Qt::Key_nobreakspace; - case 0xa1: return Qt::Key_exclamdown; - case 0xa2: return Qt::Key_cent; - case 0xa3: return Qt::Key_sterling; - case 0xa4: return Qt::Key_currency; - case 0xa5: return Qt::Key_yen; - case 0xa6: return Qt::Key_brokenbar; - case 0xa7: return Qt::Key_section; - case 0xa8: return Qt::Key_diaeresis; - case 0xa9: return Qt::Key_copyright; - case 0xaa: return Qt::Key_ordfeminine; - case 0xab: return Qt::Key_guillemotleft; - case 0xac: return Qt::Key_notsign; - case 0xad: return Qt::Key_hyphen; - case 0xae: return Qt::Key_registered; - case 0xaf: return Qt::Key_macron; - case 0xb0: return Qt::Key_degree; - case 0xb1: return Qt::Key_plusminus; - case 0xb2: return Qt::Key_twosuperior; - case 0xb3: return Qt::Key_threesuperior; - case 0xb4: return Qt::Key_acute; - case 0xb5: return Qt::Key_mu; - case 0xb6: return Qt::Key_paragraph; - case 0xb7: return Qt::Key_periodcentered; - case 0xb8: return Qt::Key_cedilla; - case 0xb9: return Qt::Key_onesuperior; - case 0xba: return Qt::Key_masculine; - case 0xbb: return Qt::Key_guillemotright; - case 0xbc: return Qt::Key_onequarter; - case 0xbd: return Qt::Key_onehalf; - case 0xbe: return Qt::Key_threequarters; - case 0xbf: return Qt::Key_questiondown; - case 0xc0: return Qt::Key_Agrave; - case 0xc1: return Qt::Key_Aacute; - case 0xc2: return Qt::Key_Acircumflex; - case 0xc3: return Qt::Key_Atilde; - case 0xc4: return Qt::Key_Adiaeresis; - case 0xc5: return Qt::Key_Aring; - case 0xc6: return Qt::Key_AE; - case 0xc7: return Qt::Key_Ccedilla; - case 0xc8: return Qt::Key_Egrave; - case 0xc9: return Qt::Key_Eacute; - case 0xca: return Qt::Key_Ecircumflex; - case 0xcb: return Qt::Key_Ediaeresis; - case 0xcc: return Qt::Key_Igrave; - case 0xcd: return Qt::Key_Iacute; - case 0xce: return Qt::Key_Icircumflex; - case 0xcf: return Qt::Key_Idiaeresis; - case 0xd0: return Qt::Key_ETH; - case 0xd1: return Qt::Key_Ntilde; - case 0xd2: return Qt::Key_Ograve; - case 0xd3: return Qt::Key_Oacute; - case 0xd4: return Qt::Key_Ocircumflex; - case 0xd5: return Qt::Key_Otilde; - case 0xd6: return Qt::Key_Odiaeresis; - case 0xd7: return Qt::Key_multiply; - case 0xd8: return Qt::Key_Ooblique; - case 0xd9: return Qt::Key_Ugrave; - case 0xda: return Qt::Key_Uacute; - case 0xdb: return Qt::Key_Ucircumflex; - case 0xdc: return Qt::Key_Udiaeresis; - case 0xdd: return Qt::Key_Yacute; - case 0xde: return Qt::Key_THORN; - case 0xdf: return Qt::Key_ssharp; - case 0xe5: return Qt::Key_Aring; - case 0xe6: return Qt::Key_AE; - case 0xf7: return Qt::Key_division; - case 0xf8: return Qt::Key_Ooblique; - case 0xff: return Qt::Key_ydiaeresis; - default: QTEST_ASSERT(false); return Qt::Key(0); - } -} - -char HbAutoTest::keyToAscii(Qt::Key key) -{ - switch (key) { - case Qt::Key_Backspace: return 0x8; //BS - case Qt::Key_Tab: return 0x09; // HT - case Qt::Key_Backtab: return 0x0b; // VT - case Qt::Key_Enter: - case Qt::Key_Return: return 0x0d; // CR - case Qt::Key_Escape: return 0x1b; // ESC - case Qt::Key_Space: return 0x20; // 7 bit printable ASCII - case Qt::Key_Exclam: return 0x21; - case Qt::Key_QuoteDbl: return 0x22; - case Qt::Key_NumberSign: return 0x23; - case Qt::Key_Dollar: return 0x24; - case Qt::Key_Percent: return 0x25; - case Qt::Key_Ampersand: return 0x26; - case Qt::Key_Apostrophe: return 0x27; - case Qt::Key_ParenLeft: return 0x28; - case Qt::Key_ParenRight: return 0x29; - case Qt::Key_Asterisk: return 0x2a; - case Qt::Key_Plus: return 0x2b; - case Qt::Key_Comma: return 0x2c; - case Qt::Key_Minus: return 0x2d; - case Qt::Key_Period: return 0x2e; - case Qt::Key_Slash: return 0x2f; - case Qt::Key_0: return 0x30; - case Qt::Key_1: return 0x31; - case Qt::Key_2: return 0x32; - case Qt::Key_3: return 0x33; - case Qt::Key_4: return 0x34; - case Qt::Key_5: return 0x35; - case Qt::Key_6: return 0x36; - case Qt::Key_7: return 0x37; - case Qt::Key_8: return 0x38; - case Qt::Key_9: return 0x39; - case Qt::Key_Colon: return 0x3a; - case Qt::Key_Semicolon: return 0x3b; - case Qt::Key_Less: return 0x3c; - case Qt::Key_Equal: return 0x3d; - case Qt::Key_Greater: return 0x3e; - case Qt::Key_Question: return 0x3f; - case Qt::Key_At: return 0x40; - case Qt::Key_A: return 0x61; // 0x41 == 'A', 0x61 == 'a' - case Qt::Key_B: return 0x62; - case Qt::Key_C: return 0x63; - case Qt::Key_D: return 0x64; - case Qt::Key_E: return 0x65; - case Qt::Key_F: return 0x66; - case Qt::Key_G: return 0x67; - case Qt::Key_H: return 0x68; - case Qt::Key_I: return 0x69; - case Qt::Key_J: return 0x6a; - case Qt::Key_K: return 0x6b; - case Qt::Key_L: return 0x6c; - case Qt::Key_M: return 0x6d; - case Qt::Key_N: return 0x6e; - case Qt::Key_O: return 0x6f; - case Qt::Key_P: return 0x70; - case Qt::Key_Q: return 0x71; - case Qt::Key_R: return 0x72; - case Qt::Key_S: return 0x73; - case Qt::Key_T: return 0x74; - case Qt::Key_U: return 0x75; - case Qt::Key_V: return 0x76; - case Qt::Key_W: return 0x77; - case Qt::Key_X: return 0x78; - case Qt::Key_Y: return 0x79; - case Qt::Key_Z: return 0x7a; - case Qt::Key_BracketLeft: return 0x5b; - case Qt::Key_Backslash: return 0x5c; - case Qt::Key_BracketRight: return 0x5d; - case Qt::Key_AsciiCircum: return 0x5e; - case Qt::Key_Underscore: return 0x5f; - case Qt::Key_QuoteLeft: return 0x60; - - case Qt::Key_BraceLeft: return 0x7b; - case Qt::Key_Bar: return 0x7c; - case Qt::Key_BraceRight: return 0x7d; - case Qt::Key_AsciiTilde: return 0x7e; - - case Qt::Key_Delete: return 0; - case Qt::Key_Insert: return 0; // = 0x1006, - case Qt::Key_Pause: return 0; // = 0x1008, - case Qt::Key_Print: return 0; // = 0x1009, - case Qt::Key_SysReq: return 0; // = 0x100a, - - case Qt::Key_Clear: return 0; // = 0x100b, - - case Qt::Key_Home: return 0; // = 0x1010, // cursor movement - case Qt::Key_End: return 0; // = 0x1011, - case Qt::Key_Left: return 0; // = 0x1012, - case Qt::Key_Up: return 0; // = 0x1013, - case Qt::Key_Right: return 0; // = 0x1014, - case Qt::Key_Down: return 0; // = 0x1015, - case Qt::Key_PageUp: return 0; // = 0x1016, - case Qt::Key_PageDown: return 0; // = 0x1017, - case Qt::Key_Shift: return 0; // = 0x1020, // modifiers - case Qt::Key_Control: return 0; // = 0x1021, - case Qt::Key_Meta: return 0; // = 0x1022, - case Qt::Key_Alt: return 0; // = 0x1023, - case Qt::Key_CapsLock: return 0; // = 0x1024, - case Qt::Key_NumLock: return 0; // = 0x1025, - case Qt::Key_ScrollLock: return 0; // = 0x1026, - case Qt::Key_F1: return 0; // = 0x1030, // function keys - case Qt::Key_F2: return 0; // = 0x1031, - case Qt::Key_F3: return 0; // = 0x1032, - case Qt::Key_F4: return 0; // = 0x1033, - case Qt::Key_F5: return 0; // = 0x1034, - case Qt::Key_F6: return 0; // = 0x1035, - case Qt::Key_F7: return 0; // = 0x1036, - case Qt::Key_F8: return 0; // = 0x1037, - case Qt::Key_F9: return 0; // = 0x1038, - case Qt::Key_F10: return 0; // = 0x1039, - case Qt::Key_F11: return 0; // = 0x103a, - case Qt::Key_F12: return 0; // = 0x103b, - case Qt::Key_F13: return 0; // = 0x103c, - case Qt::Key_F14: return 0; // = 0x103d, - case Qt::Key_F15: return 0; // = 0x103e, - case Qt::Key_F16: return 0; // = 0x103f, - case Qt::Key_F17: return 0; // = 0x1040, - case Qt::Key_F18: return 0; // = 0x1041, - case Qt::Key_F19: return 0; // = 0x1042, - case Qt::Key_F20: return 0; // = 0x1043, - case Qt::Key_F21: return 0; // = 0x1044, - case Qt::Key_F22: return 0; // = 0x1045, - case Qt::Key_F23: return 0; // = 0x1046, - case Qt::Key_F24: return 0; // = 0x1047, - case Qt::Key_F25: return 0; // = 0x1048, // F25 .. F35 only on X11 - case Qt::Key_F26: return 0; // = 0x1049, - case Qt::Key_F27: return 0; // = 0x104a, - case Qt::Key_F28: return 0; // = 0x104b, - case Qt::Key_F29: return 0; // = 0x104c, - case Qt::Key_F30: return 0; // = 0x104d, - case Qt::Key_F31: return 0; // = 0x104e, - case Qt::Key_F32: return 0; // = 0x104f, - case Qt::Key_F33: return 0; // = 0x1050, - case Qt::Key_F34: return 0; // = 0x1051, - case Qt::Key_F35: return 0; // = 0x1052, - case Qt::Key_Super_L: return 0; // = 0x1053, // extra keys - case Qt::Key_Super_R: return 0; // = 0x1054, - case Qt::Key_Menu: return 0; // = 0x1055, - case Qt::Key_Hyper_L: return 0; // = 0x1056, - case Qt::Key_Hyper_R: return 0; // = 0x1057, - case Qt::Key_Help: return 0; // = 0x1058, - case Qt::Key_Direction_L: return 0; // = 0x1059, - case Qt::Key_Direction_R: return 0; // = 0x1060, - - // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06 - case Qt::Key_nobreakspace: return char(0xa0); - case Qt::Key_exclamdown: return char(0xa1); - case Qt::Key_cent: return char(0xa2); - case Qt::Key_sterling: return char(0xa3); - case Qt::Key_currency: return char(0xa4); - case Qt::Key_yen: return char(0xa5); - case Qt::Key_brokenbar: return char(0xa6); - case Qt::Key_section: return char(0xa7); - case Qt::Key_diaeresis: return char(0xa8); - case Qt::Key_copyright: return char(0xa9); - case Qt::Key_ordfeminine: return char(0xaa); - case Qt::Key_guillemotleft: return char(0xab); // left angle quotation mar - case Qt::Key_notsign: return char(0xac); - case Qt::Key_hyphen: return char(0xad); - case Qt::Key_registered: return char(0xae); - case Qt::Key_macron: return char(0xaf); - case Qt::Key_degree: return char(0xb0); - case Qt::Key_plusminus: return char(0xb1); - case Qt::Key_twosuperior: return char(0xb2); - case Qt::Key_threesuperior: return char(0xb3); - case Qt::Key_acute: return char(0xb4); - case Qt::Key_mu: return char(0xb5); - case Qt::Key_paragraph: return char(0xb6); - case Qt::Key_periodcentered: return char(0xb7); - case Qt::Key_cedilla: return char(0xb8); - case Qt::Key_onesuperior: return char(0xb9); - case Qt::Key_masculine: return char(0xba); - case Qt::Key_guillemotright: return char(0xbb); // right angle quotation mar - case Qt::Key_onequarter: return char(0xbc); - case Qt::Key_onehalf: return char(0xbd); - case Qt::Key_threequarters: return char(0xbe); - case Qt::Key_questiondown: return char(0xbf); - case Qt::Key_Agrave: return char(0xc0); - case Qt::Key_Aacute: return char(0xc1); - case Qt::Key_Acircumflex: return char(0xc2); - case Qt::Key_Atilde: return char(0xc3); - case Qt::Key_Adiaeresis: return char(0xc4); - case Qt::Key_Aring: return char(0xe5); - case Qt::Key_AE: return char(0xe6); - case Qt::Key_Ccedilla: return char(0xc7); - case Qt::Key_Egrave: return char(0xc8); - case Qt::Key_Eacute: return char(0xc9); - case Qt::Key_Ecircumflex: return char(0xca); - case Qt::Key_Ediaeresis: return char(0xcb); - case Qt::Key_Igrave: return char(0xcc); - case Qt::Key_Iacute: return char(0xcd); - case Qt::Key_Icircumflex: return char(0xce); - case Qt::Key_Idiaeresis: return char(0xcf); - case Qt::Key_ETH: return char(0xd0); - case Qt::Key_Ntilde: return char(0xd1); - case Qt::Key_Ograve: return char(0xd2); - case Qt::Key_Oacute: return char(0xd3); - case Qt::Key_Ocircumflex: return char(0xd4); - case Qt::Key_Otilde: return char(0xd5); - case Qt::Key_Odiaeresis: return char(0xd6); - case Qt::Key_multiply: return char(0xd7); - case Qt::Key_Ooblique: return char(0xf8); - case Qt::Key_Ugrave: return char(0xd9); - case Qt::Key_Uacute: return char(0xda); - case Qt::Key_Ucircumflex: return char(0xdb); - case Qt::Key_Udiaeresis: return char(0xdc); - case Qt::Key_Yacute: return char(0xdd); - case Qt::Key_THORN: return char(0xde); - case Qt::Key_ssharp: return char(0xdf); - case Qt::Key_division: return char(0xf7); - case Qt::Key_ydiaeresis: return char(0xff); - - // multimedia/internet keys - ignored by default - see QKeyEvent c'tor - - case Qt::Key_Back : return 0; // = 0x1061, - case Qt::Key_Forward : return 0; // = 0x1062, - case Qt::Key_Stop : return 0; // = 0x1063, - case Qt::Key_Refresh : return 0; // = 0x1064, - - case Qt::Key_VolumeDown: return 0; // = 0x1070, - case Qt::Key_VolumeMute : return 0; // = 0x1071, - case Qt::Key_VolumeUp: return 0; // = 0x1072, - case Qt::Key_BassBoost: return 0; // = 0x1073, - case Qt::Key_BassUp: return 0; // = 0x1074, - case Qt::Key_BassDown: return 0; // = 0x1075, - case Qt::Key_TrebleUp: return 0; // = 0x1076, - case Qt::Key_TrebleDown: return 0; // = 0x1077, - - case Qt::Key_MediaPlay : return 0; // = 0x1080, - case Qt::Key_MediaStop : return 0; // = 0x1081, - case Qt::Key_MediaPrevious : return 0; // = 0x1082, - case Qt::Key_MediaNext : return 0; // = 0x1083, - case Qt::Key_MediaRecord: return 0; // = 0x1084, - - case Qt::Key_HomePage : return 0; // = 0x1090, - case Qt::Key_Favorites : return 0; // = 0x1091, - case Qt::Key_Search : return 0; // = 0x1092, - case Qt::Key_Standby: return 0; // = 0x1093, - case Qt::Key_OpenUrl: return 0; // = 0x1094, - - case Qt::Key_LaunchMail : return 0; // = 0x10a0, - case Qt::Key_LaunchMedia: return 0; // = 0x10a1, - case Qt::Key_Launch0 : return 0; // = 0x10a2, - case Qt::Key_Launch1 : return 0; // = 0x10a3, - case Qt::Key_Launch2 : return 0; // = 0x10a4, - case Qt::Key_Launch3 : return 0; // = 0x10a5, - case Qt::Key_Launch4 : return 0; // = 0x10a6, - case Qt::Key_Launch5 : return 0; // = 0x10a7, - case Qt::Key_Launch6 : return 0; // = 0x10a8, - case Qt::Key_Launch7 : return 0; // = 0x10a9, - case Qt::Key_Launch8 : return 0; // = 0x10aa, - case Qt::Key_Launch9 : return 0; // = 0x10ab, - case Qt::Key_LaunchA : return 0; // = 0x10ac, - case Qt::Key_LaunchB : return 0; // = 0x10ad, - case Qt::Key_LaunchC : return 0; // = 0x10ae, - case Qt::Key_LaunchD : return 0; // = 0x10af, - case Qt::Key_LaunchE : return 0; // = 0x10b0, - case Qt::Key_LaunchF : return 0; // = 0x10b1, - - default: QTEST_ASSERT(false); return 0; - } -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/hbautotest.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,279 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef HBAUTOTEST_H -#define HBAUTOTEST_H - -#include -#include -#include - -class HbMainWindow; -class HbWidget; -class HbAutoTestMainWindow; -class HbAutoTest; -class HbAutoTestMouseEvent; -/* -INSTRUCTIONS: -The class HbAutoTest is meant to be used with Orbit applications auto testing instead of GUI testing APIs of QTestLib. - -The functions of this class is to used similarily to the related QTestLib functions. - -Use HbAutoTestMainWindow (defined below) instead of HbMainWindow to enble filtering. -Filterin filters out UI events that are not sent by function defined in HbAutoTest class. - -*/ - -class HbAutoTestMouseEvent : public QMouseEvent -{ -public: - HbAutoTestMouseEvent(Type type, const QPoint & pos, const QPoint & globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers ) - : QMouseEvent(type,pos,globalPos,button,buttons,modifiers){} -}; - -class HbAutoTestKeyEvent : public QKeyEvent -{ -public: - HbAutoTestKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(), - bool autorep = false, ushort count = 1 ) - : QKeyEvent(type, key, modifiers, text, autorep, count){} -}; - -class HbAutoTest -{ -public: - - static void mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1 ); - static void mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1); - static void mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1); - static void mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos = QPointF(), int delay = -1); - -private: - static void drag(HbAutoTestMainWindow *window, QPointF targetPoint); - static QPointF middlePointOfWidget( const HbWidget* widget); - - static bool pointerPressed; - static QPointF pressPoint; - -//Key event Part: copy-pasted from QTestLib and modified to support HbAutoTestKeyEvent to enable filtering. -//see HbAutoTestMainWindow below. -public: - - static Qt::Key asciiToKey(char ascii); - static char keyToAscii(Qt::Key key); - - static void simulateEvent(QWidget *widget, bool press, int code, - Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1); - - static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, - QString text, Qt::KeyboardModifiers modifier, int delay=-1); - - static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, - char ascii, Qt::KeyboardModifiers modifier, int delay=-1); - - static void keyEvent(QTest::KeyAction action, QWidget *widget, char ascii, - Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key, - Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyClicks(QWidget *widget, const QString &sequence, - Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); - - static void keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); -}; - -class HbTestEvent -{ -public: - virtual void simulate(QWidget *w) = 0; - virtual HbTestEvent *clone() const = 0; - - virtual ~HbTestEvent() {} -}; - -class HbTestKeyEvent: public HbTestEvent -{ -public: - inline HbTestKeyEvent(QTest::KeyAction action, Qt::Key key, Qt::KeyboardModifiers modifiers, int delay) - : _action(action), _delay(delay), _modifiers(modifiers), _ascii(0), _key(key) {} - inline HbTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay) - : _action(action), _delay(delay), _modifiers(modifiers), - _ascii(ascii), _key(Qt::Key_unknown) {} - inline HbTestEvent *clone() const { return new HbTestKeyEvent(*this); } - - inline void simulate(QWidget *w) - { - if (_ascii == 0) - HbAutoTest::keyEvent(_action, w, _key, _modifiers, _delay); - else - HbAutoTest::keyEvent(_action, w, _ascii, _modifiers, _delay); - } - -protected: - QTest::KeyAction _action; - int _delay; - Qt::KeyboardModifiers _modifiers; - char _ascii; - Qt::Key _key; -}; - -class HbTestKeyClicksEvent: public HbTestEvent -{ -public: - inline HbTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay) - : _keys(keys), _modifiers(modifiers), _delay(delay) {} - inline HbTestEvent *clone() const { return new HbTestKeyClicksEvent(*this); } - - inline void simulate(QWidget *w) - { - HbAutoTest::keyClicks(w, _keys, _modifiers, _delay); - } - -private: - QString _keys; - Qt::KeyboardModifiers _modifiers; - int _delay; -}; - -class HbTestDelayEvent: public HbTestEvent -{ -public: - inline HbTestDelayEvent(int msecs): _delay(msecs) {} - inline HbTestEvent *clone() const { return new HbTestDelayEvent(*this); } - - inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); } - -private: - int _delay; -}; - -class HbTestEventList: public QList -{ -public: - inline HbTestEventList() {} - inline HbTestEventList(const HbTestEventList &other): QList() - { for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); } - inline ~HbTestEventList() - { clear(); } - inline void clear() - { qDeleteAll(*this); QList::clear(); } - - inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { addKeyEvent(QTest::Click, qtKey, modifiers, msecs); } - inline void addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { addKeyEvent(QTest::Press, qtKey, modifiers, msecs); } - inline void addKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { addKeyEvent(QTest::Release, qtKey, modifiers, msecs); } - inline void addKeyEvent(QTest::KeyAction action, Qt::Key qtKey, - Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { append(new HbTestKeyEvent(action, qtKey, modifiers, msecs)); } - - inline void addKeyClick(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { addKeyEvent(QTest::Click, ascii, modifiers, msecs); } - inline void addKeyPress(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { addKeyEvent(QTest::Press, ascii, modifiers, msecs); } - inline void addKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { addKeyEvent(QTest::Release, ascii, modifiers, msecs); } - inline void addKeyClicks(const QString &keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { append(new HbTestKeyClicksEvent(keys, modifiers, msecs)); } - inline void addKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) - { append(new HbTestKeyEvent(action, ascii, modifiers, msecs)); } - - inline void addDelay(int msecs) - { append(new HbTestDelayEvent(msecs)); } - - inline void simulate(QWidget *w) - { - for (int i = 0; i < count(); ++i) - at(i)->simulate(w); - } -}; - -class HbAutoTestMainWindow : public HbMainWindow -{ -public: - HbAutoTestMainWindow() : HbMainWindow() {} - - void mousePressEvent(QMouseEvent *event) - { - qDebug( - "HbAutoTestMainWindow::mousePressEvent: x(%d) y(%d)", - event->x(), - event->y()); - if ( dynamic_cast(event) ) { - HbMainWindow::mousePressEvent(event); - } else { - ;//Do nothing - } - } - - void mouseMoveEvent(QMouseEvent *event) - { - if ( dynamic_cast(event) ) { - HbMainWindow::mouseMoveEvent(event); - } else { - ;//Do nothing - } - } - - void mouseReleaseEvent(QMouseEvent *event) - { - if ( dynamic_cast(event) ) { - HbMainWindow::mouseReleaseEvent(event); - } else { - ;//Do nothing - } - } - - void keyPressEvent(QKeyEvent *event) - { - if ( dynamic_cast(event) ) { - HbMainWindow::keyPressEvent(event); - } else { - ;//Do nothing - } - } - void keyReleaseEvent(QKeyEvent *event) - { - if ( dynamic_cast(event) ) { - HbMainWindow::keyReleaseEvent(event); - } else { - ;//Do nothing - } - } - - void mouseDoubleClickEvent(QMouseEvent *event) - { - Q_UNUSED(event); - //Just ignore, not supported in Orbit - } -}; - - -Q_DECLARE_METATYPE(HbTestEventList) -#endif //HBAUTOTEST_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/main.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/main.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes -#include -#include -#include -#include -#include - -// User includes -#include "testwlanwizard.h" -#include "testwlanwizardeap.h" -#include "testwlanwizardconnect.h" -#include "testwlanwizardmanual.h" -#include "testwlanwizardwps.h" - -// ======== LOCAL FUNCTIONS ======== -int main(int argc, char *argv[]) -{ - qDebug("TestWlanWizard main start"); - HbApplication app(argc, argv); - int res = 0; - char *pass[3]; - pass[0] = argv[0]; - pass[1] = "-o"; - - // log folder: \epoc32\winscw\c\data - - app.setApplicationName("TestWlanWizardUtilities"); - pass[2] = "c:\\data\\TestWlanWizardUtilities.txt"; - TestWlanWizard *tcUtilities = new TestWlanWizard(); - res |= QTest::qExec(tcUtilities, 3, pass); - delete tcUtilities; - tcUtilities = NULL; - - app.setApplicationName("TestWlanWizardConnect"); - pass[2] = "c:\\data\\TestWlanWizardConnect.txt"; - TestWlanWizardConnect *tcConnect = new TestWlanWizardConnect(); - res |= QTest::qExec(tcConnect, 3, pass); - delete tcConnect; - tcConnect = NULL; - - app.setApplicationName("TestWlanWizardManual"); - pass[2] = "c:\\data\\TestWlanWizardManual.txt"; - TestWlanWizardManual *tcManual = new TestWlanWizardManual(); - res |= QTest::qExec(tcManual, 3, pass); - delete tcManual; - tcManual = NULL; - - app.setApplicationName("TestWlanWizardEap"); - pass[2] = "c:\\data\\TestWlanWizardEap.txt"; - TestWlanWizardEap *tcEap = new TestWlanWizardEap(); - res |= QTest::qExec(tcEap, 3, pass); - delete tcEap; - tcEap = NULL; - - app.setApplicationName("TestWlanWizardWps"); - pass[2] = "c:\\data\\TestWlanWizardWps.txt"; - TestWlanWizardWps *tcWps = new TestWlanWizardWps(); - res |= QTest::qExec(tcWps, 3, pass); - delete tcWps; - tcWps = NULL; - - qDebug("TestWlanWizard main exit"); - return res; -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,347 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This is the source file for testing Wlan Wizard library. - */ - -// System includes -#include -#include - -// User includes -#include "testwlanwizard.h" -#include "wlanwizardutils.h" - -// External function prototypes - -// Local constants - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - -// --------------------------------------------------------- -// FRAMEWORK FUNCTIONS -// --------------------------------------------------------- - -/** - * This function will be called before the first test function is executed. - */ -void TestWlanWizard::initTestCase() -{ - -} - -/** - * This function will be called after the last test function was executed. - */ -void TestWlanWizard::cleanupTestCase() -{ -} - -/** - * This function will be called before each test function is executed. - */ -void TestWlanWizard::init() -{ - -} - -/** - * This function will be called after each test function is executed. - */ -void TestWlanWizard::cleanup() -{ - -} - -// --------------------------------------------------------- -// TEST CASES -// --------------------------------------------------------- - - -void TestWlanWizard::testWepHex64Valid() -{ - QString key("a0cd9fACDF"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testWepHex128Valid() -{ - QString key("ABCDEFabcdef0123456789AAAA"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testWepHexInvalidCharacters() -{ - QString key("wlanwizard"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testWepAscii64Valid() -{ - QString key("testi"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testWepAscii128Valid() -{ - QString key("wlanwizardjee"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testWepAsciiInvalidCharacters() -{ - QString key("wlanwizardje"); - key.append(QChar(31)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testWepLength9Invalid() -{ - QString key("123456789"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -void TestWlanWizard::testWepLength11Invalid() -{ - QString key("12345678901"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -void TestWlanWizard::testWepLength25Invalid() -{ - QString key("1234567890123456789012345"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -void TestWlanWizard::testWepLength27Invalid() -{ - QString key("123456789012345678901234567"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -void TestWlanWizard::testWepLength4Invalid() -{ - QString key("1234"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -void TestWlanWizard::testWepLength6Invalid() -{ - QString key("123456"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -void TestWlanWizard::testWepLength12Invalid() -{ - QString key("123456789012"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -void TestWlanWizard::testWepLength14Invalid() -{ - QString key("12345678901234"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); -} - -// ---------------------------------------------------------------------------- -// WPA test cases -// ---------------------------------------------------------------------------- -void TestWlanWizard::testWpaHexValid() -{ - QString key("1234567890123456789012345678abcdefabcdefabcdefABCDEFABCDEFABCDEF"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testWpaHexInvalidCharacters() -{ - QString key("abcdefabcdefabcdefABCDEFABCDEFABCDEF123456789012345678901234567G"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} -void TestWlanWizard::testWpaAsciiLength8Valid() -{ - QString key("ictsucks"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testWpaAsciiLength63Valid() -{ - QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-123"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testWpaAsciiLength64Invalid() -{ - QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-1234"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testWpaAsciiInvalidCharacters() -{ - QString key("wizardrules"); - key.append(QChar(127)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testWpaLength7Invalid() -{ - QString key("wizards"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooShort); -} - -void TestWlanWizard::testWpaLength65Invalid() -{ - QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-12345"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooLong); -} - - -// ---------------------------------------------------------------------------- -// ASCII test cases -// ---------------------------------------------------------------------------- -void TestWlanWizard::testAsciiValidCharacters() -{ - QString key; - for (int i = 32 ; i <= 126 ; i++){ - key.append(QChar(i)); - } - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testAsciiInvalidCharactersLower() -{ - QString key("wizardrules"); - key.append(QChar(31)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testAsciiInvalidCharactersUpper() -{ - QString key("wizardrules"); - key.append(QChar(127)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - - -// ---------------------------------------------------------------------------- -// HEX test cases -// ---------------------------------------------------------------------------- -void TestWlanWizard::testHexValidCharacters() -{ - QString key("abcdefABCDEF1234567890"); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusOk); -} - -void TestWlanWizard::testHexInvalidCharactersDigitLower() -{ - QString key("afAF09"); - key.append(QChar(47)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testHexInvalidCharactersDigitUpper() -{ - QString key("abc"); - key.append(QChar(58)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testHexInvalidCharacters_a_Lower() -{ - QString key("abc"); - key.append(QChar(96)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testHexInvalidCharacters_f_Upper() -{ - QString key("abc"); - key.append(QChar(103)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testHexInvalidCharacters_A_Lower() -{ - QString key("abc"); - key.append(QChar(64)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testHexInvalidCharacters_F_Upper() -{ - QString key("abc"); - key.append(QChar(71)); - WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); - QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); -} - -void TestWlanWizard::testSsidValidCharacters() -{ - QString key("12345678901234567890123456789012"); - WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); - QCOMPARE(status, WlanWizardUtils::SsidStatusOk); -} - -void TestWlanWizard::testSsidValidCharacters2() -{ - QString key("1"); - WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); - QCOMPARE(status, WlanWizardUtils::SsidStatusOk); -} - -void TestWlanWizard::testSsidInvalidTooShort() -{ - QString key(""); - WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); - QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength); -} - -void TestWlanWizard::testSsidInvalidTooLong() -{ - QString key("123456789012345678901234567890123"); - WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); - QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength); -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizard.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the header file for testing Wlan Qt Utilities library. -*/ - -#ifndef TESTWLANWIZARD_H_ -#define TESTWLANWIZARD_H_ - -// System includes -#include - -// User includes - -// Forward declarations -class QSignalSpy; -class WlanQtUtils; - -// External data types - -// Constants - -class TestWlanWizard: public QObject -{ - Q_OBJECT - -private slots: - - // Functions from QTest framework. - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - - // WEP test cases - void testWepHex64Valid(); - void testWepHex128Valid(); - void testWepHexInvalidCharacters(); - - void testWepAscii64Valid(); - void testWepAscii128Valid(); - void testWepAsciiInvalidCharacters(); - void testWepLength9Invalid(); - void testWepLength11Invalid(); - void testWepLength25Invalid(); - void testWepLength27Invalid(); - void testWepLength4Invalid(); - void testWepLength6Invalid(); - void testWepLength12Invalid(); - void testWepLength14Invalid(); - - // WPA test cases - void testWpaHexValid(); - void testWpaHexInvalidCharacters(); - void testWpaAsciiLength8Valid(); - void testWpaAsciiLength63Valid(); - void testWpaAsciiLength64Invalid(); - void testWpaAsciiInvalidCharacters(); - void testWpaLength7Invalid(); - void testWpaLength65Invalid(); - - // ASCII test cases - void testAsciiValidCharacters(); - void testAsciiInvalidCharactersLower(); - void testAsciiInvalidCharactersUpper(); - - // HEX test cases - void testHexValidCharacters(); - void testHexInvalidCharactersDigitLower(); - void testHexInvalidCharactersDigitUpper(); - void testHexInvalidCharacters_a_Lower(); - void testHexInvalidCharacters_f_Upper(); - void testHexInvalidCharacters_A_Lower(); - void testHexInvalidCharacters_F_Upper(); - - // SSID test cases - void testSsidValidCharacters(); - void testSsidValidCharacters2(); - void testSsidInvalidTooShort(); - void testSsidInvalidTooLong(); - -private: - -}; - -#endif /* TESTWLANWIZARD_H_ */ - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,608 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "testwlanwizardconnect.h" -#include "testwlanwizardconnect_conf.h" -#include "hbautotest.h" -#include "wlanwizard.h" -#include "wlanwizard_p.h" -#include "wlanwizardpagessid.h" -#include "wlanqtutils_context.h" -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" - -// External function prototypes - -// Local constants - - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - - -// --------------------------------------------------------- -// TEST CASES -// --------------------------------------------------------- - -/*! - * Connect to open: - * - verifies IAP settings - * - ICT success - * - Finish button pressed - */ -void TestWlanWizardConnect::tc_connect_to_open_success() -{ -#ifdef tc_connect_to_open_success_enabled - tc_connect_success("tc_connect_to_open_success", CMManagerShim::Infra, - CMManagerShim::WlanSecModeOpen, false, ""); -#endif -} - -/*! - * Connect to open - */ -void TestWlanWizardConnect::tc_connect_to_open_success_hidden() -{ -#ifdef tc_connect_to_open_success_hidden_enabled - tc_connect_success("tc_connect_to_open_success_hidden", CMManagerShim::Infra, - CMManagerShim::WlanSecModeOpen, true, ""); -#endif -} - -/*! - * Connect to open - */ -void TestWlanWizardConnect::tc_connect_to_open_success_adhoc() -{ -#ifdef tc_connect_to_open_success_adhoc_enabled - tc_connect_success("tc_connect_to_open_success_adhoc", CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, true, ""); -#endif -} - -/*! - * Connect to open - */ -void TestWlanWizardConnect::tc_connect_to_wep_success() -{ -#ifdef tc_connect_to_wep_success_enabled - tc_connect_success("tc_connect_to_wep_success", CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeWep, true, "abcde"); -#endif -} - -/*! - * Connect to open - */ -void TestWlanWizardConnect::tc_connect_to_wpa_psk_success() -{ -#ifdef tc_connect_to_wpa_psk_success_enabled - tc_connect_success("tc_connect_to_wpa_psk_success", CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, false, "password"); -#endif -} -/*! - * Connect to open - */ -void TestWlanWizardConnect::tc_connect_to_wpa2_psk_success() -{ -#ifdef tc_connect_to_wpa2_psk_success_enabled - tc_connect_success("tc_connect_to_wpa2_psk_success", CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeWpa2, false, "password"); -#endif -} - -/*! - * Connect to open: - * - Opens - * - ICT success - * - Cancel pressed in summary page - */ -void TestWlanWizardConnect::tc_connect_to_open_success_cancel() -{ -#ifdef tc_connect_to_open_success_cancel_enabled - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mView->mWizard->setParameters("tc_connect_to_open_success_cancel", - CMManagerShim::Infra, - CMManagerShim::WlanSecModeOpen, false, false, false); - - mView->showWizard(); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "tc_connect_to_open_success_cancel"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QTest::qWait(WaitTimeForUi); - - // Ignore previous calls - mWlanQtUtilsContext->calledMethods(); - - QCOMPARE( mouseClickCancel(), true ); - - QStringList calledMethods; - calledMethods << "disconnectIap" << "deleteIap"; - - QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); - QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true); -#endif -} - -void TestWlanWizardConnect::tc_network_failure_OpenAuthFailed() -{ -#ifdef tc_network_failure_OpenAuthFailed_enabled - tc_network_error_codes( - "tc_network_failure_OpenAuthFailed", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlanOpenAuthFailed ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthRequired() -{ -#ifdef tc_network_failure_SharedKeyAuthRequired_enabled - tc_network_error_codes( - "tc_network_failure_SharedKeyAuthRequired", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlanSharedKeyAuthRequired ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_WpaAuthRequired() -{ -#ifdef tc_network_failure_WpaAuthRequired_enabled - tc_network_error_codes( - "tc_network_failure_WpaAuthRequired", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlanWpaAuthRequired ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_WpaAuthFailed() -{ -#ifdef tc_network_failure_WpaAuthFailed_enabled - tc_network_error_codes( - "tc_network_failure_WpaAuthFailed", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeWpa, - true, - "password", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlanWpaAuthFailed ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_802dot1xAuthFailed() -{ -#ifdef tc_network_failure_802dot1xAuthFailed_enabled - tc_network_error_codes( - "tc_network_failure_802dot1xAuthFailed", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlan802dot1xAuthFailed ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_IllegalEncryptionKeys() -{ -#ifdef tc_network_failure_IllegalEncryptionKeys_enabled - tc_network_error_codes( - "tc_network_failure_IllegalEncryptionKeys", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlanIllegalEncryptionKeys ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_PskModeRequired() -{ -#ifdef tc_network_failure_PskModeRequired_enabled - tc_network_error_codes( - "tc_network_failure_PskModeRequired", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlanPskModeRequired ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_EapModeRequired() -{ -#ifdef tc_network_failure_EapModeRequired_enabled - tc_network_error_codes( - "tc_network_failure_EapModeRequired", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_authentication_unsuccessful"), - KErrWlanEapModeRequired ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_IllefalWpaPskKey() -{ -#ifdef tc_network_failure_IllefalWpaPskKey_enabled - tc_network_error_codes( - "tc_network_failure_IllefalWpaPskKey", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_incorrect_wpa_preshared_key_pleas"), - KErrWlanIllegalWpaPskKey ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthFailed() -{ -#ifdef tc_network_failure_SharedKeyAuthFailed_enabled - tc_network_error_codes( - "tc_network_failure_SharedKeyAuthFailed", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"), - KErrWlanSharedKeyAuthFailed ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_ErrNone() -{ -#ifdef tc_network_failure_ErrNone_enabled - tc_network_error_codes( - "tc_network_failure_ErrNone", - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeOpen, - false, - "", - hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"), - KErrWlanSharedKeyAuthFailed ); -#endif -} -void TestWlanWizardConnect::tc_network_failure_30180() -{ -#ifdef tc_network_failure_30180_enabled - const QString ssid("tc_network_failure_30180"); - tc_network_error_codes( - ssid, - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeWep, - false, - "abcde", - hbTrId("txt_occ_dialog_connection_failed"), - 30180 ); - - QCOMPARE( mouseClickPrevious(), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_connection_failed")), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QStringList calledMethods; - calledMethods - << "updateIap" - << "activeIap" - << "disconnectIap" - << "connectIap"; - - QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); - -#endif -} - -void TestWlanWizardConnect::tc_iap_creation_fails() -{ -#ifdef tc_iap_creation_fails_enabled - - const QString ssid("tc_iap_creation_fails"); - - mWlanQtUtilsContext->setCreateWlanIapResult(-1); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeOpen, - false, false, false); - - mView->showWizard(); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyCurrentPageWithInfo( - WlanWizardPageInternal::PageGenericError, - hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret") ), true ); - - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QStringList calledMethods; - calledMethods << "WlanQtUtils" << "createIap"; - QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); - - QCOMPARE( mouseClickCancel(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyStatus(WizardStatusSignalCancelled, 2), true); - QTest::qWait(WaitTimeForUi); -#endif -} - -void TestWlanWizardConnect::tc_cancel_key_query() -{ -#ifdef tc_cancel_key_query_enabled - - const QString ssid("tc_cancel_key_query"); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeWep, - true, false, false); - mView->showWizard(); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickCancel(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyStatus(WizardStatusSignalCancelled), true); - - mWlanQtUtilsContext->emitWlanNetworkClosed(-1, KErrCancel); - callWlanWizard_startPageOperation(); - - QStringList calledMethods; - calledMethods << "WlanQtUtils"; - QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); -#endif -} - -/*! - * Helpper test case for testing success case with compinations of provided - * parameters. - */ -void TestWlanWizardConnect::tc_connect_success(const QString &ssid, int networkMode, - int securityMode, bool hidden, QString key) -{ - - mWlanQtUtilsContext->setCreateWlanIapResult(2); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(2); - mWlanQtUtilsContext->setSignalIctResult(2, WlanQtUtils::IctPassed); - - mView->mWizard->setParameters(ssid, networkMode, securityMode, true, hidden, false); - - WlanQtUtilsAp ap; - ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); - ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); - ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); - ap.setValue(WlanQtUtilsAp::ConfIdHidden, hidden); - - // Default values - ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); - ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); - - QStringList calledMethods; - calledMethods << "WlanQtUtils"; - QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); - - mView->showWizard(); - if (securityMode == CMManagerShim::WlanSecModeWep || securityMode - == CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) { - // Key query short pwd - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - - if (securityMode == CMManagerShim::WlanSecModeWep) { - ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); - QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true ); - } - else { - QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - } - QCOMPARE( mouseClickObject("dialog"), true ); - - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - QTest::qWait(WaitTimeForUi); - } - else { - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - QTest::qWait(WaitTimeForUi); - } - - QCOMPARE(verifySummaryPage( - ssid, - networkMode, - hidden, - securityMode, - true, - hbTrId("txt_occ_dblist_destination_val_internet")),true); - - calledMethods.clear(); - calledMethods << "createIap" << "activeIap" << "connectIap"; - QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods); - QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickFinish(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyStatus(WizardStatusSignalFinished, 2), true); -} - -/*! - * Helpper test case for testing success case with compinations of provided - * parameters. - */ -void TestWlanWizardConnect::tc_network_error_codes( - const QString &ssid, - int networkMode, - int securityMode, - bool hidden, - QString key, - const QString &errorString, - int errorCode) -{ - mWlanQtUtilsContext->setCreateWlanIapResult(2); - mWlanQtUtilsContext->setConnectionSuccessed(false); - mWlanQtUtilsContext->setSignalWlanNetworkClosed(2, errorCode); - mWlanQtUtilsContext->setActiveWlanIapResult(1); - mView->mWizard->setParameters(ssid, networkMode, securityMode, true, hidden, false); - - WlanQtUtilsAp ap; - ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); - ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); - ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); - ap.setValue(WlanQtUtilsAp::ConfIdHidden, hidden); - - // Default values - ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); - ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); - - QStringList calledMethods; - calledMethods << "WlanQtUtils"; - QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); - - mView->showWizard(); - if (securityMode == CMManagerShim::WlanSecModeWep || securityMode - == CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) { - // Key query short pwd - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - - if (securityMode == CMManagerShim::WlanSecModeWep) { - ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key); - ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); - QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true ); - } - else { - QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); - } - QCOMPARE( mouseClickObject("dialog"), true ); - - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - } - else { - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - } - - calledMethods.clear(); - calledMethods - << "createIap" - << "activeIap" - << "disconnectIap" - << "connectIap"; - QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods); - QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); - QTest::qWait(WaitTimeForUi); -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef TESTWLANWIZARDRNDCONNECT_H_ -#define TESTWLANWIZARDRNDCONNECT_H_ - -#include "testwlanwizardcontext.h" - -class TestWlanWizardConnect : public TestWlanWizardContext -{ -Q_OBJECT - -private slots: - void tc_connect_to_open_success(); - void tc_connect_to_open_success_hidden(); - void tc_connect_to_open_success_adhoc(); - void tc_connect_to_wep_success(); - void tc_connect_to_wpa_psk_success(); - void tc_connect_to_wpa2_psk_success(); - void tc_connect_to_open_success_cancel(); - void tc_network_failure_OpenAuthFailed(); - void tc_network_failure_SharedKeyAuthRequired(); - void tc_network_failure_WpaAuthRequired(); - void tc_network_failure_WpaAuthFailed(); - void tc_network_failure_802dot1xAuthFailed(); - void tc_network_failure_IllegalEncryptionKeys(); - void tc_network_failure_PskModeRequired(); - void tc_network_failure_EapModeRequired(); - void tc_network_failure_IllefalWpaPskKey(); - void tc_network_failure_SharedKeyAuthFailed(); - void tc_network_failure_ErrNone(); - void tc_network_failure_30180(); - void tc_iap_creation_fails(); - void tc_cancel_key_query(); - -private: - void tc_connect_success( - const QString &ssid, - int networkMode, - int securityMode, - bool hidden, - QString key); - - void tc_network_error_codes( - const QString &ssid, - int networkMode, - int securityMode, - bool hidden, - QString key, - const QString &errorString, - int errorCode); -}; - -#endif /* TESTWLANWIZARDRNDCONNECT_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect_conf.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardconnect_conf.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes - -// User includes - -// External function prototypes - -// Local constants - - -#define tc_connect_to_open_success_enabled -#define tc_connect_to_open_success_hidden_enabled; -#define tc_connect_to_open_success_adhoc_enabled; -#define tc_connect_to_wep_success_enabled; -#define tc_connect_to_wpa_psk_success_enabled; -#define tc_connect_to_wpa2_psk_success_enabled; -#define tc_connect_to_open_success_cancel_enabled -#define tc_network_failure_OpenAuthFailed_enabled -#define tc_network_failure_SharedKeyAuthRequired_enabled -#define tc_network_failure_WpaAuthRequired_enabled -#define tc_network_failure_WpaAuthFailed_enabled -#define tc_network_failure_802dot1xAuthFailed_enabled -#define tc_network_failure_IllegalEncryptionKeys_enabled -#define tc_network_failure_PskModeRequired_enabled -#define tc_network_failure_EapModeRequired_enabled -#define tc_network_failure_IllefalWpaPskKey_enabled -#define tc_network_failure_SharedKeyAuthFailed_enabled -#define tc_network_failure_ErrNone_enabled -#define tc_network_failure_30180_enabled -#define tc_iap_creation_fails_enabled -#define tc_cancel_key_query_enabled diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,962 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "testwlanwizardcontext.h" -#include "hbautotest.h" -#include "wlanwizard.h" -#include "wlanwizard_p.h" -#include "wlanwizardpageinternal.h" -#include "wlanwizardhelper.h" -#include "wlanqtutils_context.h" -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" -#include "eapqtconfiginterface_context.h" -#include "eapwizard.h" -#include "eapwizard_p.h" -#include "eapwizardpage.h" -#include "wpswizardpage.h" -#include "wlanmgmtclient_context.h" -#include "wpswizardstepfour.h" -#include "wpswizardstepfour_p.h" -#include "cwpsactiverunner.h" - -// External function prototypes - -// Local constants -class TestRadioButtonList: public HbRadioButtonList -{ -public: - void emitActivated(const QModelIndex &modelIndex) - { HbRadioButtonList::emitActivated(modelIndex); } -}; - - -// --------------------------------------------------------- -// FRAMEWORK FUNCTIONS -// --------------------------------------------------------- - -ContextWlanApList::ContextWlanApList() -{ - -} - -ContextWlanApList::~ContextWlanApList() -{ - clear(); -} - -void ContextWlanApList::Add(QString name, int netMode, int secMode, bool wpaPskInUse, - bool wpsSupported, int signalStrength) -{ - QSharedPointer temp = QSharedPointer(new WlanQtUtilsAp()); - temp->setValue(WlanQtUtilsAp::ConfIdSsid, name); - temp->setValue(WlanQtUtilsAp::ConfIdConnectionMode, netMode); - temp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); - temp->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, wpaPskInUse); - temp->setValue(WlanQtUtilsAp::ConfIdWpsSupported, wpsSupported); - temp->setValue(WlanQtUtilsAp::ConfIdSignalStrength, signalStrength); - - mList.append(temp); -} - -void ContextWlanApList::clear() -{ - mList.clear(); -} - - -TestWlanWizardContext::TestWlanWizardContext() : - mView(NULL), - mMainWindow(NULL), - mWlanQtUtilsContext(NULL), - mEapQtUtilsContext(NULL), - mWlanMgmtClientContext(NULL), - mApList(NULL), - mApOpenList(NULL) -{ - -} -TestWlanWizardContext::~TestWlanWizardContext() -{ - -} - -/** - * This function will be called before the first test function is executed. - */ -void TestWlanWizardContext::initTestCase() -{ - qDebug("TestWlanWizardContext::initTestCase"); - - mMainWindow = new HbAutoTestMainWindow; - - mView = new TestView(); - - mMainWindow->addView(mView); - mMainWindow->setCurrentView(mView); - mMainWindow->installEventFilter(this); - mMainWindow->show(); - - QTest::qWait(1); - while (!mEvent) { - QTest::qWait(WaitTimeForUi); - } - mEvent = false; - mApList = new ContextWlanApList(); - mApOpenList = new ContextWlanApList(); - -} - -/** - * This function will be called after the last test function was executed. - */ -void TestWlanWizardContext::cleanupTestCase() -{ - qDebug("TestWlanWizardContext::cleanupTestCase"); - - qDebug("delete mApList"); - delete mApList; - mApList = NULL; - delete mApOpenList; - mApOpenList = NULL; - - qDebug("delete mMainWindow"); - mMainWindow->setAttribute( Qt::WA_DeleteOnClose, true ); - mMainWindow->close(); - mMainWindow = NULL; - QTest::qWait(WaitTimeForUi); - qDebug("TestWlanWizardContext::cleanupTestCase exit"); -} - -/** - * This function will be called before each test function is executed. - */ -void TestWlanWizardContext::init() -{ - qDebug("TestWlanWizardContext::init()"); - - mView->createWizard(); - mWlanQtUtilsContext = new WlanQtUtilsContext(mView->mWizard->d_ptr->mWlanQtUtils.data()); - - mEapQtUtilsContext = new EapQtConfigInterfaceContext(); - mEapQtUtilsContext->setObject(getEapQtConfig()); - - mWlanMgmtClientContext = new WlanMgmtClientContext(); - //mWlanMgmtClientContext->setObject(mWlanMgmtClient); - - WpsPageStepFour* wps = (WpsPageStepFour*)(mView->mWizard->d_ptr->mPages[WpsWizardPage::PageWpsWizardStep4]); - Q_ASSERT(wps); - mWlanMgmtClientContext->setObject(wps->d_ptr->mWpsActiveRunner->iWLANMgmtClient); -} - -/** - * This function will be called after each test function is executed. - */ -void TestWlanWizardContext::cleanup() -{ - qDebug("TestWlanWizardContext::cleanup()"); - - delete mWlanQtUtilsContext; - delete mEapQtUtilsContext; - delete mWlanMgmtClientContext; - - mView->deleteWizard(); - mApList->clear(); - mApOpenList->clear(); - QTest::qWait(1); -} - - -/*! - * Filter to catch focus event to the text editor widget. - */ -bool TestWlanWizardContext::eventFilter(QObject *obj, QEvent *event) -{ - if (obj == mMainWindow && event->type() == QEvent::Show) { - mMainWindow->removeEventFilter(this); - mEvent = true; - } - return false; -} - -QGraphicsWidget* TestWlanWizardContext::findChildItem(const QString &itemName, QGraphicsWidget *widget) -{ - QList list = widget->childItems(); - for (int i = 0; i < list.size(); i++) { - QGraphicsWidget* item = (QGraphicsWidget*) list[i]; - if (item->objectName() == itemName) { - return item; - } - else if ((item = findChildItem(itemName, item))) { - return item; - } - } - return 0; -} - -bool TestWlanWizardContext::verifyStatus(WizardStatusSignal status, int iapId) -{ - return mView->verifyStatus(status, iapId); -} - -bool TestWlanWizardContext::verifyCurrentPage(int pageId, int retries, int wait_ms) -{ - bool ret = true; - - for (int i = 0; i < retries; i++) { - QTest::qWait(wait_ms); - - WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; - HbWidget* current = qobject_cast (pPrivate->mStackedWidget->currentWidget()); - WlanWizardPage *page = pPrivate->mPageMapper[current]; - - // TODO: verify title in this method - - if (page == pPrivate->mPages[pageId]) { - switch(pageId) { - case WlanWizardPageInternal::PageNetworkMode: - return verifyDialogText("dialog_6", hbTrId("txt_occ_dialog_select_network_mode_and_status")); - - case WlanWizardPageInternal::PageNetworkSecurity: - return verifyDialogText("dialog_6", hbTrId("txt_occ_dialog_select_network_security_mode")); - - case WlanWizardPageInternal::PageSsid: - return verifyDialogText("dialog", hbTrId("txt_occ_dialog_insert_the_name_of_the_new_wlan_net")); - - case WlanWizardPageInternal::PageSummary: - if (pPrivate->mTitle->plainText() != hbTrId("txt_occ_title_wlan_setup_wizard_summary")){ - qWarning("TestWlanWizardContext::verifyCurrentPage: Invalid title"); - return false; - } - return true; - - case EapWizardPage::PageOuterType: - return verifyDialogText("title", hbTrId("txt_occ_title_select_eap_type")); - - case EapWizardPage::PageCertificateCa: - return verifyDialogText("title", hbTrId("txt_occ_title_select_authority_certificate")); - - case EapWizardPage::PageCertificateUser: - return verifyDialogText("title", hbTrId("txt_occ_title_select_user_certificate")); - - case EapWizardPage::PageNewPacStorePassword: - ret &= verifyDialogText("setlabel_55", hbTrId("txt_occ_setlabel_new_pac_store_password")); - ret &= verifyDialogText("setlabel_56", hbTrId("txt_occ_setlabel_confirm_password")); - return ret; - - case EapWizardPage::PagePromptPacStorePassword: - return verifyDialogText("setlabel_59", hbTrId("txt_occ_setlabel_eap_pac_store_password")); - - case WpsWizardPage::PageWpsWizardStep2: - return verifyDialogText("label", hbTrId("txt_occ_dialog_selected_network_supports_wifi_pro")); - break; - - case WpsWizardPage::PageWpsWizardStep3_Button: - return verifyDialogText("label_heading", hbTrId("txt_occ_dialog_first_press_button_on_the_wireless")); - break; - - case WpsWizardPage::PageWpsWizardStep3_Number: - // TODO: something better here?? - return true; - - case WpsWizardPage::PageWpsWizardStep4: - return verifyDialogText("label_heading", hbTrId("txt_occ_dialog_negotiating")); - - case WpsWizardPage::PageWpsWizardStep5: - return verifyDialogText("label", hbTrId("txt_occ_dialog_settings_received_for_multiple_wlan")); - - default: - return false; - } - } - } - qWarning("verifyCurrentPage: expected: %d", pageId); - return false; -} - -bool TestWlanWizardContext::verifyCurrentPageWithInfo( - int pageId, const QString &info, int retries, int wait_ms) -{ - bool ret = true; - for (int i = 0; i < retries; i++) { - QTest::qWait(wait_ms); - - WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; - HbWidget* current = qobject_cast (pPrivate->mStackedWidget->currentWidget()); - WlanWizardPage *page = pPrivate->mPageMapper[current]; - - // TODO: verify title in this method - - if (page == pPrivate->mPages[pageId]) { - switch(pageId) { - case WlanWizardPageInternal::PageGenericError: - return verifyDialogText("dialog", info); - - case WlanWizardPageInternal::PageKeyQuery: - return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_enter_key_for_1").arg(info)); - - case WlanWizardPageInternal::PageProcessSettings: - return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_checking_connection_to_1").arg(info)); - - case WlanWizardPageInternal::PageScanning: - return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_searching").arg(info)); - - case EapWizardPage::PageUsernamePassword: - ret &= verifyDialogText( - "setlabel_55", - HbParameterLengthLimiter("txt_occ_setlabel_user_name_for_1").arg(info)); - ret &= verifyDialogText("setlabel_56", hbTrId("txt_occ_setlabel_eap_password")); - return ret; - - case EapWizardPage::PageIdentity: - ret &= verifyDialogText("setlabel_53", HbParameterLengthLimiter("txt_occ_setlabel_user_name_for_1").arg(info)); - ret &= verifyDialogText("setlabel_53_val", hbTrId("txt_occ_setlabel_user_name_val_generate_automatic")); - ret &= verifyDialogText("setlabel_54", hbTrId("txt_occ_setlabel_eap_realm")); - ret &= verifyDialogText("setlabel_54_val", hbTrId("txt_occ_setlabel_eap_realm_val_generate_automatically")); - return ret; - - case EapWizardPage::PageInnerTypePeap: - case EapWizardPage::PageInnerTypeEapTtls: - return verifyDialogText("title", HbParameterLengthLimiter("txt_occ_title_select_innear_eap_type_for_1").arg(info)); - - default: - return verifyCurrentPage(pageId, retries, wait_ms); - } - } - } - qWarning("verifyCurrentPage: expected: %d", pageId); - return false; -} - - -bool TestWlanWizardContext::verifyDialogText(const QString objName, const QString text) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - HbWidget* widget = qobject_cast ( - findChildItem(objName, current)); - - if (widget) { - HbLabel *label = qobject_cast(widget); - if (label) { - if(label->plainText() == text) { - if (!label->isVisible()){ - qWarning("verifyDialogText: not visible"); - return false; - } - return true; - - } else { - qWarning("verifyDialogText: not match"); - qDebug() << "expect: " << text; - qDebug() << "actual: " << label->plainText(); - return false; - } - } - HbCheckBox *checkBox = qobject_cast(widget); - if (checkBox) { - if(checkBox->text() == text) { - if (!checkBox->isVisible()){ - qWarning("verifyDialogText: not visible"); - return false; - } - return true; - - } else { - qWarning("verifyDialogText: not match"); - qDebug() << "expect: " << text; - qDebug() << "actual: " << checkBox->text(); - return false; - } - } - } - - qWarning("verifyDialogText: object not found"); - - return false; -} - -bool TestWlanWizardContext::verifyActionButtons(ButtonStatus prevStatus, - ButtonStatus cancelStatus, - ButtonStatus nextStatus, - ButtonStatus finishStatus) -{ - WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; - ButtonStatus prevReally = ButtonHidden; - ButtonStatus cancelReally = ButtonHidden; - ButtonStatus nextReally = ButtonHidden; - ButtonStatus finishReally = ButtonHidden; - - if(pPrivate->mActionPrevious->isVisible()) { - if(pPrivate->mActionPrevious->isEnabled()) { - prevReally = ButtonEnabled; - } else { - prevReally = ButtonDisabled; - } - } - - if(pPrivate->mActionCancel->isVisible()) { - if(pPrivate->mActionCancel->isEnabled()) { - cancelReally = ButtonEnabled; - } else { - cancelReally = ButtonDisabled; - } - } - - if(pPrivate->mActionNext->isVisible()) { - if(pPrivate->mActionNext->isEnabled()) { - nextReally = ButtonEnabled; - } else { - nextReally = ButtonDisabled; - } - } - - if(pPrivate->mActionFinish->isVisible()) { - if(pPrivate->mActionFinish->isEnabled()) { - finishReally = ButtonEnabled; - } else { - finishReally = ButtonDisabled; - } - } - bool ret = true; - if (prevReally != prevStatus){ - qWarning("Previous Button: really: %d, status: %d", prevReally, prevStatus); - ret = false; - } - if (cancelReally != cancelStatus){ - qWarning("Cancel Button: really: %d, status: %d", cancelReally, cancelStatus); - ret = false; - } - if (nextReally != nextStatus){ - qWarning("Next Button: really: %d, status: %d", nextReally, nextStatus); - ret = false; - } - if (finishReally != finishStatus){ - qWarning("Finish Button: really: %d, status: %d", finishReally, finishStatus); - ret = false; - } - - return ret; -} - -bool TestWlanWizardContext::verifySummaryPage( - const QString &ssid, - int netMode, - bool hidden, - int secMode, - bool useWpaPsk, - const QString &destination, - int outerType, - int innerType, - bool eapFastProvMode) -{ - bool ret = true; - int i = 0; - HbListWidget* listWidget = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - - if (!listWidget){ - qWarning("verifySummaryPage: ListWidget not found"); - return false; - } - - // VERIFY: NETWORK NAME - HbListWidgetItem *item = listWidget->item(i++); - if (item->text() != hbTrId("txt_occ_dblist_network_name")) { - qWarning("verifySummaryPage: no match network name"); - ret = false; - } - - if (item->secondaryText() != ssid){ - qWarning("verifySummaryPage: no match ssid"); - ret = false; - } - - // VERIFY: NETWORK MODE - item = listWidget->item(i++); - if (item->text() != hbTrId("txt_occ_dblist_network_mode")) { - qWarning("verifySummaryPage: no match network mode"); - ret = false; - } - - if (item->secondaryText() != toNetworkModeString(netMode, hidden)){ - qWarning("verifySummaryPage: no match network mode value"); - ret = false; - } - - // VERIFY: SECURITY MODE - item = listWidget->item(i++); - if (item->text() != hbTrId("txt_occ_dblist_security_mode")) { - qWarning("verifySummaryPage: no match security mode"); - ret = false; - } - - if (item->secondaryText() != toSecurityModeString(secMode, useWpaPsk)){ - qWarning("verifySummaryPage: no match security mode value"); - ret = false; - } - - // VERIFY: EAP OUTER TYPE - if (outerType != -1) { - item = listWidget->item(i++); - if (item->text() != hbTrId("txt_occ_dblist_outer_eap")) { - qWarning("verifySummaryPage: no match eap outer type"); - ret = false; - } - if (item->secondaryText() != eapTypeToString(outerType)){ - qWarning("verifySummaryPage: no match eap outer type value"); - ret = false; - } - } - - // VERIFY: EAP INNER TYPE - if (innerType != -1) { - item = listWidget->item(i++); - if (item->text() != hbTrId("txt_occ_dblist_inner_eap")) { - qWarning("verifySummaryPage: no match eap inner type"); - ret = false; - } - if (item->secondaryText() != eapTypeToString(innerType)){ - qWarning("verifySummaryPage: no match eap inner type value"); - ret = false; - } - } - - // VERIFY: EAP FAST PROVISIONING MODE - if (eapFastProvMode) { - item = listWidget->item(i++); - if (item->text() != hbTrId("txt_occ_dblist_provisioning_mode_for_eapfast")) { - qWarning("verifySummaryPage: no match eap prov mode"); - ret = false; - } - if (item->secondaryText() != hbTrId("txt_occ_dblist_provisioning_mode_for_val_unauthent")){ - qWarning("verifySummaryPage: no match eap prov mode value"); - ret = false; - } - } - - // VERIFY: DESTINATION - if (destination.length() > 0) { - item = listWidget->item(i++); - if (item->text() != hbTrId("txt_occ_dblist_destination")) { - qWarning("verifySummaryPage: no match destination"); - ret = false; - } - if (item->secondaryText() != destination){ - qWarning("verifySummaryPage: no match destination value"); - ret = false; - } - } - - - return ret; -} - -bool TestWlanWizardContext::mouseClickObject(const QString objName) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - HbWidget* widget = (HbWidget*) findChildItem(objName, current); - - if (widget) { - HbAutoTest::mouseClick(mMainWindow, widget); - widget->clearFocus(); - widget->setFocus(); - return true; - } - qWarning("mouseClickObject: object not found"); - - return false; -} - -bool TestWlanWizardContext::insertTextToObject(const QString objName, const QString text) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - HbWidget* widget = (HbWidget*) findChildItem(objName, current); - - if (widget) { - for (int i = 0; i < text.size(); i++) { - HbAutoTest::keyPress(mMainWindow, text.at(i).toAscii(), 0, 10); - QTest::qWait(20); - } - return true; - } - qWarning("insertTextToObject: object not found"); - return false; -} - -bool TestWlanWizardContext::selectRadioButton(const QString objName, int index) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - TestRadioButtonList* widget = (TestRadioButtonList*) findChildItem(objName, current); - - if (widget) { - if (widget->items().length() <= index) { - qWarning("selectRadioButton: index out of range"); - return false; - } - widget->setSelected(index); - widget->emitActivated(widget->currentIndex()); - return true; - } - qWarning("selectRadioButton: object not found"); - - return false; -} - -bool TestWlanWizardContext::verifyRadioButtonState( - const QString objName, - int index, - const QString &text) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - - HbRadioButtonList* widget = qobject_cast( - findChildItem(objName, current)); - - if (widget) { - if (widget->selected() != index) { - qWarning("verifyRadioButtonState: invalid index"); - return false; - } - - if (widget->items().at(index) != text) { - qWarning("verifyRadioButtonState: text does not match"); - return false; - } - - return true; - } - qWarning("verifyRadioButtonState: object not found"); - - return false; -} - -QStringList TestWlanWizardContext::verifyRadioButtons(const QString objName) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - - HbRadioButtonList* widget = qobject_cast( - findChildItem(objName, current)); - - QStringList ret; - - if (widget) { - ret = widget->items(); - } - else { - qWarning("verifyRadioButtons: object not found"); - } - - return ret; -} - -int TestWlanWizardContext::verifySelectedRadioButton(const QString objName) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - - HbRadioButtonList* widget = qobject_cast( - findChildItem(objName, current)); - - int ret = ListNotFound; - - if (widget) { - ret = widget->selected(); - } - else { - qWarning("verifySelectedRadioButton: object not found"); - } - - return ret; -} - -bool TestWlanWizardContext::verifyCheckBoxState(const QString &objName, bool checked) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - HbCheckBox* widget = qobject_cast( - findChildItem(objName, current)); - - if (widget) { - if (widget->isChecked() != checked) { - qWarning("Checkbox in wrong state"); - return false; - } - return true; - } - qWarning("verifyCheckBoxState: object not found"); - return false; -} - -bool TestWlanWizardContext::selectCheckBoxState(const QString &objName, bool check) -{ - HbWidget* current = qobject_cast ( - mView->mWizard->d_ptr->mStackedWidget->currentWidget()); - HbCheckBox* widget = qobject_cast( - findChildItem(objName, current)); - - if (widget) { - if (check) { - widget->setCheckState(Qt::Checked); - } else { - widget->setCheckState(Qt::Unchecked); - } - return true; - - } - qWarning("selectCheckBoxState: object not found"); - return false; -} - -bool TestWlanWizardContext::mouseClickNext() -{ - if (mView->mWizard->d_ptr->mActionNext->isEnabled()) { - mView->mWizard->d_ptr->mActionNext->activate(QAction::Trigger); - return true; - } - qWarning("Next button not enabled"); - return false; -} - -bool TestWlanWizardContext::mouseClickPrevious() -{ - if (mView->mWizard->d_ptr->mActionPrevious->isEnabled()) { - mView->mWizard->d_ptr->mActionPrevious->activate(QAction::Trigger); - return true; - } - qWarning("mouseClickPrevious: Previous button not enabled"); - - return false; -} - -bool TestWlanWizardContext::mouseClickCancel() -{ - if (mView->mWizard->d_ptr->mActionCancel->isEnabled()) { - mView->mWizard->d_ptr->mActionCancel->activate(QAction::Trigger); - return true; - } - qWarning("mouseClickCancel: Cancel button not enabled"); - - return false; -} - -bool TestWlanWizardContext::mouseClickFinish() -{ - if (mView->mWizard->d_ptr->mActionFinish->isEnabled()) { - mView->mWizard->d_ptr->mActionFinish->activate(QAction::Trigger); - return true; - } - qWarning("mouseClickFinish: Finish button not enabled"); - - return false; -} - -QString TestWlanWizardContext::toNetworkModeString(int netMode, bool isHidden) -{ - QString ret; - switch (netMode) { - case CMManagerShim::Adhoc: - ret = hbTrId("txt_occ_dblist_network_mode_val_adhoc"); - break; - - default: - if (isHidden) { - ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); - } else { - ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); - } - break; - } - return ret; -} - -QString TestWlanWizardContext::toSecurityModeString(int secMode, int useWpaPsk) -{ - QString ret; - switch (secMode) { - case CMManagerShim::WlanSecMode802_1x: - ret = hbTrId("txt_occ_dblist_security_mode_val_8021x"); - break; - - case CMManagerShim::WlanSecModeWep: - ret = hbTrId("txt_occ_dblist_security_mode_val_wep"); - break; - - case CMManagerShim::WlanSecModeWpa: - if (useWpaPsk) { - ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2psk"); - } else { - ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2_with_eap"); - } - break; - - case CMManagerShim::WlanSecModeWpa2: - if (useWpaPsk) { - ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_passwor"); - } else { - ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_eap"); - } - break; - - default: - Q_ASSERT(secMode == CMManagerShim::WlanSecModeOpen); - ret = hbTrId("txt_occ_dblist_security_mode_val_open"); - break; - } - return ret; -} - - -EapQtConfigInterface *TestWlanWizardContext::getEapQtConfig() -{ - return mView->mWizard->d_ptr->mEapWizard->d_ptr->mEapConfIf.data(); -} - -QString TestWlanWizardContext::eapTypeToString(int type) -{ - QCOMPARE(mView->mWizard->d_ptr->mEapWizard != NULL, true); - return mView->mWizard->d_ptr->mEapWizard->d_ptr->eapTypeToString(type); -} - -void TestWlanWizardContext::callWlanWizard_startPageOperation() -{ - mView->mWizard->d_ptr->startPageOperation(); -} - - -void TestWlanWizardContext::setWlanMgmtClientObject(CWlanMgmtClient* object) -{ - // TODO: mWlanMgmtClient = object; -} - -TestView::TestView() : mWizard(NULL) -{ - qDebug("TestView::TestView()"); -} - -TestView::~TestView() -{ - qDebug("TestView::~TestView()"); -} - -void TestView::createWizard() -{ - qDebug("TestView::createWizard"); - Q_ASSERT(mWizard == NULL); - mWizard = new WlanWizard(mainWindow()); - bool ok; - ok = connect( - mWizard, SIGNAL(finished(int, bool)), - this, SLOT(finished(int, bool)), - Qt::QueuedConnection); - Q_ASSERT(ok); - - ok = connect( - mWizard, SIGNAL(cancelled()), - this, SLOT(cancelled()), - Qt::QueuedConnection); - Q_ASSERT(ok); - - mWizardStatus = WizardStatusSignalNone; - mConnectedIapId = -100; -} - -void TestView::showWizard() -{ - qDebug("TestView::showWizard()"); - Q_ASSERT(mWizard); - mWizard->show(); -} - -void TestView::deleteWizard() -{ - qDebug("TestView::deleteWizard"); - - Q_ASSERT(mWizard != NULL); - QMetaObject::invokeMethod(mWizard, "deleteLater", Qt::QueuedConnection); - QTest::qWait(100); - mWizard = NULL; -} - -void TestView::finished(int iapId, bool connected) -{ - qDebug("TestView::complete(), iap id: %d, connected: %d", iapId, connected); - - if (mWizardStatus != WizardStatusSignalNone) { - qWarning("TestView::finished: multiple signals received"); - mWizardStatus = WizardStatusSignalUndefined; - } else { - mWizardStatus = WizardStatusSignalFinished; - mConnectedIapId = iapId; - } -} - -void TestView::cancelled() -{ - qDebug("TestView::cancelled()"); - if (mWizardStatus != WizardStatusSignalNone) { - qWarning("TestView::cancelled: multiple signals received"); - mWizardStatus = WizardStatusSignalUndefined; - } else { - mWizardStatus = WizardStatusSignalCancelled; - } -} - -bool TestView::verifyStatus(WizardStatusSignal status, int iapId ) -{ - // Since connections to cancelled and finished signals are queued - // we need to use qWait() here. - QTest::qWait(100); - bool ret = true; - if (status != mWizardStatus){ - qWarning("TestView::verifyStatus, status: expected: %d, actual: %d", status, mWizardStatus); - ret = false; - } - if (status == WizardStatusSignalFinished) { - if (iapId != mConnectedIapId) { - qWarning("TestView::verifyStatus, iapid: expected: %d, actual: %d", iapId, mConnectedIapId); - ret = false; - } - } - return ret; -} - - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardcontext.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef TESTWLANWIZARDRNDUICONTEXT_H_ -#define TESTWLANWIZARDRNDUICONTEXT_H_ - -#include -#include -#include - -class QGraphicsItem; -class HbAutoTestMainWindow; -class WlanWizard; -class WlanQtUtilsContext; -class WlanQtUtils; -class WlanQtUtilsAp; -class QString; -class EapWizard; -class EapQtConfigInterfaceContext; -class EapQtConfigInterface; -class WlanMgmtClientContext; -class CWlanMgmtClient; - -//! 1sec -#define WaitTimeForUi 500 - -enum WizardStatusSignal{ - WizardStatusSignalNone, - WizardStatusSignalFinished, - WizardStatusSignalCancelled, - WizardStatusSignalUndefined, -}; - -class ContextWlanApList -{ -public: - ContextWlanApList(); - ~ContextWlanApList(); - - void Add(QString name, - int netMode, - int secMode, - bool wpaPskInUse, - bool wpsSupported, - int signalStrength = 0); - - void clear(); - - const QList > &List() { return mList; } -private: - QList > mList; -}; - -class TestView: public HbView -{ -Q_OBJECT - -public: - - -public: - TestView(); - virtual ~TestView(); - - void createWizard(); - void showWizard(); - bool verifyStatus(WizardStatusSignal status, int iapId = -100); - -private slots: - void finished(int iapId, bool connected); - void cancelled(); - -public: - void deleteWizard(); - -public: - WlanWizard *mWizard; - -private: - WizardStatusSignal mWizardStatus; - int mConnectedIapId; -}; - - -class TestWlanWizardContext : public QObject -{ -Q_OBJECT -public: - TestWlanWizardContext(); - virtual ~TestWlanWizardContext(); - -public slots: - // Test framework functions - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -protected: - static const int ListNotFound = -2; - static const int ListNoneSelected = -1; - - enum ButtonStatus { - ButtonHidden, - ButtonDisabled, - ButtonEnabled - }; - /*! - * Reimplements QObject function that is invoked on any event. This - * function handles only a focus event to mSsid edit field. - * @param obj contains the object, where the event originates from. - * @param event contains the event id. - */ - bool eventFilter(QObject *obj, QEvent *event); - - QGraphicsWidget* findChildItem(const QString &itemName, QGraphicsWidget *widget); - bool verifyStatus(WizardStatusSignal status, int iapId = -100); - bool verifyCurrentPage(int pageId, int retries = 10, int wait_ms = 200); - bool verifyCurrentPageWithInfo(int pageId, const QString &info, int retries = 10, int wait_ms = 200); - bool verifyDialogText(const QString objName, const QString text); - bool verifyActionButtonVisibility(bool prevVisible, bool cancelVisible, - bool nextVisible, bool finishVisible); - bool verifyActionButtons(ButtonStatus prevStatus, ButtonStatus cancelStatus, - ButtonStatus nextStatus, ButtonStatus finishStatus); - bool verifySummaryPage( - const QString &ssid, - int netMode, - bool hidden, - int secMode, - bool useWpaPsk, - const QString &destination = QString(), - int outerType = -1, - int innerType = -1, - bool eapFastProvMode = false); - - bool mouseClickObject(const QString objName); - bool insertTextToObject(const QString objName, const QString text); - bool selectRadioButton(const QString objName, int index); - bool verifyRadioButtonState(const QString objName, int index, const QString &text); - bool verifyCheckBoxState(const QString &objName, bool checked); - QStringList verifyRadioButtons(const QString objName); - int verifySelectedRadioButton(const QString objName); - bool selectCheckBoxState(const QString &objName, bool check); - - bool mouseClickNext(); - bool mouseClickPrevious(); - bool mouseClickCancel(); - bool mouseClickFinish(); - - QString toNetworkModeString(int netMode, bool isHidden); - QString toSecurityModeString(int secMode, int useWpaPsk); - - EapQtConfigInterface *getEapQtConfig(); - QString eapTypeToString(int type); - - void callWlanWizard_startPageOperation(); - -public: - static void setWlanMgmtClientObject(CWlanMgmtClient* object); - -public: - - static CWlanMgmtClient *mWlanMgmtClient; - -protected: - bool mEvent; - - // Test data - TestView *mView; - HbAutoTestMainWindow *mMainWindow; - WlanQtUtilsContext *mWlanQtUtilsContext; - EapQtConfigInterfaceContext *mEapQtUtilsContext; - WlanMgmtClientContext *mWlanMgmtClientContext; - ContextWlanApList *mApList; - ContextWlanApList *mApOpenList; -}; - -#endif /* TESTWLANWIZARDRNDUICONTEXT_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1837 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes -#include -#include -#include -#include -#include - -// User includes -#include "testwlanwizardeap.h" -#include "testwlanwizardeap_conf.h" -#include "hbautotest.h" -#include "wlanwizard.h" -#include "wlanwizard_p.h" -#include "wlanqtutils_context.h" -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" -#include "wlanwizardpageinternal.h" -#include "eapwizardpage.h" -#include "eapqtvalidator_stub.h" - -#include "eapqtconfiginterface_context.h" - -// External function prototypes - -// Local constants - - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - - -// --------------------------------------------------------- -// TEST CASES -// --------------------------------------------------------- -void TestWlanWizardEap::tc_eap_outer_page_orientation_change() -{ -#ifdef tc_eap_outer_page_orientation_change_enabled - - const QString ssid("tc_eap_outer_page_orientation_change"); - - mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype(ButtonDisabled); - - mMainWindow->setOrientation(Qt::Horizontal, false); - QTest::qWait(WaitTimeForUi); - - verify_outertype(ButtonDisabled); - - mMainWindow->setOrientation(Qt::Vertical, false); - QTest::qWait(WaitTimeForUi); - - verify_outertype(ButtonDisabled); -#endif -} - -void TestWlanWizardEap::tc_eap_aka() -{ -#ifdef tc_eap_aka_enabled - tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); -#endif -} - -void TestWlanWizardEap::tc_eap_sim() -{ -#ifdef tc_eap_sim_enabled - tc_eap_aka_sim(EapQtPluginHandle::PluginEapSim); -#endif -} - -void TestWlanWizardEap::tc_eap_leap() -{ -#ifdef tc_eap_leap_enabled - const QString username("user"); - const QString password("passwd"); - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createLeap(username,password); - - const QString ssid("tc_eap_leap"); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_username_password_click_next(EapQtPluginHandle::PluginLeap, username, password); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifySummaryPage( - ssid, - CMManagerShim::Infra, - false, - CMManagerShim::WlanSecModeWpa, - false, - hbTrId("txt_occ_dblist_destination_val_internet"), - EapQtPluginHandle::PluginLeap),true); - - QTest::qWait(WaitTimeForUi); -#endif -} - -void TestWlanWizardEap::tc_eap_peap_gtc() -{ -#ifdef tc_eap_peap_gtc_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginPeap, - EapQtPluginHandle::PluginEapGtc); -#endif -} - -void TestWlanWizardEap::tc_eap_peap_mschapv2() -{ -#ifdef tc_eap_peap_mschapv2_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginPeap, - EapQtPluginHandle::PluginEapMschapv2); -#endif -} - -void TestWlanWizardEap::tc_eap_ttls_mschapv2() -{ -#ifdef tc_eap_ttls_mschapv2_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginPlainMschapv2); -#endif -} - -void TestWlanWizardEap::tc_eap_ttls_pap() -{ -#ifdef tc_eap_ttls_pap_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginPap); -#endif -} - -void TestWlanWizardEap::tc_eap_ttls_gtc() -{ -#ifdef tc_eap_ttls_gtc_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginEapGtc); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserRejected() -{ -#ifdef tc_eap_aka_connect_KErrWlanUserRejected_enabled - tc_eap_aka_connect_error( - KErrWlanUserRejected, - hbTrId("txt_occ_dialog_1_auth_failed_user_cert_rej").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserCertificateExpired() -{ -#ifdef tc_eap_aka_connect_KErrWlanUserCertificateExpired_enabled - tc_eap_aka_connect_error( - KErrWlanUserCertificateExpired, - hbTrId("txt_occ_dialog_1_auth_failed_user_cert_exp").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanServerCertificateExpired() -{ -#ifdef tc_eap_aka_connect_KErrWlanServerCertificateExpired_enabled - tc_eap_aka_connect_error( - KErrWlanServerCertificateExpired, - hbTrId("txt_occ_dialog_1_authentication_failed_server_ce").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanCerficateVerifyFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanCerficateVerifyFailed_enabled - tc_eap_aka_connect_error( - KErrWlanCerficateVerifyFailed, - hbTrId("txt_occ_dialog_1_authentication_failed_could_not").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoCipherSuite() -{ -#ifdef tc_eap_aka_connect_KErrWlanNoCipherSuite_enabled - tc_eap_aka_connect_error( - KErrWlanNoCipherSuite, - hbTrId("txt_occ_dialog_1_authentication_failed_cipher_su").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanSimNotInstalled() -{ -#ifdef tc_eap_aka_connect_KErrWlanSimNotInstalled_enabled - tc_eap_aka_connect_error( - KErrWlanSimNotInstalled, - hbTrId("txt_occ_dialog_1_authentication_failed_check_sim").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted_enabled - tc_eap_aka_connect_error( - KErrWlanEapFastPacStoreCorrupted, - hbTrId("txt_occ_dialog_1_authentication_failed_reset_pac").arg( - eapTypeToString(EapQtPluginHandle::PluginEapFast))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapSimFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapSimFailed_enabled - tc_eap_aka_connect_error( - KErrWlanEapSimFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNotSubscribed() -{ -#ifdef tc_eap_aka_connect_KErrWlanNotSubscribed_enabled - tc_eap_aka_connect_error( - KErrWlanNotSubscribed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrCancel() -{ -#ifdef tc_eap_aka_connect_KErrCancel_enabled - tc_eap_aka_connect_error( - KErrCancel, - hbTrId("txt_occ_dialog_connection_failed")); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTlsFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapTlsFailed_enabled - tc_eap_aka_connect_error( - KErrWlanEapTlsFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapPeapFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapPeapFailed_enabled - tc_eap_aka_connect_error( - KErrWlanEapPeapFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapAkaFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapAkaFailed_enabled - tc_eap_aka_connect_error( - KErrWlanEapAkaFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTtlsFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapTtlsFailed_enabled - tc_eap_aka_connect_error( - KErrWlanEapTtlsFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanLeapFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanLeapFailed_enabled - tc_eap_aka_connect_error( - KErrWlanLeapFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoUserCertificate() -{ -#ifdef tc_eap_aka_connect_KErrWlanNoUserCertificate_enabled - tc_eap_aka_connect_error( - KErrWlanNoUserCertificate, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError_enabled - tc_eap_aka_connect_error( - KErrWlanEapFastTunnelCompromiseError, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged_enabled - tc_eap_aka_connect_error( - KErrWlanEapFastUnexpextedTlvExhanged, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled_enabled - tc_eap_aka_connect_error( - KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid_enabled - tc_eap_aka_connect_error( - KErrWlanEapFastNoMatchingPacForAid, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastAuthFailed() -{ -#ifdef tc_eap_aka_connect_KErrWlanEapFastAuthFailed_enabled - tc_eap_aka_connect_error( - KErrWlanEapFastAuthFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccessBarred() -{ -#ifdef tc_eap_aka_connect_KErrWlanAccessBarred_enabled - tc_eap_aka_connect_error( - KErrWlanAccessBarred, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanPasswordExpired() -{ -#ifdef tc_eap_aka_connect_KErrWlanPasswordExpired_enabled - tc_eap_aka_connect_error( - KErrWlanPasswordExpired, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoDialinPermissions() -{ -#ifdef tc_eap_aka_connect_KErrWlanNoDialinPermissions_enabled - tc_eap_aka_connect_error( - KErrWlanNoDialinPermissions, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccountDisabled() -{ -#ifdef tc_eap_aka_connect_KErrWlanAccountDisabled_enabled - tc_eap_aka_connect_error( - KErrWlanAccountDisabled, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanRestrictedLogonHours() -{ -#ifdef tc_eap_aka_connect_KErrWlanRestrictedLogonHours_enabled - tc_eap_aka_connect_error( - KErrWlanRestrictedLogonHours, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapAka))); -#endif -} - -void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed() -{ -#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginPlainMschapv2, - KErrWlanEapGtcFailed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); -#endif -} - -void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2() -{ -#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginPlainMschapv2, - KErrWlanEapMsChapv2, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); -#endif -} - -void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed() -{ -#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginPlainMschapv2, - KErrWlanNotSubscribed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); -#endif -} - -void TestWlanWizardEap::tc_eap_ttls_gtc_back_and_forward() -{ -#ifdef tc_eap_ttls_gtc_back_and_forward_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginEapGtc, - KErrWlanNotSubscribed, - hbTrId("txt_occ_dialog_1_authentication_failed").arg( - eapTypeToString(EapQtPluginHandle::PluginEapGtc))); - - // Go back to outertype selection page - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_username_password(EapQtPluginHandle::PluginEapGtc); - - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_innertype( - EapQtPluginHandle::PluginEapTtls, - ButtonEnabled); - - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls)); - - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_ca_cert_page(); - - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_outertype(ButtonEnabled); - - // Go forward to username & password page - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - verify_ca_cert_page(); - - // Create new validators - mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTtls); - mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapGtc); - - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls)); - - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - verify_innertype( - EapQtPluginHandle::PluginEapTtls, - ButtonEnabled); - - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - verify_username_password(EapQtPluginHandle::PluginEapGtc); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_set_outer_type_fails() -{ -#ifdef tc_eap_aka_set_outer_type_fails_enabled - const QString ssid("tc_eap_aka_set_outer_type_fails"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(false); - mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); - - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); - mEapQtUtilsContext->setSelectectedOuterTypesReturn(false); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( - verifyCurrentPageWithInfo( - WlanWizardPageInternal::PageGenericError, - hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); - - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_save_outer_configuration_fails() -{ -#ifdef tc_eap_aka_save_outer_configuration_fails_enabled - const QString ssid("tc_eap_aka_save_outer_configuration_fails"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(false); - mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); - - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); - mEapQtUtilsContext->setOuterConfigReturn(false); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( - verifyCurrentPageWithInfo( - WlanWizardPageInternal::PageGenericError, - hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); - - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); -#endif -} - -void TestWlanWizardEap::tc_eap_aka_set_configuration_reference_fails() -{ -#ifdef tc_eap_aka_set_configuration_reference_fails_enabled - const QString ssid("tc_eap_aka_set_configuration_reference_fails"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(false); - mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); - - mEapQtUtilsContext->setConfigurationReference(3, false); - mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( - verifyCurrentPageWithInfo( - WlanWizardPageInternal::PageGenericError, - hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); - - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); -#endif -} - -void TestWlanWizardEap::tc_eap_peap_gtc_save_inner_configuration_fails() -{ -#ifdef tc_eap_peap_gtc_save_inner_configuration_fails_enabled - tc_eap_peap_ttls( - EapQtPluginHandle::PluginEapTtls, - EapQtPluginHandle::PluginEapGtc, - KErrGeneral, // Not used directly in sub test case - hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"), - false ); -#endif -} - - -void TestWlanWizardEap::tc_eap_peap_identity_validators() -{ -#ifdef tc_eap_peap_identity_validators_enabled - const QString ssid("tc_eap_peap_identity_validators"); - const QString username("u"); - const QString password("p"); - const QString usernameIdentity("identity"); - const QString realm("realm.com"); - EapQtPluginHandle::Plugin outerType(EapQtPluginHandle::PluginPeap); - EapQtPluginHandle::Plugin innerType(EapQtPluginHandle::PluginEapGtc); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createEapTtlsPeap( - outerType, - true, - true, - usernameIdentity, - true, - realm, - innerType ); - - EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator( - EapQtExpandedEapType::TypePeap, EapQtConfig::Username); - EapQtValidatorStub* validatorRealm = (EapQtValidatorStub*)mEapQtUtilsContext->validator( - EapQtExpandedEapType::TypePeap,EapQtConfig::Realm); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_ca_cert_page_select_and_click_next(true); - - QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, eapTypeToString(outerType)), true ); - // Check box checked next enabled - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); - QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); - - // 1. Username validator returns false, checkbox not checked - validatorUser->setReturnValue(EapQtValidator::StatusInvalid); - validatorRealm->setReturnValue(EapQtValidator::StatusOk); - - QCOMPARE(selectCheckBoxState("setlabel_53_val", false), true); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - // 2. Username validator returns true, checkbox not checked - validatorUser->setReturnValue(EapQtValidator::StatusOk); - validatorRealm->setReturnValue(EapQtValidator::StatusOk); - QCOMPARE( mouseClickObject("lineEditUsername"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditUsername", username), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - // 3. back to valid state, checkboc checked - QCOMPARE(selectCheckBoxState("setlabel_53_val", true), true); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - // 4. Realm validator returns false, checkbox not checked - validatorUser->setReturnValue(EapQtValidator::StatusOk); - validatorRealm->setReturnValue(EapQtValidator::StatusInvalid); - - QCOMPARE(selectCheckBoxState("setlabel_54_val", false), true); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - // 5. Realm validator returns true, checkbox not checked - validatorUser->setReturnValue(EapQtValidator::StatusOk); - validatorRealm->setReturnValue(EapQtValidator::StatusOk); - QCOMPARE( mouseClickObject("lineEditRealm"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditRealm", username), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - // 6. back to valid state, checkboc checked - QCOMPARE(selectCheckBoxState("setlabel_54_val", true), true); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); -#endif -} - -void TestWlanWizardEap::tc_eap_leap_user_password_validators() -{ -#ifdef tc_eap_leap_user_password_validators_enabled - const QString ssid("tc_eap_leap_user_password_validators"); - const QString username("u"); - const QString password("p"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createLeap(username,password); - - EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator( - EapQtExpandedEapType::TypeLeap, EapQtConfig::Username); - EapQtValidatorStub* validatorPassword = (EapQtValidatorStub*)mEapQtUtilsContext->validator( - EapQtExpandedEapType::TypeLeap, EapQtConfig::Password); - validatorUser->setReturnValue(EapQtValidator::StatusInvalid); - validatorPassword->setReturnValue(EapQtValidator::StatusInvalid); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - - // 1. By default both validator return invalid - QCOMPARE( - verifyCurrentPageWithInfo( - EapWizardPage::PageUsernamePassword, - eapTypeToString(EapQtPluginHandle::PluginLeap)), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - // 2. User return ok, password invalid - validatorUser->setReturnValue(EapQtValidator::StatusOk); - QCOMPARE( mouseClickObject("lineEditUsername"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditUsername", username), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - // 3. User return ok, password ok - validatorPassword->setReturnValue(EapQtValidator::StatusOk); - QCOMPARE( mouseClickObject("lineEditPassword"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditPassword", password), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); -#endif -} - -void TestWlanWizardEap::tc_eap_tls_no_user_certificate() -{ -#ifdef tc_eap_tls_no_user_certificate_enabled - - const QString ssid("tc_eap_tls_no_user_certificate"); - - QList caCerts; - QList userCerts; - - EapQtCertificateInfo caCert; - caCert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super Cert 1"); - caCerts.append(caCert); - - mEapQtUtilsContext->createEapTls( - caCerts, - 0, - userCerts, - -1); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_ca_cert_page_select_and_click_next(false); - verify_user_cert_page_select_and_click_next(ButtonDisabled, -1); - -#endif -} - -void TestWlanWizardEap::tc_eap_tls_one_user_certificate_with_ca_selection() -{ -#ifdef tc_eap_tls_one_user_certificate_with_ca_selection_enabled - const QString ssid("tc_eap_tls_one_user_certificate_with_ca_selection"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(3, true); - - QList caCerts; - QList userCerts; - - EapQtCertificateInfo cert; - cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert"); - caCerts.append(cert); - - cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert"); - userCerts.append(cert); - - mEapQtUtilsContext->createEapTls( - caCerts, - 0, - userCerts, - 0); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_ca_cert_page_select_and_click_next(false); - verify_user_cert_page_select_and_click_next(ButtonEnabled, 0); - verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - - QCOMPARE( verifySummaryPage( - ssid, - CMManagerShim::Infra, - false, - CMManagerShim::WlanSecModeWpa2, - false, - hbTrId("txt_occ_dblist_destination_val_internet"), - EapQtPluginHandle::PluginEapTls),true); - -#endif -} - -void TestWlanWizardEap::tc_eap_tls_two_user_certificates() -{ -#ifdef tc_eap_tls_two_user_certificates_enabled - const QString ssid("tc_eap_tls_two_user_certificates"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(3, true); - - QList caCerts; - QList userCerts; - - EapQtCertificateInfo cert; - cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert"); - caCerts.append(cert); - cert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super CA Cert"); - caCerts.append(cert); - - cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert"); - userCerts.append(cert); - cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert Second"); - userCerts.append(cert); - - mEapQtUtilsContext->createEapTls( - caCerts, - 0, - userCerts, - 1); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_ca_cert_page_select_and_click_next(false); - verify_user_cert_page_select_and_click_next(ButtonDisabled, 1); - verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - - QCOMPARE( verifySummaryPage( - ssid, - CMManagerShim::Infra, - false, - CMManagerShim::WlanSecModeWpa2, - false, - hbTrId("txt_occ_dblist_destination_val_internet"), - EapQtPluginHandle::PluginEapTls),true); - -#endif -} - -void TestWlanWizardEap::tc_eap_tls_back_and_forward_certs_with_cert_update() -{ -#ifdef tc_eap_tls_back_and_forward_certs_with_cert_update_enabled - const QString ssid("tc_eap_tls_two_user_certificates"); - - const QString caCert1("My CA Cert"); - const QString caCert2("My CA Cert Second"); - - const QString userCert1("My User Cert"); - const QString userCert2("My User Cert Second"); - - QList caCerts; - QList userCerts; - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(3, true); - - EapQtCertificateInfo cert; - cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert1); - caCerts.append(cert); - - cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert1); - userCerts.append(cert); - - mEapQtUtilsContext->createEapTls( - caCerts, - 0, - userCerts, - 0); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - verify_outertype_select_first(ButtonDisabled); - verify_ca_cert_page_select_and_click_next(true); - verify_user_cert_page_select_and_click_next(ButtonEnabled, 0); - verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTls)); - - // backwards - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_user_cert_page(ButtonEnabled, userCert1, 0 ); - - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_ca_cert_page(); - - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_outertype(ButtonEnabled); - - cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert2); - caCerts.append(cert); - mEapQtUtilsContext->setCertsCa(caCerts); - - cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert2); - userCerts.append(cert); - mEapQtUtilsContext->setCertsUser(userCerts); - - mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTls); - - // Forward - QCOMPARE(mouseClickNext(), true); - verify_ca_cert_page_select_and_click_next(false); - verify_user_cert_page(ButtonDisabled); - - // backwards - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_ca_cert_page(caCert1, 1); - - QCOMPARE(mouseClickPrevious(), true); - QTest::qWait(WaitTimeForUi); - verify_outertype(ButtonEnabled); - - QCOMPARE(mouseClickNext(), true); - verify_ca_cert_page(caCert1, 1); - - QCOMPARE(mouseClickNext(), true); - verify_user_cert_page_select_and_click_next(ButtonDisabled, 0); - - verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - - QCOMPARE( verifySummaryPage( - ssid, - CMManagerShim::Infra, - false, - CMManagerShim::WlanSecModeWpa2, - false, - hbTrId("txt_occ_dblist_destination_val_internet"), - EapQtPluginHandle::PluginEapTls),true); - -#endif -} - -void TestWlanWizardEap::tc_eap_sim_finish() -{ -#ifdef tc_eap_sim_finish_enabled - tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); - - QCOMPARE( mouseClickFinish(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyStatus(WizardStatusSignalFinished, 3), true); -#endif -} - -void TestWlanWizardEap::tc_eap_sim_cancel() -{ -#ifdef tc_eap_sim_cancel_enabled - tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); - - QCOMPARE( mouseClickCancel(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true); -#endif -} - -void TestWlanWizardEap::tc_eap_fast_confirmed() -{ -#ifdef tc_eap_fast_confirmed_enabled - tc_eap_fast( - EapQtPacStoreConfig::PacStoreStatePasswordStored, - true); -#endif -} - -void TestWlanWizardEap::tc_eap_fast_new_store() -{ -#ifdef tc_eap_fast_new_store_enabled - tc_eap_fast( - EapQtPacStoreConfig::PacStoreStateStoreNotExists, - true); -#endif -} - -void TestWlanWizardEap::tc_eap_fast_new_store_save_fails() -{ -#ifdef tc_eap_fast_new_store_save_fails_enabled - tc_eap_fast( - EapQtPacStoreConfig::PacStoreStateStoreNotExists, - false); -#endif -} - -void TestWlanWizardEap::tc_eap_fast_new_store_and_validators() -{ -#ifdef tc_eap_fast_new_store_and_validators_enabled - const QString ssid("tc_eap_fast_new_store_and_validators"); - const QString username("user"); - - mWlanQtUtilsContext->setCreateWlanIapResult(4); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); - mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(4, true); - mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists); - mEapQtUtilsContext->createInner( - EapQtPluginHandle::PluginEapFast, - EapQtPluginHandle::PluginEapMschapv2, - "u", - "p"); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore( - EapQtPacStoreConfig::PacStorePassword); - validator->setReturnValue(EapQtValidator::StatusInvalid); - - verify_outertype_select_first(ButtonDisabled); - verify_new_pac_store_password_page(ButtonDisabled); - - QCOMPARE( mouseClickObject("lineEditUsername"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditUsername", username), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - validator->setReturnValue(EapQtValidator::StatusOk); - - QCOMPARE( mouseClickObject("lineEditPassword"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditPassword", username), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - QCOMPARE( mouseClickNext(), true ); - verify_username_password(EapQtPluginHandle::PluginEapMschapv2); - -#endif -} - - -void TestWlanWizardEap::tc_eap_fast_new_store_back_and_forwards() -{ -#ifdef tc_eap_fast_new_store_back_and_forwards_enabled - const QString ssid("tc_eap_fast_new_store_back_and_forwards"); - const QString username("u"); - const QString password("p"); - - mWlanQtUtilsContext->setCreateWlanIapResult(4); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); - mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(4, true); - mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists); - mEapQtUtilsContext->createInner( - EapQtPluginHandle::PluginEapFast, - EapQtPluginHandle::PluginEapMschapv2, - username, - password); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_new_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickNext(), true ); - verify_username_password(EapQtPluginHandle::PluginEapMschapv2); - - // backwards - QCOMPARE( mouseClickPrevious(), true ); - verify_new_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickPrevious(), true ); - - mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2); - - // forwards - verify_outertype_select_first(ButtonEnabled); - verify_new_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickNext(), true ); - verify_username_password(EapQtPluginHandle::PluginEapMschapv2); -#endif -} - -void TestWlanWizardEap::tc_eap_fast_new_store_read_config_fail() -{ -#ifdef tc_eap_fast_new_store_read_config_fail_enabled - tc_eap_fast( - EapQtPacStoreConfig::PacStoreStateStoreNotExists, - true, - false); -#endif -} - -void TestWlanWizardEap::tc_eap_fast_confirm_store() -{ -#ifdef tc_eap_fast_confirm_store_enabled - tc_eap_fast( - EapQtPacStoreConfig::PacStoreStatePasswordRequired, - true); -#endif -} - -void TestWlanWizardEap::tc_eap_fast_confirm_store_and_validators() -{ -#ifdef tc_eap_fast_confirm_store_and_validators_enabled - const QString ssid("tc_eap_fast_confirm_store_and_validators"); - const QString username_invalid("invalid"); - const QString username_valid("valid"); - - mWlanQtUtilsContext->setCreateWlanIapResult(4); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); - mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(4, true); - mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired); - mEapQtUtilsContext->createInner( - EapQtPluginHandle::PluginEapFast, - EapQtPluginHandle::PluginEapMschapv2, - "u", - "p"); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore( - EapQtPacStoreConfig::PacStorePasswordConfirmation); - validator->setReturnValue(EapQtValidator::StatusInvalid); - - verify_outertype_select_first(ButtonDisabled); - verify_confirm_pac_store_password_page(ButtonEnabled); - - QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_invalid), true ); - QCOMPARE( mouseClickObject("labelError"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - QCOMPARE( mouseClickNext(), true ); - verify_confirm_pac_store_password_page(ButtonEnabled); - QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), true); - - - validator->setReturnValue(EapQtValidator::StatusOk); - - QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_valid), true ); - QCOMPARE( mouseClickObject("labelError"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), false); - - QCOMPARE( mouseClickNext(), true ); - verify_username_password(EapQtPluginHandle::PluginEapMschapv2); - -#endif -} - -void TestWlanWizardEap::tc_eap_fast_confirm_store_back_and_forwards() -{ -#ifdef tc_eap_fast_confirm_store_back_and_forwards_enabled - const QString ssid("tc_eap_fast_confirm_store_back_and_forwards"); - const QString username("u"); - const QString password("p"); - - mWlanQtUtilsContext->setCreateWlanIapResult(4); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); - mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(4, true); - mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired); - mEapQtUtilsContext->createInner( - EapQtPluginHandle::PluginEapFast, - EapQtPluginHandle::PluginEapMschapv2, - username, - password); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_confirm_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickNext(), true ); - verify_username_password(EapQtPluginHandle::PluginEapMschapv2); - - // backwards - QCOMPARE( mouseClickPrevious(), true ); - verify_confirm_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickPrevious(), true ); - - mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2); - - // forwards - verify_outertype_select_first(ButtonEnabled); - verify_confirm_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickNext(), true ); - verify_username_password(EapQtPluginHandle::PluginEapMschapv2); -#endif -} - - -// --------------------------------------------------------- -// HELPPER VERIFICATORS & NAVIGATORS -// --------------------------------------------------------- - -void TestWlanWizardEap::verify_outertype_select_first( - TestWlanWizardContext::ButtonStatus nextButtonStatus) -{ - verify_outertype(nextButtonStatus); - - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE( mouseClickNext(), true ); -} - -void TestWlanWizardEap::verify_outertype( - TestWlanWizardContext::ButtonStatus nextButtonStatus) -{ - QCOMPARE( verifyCurrentPage(EapWizardPage::PageOuterType), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); -} - -void TestWlanWizardEap::verify_innertype_select_first( - int outerType, - TestWlanWizardContext::ButtonStatus nextButtonStatus) -{ - verify_innertype(outerType, nextButtonStatus); - - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE( mouseClickNext(), true ); -} - -void TestWlanWizardEap::verify_innertype( - int outerType, - TestWlanWizardContext::ButtonStatus nextButtonStatus) -{ - int pageId; - if (outerType == EapQtPluginHandle::PluginPeap){ - pageId = EapWizardPage::PageInnerTypePeap; - - } else { - Q_ASSERT(outerType == EapQtPluginHandle::PluginEapTtls); - pageId = EapWizardPage::PageInnerTypeEapTtls; - } - QCOMPARE( verifyCurrentPageWithInfo(pageId, eapTypeToString(outerType)), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); -} - -void TestWlanWizardEap::verify_username_password_click_next( - int type, - const QString &username, - const QString &password) -{ - verify_username_password(type); - - QCOMPARE( mouseClickObject("lineEditUsername"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditUsername", username), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickObject("lineEditPassword"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditPassword", password), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickObject("setlabel_56"), true ); - QCOMPARE( mouseClickNext(), true ); -} - -void TestWlanWizardEap::verify_username_password(int type) -{ - QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageUsernamePassword, eapTypeToString(type)), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); -} - -void TestWlanWizardEap::verify_ca_cert_page_select_and_click_next(bool automatic) -{ - verify_ca_cert_page(); - - int index = 0; - if (automatic == false) { - index = 1; - } - QCOMPARE( selectRadioButton( "list", index ), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE( mouseClickNext(), true ); -} - - -void TestWlanWizardEap::verify_ca_cert_page() -{ - QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - QCOMPARE( verifyRadioButtonState( - "list", - 0, - hbTrId("txt_occ_setlabel_val_select_automatically")), true); -} - -void TestWlanWizardEap::verify_ca_cert_page(const QString &text, int index) -{ - QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - QCOMPARE( verifyRadioButtonState("list", index, text), true); -} - -void TestWlanWizardEap::verify_user_cert_page_select_and_click_next( - ButtonStatus nextButtonStatus, - int index) -{ - verify_user_cert_page(nextButtonStatus); - - if (index != -1){ - QCOMPARE( selectRadioButton( "list", index ), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE( mouseClickNext(), true ); - } else { - QCOMPARE( - verifyDialogText( - "errorLabel", - hbTrId("txt_occ_dialog_no_certificates_installed_wizard_c")), true); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - } -} - -void TestWlanWizardEap::verify_user_cert_page(ButtonStatus nextButtonStatus) -{ - QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); -} - - -void TestWlanWizardEap::verify_user_cert_page( - ButtonStatus nextButtonStatus, - const QString &text, - int index) -{ - QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); - - QCOMPARE( verifyRadioButtonState("list", index, text), true); -} - -void TestWlanWizardEap::verify_identity_modify_and_click_next( - const QString &outerType, - bool usernameAutomatic, - const QString &username, - bool realmAutomatic, - const QString &realm) -{ - QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); - QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); - - QCOMPARE(selectCheckBoxState("setlabel_53_val", usernameAutomatic), true); - QCOMPARE(selectCheckBoxState("setlabel_54_val", realmAutomatic), true); - - QTest::qWait(WaitTimeForUi); - - QCOMPARE(verifyCheckBoxState("setlabel_53_val", usernameAutomatic), true); - QCOMPARE(verifyCheckBoxState("setlabel_54_val", realmAutomatic), true); - - QCOMPARE( mouseClickObject("lineEditUsername"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditUsername", username), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickObject("lineEditRealm"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditRealm", realm), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickObject("setlabel_53"), true ); - QCOMPARE( mouseClickNext(), true ); -} - -void TestWlanWizardEap::verify_identity_and_click_next(const QString &outerType) -{ - verify_identity_page(outerType); - - QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); - QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); - - QCOMPARE( mouseClickObject("setlabel_53"), true ); - QCOMPARE( mouseClickNext(), true ); -} - -void TestWlanWizardEap::verify_identity_page(const QString &outerType) -{ - QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); -} - - -void TestWlanWizardEap::verify_new_pac_store_password_page( - ButtonStatus nextButtonStatus ) -{ - QCOMPARE( verifyCurrentPage(EapWizardPage::PageNewPacStorePassword), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); -} - - -void TestWlanWizardEap::verify_confirm_pac_store_password_page( - ButtonStatus nextButtonStatus) -{ - QCOMPARE( verifyCurrentPage(EapWizardPage::PagePromptPacStorePassword), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); -} - -// --------------------------------------------------------- -// SUBTEST CASES -// --------------------------------------------------------- - - -void TestWlanWizardEap::tc_eap_aka_sim(int type) -{ - // TODO: verify IAP settings - // TODO: verify call stack - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createEapAkaSim(type); - - const QString ssid("tc_eap_aka_sim"); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecMode802_1x, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - - QCOMPARE( verifySummaryPage( - ssid, - CMManagerShim::Infra, - false, - CMManagerShim::WlanSecMode802_1x, - true, - hbTrId("txt_occ_dblist_destination_val_internet"), - type),true); -} - -void TestWlanWizardEap::tc_eap_peap_ttls( - int outerType, - int innerType, - int errorCode, - const QString &errorString, - bool saveInnerConfReturn ) -{ - // TODO: verify IAP settings - // TODO: verify call stack - const QString ssid("tc_eap_peap_ttls"); - const QString username("u"); - const QString password("p"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - - if (errorCode == KErrNone) { - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - } else { - mWlanQtUtilsContext->setConnectionSuccessed(false); - mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode); - } - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createEapTtlsPeap( - (EapQtPluginHandle::Plugin)outerType, - true, - true, - QString(), //usernameIdentity, - true, - QString(), //realm, - (EapQtPluginHandle::Plugin)innerType ); - - mEapQtUtilsContext->createInner( - (EapQtPluginHandle::Plugin)outerType, - (EapQtPluginHandle::Plugin)innerType, - username, - password); - - mEapQtUtilsContext->setInnerConfigReturn(saveInnerConfReturn); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - verify_ca_cert_page_select_and_click_next(true); - verify_identity_and_click_next(eapTypeToString((EapQtPluginHandle::Plugin)outerType)); - verify_innertype_select_first( - (EapQtPluginHandle::Plugin)outerType, - ButtonDisabled); - - verify_username_password_click_next(innerType, username, password); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - if (errorCode == KErrNone){ - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - - QCOMPARE( verifySummaryPage( - ssid, - CMManagerShim::Infra, - false, - CMManagerShim::WlanSecModeWpa, - false, - hbTrId("txt_occ_dblist_destination_val_internet"), - (EapQtPluginHandle::Plugin)outerType, - (EapQtPluginHandle::Plugin)innerType),true); - - } else { - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - } -} - -void TestWlanWizardEap::tc_eap_aka_connect_error( - int errorCode, - const QString &errorString) -{ - // TODO: verify IAP settings - // TODO: verify call stack - - const QString ssid(errorString); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(false); - mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode); - - mEapQtUtilsContext->setConfigurationReference(3, true); - mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa2, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); -} - - -void TestWlanWizardEap::tc_eap_fast( - int pacStoreState, - bool savePacStoreReturn, - bool readPacStoreReturn) -{ - // TODO: verify IAP settings - // TODO: verify call stack - - const QString ssid("tc_eap_fast"); - const QString username("u"); - const QString password("p"); - - mWlanQtUtilsContext->setCreateWlanIapResult(4); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); - mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); - - mEapQtUtilsContext->setConfigurationReference(4, true); - mEapQtUtilsContext->createEapFast(pacStoreState); - mEapQtUtilsContext->setPacStoreConfigSaveReturn(savePacStoreReturn); - mEapQtUtilsContext->setPacStoreConfigReadReturn(readPacStoreReturn); - - if (!readPacStoreReturn) { - EapQtPacStoreConfig pacStoreConfig; - pacStoreConfig.setValue( - EapQtPacStoreConfig::PacStoreReset, - true); - - mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true); - } - - mEapQtUtilsContext->createInner( - EapQtPluginHandle::PluginEapFast, - EapQtPluginHandle::PluginEapMschapv2, - username, - password); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeWpa, - false, false, false); - - mView->showWizard(); - - verify_outertype_select_first(ButtonDisabled); - - if (!readPacStoreReturn) { - EapQtPacStoreConfig pacStoreConfig; - - pacStoreConfig.setValue( - EapQtPacStoreConfig::PacStorePassword, - ""); - - pacStoreConfig.setValue( - EapQtPacStoreConfig::PacStoreSavePassword, - true); - - - mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true); - } - - switch (pacStoreState){ - case EapQtPacStoreConfig::PacStoreStateStoreNotExists: - verify_new_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickNext(), true ); - break; - - case EapQtPacStoreConfig::PacStoreStatePasswordRequired: - verify_confirm_pac_store_password_page(ButtonEnabled); - QCOMPARE( mouseClickNext(), true ); - break; - } - - verify_username_password_click_next(EapQtPluginHandle::PluginEapMschapv2,username,password); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - if (savePacStoreReturn) { - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - - QCOMPARE( verifySummaryPage( - ssid, - CMManagerShim::Infra, - false, - CMManagerShim::WlanSecModeWpa, - false, - hbTrId("txt_occ_dblist_destination_val_internet"), - EapQtPluginHandle::PluginEapFast, - EapQtPluginHandle::PluginEapMschapv2, - true) ,true); - } else { - QCOMPARE( - verifyCurrentPageWithInfo( - WlanWizardPageInternal::PageGenericError, - hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - } -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef TESTWLANWIZARDRNDEAP_H -#define TESTWLANWIZARDRNDEAP_H - -#include "testwlanwizardcontext.h" - -class TestWlanWizardEap : public TestWlanWizardContext -{ -Q_OBJECT - -private slots: - void tc_eap_outer_page_orientation_change(); - void tc_eap_aka(); - void tc_eap_sim(); - void tc_eap_leap(); - void tc_eap_peap_gtc(); - void tc_eap_peap_mschapv2(); - void tc_eap_ttls_mschapv2(); - void tc_eap_ttls_pap(); - void tc_eap_ttls_gtc(); - void tc_eap_aka_connect_KErrWlanUserRejected(); - void tc_eap_aka_connect_KErrWlanUserCertificateExpired(); - void tc_eap_aka_connect_KErrWlanServerCertificateExpired(); - void tc_eap_aka_connect_KErrWlanCerficateVerifyFailed(); - void tc_eap_aka_connect_KErrWlanNoCipherSuite(); - void tc_eap_aka_connect_KErrWlanSimNotInstalled(); - void tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted(); - void tc_eap_aka_connect_KErrWlanEapSimFailed(); - void tc_eap_aka_connect_KErrWlanNotSubscribed(); - void tc_eap_aka_connect_KErrCancel(); - void tc_eap_aka_connect_KErrWlanEapTlsFailed(); - void tc_eap_aka_connect_KErrWlanEapPeapFailed(); - void tc_eap_aka_connect_KErrWlanEapAkaFailed(); - void tc_eap_aka_connect_KErrWlanEapTtlsFailed(); - void tc_eap_aka_connect_KErrWlanLeapFailed(); - void tc_eap_aka_connect_KErrWlanNoUserCertificate(); - void tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError(); - void tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged(); - void tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled(); - void tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid(); - void tc_eap_aka_connect_KErrWlanEapFastAuthFailed(); - void tc_eap_aka_connect_KErrWlanAccessBarred(); - void tc_eap_aka_connect_KErrWlanPasswordExpired(); - void tc_eap_aka_connect_KErrWlanNoDialinPermissions(); - void tc_eap_aka_connect_KErrWlanAccountDisabled(); - void tc_eap_aka_connect_KErrWlanRestrictedLogonHours(); - void tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed(); - void tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2(); - void tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed(); - void tc_eap_ttls_gtc_back_and_forward(); - void tc_eap_aka_set_outer_type_fails(); - void tc_eap_aka_save_outer_configuration_fails(); - void tc_eap_aka_set_configuration_reference_fails(); - void tc_eap_peap_gtc_save_inner_configuration_fails(); - void tc_eap_peap_identity_validators(); - void tc_eap_leap_user_password_validators(); - void tc_eap_tls_no_user_certificate(); - void tc_eap_tls_one_user_certificate_with_ca_selection(); - void tc_eap_tls_two_user_certificates(); - void tc_eap_tls_back_and_forward_certs_with_cert_update(); - void tc_eap_sim_finish(); - void tc_eap_sim_cancel(); - void tc_eap_fast_confirmed(); - void tc_eap_fast_new_store(); - void tc_eap_fast_new_store_save_fails(); - void tc_eap_fast_new_store_and_validators(); - void tc_eap_fast_new_store_back_and_forwards(); - void tc_eap_fast_new_store_read_config_fail(); - void tc_eap_fast_confirm_store(); - void tc_eap_fast_confirm_store_and_validators(); - void tc_eap_fast_confirm_store_back_and_forwards(); - -private: // Helpper methods - void verify_outertype_select_first( - TestWlanWizardContext::ButtonStatus nextButtonStatus); - void verify_outertype( - TestWlanWizardContext::ButtonStatus nextButtonStatus); - - void verify_innertype_select_first( - int outerType, - TestWlanWizardContext::ButtonStatus nextButtonStatus); - - void verify_innertype( - int outerType, - TestWlanWizardContext::ButtonStatus nextButtonStatus); - - void verify_username_password_click_next( - int type, - const QString &username, - const QString &password); - - void verify_username_password(int type); - - void verify_ca_cert_page_select_and_click_next(bool automatic); - void verify_ca_cert_page(); - void verify_ca_cert_page( const QString &text, int index); - - void verify_user_cert_page_select_and_click_next( - ButtonStatus nextButtonStatus, - int index); - - void verify_user_cert_page(ButtonStatus nextButtonStatus); - void verify_user_cert_page( - ButtonStatus nextButtonStatus, - const QString &text, - int index); - - void verify_identity_modify_and_click_next( - const QString &outerType, - bool usernameAutomatic, - const QString &username, - bool realmAutomatic, - const QString &realm); - void verify_identity_and_click_next(const QString &outerType); - void verify_identity_page(const QString &outerType); - - void verify_new_pac_store_password_page(ButtonStatus nextButtonStatus); - void verify_confirm_pac_store_password_page(ButtonStatus nextButtonStatus); - -private: // Helpper test cases - void tc_eap_aka_sim(int type); - - void tc_eap_peap_ttls( - int outerType, - int innerType, - int errorCode = 0, - const QString &errorString = QString(), - bool saveInnerConfReturn = true); - - void tc_eap_aka_connect_error( - int errorCode, - const QString &errorString); - - void tc_eap_fast( - int pacStoreState, - bool savePacStoreReturn, - bool readPacStoreReturn = true); - - -}; - -#endif /* TESTWLANWIZARDRNDEAP_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap_conf.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardeap_conf.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes - -// User includes - -// External function prototypes - -// Local constants - -#define tc_eap_outer_page_orientation_change_enabled -#define tc_eap_aka_enabled -#define tc_eap_sim_enabled -#define tc_eap_leap_enabled -#define tc_eap_peap_gtc_enabled -#define tc_eap_peap_mschapv2_enabled -#define tc_eap_ttls_mschapv2_enabled -#define tc_eap_ttls_pap_enabled -#define tc_eap_ttls_gtc_enabled -#define tc_eap_aka_connect_KErrWlanUserRejected_enabled -#define tc_eap_aka_connect_KErrWlanUserCertificateExpired_enabled -#define tc_eap_aka_connect_KErrWlanServerCertificateExpired_enabled -#define tc_eap_aka_connect_KErrWlanCerficateVerifyFailed_enabled -#define tc_eap_aka_connect_KErrWlanNoCipherSuite_enabled -#define tc_eap_aka_connect_KErrWlanSimNotInstalled_enabled -#define tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted_enabled -#define tc_eap_aka_connect_KErrWlanEapSimFailed_enabled -#define tc_eap_aka_connect_KErrWlanNotSubscribed_enabled -#define tc_eap_aka_connect_KErrCancel_enabled -#define tc_eap_aka_connect_KErrWlanEapTlsFailed_enabled -#define tc_eap_aka_connect_KErrWlanEapPeapFailed_enabled -#define tc_eap_aka_connect_KErrWlanEapAkaFailed_enabled -#define tc_eap_aka_connect_KErrWlanEapTtlsFailed_enabled -#define tc_eap_aka_connect_KErrWlanLeapFailed_enabled -#define tc_eap_aka_connect_KErrWlanNoUserCertificate_enabled -#define tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError_enabled -#define tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged_enabled -#define tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled_enabled -#define tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid_enabled -#define tc_eap_aka_connect_KErrWlanEapFastAuthFailed_enabled -#define tc_eap_aka_connect_KErrWlanAccessBarred_enabled -#define tc_eap_aka_connect_KErrWlanPasswordExpired_enabled -#define tc_eap_aka_connect_KErrWlanNoDialinPermissions_enabled -#define tc_eap_aka_connect_KErrWlanAccountDisabled_enabled -#define tc_eap_aka_connect_KErrWlanRestrictedLogonHours_enabled -#define tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed_enabled -#define tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2_enabled -#define tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed_enabled -#define tc_eap_ttls_gtc_back_and_forward_enabled -#define tc_eap_aka_set_outer_type_fails_enabled -#define tc_eap_aka_save_outer_configuration_fails_enabled -#define tc_eap_aka_set_configuration_reference_fails_enabled -#define tc_eap_peap_gtc_save_inner_configuration_fails_enabled -#define tc_eap_peap_identity_validators_enabled -#define tc_eap_leap_user_password_validators_enabled -#define tc_eap_tls_no_user_certificate_enabled -#define tc_eap_tls_one_user_certificate_with_ca_selection_enabled -#define tc_eap_tls_two_user_certificates_enabled -#define tc_eap_tls_back_and_forward_certs_with_cert_update_enabled -#define tc_eap_sim_finish_enabled -#define tc_eap_sim_cancel_enabled -#define tc_eap_fast_confirmed_enabled -#define tc_eap_fast_new_store_enabled -#define tc_eap_fast_new_store_save_fails_enabled -#define tc_eap_fast_new_store_and_validators_enabled -#define tc_eap_fast_new_store_back_and_forwards_enabled -#define tc_eap_fast_new_store_read_config_fail_enabled -#define tc_eap_fast_confirm_store_enabled -#define tc_eap_fast_confirm_store_and_validators_enabled -#define tc_eap_fast_confirm_store_back_and_forwards_enabled - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1257 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "testwlanwizardmanual.h" -#include "testwlanwizardmanual_conf.h" -#include "hbautotest.h" -#include "wlanwizard.h" -#include "wlanwizard_p.h" -#include "wlanwizardpagessid.h" -#include "wlanqtutils_context.h" -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" - -// External function prototypes - -// Local constants - - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - - -// --------------------------------------------------------- -// TEST CASES -// --------------------------------------------------------- - - -void TestWlanWizardManual::tcStartWizard() -{ - qDebug("Start TestWlanWizardManual"); -} - -/*! - * - */ -void TestWlanWizardManual::tc_open_scan_results_received_at_scan_page() -{ -#ifdef tc_open_scan_results_received_at_scan_page_enabled - - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mWlanQtUtilsContext->setImmediateApScanResult(false); - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - mWlanQtUtilsContext->emitScanApReady(); - mWlanQtUtilsContext->setImmediateApScanResult(true); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_attempt_to_input_too_long_ssid() -{ -#ifdef tc_attempt_to_input_too_long_ssid_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanDirectResult("12345678901234567890123456789012", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "1234567890123456789012345678901234567890"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "12345678901234567890123456789012"), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_scan_succesful_press_cancel_at_summary() -{ -#ifdef tc_scan_succesful_press_cancel_at_summary_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - - QCOMPARE( mouseClickCancel(), true ); - - QTest::qWait(WaitTimeForUi); - -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_press_previous_at_scanning_page() -{ -#ifdef tc_press_previous_at_scanning_page_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - // Click previous button and next again - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_scan_succesful_go_to_summary_and_finish() -{ -#ifdef tc_scan_succesful_go_to_summary_and_finish_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); - QCOMPARE( mouseClickFinish(), true ); -#endif -} - -/*! - * Stop verifying buttons for views that have been already verified. - */ -void TestWlanWizardManual::tc_wep_pwd_too_short_error_label() -{ -#ifdef tc_wep_pwd_too_short_error_label_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - - // Key query short pwd - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_key_is_of_incorrect_length_please")), true ); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - - // Key query success - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyDialogText("labelErrorNote", ""), true ); - QCOMPARE( insertTextToObject("lineEditKey", "12345"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_press_previous_at_key_query() -{ -#ifdef tc_press_previous_at_key_query_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_manual_selection_with_press_previous() -{ -#ifdef tc_manual_selection_with_press_previous_enabled - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkMode, "huuhaa3421"), true ); - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkMode, "huuhaa3421"), true ); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_illegal_characters_in_wep_key() -{ -#ifdef tc_illegal_characters_in_wep_key_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); - - QCOMPARE( insertTextToObject("lineEditKey", "passworddd"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_illegal_characters_in_key_please_c")), true ); - QTest::qWait(WaitTimeForUi); - -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_too_short_wpa_key() -{ -#ifdef tc_too_short_wpa_key_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QTest::qWait(2000); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); - - QCOMPARE( insertTextToObject("lineEditKey", "1234"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_preshared_key_too_short_at_least")), true ); - QTest::qWait(WaitTimeForUi); -#endif -} - -/*! - * wpa psk - */ -void TestWlanWizardManual::tc_wpa_psk_success() -{ -#ifdef tc_wpa_psk_success_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QTest::qWait(2000); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); - - QCOMPARE( insertTextToObject("lineEditKey", "1234567890"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); -#endif -} - -/*! - * no wpa psk - */ -void TestWlanWizardManual::tc_wpa_no_psk_go_to_eap_start() -{ -#ifdef tc_wpa_no_psk_go_to_eap_start_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); -#endif -} - -/*! - * wpa2 psk - */ -void TestWlanWizardManual::tc_wpa2_psk_success() -{ -#ifdef tc_wpa2_psk_success_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QTest::qWait(2000); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); - - QCOMPARE( insertTextToObject("lineEditKey", "1234567890"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); -#endif -} - -/*! - * wpa2 no psk - */ -void TestWlanWizardManual::tc_wpa2_no_psk_go_to_eap_start() -{ -#ifdef tc_wpa2_no_psk_go_to_eap_start_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); -#endif -} - -/*! - * Wlan network closed -> generic error - */ -void TestWlanWizardManual::tc_network_closed_generic_error() -{ -#ifdef tc_network_closed_generic_error_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkClosed(100, 1); - mWlanQtUtilsContext->setConnectionSuccessed(false); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_connection_failed")), true ); - -#endif -} - -/*! - * adhoc no psk - */ -void TestWlanWizardManual::tc_adhoc_network_no_psk() -{ -#ifdef tc_adhoc_network_no_psk_enabled - mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - -#endif -} - -/*! - * 802_1x - */ -void TestWlanWizardManual::tc_secmode_802_1x_go_to_eap_start() -{ -#ifdef tc_secmode_802_1x_go_to_eap_start_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); -#endif -} - -/*! - * Wapi - */ -void TestWlanWizardManual::tc_sec_mode_wapi() -{ -#ifdef tc_sec_mode_wapi_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWapi, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); -#endif -} - -/*! - * Multiple AP scan match results - */ -void TestWlanWizardManual::tc_multiple_open_scan_results_single_match() -{ -#ifdef tc_multiple_open_scan_results_single_match_enabled - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); - mApOpenList->Add("foobar", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 300); - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 200); - - mApList->Add("foobar", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 300); - - mWlanQtUtilsContext->setScanWlanApsResult(mApOpenList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("foobar", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "foobar"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "foobar"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "foobar"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_iap_creation_fail() -{ -#ifdef tc_iap_creation_fail_enabled - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(-1); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - - QStringList buttons; - buttons << hbTrId("txt_occ_dblist_val_infrastructure_public") - << hbTrId("txt_occ_list_infrastructure_hidden") - << hbTrId("txt_occ_list_adhoc_1"); - QCOMPARE( verifyRadioButtons("list"), buttons ); - - QCOMPARE( selectRadioButton( "list", 2 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QCOMPARE( verifySelectedRadioButton("list"), ListNoneSelected ); - QCOMPARE( selectRadioButton( "list", 2 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); - - buttons.clear(); - buttons << hbTrId("txt_occ_list_open") - << hbTrId("txt_occ_list_wep_1"); - QCOMPARE( verifyRadioButtons("list"), buttons ); - - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_scan_ap_status_not_ok() -{ -#ifdef tc_scan_ap_status_not_ok_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mWlanQtUtilsContext->setScanApStatus(WlanQtUtils::ScanStatusError); - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_scan_direct_status_not_ok() -{ -#ifdef tc_scan_direct_status_not_ok_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); - - mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - //mWlanQtUtilsContext->setImmediateApScanResult(false); - mWlanQtUtilsContext->setScanDirectStatus(WlanQtUtils::ScanStatusError); - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); -#endif -} - -/*! - * Ict Result enumerator used. Hotspot. - */ -void TestWlanWizardManual::tc_ictresult_enumerated_hotspot() -{ -#ifdef tc_ictresult_enumerated_hotspot_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctHotspotPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(1000); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(1000); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(1000); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QTest::qWait(5000); -#endif -} - -/*! - * Ict Result enumerator used. Ict canceled. - */ -void TestWlanWizardManual::tc_ictresult_enumerated_cancel() -{ -#ifdef tc_ictresult_enumerated_cancel_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctCancelled); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(1000); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(1000); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(1000); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); -#endif -} - -/*! - * Ict fails in this case - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_2_netmode_options() -{ -#ifdef tc_multiple_ssids_with_same_name_2_netmode_options_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - // Add duplicates - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); - mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false, 300); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctFailed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QStringList buttons; - buttons << hbTrId("txt_occ_list_infrastructure_hidden") - << hbTrId("txt_occ_list_adhoc_1"); - QCOMPARE( verifyRadioButtons("list"), buttons ); - - QTest::qWait(WaitTimeForUi); - QCOMPARE( selectRadioButton( "list", 1 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_press_previous() -{ -#ifdef tc_multiple_ssids_with_same_name_press_previous_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - // Add duplicates - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); - mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); - QCOMPARE( selectRadioButton( "list", 1 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_all_sec_modes() -{ -#ifdef tc_multiple_ssids_with_same_name_all_sec_modes_enabled - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - // Add duplicates - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - - // Add all five kinds of security modes. - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false, 500); - mApOpenList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); - mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); - mApOpenList->Add("dippadappa", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 200); - - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - // Add duplicates - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false, 500); - mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); - - mWlanQtUtilsContext->setScanWlanApsResult(mApOpenList->List()); - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QStringList buttons; - buttons << hbTrId("txt_occ_dblist_val_infrastructure_public") - << hbTrId("txt_occ_list_infrastructure_hidden") - << hbTrId("txt_occ_list_adhoc_1"); - QCOMPARE( verifyRadioButtons("list"), buttons ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); - QCOMPARE( mouseClickPrevious(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QCOMPARE( mouseClickNext(), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_orientation_switch() -{ -#ifdef tc_multiple_ssids_with_same_name_orientation_switch_enabled - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - // Add duplicates - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); - mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - - mMainWindow->setOrientation(Qt::Horizontal, false); - QTest::qWait(WaitTimeForUi); - mMainWindow->setOrientation(Qt::Vertical, false); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); - QCOMPARE( selectRadioButton( "list", 0 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_wps_and_nonwps() -{ -#ifdef tc_multiple_ssids_with_same_name_wps_and_nonwps_enabled - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, true, 300); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); - QStringList buttons; - buttons << hbTrId("txt_occ_list_infrastructure_hidden") - << hbTrId("txt_occ_list_wifi_protected_setup"); - QCOMPARE( verifyRadioButtons("list"), buttons ); - QCOMPARE( selectRadioButton( "list", 1 ), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageWpsStart), true ); -#endif -} - -/*! - * - */ -void TestWlanWizardManual::tc_multiple_ssids_with_same_name_two_wps_aps() -{ -#ifdef tc_multiple_ssids_with_same_name_two_wps_aps_enabled - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, true, 100); - - // Add all five kinds of security modes. - mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, true, 300); - - mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa", mApList->List()); - mWlanQtUtilsContext->setCreateWlanIapResult(100); - mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); - mWlanQtUtilsContext->setConnectionSuccessed(true); - - mView->showWizard(); - - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); - - QCOMPARE( mouseClickObject("lineEditKey"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( insertTextToObject("lineEditKey", "huuhaa"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickObject("dialog"), true ); - QTest::qWait(WaitTimeForUi); - QCOMPARE( mouseClickNext(), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa"), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageWpsStart), true ); -#endif -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef TESTWLANWIZARDRNMANUAL_H_ -#define TESTWLANWIZARDRNMANUAL_H_ - -#include "testwlanwizardcontext.h" - -class TestWlanWizardManual : public TestWlanWizardContext -{ -Q_OBJECT - -private slots: - // Test cases - void tcStartWizard(); - void tc_open_scan_results_received_at_scan_page(); - void tc_attempt_to_input_too_long_ssid(); - void tc_scan_succesful_press_cancel_at_summary(); - void tc_press_previous_at_scanning_page(); - void tc_scan_succesful_go_to_summary_and_finish(); - void tc_wep_pwd_too_short_error_label(); - void tc_press_previous_at_key_query(); - void tc_manual_selection_with_press_previous(); - void tc_illegal_characters_in_wep_key(); - void tc_too_short_wpa_key(); - void tc_wpa_psk_success(); - void tc_wpa_no_psk_go_to_eap_start(); - void tc_wpa2_psk_success(); - void tc_wpa2_no_psk_go_to_eap_start(); - void tc_network_closed_generic_error(); - void tc_adhoc_network_no_psk(); - void tc_secmode_802_1x_go_to_eap_start(); - void tc_sec_mode_wapi(); - void tc_multiple_open_scan_results_single_match(); - void tc_iap_creation_fail(); - void tc_scan_ap_status_not_ok(); - void tc_scan_direct_status_not_ok(); - void tc_ictresult_enumerated_hotspot(); - void tc_ictresult_enumerated_cancel(); - void tc_multiple_ssids_with_same_name_2_netmode_options(); - void tc_multiple_ssids_with_same_name_press_previous(); - void tc_multiple_ssids_with_same_name_all_sec_modes(); - void tc_multiple_ssids_with_same_name_orientation_switch(); - void tc_multiple_ssids_with_same_name_wps_and_nonwps(); - void tc_multiple_ssids_with_same_name_two_wps_aps(); - -}; - -#endif /* TESTWLANWIZARDRNMANUAL_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual_conf.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardmanual_conf.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes - -// User includes - -// External function prototypes - -// Local constants -#define tc_open_scan_results_received_at_scan_page_enabled -#define tc_attempt_to_input_too_long_ssid_enabled -#define tc_scan_succesful_press_cancel_at_summary_enabled -#define tc_press_previous_at_scanning_page_enabled -#define tc_scan_succesful_go_to_summary_and_finish_enabled -#define tc_wep_pwd_too_short_error_label_enabled -#define tc_press_previous_at_key_query_enabled -#define tc_manual_selection_with_press_previous_enabled -#define tc_illegal_characters_in_wep_key_enabled -#define tc_too_short_wpa_key_enabled -#define tc_wpa_psk_success_enabled -#define tc_wpa_no_psk_go_to_eap_start_enabled -#define tc_wpa2_psk_success_enabled -#define tc_wpa2_no_psk_go_to_eap_start_enabled -#define tc_network_closed_generic_error_enabled -#define tc_adhoc_network_no_psk_enabled -#define tc_secmode_802_1x_go_to_eap_start_enabled -#define tc_sec_mode_wapi_enabled -#define tc_multiple_open_scan_results_single_match_enabled -#define tc_iap_creation_fail_enabled -#define tc_scan_ap_status_not_ok_enabled -#define tc_scan_direct_status_not_ok_enabled -#define tc_ictresult_enumerated_hotspot_enabled -#define tc_ictresult_enumerated_cancel_enabled -#define tc_multiple_ssids_with_same_name_2_netmode_options_enabled -#define tc_multiple_ssids_with_same_name_press_previous_enabled -#define tc_multiple_ssids_with_same_name_all_sec_modes_enabled -#define tc_multiple_ssids_with_same_name_orientation_switch_enabled -#define tc_multiple_ssids_with_same_name_wps_and_nonwps_enabled -#define tc_multiple_ssids_with_same_name_two_wps_aps_enabled diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.cpp --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.cpp Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,490 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes -#include -#include -#include -#include -#include - -// User includes -#include "testwlanwizardwps.h" -#include "testwlanwizardwps_conf.h" -#include "wlanwizard.h" -#include "wlanwizard_p.h" -#include "wlanqtutils_context.h" -#include "wlanqtutils.h" -#include "wlanqtutilsap.h" -#include "wlanwizardpageinternal.h" -#include "wpswizardpage.h" - -#include "wlanmgmtclient_context.h" - -// External function prototypes - -// Local constants - - -// ======== LOCAL FUNCTIONS ======== - -// ======== MEMBER FUNCTIONS ======== - - -// --------------------------------------------------------- -// TEST CASES -// --------------------------------------------------------- - -void TestWlanWizardWps::tcConfigureManualOpen() -{ -#ifdef tcConfigureManualOpen_enabled - const QString ssid("tcConfigureManualOpen"); - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - WlanQtUtilsAp ap; - ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); - ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); - ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); - ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); - - // Default values - ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); - ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Infra, - CMManagerShim::WlanSecModeOpen, - false, false, true); - - mView->showWizard(); - verifyModeSelection(); - QCOMPARE(selectRadioButton("radioButtonList", 2), true); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); -#endif -} - -void TestWlanWizardWps::tcPushButtonOpen() -{ -#ifdef tcPushButtonOpen_enabled - tcPushButton( - "tcPushButtonOpen", - EWlanIapSecurityModeAllowUnsecure, - CMManagerShim::WlanSecModeOpen, - EWlanOperatingModeInfrastructure, - CMManagerShim::Infra, - EWlanDefaultWepKey1, - CMManagerShim::WepKeyIndex1); -#endif -} - -void TestWlanWizardWps::tcPushButtonWep1() -{ -#ifdef tcPushButtonWep1_enabled - tcPushButton( - "tcPushButtonWep1", - EWlanIapSecurityModeWep, - CMManagerShim::WlanSecModeWep, - EWlanOperatingModeAdhoc, - CMManagerShim::Adhoc, - EWlanDefaultWepKey1, - CMManagerShim::WepKeyIndex1); -#endif -} - -void TestWlanWizardWps::tcPushButtonWep2() -{ -#ifdef tcPushButtonWep2_enabled - tcPushButton( - "tcPushButtonWep2", - EWlanIapSecurityModeWep, - CMManagerShim::WlanSecModeWep, - EWlanOperatingModeAdhoc, - CMManagerShim::Adhoc, - EWlanDefaultWepKey2, - CMManagerShim::WepKeyIndex2); -#endif -} - -void TestWlanWizardWps::tcPushButtonWep3() -{ -#ifdef tcPushButtonWep3_enabled - tcPushButton( - "tcPushButtonWep3", - EWlanIapSecurityModeWep, - CMManagerShim::WlanSecModeWep, - EWlanOperatingModeAdhoc, - CMManagerShim::Adhoc, - EWlanDefaultWepKey3, - CMManagerShim::WepKeyIndex3); -#endif -} - -void TestWlanWizardWps::tcPushButtonWep4() -{ -#ifdef tcPushButtonWep4_enabled - tcPushButton( - "tcPushButtonWep4", - EWlanIapSecurityModeWep, - CMManagerShim::WlanSecModeWep, - EWlanOperatingModeAdhoc, - CMManagerShim::Adhoc, - EWlanDefaultWepKey4, - CMManagerShim::WepKeyIndex4); -#endif -} - -void TestWlanWizardWps::tcPushButtonWpa() -{ -#ifdef tcPushButtonWpa_enabled - tcPushButton( - "tcPushButtonWpa", - EWlanIapSecurityModeWpa, - CMManagerShim::WlanSecModeWpa, - EWlanOperatingModeAdhoc, - CMManagerShim::Adhoc, - EWlanDefaultWepKey1, - CMManagerShim::WepKeyIndex1); -#endif -} - -void TestWlanWizardWps::tcPushButtonWpa2() -{ -#ifdef tcPushButtonWpa2_enabled - tcPushButton( - "tcPushButtonWpa2", - EWlanIapSecurityModeWpa2Only, - CMManagerShim::WlanSecModeWpa2, - EWlanOperatingModeAdhoc, - CMManagerShim::Adhoc, - EWlanDefaultWepKey1, - CMManagerShim::WepKeyIndex1); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError_enabled - tcPinCode_failure( - KErrWlanProtectedSetupOOBInterfaceReadError, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure_enabled - tcPinCode_failure( - KErrWlanProtectedSetupDecryptionCRCFailure, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported() -{ -#ifdef tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported_enabled - tcPinCode_failure( - KErrWlanProtectedSetup2_4ChannelNotSupported, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported() -{ -#ifdef tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported_enabled - tcPinCode_failure( - KErrWlanProtectedSetup5_0ChannelNotSupported, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure_enabled - tcPinCode_failure( - KErrWlanProtectedSetupNetworkAuthFailure, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupNoDHCPResponse() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupNoDHCPResponse_enabled - tcPinCode_failure( - KErrWlanProtectedSetupNoDHCPResponse, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig_enabled - tcPinCode_failure( - KErrWlanProtectedSetupFailedDHCPConfig, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupIPAddressConflict() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupIPAddressConflict_enabled - tcPinCode_failure( - KErrWlanProtectedSetupIPAddressConflict, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar_enabled - tcPinCode_failure( - KErrWlanProtectedSetupCouldNotConnectToRegistrar, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected_enabled - tcPinCode_failure( - KErrWlanProtectedSetupMultiplePBCSessionsDetected, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected_enabled - tcPinCode_failure( - KErrWlanProtectedSetupRogueActivitySuspected, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDeviceBusy() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupDeviceBusy_enabled - tcPinCode_failure( - KErrWlanProtectedSetupDeviceBusy, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupSetupLocked() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupSetupLocked_enabled - tcPinCode_failure( - KErrWlanProtectedSetupSetupLocked, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupMessageTimeout() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupMessageTimeout_enabled - tcPinCode_failure( - KErrWlanProtectedSetupMessageTimeout, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout_enabled - tcPinCode_failure( - KErrWlanProtectedSetupRegistrationSessionTimeout, - hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure_enabled - tcPinCode_failure( - KErrWlanProtectedSetupDevicePasswordAuthFailure, - hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported_enabled - tcPinCode_failure( - KErrWlanProtectedSetupPINMethodNotSupported, - hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); -#endif -} - -void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported() -{ -#ifdef tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported_enabled - tcPinCode_failure( - KErrWlanProtectedSetupPBMethodNotSupported, - hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); -#endif -} - -void TestWlanWizardWps::verifyModeSelection() -{ - QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep2 ), true ); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QStringList list; - list << hbTrId("txt_occ_list_use_pushbutton") - << hbTrId("txt_occ_list_use_pin_code") - << hbTrId("txt_occ_list_configure_manually"); - - QCOMPARE(verifyRadioButtons("radioButtonList"), list); -} - - -void TestWlanWizardWps::tcPushButton( - const QString &ssid, - int secModeWlan, - int secModeCmm, - int operModeWlan, - int operModeCmm, - int defaultWepKeyIndexWlan, - int defaultWepKeyIndexCmm) -{ - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - WlanQtUtilsAp ap; - ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, operModeCmm); - ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, secModeCmm); - ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); - ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); - - // Default values - ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); - ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); - - if (secModeCmm == CMManagerShim::WlanSecModeWep){ - ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, "wepkey1"); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, "wepkey2"); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, "wepkey3"); - ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, "wepkey4"); - ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, defaultWepKeyIndexCmm ); - } else if (secModeCmm == CMManagerShim::WlanSecModeWpa || - secModeCmm == CMManagerShim::WlanSecModeWpa2) { - ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, "wpapsk"); - } - - mWlanMgmtClientContext->setRunProtectedSetup(ssid, KErrNone); - mWlanMgmtClientContext->appendResult( - ssid, - secModeWlan, - operModeWlan, - defaultWepKeyIndexWlan, - "wepkey1", - "wepkey2", - "wepkey3", - "wepkey4", - "wpapsk"); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeWep, - false, false, true); - - mView->showWizard(); - verifyModeSelection(); - - QCOMPARE(selectRadioButton("radioButtonList", 0), true); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep3_Button), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE( mouseClickNext(), true); - QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep4), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); - QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); -} - - -void TestWlanWizardWps::tcPinCode_failure( - int errorCode, - const QString &errorText) -{ - const QString ssid("tcPinCode_failure"); - - mWlanQtUtilsContext->setCreateWlanIapResult(3); - mWlanQtUtilsContext->setConnectionSuccessed(true); - mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); - mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); - - mWlanMgmtClientContext->setRunProtectedSetup(ssid, errorCode); - - mView->mWizard->setParameters( - ssid, - CMManagerShim::Adhoc, - CMManagerShim::WlanSecModeWep, - false, false, true); - - mView->showWizard(); - verifyModeSelection(); - - QCOMPARE(selectRadioButton("radioButtonList", 1), true); - QTest::qWait(WaitTimeForUi); - QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep3_Number), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); - - QCOMPARE(mouseClickNext(), true); - QTest::qWait(WaitTimeForUi); - - QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep4), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - - QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorText), true ); - QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); - QTest::qWait(WaitTimeForUi); -} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -#ifndef TESTWLANWIZARDRNDWPS_H -#define TESTWLANWIZARDRNDWPS_H - -#include "testwlanwizardcontext.h" - -class TestWlanWizardWps : public TestWlanWizardContext -{ -Q_OBJECT - -private slots: - void tcConfigureManualOpen(); - void tcPushButtonOpen(); - void tcPushButtonWep1(); - void tcPushButtonWep2(); - void tcPushButtonWep3(); - void tcPushButtonWep4(); - void tcPushButtonWpa(); - void tcPushButtonWpa2(); - void tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError(); - void tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure(); - void tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported(); - void tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported(); - void tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure(); - void tcPinCode_KErrWlanProtectedSetupNoDHCPResponse(); - void tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig(); - void tcPinCode_KErrWlanProtectedSetupIPAddressConflict(); - void tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar(); - void tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected(); - void tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected(); - void tcPinCode_KErrWlanProtectedSetupDeviceBusy(); - void tcPinCode_KErrWlanProtectedSetupSetupLocked(); - void tcPinCode_KErrWlanProtectedSetupMessageTimeout(); - void tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout(); - void tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure(); - void tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported(); - void tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported(); - /* - void tcPushButton_KErrNone_back_forward_KErrNone(); - void tcPinCodeMultipleResults(); - void tcPinCodeMultipleResults_back_and_forward(); - */ - -private: // Helper methods - void verifyModeSelection(); - -private: // Helper test cases - void tcPushButton( - const QString &ssid, - int secModeWlan, - int secModeCmm, - int operModeWlan, - int operModeCmm, - int defaultWepKeyIndexWlan, - int defaultWepKeyIndexCmm); - - void tcPinCode_failure( - int errorCode, - const QString &errorText); - - - -}; - -#endif /* TESTWLANWIZARDRNDWPS_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps_conf.h --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/testwlanwizardwps_conf.h Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - */ - -// System includes - -// User includes - -// External function prototypes - -// Local constants - -#define tcConfigureManualOpen_enabled -#define tcPushButtonOpen_enabled -#define tcPushButtonWep1_enabled -#define tcPushButtonWep2_enabled -#define tcPushButtonWep3_enabled -#define tcPushButtonWep4_enabled -#define tcPushButtonWpa_enabled -#define tcPushButtonWpa2_enabled -#define tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError_enabled -#define tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure_enabled -#define tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported_enabled -#define tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported_enabled -#define tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure_enabled -#define tcPinCode_KErrWlanProtectedSetupNoDHCPResponse_enabled -#define tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig_enabled -#define tcPinCode_KErrWlanProtectedSetupIPAddressConflict_enabled -#define tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar_enabled -#define tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected_enabled -#define tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected_enabled -#define tcPinCode_KErrWlanProtectedSetupDeviceBusy_enabled -#define tcPinCode_KErrWlanProtectedSetupSetupLocked_enabled -#define tcPinCode_KErrWlanProtectedSetupMessageTimeout_enabled -#define tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout_enabled -#define tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure_enabled -#define tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported_enabled -#define tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported_enabled - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/t_wlanwizard/ut/ut.pri --- a/wlanutilities/wlanwizard/t_wlanwizard/ut/ut.pri Fri Aug 06 18:38:57 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# -# Description: -# UT for Wlan wizard testing -# - -HEADERS += \ - ut/hbautotest.h \ - ut/testwlanwizard.h \ - ut/testwlanwizardeap.h \ - ut/testwlanwizardeap_conf.h \ - ut/testwlanwizardcontext.h \ - ut/testwlanwizardmanual.h \ - ut/testwlanwizardmanual_conf.h \ - ut/testwlanwizardconnect.h \ - ut/testwlanwizardconnect_conf.h \ - ut/testwlanwizardwps.h \ - ut/testwlanwizardwps_conf.h - -SOURCES += \ - ut/main.cpp \ - ut/hbautotest.cpp \ - ut/testwlanwizardeap.cpp \ - ut/testwlanwizardcontext.cpp \ - ut/testwlanwizardconnect.cpp \ - ut/testwlanwizardmanual.cpp \ - ut/testwlanwizard.cpp \ - ut/testwlanwizardwps.cpp diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/traces/trace.properties --- a/wlanutilities/wlanwizard/traces/trace.properties Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/traces/trace.properties Mon Aug 23 13:30:09 2010 +0300 @@ -13,7 +13,7 @@ ConfIctStatus ConfIapId ConfConnected - ConfHiddenWlan + ConfWlanScanSSID ConfUsePsk ConfProcessSessings ConfGenericErrorString @@ -60,4 +60,3 @@ SsidStatusInvalidLength - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/make_ctc.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/make_ctc.bat Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,17 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to instrument and run test cases with CTC. + +@echo off +call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\src\*.cpp -C NO_EXCLUDE+..\..\eapwizard\src\*.cpp -C NO_EXCLUDE+..\..\wpswizard\src\*.cpp -i fd -v -2comp sbs -c winscw_udeb diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/make_ctc_post.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/make_ctc_post.bat Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,17 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to create coverage reports from CTC results. + +call ctcpost -p profile.txt +call ctc2html -i profile.txt diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/make_ctc_with_clean.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/make_ctc_with_clean.bat Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,24 @@ +:: Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +:: All rights reserved. +:: This component and the accompanying materials are made available +:: under the terms of "Eclipse Public License v1.0" +:: which accompanies this distribution, and is available +:: at the URL "http://www.eclipse.org/legal/epl-v10.html". +:: +:: Initial Contributors: +:: Nokia Corporation - initial contribution. +:: +:: Contributors: +:: +:: Description: +:: Batch file to instrument and run test cases with CTC. + +@echo off +del MON.* +del profile.txt +rmdir /S /Q CTCHTML +call sbs clean +call sbs reallyclean +call make distclean +call qmake "CONFIG-=debug" +call ctcwrap -C EXCLUDE=* -C NO_EXCLUDE+..\src\*.cpp -C NO_EXCLUDE+..\..\eapwizard\src\*.cpp -C NO_EXCLUDE+..\..\wpswizard\src\*.cpp -i fd -v -2comp sbs -c winscw_udeb diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Stub file for eapwizard!! +*/ + +#ifndef EAPQTCERTIFICATEINFO_H +#define EAPQTCERTIFICATEINFO_H + +// System includes +#include +#include + +// User includes + +// Forward declarations +class EapQtCertificateInfoPrivate; + +// External data types + +// Constants + +// Class declaration +class EapQtCertificateInfo +{ +public: + + // Data types + + enum ItemId + { + /*! QString */ + SubjectName = 0, + /*! QString */ + IssuerName, + /*! QString */ + SerialNumber, + /*! QByteArray */ + SubjectKeyId, + /*! QString */ + ThumbPrint, + /*! QString */ + CertificateLabel, + /* marker for the last item */ + ItemIdLast + }; + +public: + + EapQtCertificateInfo(); + ~EapQtCertificateInfo(); + + EapQtCertificateInfo(const EapQtCertificateInfo &certInfo); + EapQtCertificateInfo &operator=(const EapQtCertificateInfo &certInfo); + + QVariant value(const ItemId id) const; + void setValue(const ItemId id, const QVariant &newValue); + +public: // FOR TESTING PURPOSE + bool operator==(const EapQtCertificateInfo & rhs) const; + +private: + QScopedPointer d_ptr; +}; + +// Make the class known to QMetaType to support using QVariant +Q_DECLARE_METATYPE(EapQtCertificateInfo) + +#endif // EAPQTCERTIFICATEINFO_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtcertificateinfo_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Certificate information data structure for EAP QT configuration interface + * + */ + +/* + * %version: 3 % + */ + +#include "eapqtcertificateinfo.h" +#include +class EapQtCertificateInfoPrivate +{ + friend class EapQtCertificateInfo; +public: + + EapQtCertificateInfoPrivate() {}; + ~EapQtCertificateInfoPrivate() {}; + + // copy constructor + EapQtCertificateInfoPrivate(const EapQtCertificateInfoPrivate &certInfo) + { + mCerts = certInfo.mCerts; + } + + QVariant value(int id); + void setValue(int id, QVariant newValue); + +private: + // disable assignment + EapQtCertificateInfoPrivate &operator=(const EapQtCertificateInfoPrivate&); + QHash mCerts; + +}; + + +//---------------------------------------------------------------------------- +// EapQtCertificateInfo +//---------------------------------------------------------------------------- + + +EapQtCertificateInfo::EapQtCertificateInfo() : + d_ptr(new EapQtCertificateInfoPrivate) +{ +} + +EapQtCertificateInfo::~EapQtCertificateInfo() +{ + // scoped pointer deleted automatically +} + +EapQtCertificateInfo::EapQtCertificateInfo(const EapQtCertificateInfo &certInfo) : + d_ptr(new EapQtCertificateInfoPrivate(*(certInfo.d_ptr))) +{ +} + +EapQtCertificateInfo& EapQtCertificateInfo::operator=(const EapQtCertificateInfo &certInfo) +{ + // check if assigning to myself + if (this != &certInfo) { + d_ptr.reset(new EapQtCertificateInfoPrivate(*(certInfo.d_ptr))); + } + return *this; +} + +QVariant EapQtCertificateInfo::value(const ItemId id) const +{ + // check for valid range, otherwise memory is consumed for no reason + if(id >= ItemIdLast) { + qDebug("ERROR: EapQtCertificateInfo::value - invalid id!"); + return QVariant::Invalid; + } + return d_ptr->mCerts[id]; +} + +void EapQtCertificateInfo::setValue(const ItemId id, const QVariant &newValue) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id < ItemIdLast) { + d_ptr->mCerts[id] = newValue; + } else { + qDebug("ERROR: EapQtCertificateInfo::setValue - invalid id!"); + } + return; +} + +bool EapQtCertificateInfo::operator==(const EapQtCertificateInfo & rhs ) const +{ + bool ret = true; + if (d_ptr->mCerts.size() != rhs.d_ptr->mCerts.size()) { + qWarning("EapQtCertificateInfo::operator==(): size: expect %d, actual %d ", + d_ptr->mCerts.size(), + rhs.d_ptr->mCerts.size() ); + ret = false; + } + QHashIterator i(d_ptr->mCerts); + + while (i.hasNext()) { + i.next(); + if (!rhs.d_ptr->mCerts.contains(i.key())){ + qWarning("EapQtCertificateInfo::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.value() != rhs.d_ptr->mCerts[i.key()]){ + qWarning("EapQtCertificateInfo::operator==(): values not match"); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << i.value(); + ret = false; + } + } + return ret; +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Stub for eapwizard testing. +*/ + +#ifndef EAPQTCONFIG_H +#define EAPQTCONFIG_H + +// System includes +#include +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration + +class EapQtConfig +{ +public: + + // Data types + + enum CipherSuite + { + /* from RFC4346, listing only suites supported by EAP server */ + TLS_NULL_WITH_NULL_NULL = 0x0000, + TLS_RSA_WITH_RC4_128_MD5 = 0x0004, + TLS_RSA_WITH_RC4_128_SHA = 0x0005, + TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x000a, + TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x0013, + TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x0016, + TLS_RSA_WITH_AES_128_CBC_SHA = 0x002f, + TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x0032, + TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x0033, + TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x0034, + }; + + enum SettingsId + { + // see also EapSettings.h + + /*! bool */ + UsernameAutomatic = 0, + /*! QString */ + Username, + /*! bool */ + PasswordPrompt, + /*! write-only: QString */ + Password, + /*! bool + * in read: defines if password already exists in settings database + * in write: when true, defines that password is not included in the provided + * configuration since it already exists in settings database, i.e. earlier + * set password remains unchanged */ + PasswordStored, + /*! write-only: bool + * true: clears the password from database + * false: does nothing + */ + PasswordClear, + /*! bool */ + RealmAutomatic, + /*! QString */ + Realm, + /*! bool */ + UsePseudonyms, + /*! bool */ + VerifyServerRealm, + /*! bool */ + ClientAuthenticationRequired, + /*! uint */ + SessionValidityTime, + /*! QList, values from EapQtConfig::CipherSuite */ + CipherSuites, + /*! bool */ + PeapVersion0Allowed, + /*! bool */ + PeapVersion1Allowed, + /*! bool */ + PeapVersion2Allowed, + /*! bool */ + AuthorityCertificateAutomatic, + /*! QList< QVariant(EapQtCertificateInfo) > */ + AuthorityCertificate, + /*! QList< QVariant(EapQtCertificateInfo) > */ + UserCertificate, + /*! QList< QVariant(EapQtPluginHandle) > */ + InnerType, + /*! EapQtPluginHandle */ + OuterType, + /*! bool */ + ProvisioningModeAuthenticated, + /*! bool */ + ProvisioningModeUnauthenticated, + /*! QString */ + PACGroupReference, + /*! bool */ + WarnADHPNoPAC, + /*! bool */ + WarnADHPNoMatchingPAC, + /*! bool */ + WarnNotDefaultServer, + /*! bool */ + UseIdentityPrivacy, + /* marker for the last entry */ + SettingsIdLast + }; + +public: + EapQtConfig(); + EapQtConfig(const EapQtConfig& other); + ~EapQtConfig(); + + QVariant value(const SettingsId id) const; + void setValue(const SettingsId id, const QVariant &newValue); + void clear(); + +public: // FOR TESTING PURPOSE + bool operator==(const EapQtConfig & rhs ) const; + +private: + QHash mSettings; +}; + +#endif diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfig_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * STUB: EAPWIZARD: EAP method QT configuration + * + */ + +/* + * %version: 4 % + */ + +#include "eapqtconfig.h" +#include +#include "eapqtcertificateinfo.h" +#include + +//---------------------------------------------------------------------------- +// EapQtConfig +//---------------------------------------------------------------------------- + +EapQtConfig::EapQtConfig() +{ +} + +EapQtConfig::EapQtConfig(const EapQtConfig &other) +{ + mSettings = other.mSettings; +} + +EapQtConfig::~EapQtConfig() +{ + // scoped pointer deleted automatically +} + +QVariant EapQtConfig::value(const SettingsId id) const +{ + // check for valid range, otherwise memory is consumed for no reason + if(id >= SettingsIdLast) { + qDebug("ERROR: EapQtConfig::value - invalid id!"); + return QVariant::Invalid; + } + return mSettings[id]; +} + +void EapQtConfig::setValue(const SettingsId id, const QVariant &newValue) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id < SettingsIdLast) { + mSettings[id] = newValue; + } else { + qDebug("ERROR: EapQtConfig::setValue - invalid id!"); + } + return; +} + +void EapQtConfig::clear() { + mSettings.clear(); + return; +} + +bool EapQtConfig::operator==(const EapQtConfig & rhs ) const +{ + bool ret = true; + if (mSettings.size() != rhs.mSettings.size()) { + qWarning("EapQtConfig::operator==(): size: expect %d, actual %d ", + mSettings.size(), + rhs.mSettings.size() ); + ret = false; + } + QHashIterator i(mSettings); + + while (i.hasNext()) { + i.next(); + if (!rhs.mSettings.contains(i.key())){ + qWarning("EapQtConfig::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.key() == EapQtConfig::InnerType) { + QList list1(mSettings[i.key()].toList()); + QList list2(rhs.mSettings[i.key()].toList()); + + if (list1.length() != 1 || list1.length() != list2.length()){ + qWarning("Invalid length in EapQtConfig::InnerType"); + ret = false; + } else { + EapQtPluginHandle handle1 = list1.at(0).value (); + EapQtPluginHandle handle2 = list2.at(0).value (); + if (handle1.pluginId() != handle2.pluginId()){ + qWarning("Outer: %d", handle1.pluginId()); + qWarning("Outer: %d", handle2.pluginId()); + ret = false; + } + } + } + else if (i.key() == EapQtConfig::OuterType) { + EapQtPluginHandle handle = mSettings[i.key()].value (); + EapQtPluginHandle handle2 = rhs.mSettings[i.key()].value (); + if (handle.pluginId() != handle2.pluginId()){ + qWarning("Outer: %d", handle.pluginId()); + qWarning("Outer: %d", handle2.pluginId()); + ret = false; + } + } + else if (i.key() == EapQtConfig::AuthorityCertificate || + i.key() == EapQtConfig::UserCertificate) { + QList list1(mSettings[i.key()].toList()); + QList list2(rhs.mSettings[i.key()].toList()); + + if (list1.length() != 1 || list1.length() != list2.length()) { + qWarning("Invalid length Certs %d", i.key()); + ret = false; + } else { + EapQtCertificateInfo cert1 = list1.at(0).value(); + EapQtCertificateInfo cert2 = list2.at(0).value(); + + if (!(cert1 == cert2)) { + ret = false; + qWarning("Invalid certs %d", i.key()); + } + } + } + else { + if (i.value() != rhs.mSettings[i.key()]){ + qWarning("EapQtConfig::operator==(): values does not match %d", i.key()); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << rhs.mSettings[i.key()]; + ret = false; + } + } + } + return ret; +} + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* EAP method configuration QT interface. +*/ + +#ifndef EAPQTCONFIGINTERFACE_H +#define EAPQTCONFIGINTERFACE_H + +#include +#include +#include +#include +#include "eapqtconfig.h" +#include "eapqtpacstoreconfig.h" +#include "eapqtcertificateinfo.h" +#include "eapqtvalidator.h" + +class EapQtConfigInterfaceContext; +/*! + * @addtogroup group_eap_config_api + * @{ + */ + +/*! + */ +class EapQtConfigInterface +{ +public: + + enum EapBearerType + { + // EAP configuration interface for WLAN + EapBearerTypeWlan = 0, + // EAP configuration interface for VPN + EapBearerTypeVpn, + }; + + static const int IapIdUndefined = -1; + +public: + EapQtConfigInterface(const EapBearerType bearerType, const int iapId); + ~EapQtConfigInterface(); + + EapQtValidator *validatorEap(const EapQtExpandedEapType &type, const EapQtConfig::SettingsId id); + EapQtValidator *validatorPacStore(const EapQtPacStoreConfig::PacStoreSettings id); + + bool setConfigurationReference(const int iapId); + QList certificateAuthorityCertificates(); + QList userCertificates(); + + bool updateCertificates(); + + bool isSupportedOuterType(const EapQtPluginHandle& handle); + bool isSupportedInnerType(const EapQtPluginHandle& outerHandle, + const EapQtPluginHandle& innerHandle); + + bool setSelectedOuterTypes(const QList& outerHandles); + bool saveConfiguration(const EapQtPluginHandle& pluginHandle, const EapQtConfig &config); + bool deleteConfiguration(); + + bool readPacStoreConfiguration(EapQtPacStoreConfig &config); + bool savePacStoreConfiguration(EapQtPacStoreConfig &config); + + +private: + Q_DISABLE_COPY(EapQtConfigInterface) + QStringList mCalledMethods; + + // setConfigurationReference + int mIapId; + bool mReturnSetConfigurationReference; + + // certificateAuthorityCertificates + QList mCertsCa; + + // userCertificates + QList mCertsUser; + + // isSupportedOuterType + QList mSupportedOuterTypes; + + // isSupportedInnerType + QList mSupportedInnerTypes; + int mSupportedInnerTypesOuterHandle; + + // setSelectedOuterTypes + QList mSetSelectectedOuterTypes; + bool mReturnSetSelectedOuterTypes; + + // saveConfiguration + EapQtPluginHandle::Plugin mOuterPlugin; + EapQtConfig mSaveConfigurationsOuter; + bool mReturnSaveConfigurationOuter; + EapQtPluginHandle::Plugin mInnerPlugin; + EapQtConfig mSaveConfigurationsInner; + bool mReturnSaveConfigurationInner; + + // validatorEap + QHash > mValidator; + + // readPacStoreConfiguration + EapQtPacStoreConfig mReadPacStoreConfiguration; + bool mReadPacStoreConfigurationReturn; + + // savePacStoreConfiguration + EapQtPacStoreConfig mSavePacStoreConfiguration; + bool mSavePacStoreConfigurationReturn; + + // validatorPacStore, key: EapQtPacStoreConfig::PacStoreSettings + QHash mValidatorPacStore; + + friend class EapQtConfigInterfaceContext; +}; + +/*! @} */ + +#endif + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,422 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ +#include + +#include "eapqtconfiginterface_context.h" +#include "eapqtvalidator_stub.h" +#include "eapqtexpandedeaptype.h" + +EapQtConfigInterfaceContext::EapQtConfigInterfaceContext() : + mEapQtConfig(NULL) +{ +} + +EapQtConfigInterfaceContext::~EapQtConfigInterfaceContext() +{ + mEapQtConfig->mValidator.clear(); +} + +void EapQtConfigInterfaceContext::setObject(EapQtConfigInterface *eapQtConfig) +{ + mEapQtConfig = eapQtConfig; +} + +void EapQtConfigInterfaceContext::createEapAkaSim(int type) +{ + QList types; + types.append((EapQtPluginHandle::Plugin)type); + setSupportedOuterTypes(types); + + setSelectectedOuterTypes(types, true); + + EapQtConfig config; + config.setValue(EapQtConfig::UsernameAutomatic, true); + config.setValue(EapQtConfig::RealmAutomatic, true); + setOuterConfig((EapQtPluginHandle::Plugin)type, config, true); +} + +void EapQtConfigInterfaceContext::createLeap( + const QString& username, + const QString& passwd) +{ + QList types; + types.append(EapQtPluginHandle::PluginLeap); + setSupportedOuterTypes(types); + + setSelectectedOuterTypes(types, true); + + EapQtConfig config; + config.setValue(EapQtConfig::UsernameAutomatic, false); + config.setValue(EapQtConfig::Username, username); + config.setValue(EapQtConfig::PasswordPrompt, false); + config.setValue(EapQtConfig::Password, passwd); + setOuterConfig(EapQtPluginHandle::PluginLeap, config, true); + + // validators + createInnerTypeValidators(EapQtPluginHandle::PluginLeap); +} + +void EapQtConfigInterfaceContext::createEapIdentifyValidators(EapQtPluginHandle::Plugin outerType) +{ + EapQtPluginHandle typeHandle(outerType); + + EapQtValidatorStub *valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(typeHandle.type().type(), EapQtConfig::Username, valStub); + + valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(typeHandle.type().type(), EapQtConfig::Realm, valStub); +} + +void EapQtConfigInterfaceContext::createEapTtlsPeap( + EapQtPluginHandle::Plugin type, + bool automaticCert, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm, + EapQtPluginHandle::Plugin innerType) +{ + EapQtPluginHandle typeHandle(type); + + QList types; + types.append(typeHandle); + setSupportedOuterTypes(types); + setSelectectedOuterTypes(types, true); + + // Certs + QList certs; + EapQtCertificateInfo caCert; + caCert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super Cert"); + certs.append(caCert); + setCertsCa(certs); + + // CREATE VALIDATOR + createEapIdentifyValidators(type); + + // CREATE CONFIGURATION FOR TTLS/PEAP + + EapQtConfig config; + config.setValue(EapQtConfig::UseIdentityPrivacy, false); + config.setValue(EapQtConfig::VerifyServerRealm, false); + config.setValue(EapQtConfig::ClientAuthenticationRequired, false); + + config.setValue(EapQtConfig::UsernameAutomatic, usernameAutomatic); + config.setValue(EapQtConfig::Username, username); + config.setValue(EapQtConfig::RealmAutomatic, realmAutomatic); + config.setValue(EapQtConfig::Realm, realm); + if (automaticCert){ + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); + } + else { + QList caCerts; + caCerts.append(qVariantFromValue(caCert)); + config.setValue(EapQtConfig::AuthorityCertificate, caCerts); + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); + } + if (type == EapQtPluginHandle::PluginPeap){ + if (innerType == EapQtPluginHandle::PluginEapMschapv2){ + config.setValue(EapQtConfig::PeapVersion0Allowed, true); + config.setValue(EapQtConfig::PeapVersion1Allowed, false); + } + else { + config.setValue(EapQtConfig::PeapVersion0Allowed, false); + config.setValue(EapQtConfig::PeapVersion1Allowed, true); + } + config.setValue(EapQtConfig::PeapVersion2Allowed, false); + } + QList innerTypeList; + EapQtPluginHandle inner(innerType); + innerTypeList.append(qVariantFromValue(inner)); + config.setValue(EapQtConfig::InnerType, innerTypeList); + + setOuterConfig(type, config, true); +} + +void EapQtConfigInterfaceContext::createEapTls( + QList &caCerts, + int indexForCaCert, + QList &userCerts, + int indexForUserCert) +{ + QList types; + types.append(EapQtPluginHandle::PluginEapTls); + setSupportedOuterTypes(types); + setSelectectedOuterTypes(types, true); + + // Certs + setCertsCa(caCerts); + setCertsUser(userCerts); + + // CREATE VALIDATOR + createEapIdentifyValidators(EapQtPluginHandle::PluginEapTls); + + // CREATE CONFIGURATION FOR TTLS/PEAP + + EapQtConfig config; + config.setValue(EapQtConfig::UseIdentityPrivacy, false); + config.setValue(EapQtConfig::VerifyServerRealm, false); + config.setValue(EapQtConfig::ClientAuthenticationRequired, true); + + config.setValue(EapQtConfig::UsernameAutomatic, true); + config.setValue(EapQtConfig::Username, QString()); + config.setValue(EapQtConfig::RealmAutomatic, true); + config.setValue(EapQtConfig::Realm, QString()); + + if (caCerts.length() == 0){ + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); + } else { + QList caCertsVariant; + caCertsVariant.append(qVariantFromValue(caCerts[indexForCaCert])); + config.setValue(EapQtConfig::AuthorityCertificate, caCertsVariant); + config.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); + } + + if (indexForUserCert != -1) { + QList certs; + certs.append(qVariantFromValue(userCerts[indexForUserCert])); + config.setValue(EapQtConfig::UserCertificate, certs); + } + + setOuterConfig(EapQtPluginHandle::PluginEapTls, config, true); +} + +void EapQtConfigInterfaceContext::createInner( + EapQtPluginHandle::Plugin outerType, + EapQtPluginHandle::Plugin innerType, + const QString &username, + const QString &password) +{ + EapQtPluginHandle innerHandle(innerType); + + QList types; + types.append(innerHandle); + setSupportedInnerTypes(outerType, types); + + EapQtConfig config; + EapQtPluginHandle outerTypeHandle(outerType); + config.setValue(EapQtConfig::OuterType, qVariantFromValue(outerTypeHandle)); + config.setValue(EapQtConfig::UsernameAutomatic, false); + config.setValue(EapQtConfig::Username, username); + config.setValue(EapQtConfig::PasswordPrompt, false); + config.setValue(EapQtConfig::Password, password); + setInnerConfig(innerType, config, true); + + createInnerTypeValidators(innerType); +} + +void EapQtConfigInterfaceContext::createInnerTypeValidators(EapQtPluginHandle::Plugin innerType) +{ + EapQtPluginHandle innerHandle(innerType); + + // validators + EapQtValidatorStub *valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(innerHandle.type().type(), EapQtConfig::Username, valStub); + + valStub = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidator(innerHandle.type().type(), EapQtConfig::Password, valStub); +} + +void EapQtConfigInterfaceContext::createEapFast( + int pacState, const QString &password) +{ + QList types; + types.append(EapQtPluginHandle::PluginEapFast); + setSupportedOuterTypes(types); + setSelectectedOuterTypes(types, true); + + EapQtPacStoreConfig pacStoreConfig; + pacStoreConfig.setValue(EapQtPacStoreConfig::PacStoreState, pacState); + setPacStoreConfigRead(pacStoreConfig, true); + + if (pacState == EapQtPacStoreConfig::PacStoreStateStoreNotExists || + pacState == EapQtPacStoreConfig::PacStoreStatePasswordRequired) { + pacStoreConfig.clear(); + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStorePassword, + password); + + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStoreSavePassword, + true); + + setPacStoreConfigSave(pacStoreConfig, true); + } + + if (pacState == EapQtPacStoreConfig::PacStoreStateStoreNotExists) { + EapQtValidatorStub *validator = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidatorPacStore(EapQtPacStoreConfig::PacStorePassword, validator); + } + + if (pacState == EapQtPacStoreConfig::PacStoreStatePasswordRequired) { + EapQtValidatorStub *validator = new EapQtValidatorStub(EapQtValidator::StatusOk); + setValidatorPacStore(EapQtPacStoreConfig::PacStorePasswordConfirmation, validator); + } + + EapQtConfig config; + config.setValue(EapQtConfig::ProvisioningModeAuthenticated, false); + config.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true); + config.setValue(EapQtConfig::VerifyServerRealm, false); + config.setValue(EapQtConfig::UseIdentityPrivacy, false); + + QList innerTypeList; + EapQtPluginHandle inner(EapQtPluginHandle::PluginEapMschapv2); + innerTypeList.append(qVariantFromValue(inner)); + config.setValue(EapQtConfig::InnerType, innerTypeList); + + setOuterConfig(EapQtPluginHandle::PluginEapFast, config, true); +} + +QStringList EapQtConfigInterfaceContext::calledMethods() +{ + QStringList methods = mEapQtConfig->mCalledMethods; + mEapQtConfig->mCalledMethods.clear(); + return methods; +} + +void EapQtConfigInterfaceContext::setConfigurationReference( + int iapId, + bool retValue) +{ + mEapQtConfig->mIapId = iapId; + setConfigurationReferenceReturn(retValue); +} + +void EapQtConfigInterfaceContext::setConfigurationReferenceReturn(bool retValue) +{ + mEapQtConfig->mReturnSetConfigurationReference = retValue; +} + +void EapQtConfigInterfaceContext::setCertsCa( + QList &certs) +{ + mEapQtConfig->mCertsCa = certs; +} + +void EapQtConfigInterfaceContext::setCertsUser( + QList &certs) +{ + mEapQtConfig->mCertsUser = certs; +} + +void EapQtConfigInterfaceContext::setSupportedOuterTypes( + QList &outerTypes) +{ + mEapQtConfig->mSupportedOuterTypes = outerTypes; +} + +void EapQtConfigInterfaceContext::setSupportedInnerTypes( + EapQtPluginHandle outerHandle, + QList &innerTypes) +{ + mEapQtConfig->mSupportedInnerTypes = innerTypes; + mEapQtConfig->mSupportedInnerTypesOuterHandle = outerHandle.pluginId(); +} + +void EapQtConfigInterfaceContext::setSelectectedOuterTypes( + QList &types, + bool retValue) +{ + mEapQtConfig->mSetSelectectedOuterTypes = types; + setSelectectedOuterTypesReturn(retValue); +} + +void EapQtConfigInterfaceContext::setSelectectedOuterTypesReturn(bool retValue) +{ + mEapQtConfig->mReturnSetSelectedOuterTypes = retValue; +} + +void EapQtConfigInterfaceContext::setOuterConfig( + EapQtPluginHandle::Plugin handle, + EapQtConfig &config, + bool retValue) +{ + mEapQtConfig->mOuterPlugin = handle; + mEapQtConfig->mSaveConfigurationsOuter = config; + setOuterConfigReturn(retValue); +} + +void EapQtConfigInterfaceContext::setOuterConfigReturn(bool retValue) +{ + mEapQtConfig->mReturnSaveConfigurationOuter = retValue; +} + +void EapQtConfigInterfaceContext::setInnerConfig( + EapQtPluginHandle::Plugin handle, + EapQtConfig &config, + bool retValue) +{ + mEapQtConfig->mInnerPlugin = handle; + mEapQtConfig->mSaveConfigurationsInner = config; + setInnerConfigReturn(retValue); +} + +void EapQtConfigInterfaceContext::setInnerConfigReturn(bool retValue) +{ + mEapQtConfig->mReturnSaveConfigurationInner = retValue; +} + +void EapQtConfigInterfaceContext::setValidator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId id, + EapQtValidator *validator) +{ + QCOMPARE(mEapQtConfig->mValidator[eapType][id] == NULL, true); + mEapQtConfig->mValidator[eapType][id] = validator; +} + + +EapQtValidator *EapQtConfigInterfaceContext::validator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId id) +{ + return mEapQtConfig->mValidator[eapType][id]; +} + +void EapQtConfigInterfaceContext::setPacStoreConfigRead( + EapQtPacStoreConfig &config, + bool retValue) +{ + mEapQtConfig->mReadPacStoreConfiguration = config; + setPacStoreConfigReadReturn(retValue); +} + +void EapQtConfigInterfaceContext::setPacStoreConfigReadReturn(bool retValue) +{ + mEapQtConfig->mReadPacStoreConfigurationReturn = retValue; +} + +void EapQtConfigInterfaceContext::setPacStoreConfigSave( + EapQtPacStoreConfig &config, + bool retValue) +{ + mEapQtConfig->mSavePacStoreConfiguration = config; + setPacStoreConfigSaveReturn(retValue); +} + +void EapQtConfigInterfaceContext::setPacStoreConfigSaveReturn(bool retValue) +{ + mEapQtConfig->mSavePacStoreConfigurationReturn = retValue; +} + +void EapQtConfigInterfaceContext::setValidatorPacStore(int id, EapQtValidator * validator) +{ + mEapQtConfig->mValidatorPacStore[id] = validator; +} + +EapQtValidator *EapQtConfigInterfaceContext::validatorPacStore(int id) +{ + return mEapQtConfig->mValidatorPacStore[id]; +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_context.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,102 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef EAPQTCONFIGINTERFACE_CONTEXT_H +#define EAPQTCONFIGINTERFACE_CONTEXT_H + +#include "eapqtconfiginterface.h" +#include "eapqtpacstoreconfig.h" + +class EapQtConfigInterfaceContext +{ +public: + EapQtConfigInterfaceContext(); + ~EapQtConfigInterfaceContext(); + + void setObject(EapQtConfigInterface *eapQtConfig); + +public: // Helpper methods to create simple valid configurations + void createEapAkaSim(int pluginHandleEnum); + + void createLeap(const QString& username, const QString& passwd); + + void createEapIdentifyValidators(EapQtPluginHandle::Plugin outerType); + + void createEapTtlsPeap( + EapQtPluginHandle::Plugin type, + bool automaticCert, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm, + EapQtPluginHandle::Plugin innerType); + + void createEapTls( + QList &caCerts, + int indexForCaCert, + QList &userCerts, + int indexForUserCert); + + void createInner( + EapQtPluginHandle::Plugin outerType, + EapQtPluginHandle::Plugin innerType, + const QString &username, + const QString &password); + + void createInnerTypeValidators(EapQtPluginHandle::Plugin innerType); + + void createEapFast(int pacState, const QString &password = QString()); + +public: // Methods to set the exact behavior of the interface + QStringList calledMethods(); + void setConfigurationReference(int iapId, bool retValue); + void setConfigurationReferenceReturn(bool retValue); + void setCertsCa(QList &certs); + void setCertsUser(QList &certs); + void setSupportedOuterTypes(QList &outerTypes); + void setSupportedInnerTypes(EapQtPluginHandle outerHandle, QList &innerTypes); + void setSelectectedOuterTypes(QList &types, bool retValue); + void setSelectectedOuterTypesReturn(bool retValue); + void setOuterConfig(EapQtPluginHandle::Plugin handle, EapQtConfig &config, bool retValue); + void setOuterConfigReturn(bool retValue); + void setInnerConfig(EapQtPluginHandle::Plugin handle, EapQtConfig &config, bool retValue); + void setInnerConfigReturn(bool retValue); + // Moved ownership to context + void setValidator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId, + EapQtValidator *validator); + + EapQtValidator *validator( + EapQtExpandedEapType::Type eapType, + EapQtConfig::SettingsId id); + + void setPacStoreConfigRead(EapQtPacStoreConfig &config, bool retValue); + void setPacStoreConfigReadReturn(bool retValue); + void setPacStoreConfigSave(EapQtPacStoreConfig &config, bool retValue); + void setPacStoreConfigSaveReturn(bool retValue); + void setValidatorPacStore(int id, EapQtValidator * validator); + + EapQtValidator *validatorPacStore(int id); + + +private: + EapQtConfigInterface* mEapQtConfig; +}; + +#endif /* EAPQTCONFIGINTERFACE_CONTEXT_H */ + +// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtconfiginterface_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Stub for EAP method configuration QT interface + * + */ + +/* + * %version: 6 % + */ + +#include +#include +#include +#include "eapqtconfiginterface.h" + +//---------------------------------------------------------------------------- +// EapQtConfigInterface +//---------------------------------------------------------------------------- + +EapQtConfigInterface::EapQtConfigInterface( + const EapBearerType bearerType, + const int iapId) +{ + mCalledMethods.append("EapQtConfigInterface"); + QCOMPARE(bearerType, EapQtConfigInterface::EapBearerTypeWlan); + QCOMPARE(iapId, EapQtConfigInterface::IapIdUndefined); +} + +EapQtConfigInterface::~EapQtConfigInterface() +{ + mCalledMethods.append("~EapQtConfigInterface"); +} + + +EapQtValidator *EapQtConfigInterface::validatorEap( + const EapQtExpandedEapType &type, + const EapQtConfig::SettingsId id) +{ + mCalledMethods.append("validatorEap"); + + QCOMPARE(mValidator[type.type()][id] != NULL, true); + EapQtValidator *validator = mValidator[type.type()][id]; + mValidator[type.type()].remove(id); + return validator; +} + +EapQtValidator *EapQtConfigInterface::validatorPacStore( + const EapQtPacStoreConfig::PacStoreSettings id) +{ + mCalledMethods.append("validatorPacStore"); + + QCOMPARE(mValidatorPacStore.contains(id), true); + EapQtValidator *validator = mValidatorPacStore[id]; + mValidatorPacStore.remove(id); + return validator; +} + +bool EapQtConfigInterface::setConfigurationReference(const int iapId) +{ + mCalledMethods.append("setConfigurationReference"); + QCOMPARE(iapId, mIapId); + + return mReturnSetConfigurationReference; +} + +QList EapQtConfigInterface::certificateAuthorityCertificates() +{ + mCalledMethods.append("certificateAuthorityCertificates"); + return mCertsCa; +} + +QList EapQtConfigInterface::userCertificates() +{ + mCalledMethods.append("userCertificates"); + return mCertsUser; +} + + +bool EapQtConfigInterface::updateCertificates() +{ + mCalledMethods.append("updateCertificates"); + return true; +} + +bool EapQtConfigInterface::isSupportedOuterType(const EapQtPluginHandle& handle) +{ + mCalledMethods.append("isSupportedOuterType"); + return mSupportedOuterTypes.contains(handle); +} + +bool EapQtConfigInterface::isSupportedInnerType( + const EapQtPluginHandle& outerHandle, + const EapQtPluginHandle& innerHandle) +{ + mCalledMethods.append("isSupportedOuterType"); + QCOMPARE(mSupportedInnerTypesOuterHandle, (int)outerHandle.pluginId()); + return mSupportedInnerTypes.contains(innerHandle); +} + +bool EapQtConfigInterface::setSelectedOuterTypes( + const QList& outerHandles) +{ + mCalledMethods.append("setSelectedOuterTypes"); + QCOMPARE(mSetSelectectedOuterTypes, outerHandles); + return mReturnSetSelectedOuterTypes; +} + +bool EapQtConfigInterface::saveConfiguration( + const EapQtPluginHandle& pluginInfo, + const EapQtConfig &config) +{ + mCalledMethods.append("saveConfiguration"); + + if (pluginInfo == mOuterPlugin) { + QCOMPARE(config == mSaveConfigurationsOuter, true); + return mReturnSaveConfigurationOuter; + } else { + QCOMPARE(pluginInfo == mInnerPlugin, true); + QCOMPARE(config == mSaveConfigurationsInner, true); + return mReturnSaveConfigurationInner; + } +} + +bool EapQtConfigInterface::deleteConfiguration() +{ + mCalledMethods.append("deleteConfiguration"); + return true; +} + + +bool EapQtConfigInterface::readPacStoreConfiguration(EapQtPacStoreConfig &config) +{ + config = mReadPacStoreConfiguration; + return mReadPacStoreConfigurationReturn; +} + +bool EapQtConfigInterface::savePacStoreConfiguration(EapQtPacStoreConfig &config) +{ + QCOMPARE(config == mSavePacStoreConfiguration, true); + return mSavePacStoreConfigurationReturn; +} + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP-FAST PAC store configuration data: For EAP Wizard testing + * + */ + +#ifndef EAPQTPACSTORECONFIG_H +#define EAPQTPACSTORECONFIG_H + +// System includes +#include + +// User includes + +// Forward declarations + +// External data types + +// Constants + +// Class declaration + +class EapQtPacStoreConfig +{ +public: + + // PAC store is global, i.e. only a single PAC store exists in a device + + // Data types + + enum PacStoreStatus + { + // PAC store does not exist and needs to be created + // (status also reverts to PacStoreStateStoreNotExists if the PAC store is + // corrupted, i.e. it gets deleted automatically) + PacStoreStateStoreNotExists = 0, + // PAC store exists but the password has not been stored and + // is needed to access the PAC store + PacStoreStatePasswordRequired, + // PAC store password has been stored to settings database + // and is not needed to use the PAC store + PacStoreStatePasswordStored, + // marker for the last item + PacStoreStateLast + }; + + enum PacStoreSettings + { + /*! write-only: QString + * password to be used for accessing the PAC store + * - must be new password if the read PacStoreState is PacStoreStateStoreNotExists + * - must be password of the existing PAC store if the PacStoreState state is + * PacStoreStatePasswordRequired */ + PacStorePassword = 0, + /*! write-only: bool + * true: saves the password given in settings + * false: clears the earlier stored password from database, i.e. password + * will be prompted when needed, PAC store itself remains valid + * QVariant::Invalid: no actions */ + PacStoreSavePassword, + /*! write-only: bool + * true: deletes PAC store, i.e. clears everything related to the + * existing PAC store including saved password + * false/QVariant::Invalid: no actions */ + PacStoreReset, + /*! read-only: int (PacStoreStatus) */ + PacStoreState, + /*! no write nor read operation, for validator usage only + * - uses the validator to check if the given password + * can open the existing PAC store */ + PacStorePasswordConfirmation, + // marker for the last item + PacStoreLast + }; + +public: + EapQtPacStoreConfig(); + ~EapQtPacStoreConfig(); + + // gets the configuration field referred to by an id from PacStoreSettings + // returns QVariant::Invalid is the field has not been set + QVariant value(const PacStoreSettings id) const; + + // sets the configuration field referred to by an id from PacStoreSettings + // does nothing if newValue >= PacStoreLast + void setValue(const PacStoreSettings id, const QVariant &newValue); + + // resets the object i.e. any successive call to + // value() returns QVariant::Invalid + void clear(); + +public: // FOR TESTING PURPOSE + bool operator==(const EapQtPacStoreConfig & rhs ) const; + bool operator=(const EapQtPacStoreConfig & rhs ); + +private: + QHash mPacStoreSettings; +}; + +#endif /* EAPQTPACSTORECONFIG_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtpacstoreconfig_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP-FAST PAC store configuration data + * + */ + +/* + * %version: 3 % + */ +#include +#include + +EapQtPacStoreConfig::EapQtPacStoreConfig() +{ +} + +EapQtPacStoreConfig::~EapQtPacStoreConfig() +{ + // scoped pointer deleted automatically +} + +QVariant EapQtPacStoreConfig::value(const PacStoreSettings id) const +{ + // check for valid range, otherwise memory is consumed for no reason + if(id >= PacStoreLast) { + qDebug("ERROR: EapQtPacStoreConfig::value - invalid id!"); + return QVariant::Invalid; + } + return mPacStoreSettings[id]; +} + +void EapQtPacStoreConfig::setValue( + const PacStoreSettings id, + const QVariant & newValue) +{ + // check for valid range, otherwise memory is consumed for no reason + if(id < PacStoreLast) { + mPacStoreSettings[id] = newValue; + } else { + qDebug("ERROR: EapQtPacStoreConfig::setValue - invalid id!"); + } +} + +void EapQtPacStoreConfig::clear() +{ + mPacStoreSettings.clear(); +} + +bool EapQtPacStoreConfig::operator==(const EapQtPacStoreConfig & rhs ) const +{ + bool ret = true; + if (mPacStoreSettings.size() != rhs.mPacStoreSettings.size()) { + qWarning("EapQtPacStoreConfig::operator==(): size: expect %d, actual %d ", + mPacStoreSettings.size(), + rhs.mPacStoreSettings.size() ); + ret = false; + } + QHashIterator i(mPacStoreSettings); + + while (i.hasNext()) { + i.next(); + if (!rhs.mPacStoreSettings.contains(i.key())){ + qWarning("EapQtPacStoreConfig::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.value() != rhs.mPacStoreSettings[i.key()]){ + qWarning("EapQtPacStoreConfig::operator==(): values not match"); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << rhs.mPacStoreSettings[i.key()]; + ret = false; + } + } + return ret; +} + + +bool EapQtPacStoreConfig::operator=(const EapQtPacStoreConfig & rhs ) +{ + mPacStoreSettings = rhs.mPacStoreSettings; +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,108 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Stub for EAP WIZARD testing: EAP QT configuration validator interface. +*/ + +#ifndef EAPQTVALIDATOR_H +#define EAPQTVALIDATOR_H + +// System includes +#include + +// User includes + +// Forward declarations + +class HbLineEdit; + +// External data types + +// Constants + +// Class declaration + +/*! + * @addtogroup group_eap_config_api + * @{ + */ + +/* + * Eap Qt Validator interface. This interface provides a method to configure + * the editor to use required constraints, hints, editor classes and so one + * depending on the EAP type and the configuration identifier. + * See updateEditor() method for further details. + * + * validate() method checks that the content and format are valid for + * given configuration parameter. + * + * An instance of a validator is created with + * EapQtConfigInterface::validatorEap() method. + */ + +class EapQtValidator +{ + +public: + + // Data types + + /* + * Validation status. Can be extended. + */ + enum Status { + /// Ok + StatusOk = 0, + /// Content is invalid + StatusInvalid, + /// The length is not valid + StatusInvalidLength, + /// Invalid characters detected + StatusInvalidCharacters, + /// Input is too short + StatusTooShort, + /// Input is too long + StatusTooLong, + }; + + EapQtValidator() {}; + virtual ~EapQtValidator() {}; + + /*! + * Validates the given input \a value. + * + * @param value Value to be validated + * + * @return Status code. + */ + virtual Status validate(const QVariant &value) = 0; + + /*! + * Sets required configurations to the line edit. + * + * Configurations depend on given EAP type and the configuration + * identifire which was used to instantiate the validator. + * + * @param edit LineEdit to be updated. + */ + virtual void updateEditor(HbLineEdit* const edit) = 0; + +private: + + Q_DISABLE_COPY(EapQtValidator) +}; + +/*! @} */ + +#endif diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* EAP method validator: Stub or EapWizard testing +*/ + +#include "eapqtvalidator_stub.h" + +EapQtValidatorStub::EapQtValidatorStub( + EapQtValidator::Status status) : + mStatus(status) +{ +} + +EapQtValidatorStub::~EapQtValidatorStub() +{ +} + +EapQtValidator::Status EapQtValidatorStub::validate(const QVariant & value) +{ + Q_UNUSED(value); + return mStatus; +} + +void EapQtValidatorStub::updateEditor(HbLineEdit* const edit) +{ + Q_UNUSED(edit); +} + +void EapQtValidatorStub::setReturnValue(EapQtValidator::Status status) +{ + mStatus = status; +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/eapqtvalidator_stub.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * Stub for EAP WIZARD testing: EAP QT configuration validator interface + * + */ + +#ifndef EAPQTVALIDATOR_STUB_H +#define EAPQTVALIDATOR_STUB_H + +// System includes +#include + +// User includes + +// Forward declarations + +class HbLineEdit; + +// External data types + +// Constants + +// Class declaration + +/*! + * @addtogroup group_eap_config_api + * @{ + */ + +class EapQtValidatorStub : public EapQtValidator +{ + +public: + + EapQtValidatorStub(EapQtValidator::Status status); + ~EapQtValidatorStub(); + virtual EapQtValidator::Status validate(const QVariant & value); + void updateEditor(HbLineEdit* const edit ); + void setReturnValue(EapQtValidator::Status status); + +private: + EapQtValidator::Status mStatus; + Q_DISABLE_COPY(EapQtValidatorStub) +}; + +/*! @} */ + +#endif diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/stubs.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/stubs.pri Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,47 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# +# Description: +# Stubs for Wlan wizard testing +# + +DEFINES += BUILD_WLANQTUTILITIES_DLL + +HEADERS += \ + stubs/eapqtcertificateinfo.h \ + stubs/eapqtconfig.h \ + stubs/eapqtconfiginterface.h \ + stubs/eapqtconfiginterface_context.h \ + stubs/eapqtpacstoreconfig.h \ + stubs/eapqtvalidator.h \ + stubs/eapqtvalidator_stub.h \ + stubs/wlanmgmtclient.h \ + stubs/wlanmgmtclient_context.h \ + stubs/wlanqtutils.h \ + stubs/wlanqtutils_context.h \ + stubs/wlanqtutilsap.h \ + stubs/wlanqtutilscommon.h + +SOURCES += \ + stubs/eapqtcertificateinfo_stub.cpp \ + stubs/eapqtconfig_stub.cpp \ + stubs/eapqtconfiginterface_stub.cpp \ + stubs/eapqtconfiginterface_context.cpp \ + stubs/eapqtpacstoreconfig_stub.cpp \ + stubs/eapqtvalidator_stub.cpp \ + stubs/wlanmgmtclient_stub.cpp \ + stubs/wlanmgmtclient_context.cpp \ + stubs/wlanqtutils_context.cpp \ + stubs/wlanqtutils_stub.cpp \ + stubs/wlanqtutilsap_stub.cpp diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#ifndef WLANMGMTCLIENT_H +#define WLANMGMTCLIENT_H + +#include "wlanmgmtcommon.h" +#include "wlanscaninfo.h" + +class WlanMgmtClientContext; + +// CLASS DECLARATION + +class CWlanMgmtClient : public CBase + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + * @return Pointer to the constructed object. + */ + static CWlanMgmtClient* NewL(); + + /** + * Destructor. + */ + ~CWlanMgmtClient(); + + /** + * Start Protected Setup. + * + * @param aStatus Status of the calling active object. On successful + * completion contains KErrNone, otherwise one of the + * system-wide error codes. + * @param aSsid SSID of the network to configure. + * @param aWpsPin PIN value to be used. "00000000" (string of eight zeros) + * if push button method is used. + * @param aCredentials Results of a successful Protected Setup operation. + * @sa \link psetup Protected Setup-specific error codes \endlink. + */ + virtual void RunProtectedSetup( + TRequestStatus& aStatus, + const TWlanSsid& aSsid, + const TWlanWpsPin& aWpsPin, + CArrayFixSeg& aCredentials ); + + /** + * Cancel an outstanding Protected Setup operation. + */ + virtual void CancelProtectedSetup(); + + private: // Data + + CWlanMgmtClient(); + CArrayFixSeg *iResults; + TWlanSsid iSsid; + TInt iCompletionCode; + + friend class WlanMgmtClientContext; + }; + +#endif // WLANMGMTCLIENT_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ +#include + +#include "wlanmgmtclient_context.h" + +WlanMgmtClientContext::WlanMgmtClientContext() : + mWlanMgmtClient(NULL) +{ +} + +WlanMgmtClientContext::~WlanMgmtClientContext() +{ +} + +void WlanMgmtClientContext::setObject(CWlanMgmtClient *wlanMgmtClient) +{ + mWlanMgmtClient = wlanMgmtClient; +} + + +void WlanMgmtClientContext::setRunProtectedSetup(const QString &ssid, int completionCode) +{ + mWlanMgmtClient->iSsid.Copy((unsigned char*)ssid.toAscii().constData()); + mWlanMgmtClient->iCompletionCode = completionCode; +} + +void WlanMgmtClientContext::appendResult( + const QString &ssid, + int securityMode, + int operatingMode, + int defaultWepKeyIndex, + const QString &wepKey1, + const QString &wepKey2, + const QString &wepKey3, + const QString &wepKey4, + const QString &wpaKey) +{ + TWlanProtectedSetupCredentialAttribute attr; + + attr.iOperatingMode =(TWlanOperatingMode)operatingMode; + attr.iSecurityMode = (TWlanIapSecurityMode)securityMode; + + attr.iSsid.Copy( + (unsigned char*)ssid.toLatin1().constData(), + ssid.length()); + + attr.iWepKey1.Copy( + (unsigned char*)wepKey1.toLatin1().constData(), + wepKey1.length()); + + attr.iWepKey2.Copy( + (unsigned char*)wepKey2.toLatin1().constData(), + wepKey2.length()); + + attr.iWepKey3.Copy( + (unsigned char*)wepKey3.toLatin1().constData(), + wepKey3.length()); + + attr.iWepKey4.Copy( + (unsigned char*)wepKey4.toLatin1().constData(), + wepKey4.length()); + + attr.iWepDefaultKey = (TWlanDefaultWepKey)defaultWepKeyIndex; + + attr.iWpaPreSharedKey.Copy( + (unsigned char*)wpaKey.toLatin1().constData(), + wpaKey.length()); + + mWlanMgmtClient->iResults->AppendL(attr); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_context.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef WLANMGMTCLIENT_CONTEXT_H +#define WLANMGMTCLIENT_CONTEXT_H + +#include "wlanmgmtclient.h" + +class WlanMgmtClientContext +{ +public: + WlanMgmtClientContext(); + ~WlanMgmtClientContext(); + + void setObject(CWlanMgmtClient *eapQtConfig); +public: + + void setRunProtectedSetup(const QString &ssid, int completionCode); + void appendResult( + const QString &ssid, + int securityMode, + int operatingMode, + int defaultWepKeyIndex, + const QString &wepKey1 = QString(), + const QString &wepKey2 = QString(), + const QString &wepKey3 = QString(), + const QString &wepKey4 = QString(), + const QString &wpaKey = QString()); + +private: + CWlanMgmtClient* mWlanMgmtClient; + +}; + +#endif /* WLANMGMTCLIENT_CONTEXT_H */ + +// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanmgmtclient_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Management API stubbing for WLAN Qt Utilities. +*/ + +#include + +#include +#include +#include +#include "wlanmgmtclient.h" +#include "testwlanwizardcontext.h" + +// --------------------------------------------------------- +// CWlanScanRequest::NewL +// --------------------------------------------------------- +// +CWlanMgmtClient* CWlanMgmtClient::NewL() + { + CWlanMgmtClient* self = new CWlanMgmtClient; + + TestWlanWizardContext::setWlanMgmtClientObject(self); + return self; + } + +// --------------------------------------------------------- +// CWlanScanRequest::~CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::~CWlanMgmtClient() + { + delete iResults; + } + +// --------------------------------------------------------- +// CWlanScanRequest::CWlanMgmtClient +// --------------------------------------------------------- +// +CWlanMgmtClient::CWlanMgmtClient() + { + iResults = new (ELeave) CArrayFixSeg (4); + } + +// --------------------------------------------------------- +// CWlanScanRequest::RunProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtClient::RunProtectedSetup( + TRequestStatus& aStatus, + const TWlanSsid& aSsid, + const TWlanWpsPin& aWpsPin, + CArrayFixSeg& aCredentials ) +{ + Q_UNUSED(aWpsPin); + QCOMPARE(aSsid, iSsid); + for (int i = 0 ; i < iResults->Count() ; ++i){ + aCredentials.AppendL(iResults->At(i)); + } + User::RequestComplete(&aStatus, iCompletionCode); +} + +// --------------------------------------------------------- +// CWlanScanRequest::CancelProtectedSetup +// --------------------------------------------------------- +// +void CWlanMgmtClient::CancelProtectedSetup() + { + // TODO + //User::RequestComplete(iStubRequestStatus, KErrCancel); + //iStubRequestStatus = 0; + } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef STUB_WLANQTUTILS_H +#define STUB_WLANQTUTILS_H + +#include +#include +#include +#include + +#include "wlanqtutilscommon.h" +#include "wlanqtutilsap.h" + +class WlanQtUtilsIap; +class WlanQtUtilsWlanIap; + +class WLANQTUTILITIESDLL_EXPORT WlanQtUtils : public QObject +{ + Q_OBJECT + friend class WlanQtUtilsContext; +public: + //! "None" IAP ID value (e.g. for "not found" cases) + static const int IapIdNone = -1; + + /*! + WLAN connection status. + Remember to update traces/trace.properties when modifying this enum. + */ + enum ConnStatus { + ConnStatusNone = 0, //!< Reserved. + ConnStatusConnecting, //!< Connecting. + ConnStatusConnected, //!< Connected. + ConnStatusDisconnected //!< Disconnected. + }; + + /*! + WLAN scan status + Remember to update traces/trace.properties when modifying this enum. + */ + enum ScanStatus { + ScanStatusOk = 0, //!< Scan succeeded. + ScanStatusCancelled, //!< Scan was cancelled. + ScanStatusError //!< Scan failed. + }; + + /*! + Internet Connectivity Test status. + Remember to update traces/trace.properties when modifying this enum. + */ + enum IctStatus { + IctPassed = 0, //!< Normal ICT passed. + IctHotspotPassed, //!< Hotspot ICT passed. + IctCancelled, //!< ICT was cancelled. + IctFailed //!< ICT failed. + }; + +public: + WlanQtUtils(); + + ~WlanQtUtils(); + + void availableWlanAps( QList > &wlanApList); + + int createIap(const WlanQtUtilsAp *wlanAp); + + bool updateIap(int iapId, const WlanQtUtilsAp *wlanAp); + + void deleteIap(int iapId); + + void connectIap(int iapId, bool runIct = false); + + int connectedWlanId(); + + void disconnectIap(int iapId); + + int activeIap(); + + void scanWlanAps(); + + void scanWlanDirect(const QString &ssid); + + void stopWlanScan(); + +signals: + + void wlanScanApReady(int scanStatus); + + void wlanScanDirectReady(int scanStatus); + + void wlanNetworkOpened(int iapId); + + void wlanNetworkClosed(int iapId, int reason); + + void ictResult(int iapId, int result); + +private: // Return values for all methods. + + void emitScanApsReady(); + + QList > mScanWlanAps; + QList > mScanWlanDirect; + QList > *mScanResult; + QString mScanWlanDirectSsid; + int mCreateWlanIapReturn; + bool mUpdateWlanIapReturn; + + int mWlanNetworkOpenedIapId; + int mWlanNetworkActiveIapId; + int mWlanNetworkClosedIapId; + int mWlanNetworkClosedReason; + + int mActiveWlanIapReturn; + + int mIctResultIapId; + WlanQtUtils::IctStatus mIctResultResults; + + bool mConnectionSuccess; + + QStringList mCalledMethods; + + WlanQtUtilsAp *mWlanAp; + + bool mEmitScanApReady; + + int mScanApStatus; + int mScanDirectStatus; +}; + +#endif /* WLANQTUTILS_H */ + +// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + + +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" + +WlanQtUtilsContext::WlanQtUtilsContext(WlanQtUtils *utils ) +: mUtils(utils) +{ + + +} + +WlanQtUtilsContext::~WlanQtUtilsContext() +{ + +} + +void WlanQtUtilsContext::setScanWlanApsResult( + QList > result ) +{ + mUtils->mScanWlanAps = result; +} + +void WlanQtUtilsContext::setScanWlanDirectResult( QString ssid, + QList > result ) +{ + mUtils->mScanWlanDirectSsid = ssid; + mUtils->mScanWlanDirect = result; +} + +void WlanQtUtilsContext::setCreateWlanIapResult(int iapId) +{ + mUtils->mCreateWlanIapReturn = iapId; + mUtils->mActiveWlanIapReturn = iapId; +} + +void WlanQtUtilsContext::setActiveWlanIapResult(int iapId) +{ + mUtils->mActiveWlanIapReturn = iapId; +} + +void WlanQtUtilsContext::setUpdateWlanIapResult(bool returnValue) +{ + mUtils->mUpdateWlanIapReturn = returnValue; +} + +void WlanQtUtilsContext::setConnectionSuccessed(bool value) +{ + mUtils->mConnectionSuccess = value; +} + +void WlanQtUtilsContext::setSignalWlanNetworkOpened(int iapId) +{ + mUtils->mWlanNetworkOpenedIapId = iapId; +} + +void WlanQtUtilsContext::setSignalWlanNetworkClosed(int iapId, int reason) +{ + mUtils->mWlanNetworkClosedIapId = iapId; + mUtils->mWlanNetworkClosedReason = reason; +} + +void WlanQtUtilsContext::setSignalIctResult(int iapId, WlanQtUtils::IctStatus result) +{ + mUtils->mIctResultIapId = iapId; + mUtils->mIctResultResults = result; +} + +void WlanQtUtilsContext::setScanApStatus(int status) +{ + mUtils->mScanApStatus = status; +} + +void WlanQtUtilsContext::setScanDirectStatus(int status) +{ + mUtils->mScanDirectStatus = status; +} + +void WlanQtUtilsContext::setImmediateApScanResult(bool immediate) +{ + mUtils->mEmitScanApReady = immediate; +} + +void WlanQtUtilsContext::emitScanApReady() +{ + mUtils->emitScanApsReady(); +} + +QStringList WlanQtUtilsContext::calledMethods() +{ + QStringList methods = mUtils->mCalledMethods; + mUtils->mCalledMethods.clear(); + return methods; +} + +bool WlanQtUtilsContext::verifyWlanIapSettings(WlanQtUtilsAp &ref) +{ + bool ret = true; + if (!mUtils->mWlanAp){ + qWarning("WlanQtUtilsContext::verifyWlanIapSettings: iap not created"); + ret = false; + } + + if (!(*(mUtils->mWlanAp) == ref)){ + qWarning("WlanQtUtilsContext::verifyWlanIapSettings: settings does not match"); + ret = false; + } + return ret; +} + +void WlanQtUtilsContext::emitWlanNetworkOpened(int iapId) +{ + emit mUtils->wlanNetworkOpened(iapId); +} + +void WlanQtUtilsContext::emitWlanNetworkClosed(int iapId, int reason) +{ + emit mUtils->wlanNetworkClosed(iapId, reason); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_context.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#ifndef WLANQTUTILS_CONTEXT_H +#define WLANQTUTILS_CONTEXT_H + +#include +#include + +#include "wlanqtutilscommon.h" +#include "wlanqtutils.h" + +class WlanQtUtilsWlanIap; +class WlanQtUtilsAp; + +class Q_DECL_EXPORT WlanQtUtilsContext: public QObject +{ + Q_OBJECT + +public: + WlanQtUtilsContext(WlanQtUtils *utils ); + ~WlanQtUtilsContext(); + +public: + void setScanWlanApsResult( QList > result ); + + void setScanWlanDirectResult( QString ssid, + QList > result ); + + void setCreateWlanIapResult(int iapId); + + void setActiveWlanIapResult(int iapId); + + void setUpdateWlanIapResult(bool returnValue); + + void setConnectionSuccessed(bool value); + + void setSignalWlanNetworkOpened(int iapId); + + void setSignalWlanNetworkClosed(int iapId, int reason); + + void setSignalIctResult(int iapId, WlanQtUtils::IctStatus result); + + void setImmediateApScanResult(bool immediate); + + void setScanApStatus(int status); + + void setScanDirectStatus(int status); + + void emitScanApReady(); + + QStringList calledMethods(); + + bool verifyWlanIapSettings(WlanQtUtilsAp &ref); + + void emitWlanNetworkOpened(int iapId); + void emitWlanNetworkClosed(int iapId, int reason); + +private: + WlanQtUtils* mUtils; +}; + +#endif /* WLANQTUTILS_CONTEXT_H */ + +// End of File diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutils_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#include "wlanqtutilsap.h" +#include "wlanqtutils.h" +#include + +WlanQtUtils::WlanQtUtils() : mWlanAp(NULL), mEmitScanApReady(true), +mScanApStatus(ScanStatusOk), mScanDirectStatus(ScanStatusOk) +{ + mWlanNetworkActiveIapId = -1; + mCalledMethods.append("WlanQtUtils"); +} + +WlanQtUtils::~WlanQtUtils() +{ + mCalledMethods.append("~WlanQtUtils"); + delete mWlanAp; +} + +void WlanQtUtils::availableWlanAps(QList > &wlanApList) +{ + wlanApList = *mScanResult; + mCalledMethods.append("availableWlanAps"); +} + +int WlanQtUtils::createIap(const WlanQtUtilsAp * wlanAp) +{ + mCalledMethods.append("createIap"); + delete mWlanAp; + mWlanAp = new WlanQtUtilsAp(*wlanAp); + return mCreateWlanIapReturn; +} + +bool WlanQtUtils::updateIap(int iapId, const WlanQtUtilsAp * wlanAp) +{ + mCalledMethods.append("updateIap"); + qDebug("updateWlanIap iapId = %d", iapId); + qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn); + delete mWlanAp; + mWlanAp = new WlanQtUtilsAp(*wlanAp); + QCOMPARE(iapId, mCreateWlanIapReturn); + return mUpdateWlanIapReturn; +} + +void WlanQtUtils::deleteIap(int iapId) +{ + mCalledMethods.append("deleteIap"); + QCOMPARE(iapId, mCreateWlanIapReturn); +} + +int WlanQtUtils::connectedWlanId() +{ + mCalledMethods.append("connectedWlanId"); + return mCreateWlanIapReturn; +} + +void WlanQtUtils::connectIap(int iapId, bool runIct) +{ + qDebug("connectIap iapId = %d", iapId); + qDebug("mCreateWlanIapReturn = %d", mCreateWlanIapReturn); + mCalledMethods.append("connectIap"); + QCOMPARE(iapId, mCreateWlanIapReturn); + QCOMPARE(runIct, true); + + if (mConnectionSuccess) { + mWlanNetworkActiveIapId = iapId; + emit wlanNetworkOpened(mWlanNetworkOpenedIapId); + emit ictResult(mIctResultIapId - 1, false); + emit ictResult(mIctResultIapId, mIctResultResults); + } else { + emit wlanNetworkClosed( + mWlanNetworkClosedIapId -1, + mWlanNetworkClosedReason ); + + emit wlanNetworkClosed( + mWlanNetworkClosedIapId, + mWlanNetworkClosedReason ); + } +} + +void WlanQtUtils::disconnectIap(int iapId) +{ + qDebug("disconnectIap iapId = %d", iapId); + qDebug("mActiveWlanIapReturn = %d", mActiveWlanIapReturn); + mCalledMethods.append("disconnectIap"); + QCOMPARE(iapId, mActiveWlanIapReturn); +} + +int WlanQtUtils::activeIap() +{ + mCalledMethods.append("activeIap"); + return mActiveWlanIapReturn; +} + +void WlanQtUtils::scanWlanAps() +{ + mCalledMethods.append("scanWlanAps"); + mScanResult = &mScanWlanAps; + + if(mEmitScanApReady) { + emit wlanScanApReady(mScanApStatus); + } +} + +void WlanQtUtils::scanWlanDirect(const QString &ssid) +{ + mCalledMethods.append("scanWlanDirect"); + QCOMPARE(ssid, mScanWlanDirectSsid); + mScanResult = &mScanWlanDirect; + + emit wlanScanDirectReady(mScanDirectStatus); +} + +void WlanQtUtils::stopWlanScan() +{ + mCalledMethods.append("stopWlanScan"); +} + +void WlanQtUtils::emitScanApsReady() +{ + emit wlanScanApReady(mScanApStatus); +} + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for WlanQtUtilsWlanAp class. +*/ + +#ifndef STUB_WLANQTUTILSWLANAP_H +#define STUB_WLANQTUTILSWLANAP_H + +#include +#include +#include +#include "cmmanagerdefines_shim.h" + +class QString; +class WlanQtUtilsApPrivate; + +/** + * This class represents WLAN access point (AP). + */ +class WlanQtUtilsAp : public QObject +{ +public: + + // Data types + + /*! + Configuration IDs that can be read and set in this class. + + ConfID's available for scan results: + - ConfIdSsid + - ConfIdBssid + - ConfIdSignalStrength + - ConfIdConnectionMode + - ConfIdSecurityMode + - ConfIdWpaPskUse + - ConfIdWpsSupported + + ConfID's for IAP creation and updates, these are + mandatory for all security modes: + - ConfIdSsid + - ConfIdConnectionMode + - ConfIdSecurityMode + - ConfIdWepKey1 (Empty if not used) + - ConfIdWepKey2 (Empty if not used) + - ConfIdWepKey3 (Empty if not used) + - ConfIdWepKey4 (Empty if not used) + - ConfIdWepDefaultIndex + - ConfIdWpaPskUse + - ConfIdWpaPsk (Empty if not used) + - ConfIdHidden + - ConfIdWlanScanSSID + */ + enum ConfId { + //! QString: WLAN Network Name (SSID) + ConfIdSsid = 0, + //! QByteArray: Basic Service Set Identifier + ConfIdBssid = 1, + //! int: signal strength in RSSI (dBm) + ConfIdSignalStrength = 2, + //! int: (CMManagerShim::WlanNetMode) + ConfIdConnectionMode = 3, + //! int: (CMManagerShim::WlanSecMode) + ConfIdSecurityMode = 4, + //! bool: true - WPA PSK, false - WPA EAP + ConfIdWpaPskUse = 5, + //! QString: Pre-Shared Key for WPA + //! Length: 8-63 - Ascii key + //! Length: 64 - Hex key + ConfIdWpaPsk = 6, + //! QString: WEP Key for index 1: + //! HEX: + //! - 64 bit: allowed key length = 10 + //! - 128 bit: allowed key length = 26 + //! + //! ASCII: + //! - 64 bit: allowed key length = 5 + //! - 128 bit: allowed key length = 13 + ConfIdWepKey1 = 7, + //! QString: WEP Key for index 2 + ConfIdWepKey2 = 8, + //! QString: WEP Key for index 3 + ConfIdWepKey3 = 9, + //! QString: WEP Key for index 4 + ConfIdWepKey4 = 10, + //! int: (CMManagerShim::WlanWepKeyIndex): Default WEP Key index + ConfIdWepDefaultIndex = 11, + //! bool: Is WLAN hidden (CMManagerShim::CmHidden). + ConfIdHidden = 12, + //! bool: Does WLAN AP need explicit scanning (CMManagerShim::WlanScanSSID) + ConfIdWlanScanSSID = 13, + //! bool: true - Wifi Protected setup is supported, false - not + ConfIdWpsSupported = 14 + }; + +public: + WlanQtUtilsAp(); + WlanQtUtilsAp(const WlanQtUtilsAp &ref); + ~WlanQtUtilsAp(); + QVariant value(int identifier) const; + void setValue(int identifier, QVariant value ); + bool operator==(const WlanQtUtilsAp & rhs ) const; + + static int compare( + const WlanQtUtilsAp *ap1, + const WlanQtUtilsAp *ap2); + +private: + WlanQtUtilsApPrivate *d_ptr; + +}; + +Q_DECLARE_METATYPE(WlanQtUtilsAp) + +#endif /* WLANQTUTILSWLANIAP_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap_stub.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilsap_stub.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This is the source file for WlanQtUtilsAp class. + */ + +#include +#include +#include +#include +#include "wlanqtutilscommon.h" +#include "wlanqtutilsap.h" + +class WlanQtUtilsApPrivate +{ + friend class WlanQtUtilsAp; + +private: + QHash mConfigurations; +}; + +WlanQtUtilsAp::WlanQtUtilsAp() : + d_ptr(new WlanQtUtilsApPrivate()) +{ +} + +WlanQtUtilsAp::WlanQtUtilsAp(const WlanQtUtilsAp &ref) : + d_ptr(new WlanQtUtilsApPrivate()) +{ + d_ptr->mConfigurations = ref.d_ptr->mConfigurations; +} + +WlanQtUtilsAp::~WlanQtUtilsAp() +{ + d_ptr->mConfigurations.clear(); + delete d_ptr; +} + +QVariant WlanQtUtilsAp::value(int identifier) const +{ + return d_ptr->mConfigurations[identifier]; +} + +void WlanQtUtilsAp::setValue(int identifier, QVariant value) +{ + d_ptr->mConfigurations[identifier] = value; +} + +bool WlanQtUtilsAp::operator==(const WlanQtUtilsAp & rhs ) const +{ + bool ret = true; + if (d_ptr->mConfigurations.size() != rhs.d_ptr->mConfigurations.size()) { + qWarning("WlanQtUtilsAp::operator==(): size: expect %d, actual %d ", + d_ptr->mConfigurations.size(), + rhs.d_ptr->mConfigurations.size() ); + ret = false; + } + QHashIterator i(d_ptr->mConfigurations); + + while (i.hasNext()) { + i.next(); + if (!rhs.d_ptr->mConfigurations.contains(i.key())){ + qWarning("WlanQtUtilsAp::operator==(): key not found: %d", i.key()); + ret = false; + + } + if (i.value() != rhs.d_ptr->mConfigurations[i.key()]){ + qWarning("WlanQtUtilsAp::operator==(): values not match %d", i.key()); + qDebug() << "Expect: " << i.value(); + qDebug() << "Actual: " << rhs.d_ptr->mConfigurations[i.key()]; + ret = false; + } + } + return ret; +} + +/*! + AP comparison function. + + @param [in] ap1 First AP to compare. + @param [in] ap2 Second AP to compare. + + @return Zero(0), if APs are considered to be same. +*/ + +int WlanQtUtilsAp::compare( + const WlanQtUtilsAp *ap1, + const WlanQtUtilsAp *ap2) +{ + int equal = 1; // Not equal + + // SSID (case sensitive) and security mode (with or without PSK) + // are the values, which identify a unique access point. + if (ap1->value(WlanQtUtilsAp::ConfIdSsid) == + ap2->value(WlanQtUtilsAp::ConfIdSsid) + && ap1->value(WlanQtUtilsAp::ConfIdSecurityMode) == + ap2->value(WlanQtUtilsAp::ConfIdSecurityMode) + && ap1->value(WlanQtUtilsAp::ConfIdWpaPskUse) == + ap2->value(WlanQtUtilsAp::ConfIdWpaPskUse)) { + equal = 0; // Equal + } + + return equal; +} + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilscommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/stubs/wlanqtutilscommon.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef STUB_WLANQTUTILSCOMMON_H +#define STUB_WLANQTUTILSCOMMON_H +/* +#ifdef BUILD_WLAN_QT_UTILS_STUBS +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT +#endif +*/ +#ifdef BUILD_WLANQTUTILITIES_DLL +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_EXPORT +#else +#define WLANQTUTILITIESDLL_EXPORT Q_DECL_IMPORT +#endif +// Maximum length of WLAN SSID (limit also for number of characters for user input) +static const int KMaxSsidLen = 32; +// Maximum length of WEP key +static const int KMaxWEPKeyLen = 64; +// Maximum length of WPA key +static const int KMaxWPAKeyLen = 256; + +/** + * Bearer type. + */ +enum WlanQtUtilsBearerType { + WlanQtUtilsBearerTypeNone = 0, ///< None of the bearer types. + WlanQtUtilsBearerTypeCellular , ///< Cellular (2G, 3G, 3.5G) bearer type. + WlanQtUtilsBearerTypeWlan ///< WLAN bearer type. +}; + +/** + * Connection status. + */ +enum WlanQtUtilsConnectionStatus { + WlanQtUtilsConnectionStatusNone = 0, ///< None of the connection statuses. + WlanQtUtilsConnectionStatusConnecting, ///< Connecting. + WlanQtUtilsConnectionStatusConnected, ///< Connected. + WlanQtUtilsConnectionStatusDisconnected ///< Disconnected. +}; + +/** + * Signal strength category boundaries in dB (absolute value). + * Smaller value means better signal. + */ +// TODO: WLAN signal level values valid are copied from 08wk41 Sniffer. OK? +// (WINS emulator gives just 0 which is equal to "Absolute max"...) +enum +{ + WlanQtUtilsWlanSignalStrengthAbsoluteMax = 0, ///< Absolute maximum signal strength. + WlanQtUtilsWlanSignalStrengthMax = 60, ///< Maximum signal strength. + WlanQtUtilsWlanSignalStrengthGood = 74, ///< Good signal strength. + WlanQtUtilsWlanSignalStrengthLow = 87, ///< signal strength. + WlanQtUtilsWlanSignalStrengthMin = 100, ///< Minimum signal strength. + WlanQtUtilsWlanSignalUnavailable = 9999, ///< Signal is unavailable. +}; + +/** WLAN signal is unknown. */ +const int WlanQtUtilsWlanSignalUnknown = 1000000; + +/** WLAN transmit power is unknown. */ +const unsigned WlanQtUtilsWlanTransmitPowerUnknown = 0xFFFFFFFF; + +#endif // WLANQTUTILSCOMMON_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/t_wlanwizard.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/t_wlanwizard.pro Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,153 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# WLAN Wizard unit testing Qt project file. +# + +include(stubs/stubs.pri) +include(ut/ut.pri) + +QT += testlib +CONFIG += hb qtestlib + +TEMPLATE = app +TARGET = t_wlanwizard + +DEPENDPATH += . +MOC_DIR = build +RCC_DIR = build + +VERSION = 0.0.1 + +DEFINES += BUILD_WLAN_WIZARD_DLL +DEFINES += BUILD_EAP_WIZARD_DLL +DEFINES += BUILD_WPS_WIZARD_DLL + +RESOURCES += ../resources/resource.qrc +RESOURCES += ../../eapwizard/resources/eapwizard_resource.qrc +RESOURCES += ../../wpswizard/resources/wpswizard_resource.qrc + +INCLUDEPATH += \ + stubs + +# Stub headers must be used instead of real ones +symbian { + MMP_RULES += "USERINCLUDE stubs" +} + +# Temporary solution to fix tracecompiler +# When tracecompiler is fixed, these can be removed +symbian: { + MMP_RULES += \ + "USERINCLUDE ../traces" \ + "USERINCLUDE ../../eapwizard/traces" \ + "USERINCLUDE ../../wpswizard/traces" +} + +# WLAN WIZARD HEADERS +HEADERS += \ + ../inc/wlanwizard.h \ + ../inc/wlanwizard_p.h \ + ../inc/wlanwizardscanlist.h \ + ../inc/wlanwizardpage.h \ + ../inc/wlanwizardhelper.h \ + ../inc/wlanwizardutils.h \ + ../inc/wlanwizardpageinternal.h \ + ../inc/wlanwizardpagekeyquery.h \ + ../inc/wlanwizardpageprocessingsettings.h \ + ../inc/wlanwizardpagesummary.h \ + ../inc/wlanwizardsummaryviewitem.h \ + ../inc/wlanwizardpagegenericerror.h \ + ../inc/wlanwizardpagenetworkmode.h \ + ../inc/wlanwizardpagescanning.h \ + ../inc/wlanwizardpagesecuritymode.h \ + ../inc/wlanwizardpagessid.h + +# WLAN WIZARD SOURCES +SOURCES += \ + ../src/wlanwizard.cpp \ + ../src/wlanwizard_p.cpp \ + ../src/wlanwizardscanlist.cpp \ + ../src/wlanwizardutils.cpp \ + ../src/wlanwizardpageinternal.cpp \ + ../src/wlanwizardpagekeyquery.cpp \ + ../src/wlanwizardpageprocessingsettings.cpp \ + ../src/wlanwizardpagesummary.cpp \ + ../src/wlanwizardsummaryviewitem.cpp \ + ../src/wlanwizardpagegenericerror.cpp \ + ../src/wlanwizardpagenetworkmode.cpp \ + ../src/wlanwizardpagescanning.cpp \ + ../src/wlanwizardpagesecuritymode.cpp \ + ../src/wlanwizardpagessid.cpp + +# EAP Wizard headers +HEADERS += \ + ../../eapwizard/inc/eapwizard.h \ + ../../eapwizard/inc/eapwizard_p.h \ + ../../eapwizard/inc/eapwizardpage.h \ + ../../eapwizard/inc/eapwizardpageoutertype.h \ + ../../eapwizard/inc/eapwizardpagecertca.h \ + ../../eapwizard/inc/eapwizardpagecertuser.h \ + ../../eapwizard/inc/eapwizardpageidentity.h \ + ../../eapwizard/inc/eapwizardpageinnertype.h \ + ../../eapwizard/inc/eapwizardpageusernamepassword.h \ + ../../eapwizard/inc/eapwizardpagenewpacstore.h \ + ../../eapwizard/inc/eapwizardpagepacstorepasswordconfirm.h + +# EAP Wizard sources +SOURCES += \ + ../../eapwizard/src/eapwizard.cpp \ + ../../eapwizard/src/eapwizard_p.cpp \ + ../../eapwizard/src/eapwizardpage.cpp \ + ../../eapwizard/src/eapwizardpageoutertype.cpp \ + ../../eapwizard/src/eapwizardpagecertca.cpp \ + ../../eapwizard/src/eapwizardpagecertuser.cpp \ + ../../eapwizard/src/eapwizardpageidentity.cpp \ + ../../eapwizard/src/eapwizardpageinnertype.cpp \ + ../../eapwizard/src/eapwizardpageusernamepassword.cpp \ + ../../eapwizard/src/eapwizardpagenewpacstore.cpp \ + ../../eapwizard/src/eapwizardpagepacstorepasswordconfirm.cpp + +# WPS Wizard sources +HEADERS += \ + ../../wpswizard/inc/wpswizard.h \ + ../../wpswizard/inc/wpswizard_p.h \ + ../../wpswizard/inc/wpswizardpage.h \ + ../../wpswizard/inc/wpswizardsteptwo.h \ + ../../wpswizard/inc/wpswizardstepthreebutton.h \ + ../../wpswizard/inc/wpswizardstepthreenumber.h \ + ../../wpswizard/inc/wpswizardstepfour.h \ + ../../wpswizard/inc/wpswizardstepfour_p.h \ + ../../wpswizard/inc/wpswizardstepfive.h \ + ../../wpswizard/inc/cwpsactiverunner.h \ + ../../wpswizard/inc/mwpsactiverunnercallback.h \ + +SOURCES += \ + ../../wpswizard/src/wpswizard.cpp \ + ../../wpswizard/src/wpswizard_p.cpp \ + ../../wpswizard/src/wpswizardpage.cpp \ + ../../wpswizard/src/wpswizardsteptwo.cpp \ + ../../wpswizard/src/wpswizardstepthreebutton.cpp \ + ../../wpswizard/src/wpswizardstepthreenumber.cpp \ + ../../wpswizard/src/wpswizardstepfour.cpp \ + ../../wpswizard/src/wpswizardstepfour_p.cpp \ + ../../wpswizard/src/wpswizardstepfive.cpp \ + ../../wpswizard/src/cwpsactiverunner.cpp + +LIBS += -leapqtplugininfo + +symbian: { + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/hbautotest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/hbautotest.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,835 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "hbautotest.h" +#include +#include + + +const qreal STEP = 4; //How many pixels to drag before sending an event + +//Init static members +bool HbAutoTest::pointerPressed = false; +QPointF HbAutoTest::pressPoint = QPointF(); + +void HbAutoTest::mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + if (pointerPressed) { + //Now we should drag an item + drag(window, targetPoint); + HbAutoTestMouseEvent me ( + QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton, + Qt::NoButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + QTest::qWait(1); + } else { + HbAutoTestMouseEvent me ( + QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton, + Qt::NoButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + QTest::qWait(1); + + } + QTest::qWait(1); + QTest::qWait(1); +} + +void HbAutoTest::mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + pointerPressed=true; + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + + pressPoint=targetPoint; + + HbAutoTestMouseEvent me ( + QEvent::MouseButtonPress, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::LeftButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + QCoreApplication::sendPostedEvents(); + QTest::qWait(1); +} + +void HbAutoTest::mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + pointerPressed=false; + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + pressPoint=QPointF(); + HbAutoTestMouseEvent me ( + QEvent::MouseButtonRelease, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::NoButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + + QTest::qWait(1); + QTest::qWait(1); +} + +void HbAutoTest::mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos, int delay) +{ + if (delay!=-1) { + QTest::qWait(delay); + } + QPointF targetPoint=QPointF(); + if (pos==QPointF()) { + targetPoint = middlePointOfWidget(widget); + } else { + targetPoint = widget->mapToScene(pos); + } + + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + + HbAutoTestMouseEvent me ( + QEvent::MouseButtonPress, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::LeftButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + //QTime currentTime = QTime::currentTime(); + //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button down"; + QTest::qWait(1); + + if (delay!=-1) { + QTest::qWait(delay); + } + HbAutoTestMouseEvent me2 ( + QEvent::MouseButtonRelease, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::LeftButton, + Qt::NoButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me2); + qApp->notify((window->viewport()), &me2); + QCoreApplication::sendPostedEvents(); + //currentTime = QTime::currentTime(); + //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button up"; + + QTest::qWait(1); + QTest::qWait(1); +} + +QPointF HbAutoTest::middlePointOfWidget( const HbWidget* widget) +{ + QRectF widgetRect = widget->rect(); + QRectF widgetSceneRect = widget->mapRectToScene(widgetRect); + qreal middleX = ((widgetSceneRect.right() - widgetSceneRect.left())/2)+widgetSceneRect.left(); + qreal middleY = ((widgetSceneRect.bottom() - widgetSceneRect.top())/2)+widgetSceneRect.top(); + return QPointF(middleX,middleY); +} + + + +void HbAutoTest::drag(HbAutoTestMainWindow *window, QPointF targetPoint) +{ + qreal tempX = targetPoint.x() - pressPoint.x(); + qreal tempY = targetPoint.y() - pressPoint.y(); + qreal totalTrip = sqrt ((tempX * tempX) + (tempY * tempY)); + + int numberOfSteps = qRound(totalTrip / STEP); + HbAutoTestMouseEvent me ( + QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton , + Qt::LeftButton, + Qt::NoModifier); + + QPointF nextPanPoint=pressPoint; + for (int i=1; imapToGlobal(nextPanPoint.toPoint())); + + me = HbAutoTestMouseEvent (QEvent::MouseMove, + nextPanPoint.toPoint(), + window->viewport()->mapToGlobal(nextPanPoint.toPoint()), + Qt::NoButton, + Qt::LeftButton, + Qt::NoModifier); + + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); + } + + QCursor::setPos(window->mapToGlobal(targetPoint.toPoint())); + + //One more (or the only one) step to the target + me = HbAutoTestMouseEvent (QEvent::MouseMove, + targetPoint.toPoint(), + window->viewport()->mapToGlobal(targetPoint.toPoint()), + Qt::NoButton, + Qt::LeftButton, + Qt::NoModifier); + QSpontaneKeyEvent::setSpontaneous(&me); + qApp->notify((window->viewport()), &me); + QCoreApplication::sendPostedEvents(); +} + + +void HbAutoTest::simulateEvent(QWidget *widget, bool press, int code, + Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + extern int Q_TESTLIB_EXPORT defaultKeyDelay(); + + if (delay == -1 || delay < 10) // defaultKeyDelay()) + delay = 10; //defaultKeyDelay(); + if(delay > 0) + QTest::qWait(delay); +// Q_UNUSED(delay); +// QTest::qWait(10); //TODO: Remove this and reveal above out-commented code + + HbAutoTestKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat); + QSpontaneKeyEvent::setSpontaneous(&a); + if (!qApp->notify(widget, &a)) + QTest::qWarn("Keyboard event not accepted by receiving widget"); + } + +void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + QString text, Qt::KeyboardModifiers modifier, int delay) + { + QTEST_ASSERT(qApp); + + if (!widget) + widget = QWidget::keyboardGrabber(); + if (!widget) { + if (QWidget *apw = QApplication::activePopupWidget()) + widget = apw->focusWidget() ? apw->focusWidget() : apw; + else + widget = QApplication::focusWidget(); + } + if (!widget) + widget = QApplication::activeWindow(); + + QTEST_ASSERT(widget); + + if (action == QTest::Click) { + QPointer ptr(widget); + sendKeyEvent(QTest::Press, widget, code, text, modifier, delay); + if (!ptr) { + // if we send key-events to embedded widgets, they might be destroyed + // when the user presses Return + return; + } + sendKeyEvent(QTest::Release, widget, code, text, modifier, delay); + return; + } + + bool repeat = false; + + if (action == QTest::Press) { + if (modifier & Qt::ShiftModifier) + simulateEvent(widget, true, Qt::Key_Shift, 0, QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(widget, true, Qt::Key_Control, modifier & Qt::ShiftModifier, QString(), false, delay); + + if (modifier & Qt::AltModifier) + simulateEvent(widget, true, Qt::Key_Alt, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + if (modifier & Qt::MetaModifier) + simulateEvent(widget, true, Qt::Key_Meta, modifier & (Qt::ShiftModifier + | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + simulateEvent(widget, true, code, modifier, text, repeat, delay); + } else if (action == QTest::Release) { + simulateEvent(widget, false, code, modifier, text, repeat, delay); + + if (modifier & Qt::MetaModifier) + simulateEvent(widget, false, Qt::Key_Meta, modifier, QString(), false, delay); + if (modifier & Qt::AltModifier) + simulateEvent(widget, false, Qt::Key_Alt, modifier & + (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier), QString(), false, delay); + + if (modifier & Qt::ControlModifier) + simulateEvent(widget, false, Qt::Key_Control, + modifier & (Qt::ShiftModifier | Qt::ControlModifier), QString(), false, delay); + + if (modifier & Qt::ShiftModifier) + simulateEvent(widget, false, Qt::Key_Shift, modifier & Qt::ShiftModifier, QString(), false, delay); + } + } + +void HbAutoTest::sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + char ascii, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + QString text; + if (ascii) + text = QString(QChar::fromLatin1(ascii)); + sendKeyEvent(action, widget, code, text, modifier, delay); + } + +void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, char ascii, + Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + sendKeyEvent(action, widget, asciiToKey(ascii), ascii, modifier, delay); + } + +void HbAutoTest::keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key, + Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + sendKeyEvent(action, widget, key, keyToAscii(key), modifier, delay); + } + +void HbAutoTest::keyClicks(QWidget *widget, const QString &sequence, + Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + for (int i=0; i < sequence.length(); i++) + keyEvent(QTest::Click, widget, sequence.at(i).toLatin1(), modifier, delay); + } + +void HbAutoTest::keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Press, widget, key, modifier, delay); + } + +void HbAutoTest::keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Release, widget, key, modifier, delay); + } + +void HbAutoTest::keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Click, widget, key, modifier, delay); + } + +void HbAutoTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Press, widget, key, modifier, delay); + } + +void HbAutoTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Release, widget, key, modifier, delay); } + +void HbAutoTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier, int delay) + { + Q_ASSERT_X(dynamic_cast(( widget) ) != 0, "HbAutoTest", "Always use with HbAutoTestMainWindow"); + keyEvent(QTest::Click, widget, key, modifier, delay); + } + +Qt::Key HbAutoTest::asciiToKey(char ascii) +{ + switch ((unsigned char)ascii) { + case 0x08: return Qt::Key_Backspace; + case 0x09: return Qt::Key_Tab; + case 0x0b: return Qt::Key_Backtab; + case 0x0d: return Qt::Key_Return; + case 0x1b: return Qt::Key_Escape; + case 0x20: return Qt::Key_Space; + case 0x21: return Qt::Key_Exclam; + case 0x22: return Qt::Key_QuoteDbl; + case 0x23: return Qt::Key_NumberSign; + case 0x24: return Qt::Key_Dollar; + case 0x25: return Qt::Key_Percent; + case 0x26: return Qt::Key_Ampersand; + case 0x27: return Qt::Key_Apostrophe; + case 0x28: return Qt::Key_ParenLeft; + case 0x29: return Qt::Key_ParenRight; + case 0x2a: return Qt::Key_Asterisk; + case 0x2b: return Qt::Key_Plus; + case 0x2c: return Qt::Key_Comma; + case 0x2d: return Qt::Key_Minus; + case 0x2e: return Qt::Key_Period; + case 0x2f: return Qt::Key_Slash; + case 0x30: return Qt::Key_0; + case 0x31: return Qt::Key_1; + case 0x32: return Qt::Key_2; + case 0x33: return Qt::Key_3; + case 0x34: return Qt::Key_4; + case 0x35: return Qt::Key_5; + case 0x36: return Qt::Key_6; + case 0x37: return Qt::Key_7; + case 0x38: return Qt::Key_8; + case 0x39: return Qt::Key_9; + case 0x3a: return Qt::Key_Colon; + case 0x3b: return Qt::Key_Semicolon; + case 0x3c: return Qt::Key_Less; + case 0x3d: return Qt::Key_Equal; + case 0x3e: return Qt::Key_Greater; + case 0x3f: return Qt::Key_Question; + case 0x40: return Qt::Key_At; + case 0x41: return Qt::Key_A; + case 0x42: return Qt::Key_B; + case 0x43: return Qt::Key_C; + case 0x44: return Qt::Key_D; + case 0x45: return Qt::Key_E; + case 0x46: return Qt::Key_F; + case 0x47: return Qt::Key_G; + case 0x48: return Qt::Key_H; + case 0x49: return Qt::Key_I; + case 0x4a: return Qt::Key_J; + case 0x4b: return Qt::Key_K; + case 0x4c: return Qt::Key_L; + case 0x4d: return Qt::Key_M; + case 0x4e: return Qt::Key_N; + case 0x4f: return Qt::Key_O; + case 0x50: return Qt::Key_P; + case 0x51: return Qt::Key_Q; + case 0x52: return Qt::Key_R; + case 0x53: return Qt::Key_S; + case 0x54: return Qt::Key_T; + case 0x55: return Qt::Key_U; + case 0x56: return Qt::Key_V; + case 0x57: return Qt::Key_W; + case 0x58: return Qt::Key_X; + case 0x59: return Qt::Key_Y; + case 0x5a: return Qt::Key_Z; + case 0x5b: return Qt::Key_BracketLeft; + case 0x5c: return Qt::Key_Backslash; + case 0x5d: return Qt::Key_BracketRight; + case 0x5e: return Qt::Key_AsciiCircum; + case 0x5f: return Qt::Key_Underscore; + case 0x60: return Qt::Key_QuoteLeft; + case 0x61: return Qt::Key_A; + case 0x62: return Qt::Key_B; + case 0x63: return Qt::Key_C; + case 0x64: return Qt::Key_D; + case 0x65: return Qt::Key_E; + case 0x66: return Qt::Key_F; + case 0x67: return Qt::Key_G; + case 0x68: return Qt::Key_H; + case 0x69: return Qt::Key_I; + case 0x6a: return Qt::Key_J; + case 0x6b: return Qt::Key_K; + case 0x6c: return Qt::Key_L; + case 0x6d: return Qt::Key_M; + case 0x6e: return Qt::Key_N; + case 0x6f: return Qt::Key_O; + case 0x70: return Qt::Key_P; + case 0x71: return Qt::Key_Q; + case 0x72: return Qt::Key_R; + case 0x73: return Qt::Key_S; + case 0x74: return Qt::Key_T; + case 0x75: return Qt::Key_U; + case 0x76: return Qt::Key_V; + case 0x77: return Qt::Key_W; + case 0x78: return Qt::Key_X; + case 0x79: return Qt::Key_Y; + case 0x7a: return Qt::Key_Z; + case 0x7b: return Qt::Key_BraceLeft; + case 0x7c: return Qt::Key_Bar; + case 0x7d: return Qt::Key_BraceRight; + case 0x7e: return Qt::Key_AsciiTilde; + + // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06 + case 0xa0: return Qt::Key_nobreakspace; + case 0xa1: return Qt::Key_exclamdown; + case 0xa2: return Qt::Key_cent; + case 0xa3: return Qt::Key_sterling; + case 0xa4: return Qt::Key_currency; + case 0xa5: return Qt::Key_yen; + case 0xa6: return Qt::Key_brokenbar; + case 0xa7: return Qt::Key_section; + case 0xa8: return Qt::Key_diaeresis; + case 0xa9: return Qt::Key_copyright; + case 0xaa: return Qt::Key_ordfeminine; + case 0xab: return Qt::Key_guillemotleft; + case 0xac: return Qt::Key_notsign; + case 0xad: return Qt::Key_hyphen; + case 0xae: return Qt::Key_registered; + case 0xaf: return Qt::Key_macron; + case 0xb0: return Qt::Key_degree; + case 0xb1: return Qt::Key_plusminus; + case 0xb2: return Qt::Key_twosuperior; + case 0xb3: return Qt::Key_threesuperior; + case 0xb4: return Qt::Key_acute; + case 0xb5: return Qt::Key_mu; + case 0xb6: return Qt::Key_paragraph; + case 0xb7: return Qt::Key_periodcentered; + case 0xb8: return Qt::Key_cedilla; + case 0xb9: return Qt::Key_onesuperior; + case 0xba: return Qt::Key_masculine; + case 0xbb: return Qt::Key_guillemotright; + case 0xbc: return Qt::Key_onequarter; + case 0xbd: return Qt::Key_onehalf; + case 0xbe: return Qt::Key_threequarters; + case 0xbf: return Qt::Key_questiondown; + case 0xc0: return Qt::Key_Agrave; + case 0xc1: return Qt::Key_Aacute; + case 0xc2: return Qt::Key_Acircumflex; + case 0xc3: return Qt::Key_Atilde; + case 0xc4: return Qt::Key_Adiaeresis; + case 0xc5: return Qt::Key_Aring; + case 0xc6: return Qt::Key_AE; + case 0xc7: return Qt::Key_Ccedilla; + case 0xc8: return Qt::Key_Egrave; + case 0xc9: return Qt::Key_Eacute; + case 0xca: return Qt::Key_Ecircumflex; + case 0xcb: return Qt::Key_Ediaeresis; + case 0xcc: return Qt::Key_Igrave; + case 0xcd: return Qt::Key_Iacute; + case 0xce: return Qt::Key_Icircumflex; + case 0xcf: return Qt::Key_Idiaeresis; + case 0xd0: return Qt::Key_ETH; + case 0xd1: return Qt::Key_Ntilde; + case 0xd2: return Qt::Key_Ograve; + case 0xd3: return Qt::Key_Oacute; + case 0xd4: return Qt::Key_Ocircumflex; + case 0xd5: return Qt::Key_Otilde; + case 0xd6: return Qt::Key_Odiaeresis; + case 0xd7: return Qt::Key_multiply; + case 0xd8: return Qt::Key_Ooblique; + case 0xd9: return Qt::Key_Ugrave; + case 0xda: return Qt::Key_Uacute; + case 0xdb: return Qt::Key_Ucircumflex; + case 0xdc: return Qt::Key_Udiaeresis; + case 0xdd: return Qt::Key_Yacute; + case 0xde: return Qt::Key_THORN; + case 0xdf: return Qt::Key_ssharp; + case 0xe5: return Qt::Key_Aring; + case 0xe6: return Qt::Key_AE; + case 0xf7: return Qt::Key_division; + case 0xf8: return Qt::Key_Ooblique; + case 0xff: return Qt::Key_ydiaeresis; + default: QTEST_ASSERT(false); return Qt::Key(0); + } +} + +char HbAutoTest::keyToAscii(Qt::Key key) +{ + switch (key) { + case Qt::Key_Backspace: return 0x8; //BS + case Qt::Key_Tab: return 0x09; // HT + case Qt::Key_Backtab: return 0x0b; // VT + case Qt::Key_Enter: + case Qt::Key_Return: return 0x0d; // CR + case Qt::Key_Escape: return 0x1b; // ESC + case Qt::Key_Space: return 0x20; // 7 bit printable ASCII + case Qt::Key_Exclam: return 0x21; + case Qt::Key_QuoteDbl: return 0x22; + case Qt::Key_NumberSign: return 0x23; + case Qt::Key_Dollar: return 0x24; + case Qt::Key_Percent: return 0x25; + case Qt::Key_Ampersand: return 0x26; + case Qt::Key_Apostrophe: return 0x27; + case Qt::Key_ParenLeft: return 0x28; + case Qt::Key_ParenRight: return 0x29; + case Qt::Key_Asterisk: return 0x2a; + case Qt::Key_Plus: return 0x2b; + case Qt::Key_Comma: return 0x2c; + case Qt::Key_Minus: return 0x2d; + case Qt::Key_Period: return 0x2e; + case Qt::Key_Slash: return 0x2f; + case Qt::Key_0: return 0x30; + case Qt::Key_1: return 0x31; + case Qt::Key_2: return 0x32; + case Qt::Key_3: return 0x33; + case Qt::Key_4: return 0x34; + case Qt::Key_5: return 0x35; + case Qt::Key_6: return 0x36; + case Qt::Key_7: return 0x37; + case Qt::Key_8: return 0x38; + case Qt::Key_9: return 0x39; + case Qt::Key_Colon: return 0x3a; + case Qt::Key_Semicolon: return 0x3b; + case Qt::Key_Less: return 0x3c; + case Qt::Key_Equal: return 0x3d; + case Qt::Key_Greater: return 0x3e; + case Qt::Key_Question: return 0x3f; + case Qt::Key_At: return 0x40; + case Qt::Key_A: return 0x61; // 0x41 == 'A', 0x61 == 'a' + case Qt::Key_B: return 0x62; + case Qt::Key_C: return 0x63; + case Qt::Key_D: return 0x64; + case Qt::Key_E: return 0x65; + case Qt::Key_F: return 0x66; + case Qt::Key_G: return 0x67; + case Qt::Key_H: return 0x68; + case Qt::Key_I: return 0x69; + case Qt::Key_J: return 0x6a; + case Qt::Key_K: return 0x6b; + case Qt::Key_L: return 0x6c; + case Qt::Key_M: return 0x6d; + case Qt::Key_N: return 0x6e; + case Qt::Key_O: return 0x6f; + case Qt::Key_P: return 0x70; + case Qt::Key_Q: return 0x71; + case Qt::Key_R: return 0x72; + case Qt::Key_S: return 0x73; + case Qt::Key_T: return 0x74; + case Qt::Key_U: return 0x75; + case Qt::Key_V: return 0x76; + case Qt::Key_W: return 0x77; + case Qt::Key_X: return 0x78; + case Qt::Key_Y: return 0x79; + case Qt::Key_Z: return 0x7a; + case Qt::Key_BracketLeft: return 0x5b; + case Qt::Key_Backslash: return 0x5c; + case Qt::Key_BracketRight: return 0x5d; + case Qt::Key_AsciiCircum: return 0x5e; + case Qt::Key_Underscore: return 0x5f; + case Qt::Key_QuoteLeft: return 0x60; + + case Qt::Key_BraceLeft: return 0x7b; + case Qt::Key_Bar: return 0x7c; + case Qt::Key_BraceRight: return 0x7d; + case Qt::Key_AsciiTilde: return 0x7e; + + case Qt::Key_Delete: return 0; + case Qt::Key_Insert: return 0; // = 0x1006, + case Qt::Key_Pause: return 0; // = 0x1008, + case Qt::Key_Print: return 0; // = 0x1009, + case Qt::Key_SysReq: return 0; // = 0x100a, + + case Qt::Key_Clear: return 0; // = 0x100b, + + case Qt::Key_Home: return 0; // = 0x1010, // cursor movement + case Qt::Key_End: return 0; // = 0x1011, + case Qt::Key_Left: return 0; // = 0x1012, + case Qt::Key_Up: return 0; // = 0x1013, + case Qt::Key_Right: return 0; // = 0x1014, + case Qt::Key_Down: return 0; // = 0x1015, + case Qt::Key_PageUp: return 0; // = 0x1016, + case Qt::Key_PageDown: return 0; // = 0x1017, + case Qt::Key_Shift: return 0; // = 0x1020, // modifiers + case Qt::Key_Control: return 0; // = 0x1021, + case Qt::Key_Meta: return 0; // = 0x1022, + case Qt::Key_Alt: return 0; // = 0x1023, + case Qt::Key_CapsLock: return 0; // = 0x1024, + case Qt::Key_NumLock: return 0; // = 0x1025, + case Qt::Key_ScrollLock: return 0; // = 0x1026, + case Qt::Key_F1: return 0; // = 0x1030, // function keys + case Qt::Key_F2: return 0; // = 0x1031, + case Qt::Key_F3: return 0; // = 0x1032, + case Qt::Key_F4: return 0; // = 0x1033, + case Qt::Key_F5: return 0; // = 0x1034, + case Qt::Key_F6: return 0; // = 0x1035, + case Qt::Key_F7: return 0; // = 0x1036, + case Qt::Key_F8: return 0; // = 0x1037, + case Qt::Key_F9: return 0; // = 0x1038, + case Qt::Key_F10: return 0; // = 0x1039, + case Qt::Key_F11: return 0; // = 0x103a, + case Qt::Key_F12: return 0; // = 0x103b, + case Qt::Key_F13: return 0; // = 0x103c, + case Qt::Key_F14: return 0; // = 0x103d, + case Qt::Key_F15: return 0; // = 0x103e, + case Qt::Key_F16: return 0; // = 0x103f, + case Qt::Key_F17: return 0; // = 0x1040, + case Qt::Key_F18: return 0; // = 0x1041, + case Qt::Key_F19: return 0; // = 0x1042, + case Qt::Key_F20: return 0; // = 0x1043, + case Qt::Key_F21: return 0; // = 0x1044, + case Qt::Key_F22: return 0; // = 0x1045, + case Qt::Key_F23: return 0; // = 0x1046, + case Qt::Key_F24: return 0; // = 0x1047, + case Qt::Key_F25: return 0; // = 0x1048, // F25 .. F35 only on X11 + case Qt::Key_F26: return 0; // = 0x1049, + case Qt::Key_F27: return 0; // = 0x104a, + case Qt::Key_F28: return 0; // = 0x104b, + case Qt::Key_F29: return 0; // = 0x104c, + case Qt::Key_F30: return 0; // = 0x104d, + case Qt::Key_F31: return 0; // = 0x104e, + case Qt::Key_F32: return 0; // = 0x104f, + case Qt::Key_F33: return 0; // = 0x1050, + case Qt::Key_F34: return 0; // = 0x1051, + case Qt::Key_F35: return 0; // = 0x1052, + case Qt::Key_Super_L: return 0; // = 0x1053, // extra keys + case Qt::Key_Super_R: return 0; // = 0x1054, + case Qt::Key_Menu: return 0; // = 0x1055, + case Qt::Key_Hyper_L: return 0; // = 0x1056, + case Qt::Key_Hyper_R: return 0; // = 0x1057, + case Qt::Key_Help: return 0; // = 0x1058, + case Qt::Key_Direction_L: return 0; // = 0x1059, + case Qt::Key_Direction_R: return 0; // = 0x1060, + + // Latin 1 codes adapted from X: keysymdef.h,v 1.21 94/08/28 16:17:06 + case Qt::Key_nobreakspace: return char(0xa0); + case Qt::Key_exclamdown: return char(0xa1); + case Qt::Key_cent: return char(0xa2); + case Qt::Key_sterling: return char(0xa3); + case Qt::Key_currency: return char(0xa4); + case Qt::Key_yen: return char(0xa5); + case Qt::Key_brokenbar: return char(0xa6); + case Qt::Key_section: return char(0xa7); + case Qt::Key_diaeresis: return char(0xa8); + case Qt::Key_copyright: return char(0xa9); + case Qt::Key_ordfeminine: return char(0xaa); + case Qt::Key_guillemotleft: return char(0xab); // left angle quotation mar + case Qt::Key_notsign: return char(0xac); + case Qt::Key_hyphen: return char(0xad); + case Qt::Key_registered: return char(0xae); + case Qt::Key_macron: return char(0xaf); + case Qt::Key_degree: return char(0xb0); + case Qt::Key_plusminus: return char(0xb1); + case Qt::Key_twosuperior: return char(0xb2); + case Qt::Key_threesuperior: return char(0xb3); + case Qt::Key_acute: return char(0xb4); + case Qt::Key_mu: return char(0xb5); + case Qt::Key_paragraph: return char(0xb6); + case Qt::Key_periodcentered: return char(0xb7); + case Qt::Key_cedilla: return char(0xb8); + case Qt::Key_onesuperior: return char(0xb9); + case Qt::Key_masculine: return char(0xba); + case Qt::Key_guillemotright: return char(0xbb); // right angle quotation mar + case Qt::Key_onequarter: return char(0xbc); + case Qt::Key_onehalf: return char(0xbd); + case Qt::Key_threequarters: return char(0xbe); + case Qt::Key_questiondown: return char(0xbf); + case Qt::Key_Agrave: return char(0xc0); + case Qt::Key_Aacute: return char(0xc1); + case Qt::Key_Acircumflex: return char(0xc2); + case Qt::Key_Atilde: return char(0xc3); + case Qt::Key_Adiaeresis: return char(0xc4); + case Qt::Key_Aring: return char(0xe5); + case Qt::Key_AE: return char(0xe6); + case Qt::Key_Ccedilla: return char(0xc7); + case Qt::Key_Egrave: return char(0xc8); + case Qt::Key_Eacute: return char(0xc9); + case Qt::Key_Ecircumflex: return char(0xca); + case Qt::Key_Ediaeresis: return char(0xcb); + case Qt::Key_Igrave: return char(0xcc); + case Qt::Key_Iacute: return char(0xcd); + case Qt::Key_Icircumflex: return char(0xce); + case Qt::Key_Idiaeresis: return char(0xcf); + case Qt::Key_ETH: return char(0xd0); + case Qt::Key_Ntilde: return char(0xd1); + case Qt::Key_Ograve: return char(0xd2); + case Qt::Key_Oacute: return char(0xd3); + case Qt::Key_Ocircumflex: return char(0xd4); + case Qt::Key_Otilde: return char(0xd5); + case Qt::Key_Odiaeresis: return char(0xd6); + case Qt::Key_multiply: return char(0xd7); + case Qt::Key_Ooblique: return char(0xf8); + case Qt::Key_Ugrave: return char(0xd9); + case Qt::Key_Uacute: return char(0xda); + case Qt::Key_Ucircumflex: return char(0xdb); + case Qt::Key_Udiaeresis: return char(0xdc); + case Qt::Key_Yacute: return char(0xdd); + case Qt::Key_THORN: return char(0xde); + case Qt::Key_ssharp: return char(0xdf); + case Qt::Key_division: return char(0xf7); + case Qt::Key_ydiaeresis: return char(0xff); + + // multimedia/internet keys - ignored by default - see QKeyEvent c'tor + + case Qt::Key_Back : return 0; // = 0x1061, + case Qt::Key_Forward : return 0; // = 0x1062, + case Qt::Key_Stop : return 0; // = 0x1063, + case Qt::Key_Refresh : return 0; // = 0x1064, + + case Qt::Key_VolumeDown: return 0; // = 0x1070, + case Qt::Key_VolumeMute : return 0; // = 0x1071, + case Qt::Key_VolumeUp: return 0; // = 0x1072, + case Qt::Key_BassBoost: return 0; // = 0x1073, + case Qt::Key_BassUp: return 0; // = 0x1074, + case Qt::Key_BassDown: return 0; // = 0x1075, + case Qt::Key_TrebleUp: return 0; // = 0x1076, + case Qt::Key_TrebleDown: return 0; // = 0x1077, + + case Qt::Key_MediaPlay : return 0; // = 0x1080, + case Qt::Key_MediaStop : return 0; // = 0x1081, + case Qt::Key_MediaPrevious : return 0; // = 0x1082, + case Qt::Key_MediaNext : return 0; // = 0x1083, + case Qt::Key_MediaRecord: return 0; // = 0x1084, + + case Qt::Key_HomePage : return 0; // = 0x1090, + case Qt::Key_Favorites : return 0; // = 0x1091, + case Qt::Key_Search : return 0; // = 0x1092, + case Qt::Key_Standby: return 0; // = 0x1093, + case Qt::Key_OpenUrl: return 0; // = 0x1094, + + case Qt::Key_LaunchMail : return 0; // = 0x10a0, + case Qt::Key_LaunchMedia: return 0; // = 0x10a1, + case Qt::Key_Launch0 : return 0; // = 0x10a2, + case Qt::Key_Launch1 : return 0; // = 0x10a3, + case Qt::Key_Launch2 : return 0; // = 0x10a4, + case Qt::Key_Launch3 : return 0; // = 0x10a5, + case Qt::Key_Launch4 : return 0; // = 0x10a6, + case Qt::Key_Launch5 : return 0; // = 0x10a7, + case Qt::Key_Launch6 : return 0; // = 0x10a8, + case Qt::Key_Launch7 : return 0; // = 0x10a9, + case Qt::Key_Launch8 : return 0; // = 0x10aa, + case Qt::Key_Launch9 : return 0; // = 0x10ab, + case Qt::Key_LaunchA : return 0; // = 0x10ac, + case Qt::Key_LaunchB : return 0; // = 0x10ad, + case Qt::Key_LaunchC : return 0; // = 0x10ae, + case Qt::Key_LaunchD : return 0; // = 0x10af, + case Qt::Key_LaunchE : return 0; // = 0x10b0, + case Qt::Key_LaunchF : return 0; // = 0x10b1, + + default: QTEST_ASSERT(false); return 0; + } +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/hbautotest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/hbautotest.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef HBAUTOTEST_H +#define HBAUTOTEST_H + +#include +#include +#include + +class HbMainWindow; +class HbWidget; +class HbAutoTestMainWindow; +class HbAutoTest; +class HbAutoTestMouseEvent; +/* +INSTRUCTIONS: +The class HbAutoTest is meant to be used with Orbit applications auto testing instead of GUI testing APIs of QTestLib. + +The functions of this class is to used similarily to the related QTestLib functions. + +Use HbAutoTestMainWindow (defined below) instead of HbMainWindow to enble filtering. +Filterin filters out UI events that are not sent by function defined in HbAutoTest class. + +*/ + +class HbAutoTestMouseEvent : public QMouseEvent +{ +public: + HbAutoTestMouseEvent(Type type, const QPoint & pos, const QPoint & globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers ) + : QMouseEvent(type,pos,globalPos,button,buttons,modifiers){} +}; + +class HbAutoTestKeyEvent : public QKeyEvent +{ +public: + HbAutoTestKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(), + bool autorep = false, ushort count = 1 ) + : QKeyEvent(type, key, modifiers, text, autorep, count){} +}; + +class HbAutoTest +{ +public: + + static void mouseMove (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1 ); + static void mousePress (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1); + static void mouseRelease (HbAutoTestMainWindow *window, HbWidget *widget, QPointF pos = QPointF(), int delay = -1); + static void mouseClick (HbAutoTestMainWindow *window, const HbWidget *widget, QPointF pos = QPointF(), int delay = -1); + +private: + static void drag(HbAutoTestMainWindow *window, QPointF targetPoint); + static QPointF middlePointOfWidget( const HbWidget* widget); + + static bool pointerPressed; + static QPointF pressPoint; + +//Key event Part: copy-pasted from QTestLib and modified to support HbAutoTestKeyEvent to enable filtering. +//see HbAutoTestMainWindow below. +public: + + static Qt::Key asciiToKey(char ascii); + static char keyToAscii(Qt::Key key); + + static void simulateEvent(QWidget *widget, bool press, int code, + Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1); + + static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + QString text, Qt::KeyboardModifiers modifier, int delay=-1); + + static void sendKeyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key code, + char ascii, Qt::KeyboardModifiers modifier, int delay=-1); + + static void keyEvent(QTest::KeyAction action, QWidget *widget, char ascii, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyEvent(QTest::KeyAction action, QWidget *widget, Qt::Key key, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyClicks(QWidget *widget, const QString &sequence, + Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); + + static void keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1); +}; + +class HbTestEvent +{ +public: + virtual void simulate(QWidget *w) = 0; + virtual HbTestEvent *clone() const = 0; + + virtual ~HbTestEvent() {} +}; + +class HbTestKeyEvent: public HbTestEvent +{ +public: + inline HbTestKeyEvent(QTest::KeyAction action, Qt::Key key, Qt::KeyboardModifiers modifiers, int delay) + : _action(action), _delay(delay), _modifiers(modifiers), _ascii(0), _key(key) {} + inline HbTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay) + : _action(action), _delay(delay), _modifiers(modifiers), + _ascii(ascii), _key(Qt::Key_unknown) {} + inline HbTestEvent *clone() const { return new HbTestKeyEvent(*this); } + + inline void simulate(QWidget *w) + { + if (_ascii == 0) + HbAutoTest::keyEvent(_action, w, _key, _modifiers, _delay); + else + HbAutoTest::keyEvent(_action, w, _ascii, _modifiers, _delay); + } + +protected: + QTest::KeyAction _action; + int _delay; + Qt::KeyboardModifiers _modifiers; + char _ascii; + Qt::Key _key; +}; + +class HbTestKeyClicksEvent: public HbTestEvent +{ +public: + inline HbTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay) + : _keys(keys), _modifiers(modifiers), _delay(delay) {} + inline HbTestEvent *clone() const { return new HbTestKeyClicksEvent(*this); } + + inline void simulate(QWidget *w) + { + HbAutoTest::keyClicks(w, _keys, _modifiers, _delay); + } + +private: + QString _keys; + Qt::KeyboardModifiers _modifiers; + int _delay; +}; + +class HbTestDelayEvent: public HbTestEvent +{ +public: + inline HbTestDelayEvent(int msecs): _delay(msecs) {} + inline HbTestEvent *clone() const { return new HbTestDelayEvent(*this); } + + inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); } + +private: + int _delay; +}; + +class HbTestEventList: public QList +{ +public: + inline HbTestEventList() {} + inline HbTestEventList(const HbTestEventList &other): QList() + { for (int i = 0; i < other.count(); ++i) append(other.at(i)->clone()); } + inline ~HbTestEventList() + { clear(); } + inline void clear() + { qDeleteAll(*this); QList::clear(); } + + inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Click, qtKey, modifiers, msecs); } + inline void addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Press, qtKey, modifiers, msecs); } + inline void addKeyRelease(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Release, qtKey, modifiers, msecs); } + inline void addKeyEvent(QTest::KeyAction action, Qt::Key qtKey, + Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new HbTestKeyEvent(action, qtKey, modifiers, msecs)); } + + inline void addKeyClick(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Click, ascii, modifiers, msecs); } + inline void addKeyPress(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Press, ascii, modifiers, msecs); } + inline void addKeyRelease(char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { addKeyEvent(QTest::Release, ascii, modifiers, msecs); } + inline void addKeyClicks(const QString &keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new HbTestKeyClicksEvent(keys, modifiers, msecs)); } + inline void addKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) + { append(new HbTestKeyEvent(action, ascii, modifiers, msecs)); } + + inline void addDelay(int msecs) + { append(new HbTestDelayEvent(msecs)); } + + inline void simulate(QWidget *w) + { + for (int i = 0; i < count(); ++i) + at(i)->simulate(w); + } +}; + +class HbAutoTestMainWindow : public HbMainWindow +{ +public: + HbAutoTestMainWindow() : HbMainWindow() {} + + void mousePressEvent(QMouseEvent *event) + { + qDebug( + "HbAutoTestMainWindow::mousePressEvent: x(%d) y(%d)", + event->x(), + event->y()); + if ( dynamic_cast(event) ) { + HbMainWindow::mousePressEvent(event); + } else { + ;//Do nothing + } + } + + void mouseMoveEvent(QMouseEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::mouseMoveEvent(event); + } else { + ;//Do nothing + } + } + + void mouseReleaseEvent(QMouseEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::mouseReleaseEvent(event); + } else { + ;//Do nothing + } + } + + void keyPressEvent(QKeyEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::keyPressEvent(event); + } else { + ;//Do nothing + } + } + void keyReleaseEvent(QKeyEvent *event) + { + if ( dynamic_cast(event) ) { + HbMainWindow::keyReleaseEvent(event); + } else { + ;//Do nothing + } + } + + void mouseDoubleClickEvent(QMouseEvent *event) + { + Q_UNUSED(event); + //Just ignore, not supported in Orbit + } +}; + + +Q_DECLARE_METATYPE(HbTestEventList) +#endif //HBAUTOTEST_H diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/main.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizard.h" +#include "testwlanwizardeap.h" +#include "testwlanwizardconnect.h" +#include "testwlanwizardmanual.h" +#include "testwlanwizardwps.h" + +// ======== LOCAL FUNCTIONS ======== +int main(int argc, char *argv[]) +{ + qDebug("TestWlanWizard main start"); + HbApplication app(argc, argv); + int res = 0; + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + + // log folder: \epoc32\winscw\c\data + + app.setApplicationName("TestWlanWizardUtilities"); + pass[2] = "c:\\data\\TestWlanWizardUtilities.txt"; + TestWlanWizard *tcUtilities = new TestWlanWizard(); + res |= QTest::qExec(tcUtilities, 3, pass); + delete tcUtilities; + tcUtilities = NULL; + + app.setApplicationName("TestWlanWizardConnect"); + pass[2] = "c:\\data\\TestWlanWizardConnect.txt"; + TestWlanWizardConnect *tcConnect = new TestWlanWizardConnect(); + res |= QTest::qExec(tcConnect, 3, pass); + delete tcConnect; + tcConnect = NULL; + + app.setApplicationName("TestWlanWizardManual"); + pass[2] = "c:\\data\\TestWlanWizardManual.txt"; + TestWlanWizardManual *tcManual = new TestWlanWizardManual(); + res |= QTest::qExec(tcManual, 3, pass); + delete tcManual; + tcManual = NULL; + + app.setApplicationName("TestWlanWizardEap"); + pass[2] = "c:\\data\\TestWlanWizardEap.txt"; + TestWlanWizardEap *tcEap = new TestWlanWizardEap(); + res |= QTest::qExec(tcEap, 3, pass); + delete tcEap; + tcEap = NULL; + + app.setApplicationName("TestWlanWizardWps"); + pass[2] = "c:\\data\\TestWlanWizardWps.txt"; + TestWlanWizardWps *tcWps = new TestWlanWizardWps(); + res |= QTest::qExec(tcWps, 3, pass); + delete tcWps; + tcWps = NULL; + + qDebug("TestWlanWizard main exit"); + return res; +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,347 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * This is the source file for testing Wlan Wizard library. + */ + +// System includes +#include +#include + +// User includes +#include "testwlanwizard.h" +#include "wlanwizardutils.h" + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------- +// FRAMEWORK FUNCTIONS +// --------------------------------------------------------- + +/** + * This function will be called before the first test function is executed. + */ +void TestWlanWizard::initTestCase() +{ + +} + +/** + * This function will be called after the last test function was executed. + */ +void TestWlanWizard::cleanupTestCase() +{ +} + +/** + * This function will be called before each test function is executed. + */ +void TestWlanWizard::init() +{ + +} + +/** + * This function will be called after each test function is executed. + */ +void TestWlanWizard::cleanup() +{ + +} + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + + +void TestWlanWizard::testWepHex64Valid() +{ + QString key("a0cd9fACDF"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepHex128Valid() +{ + QString key("ABCDEFabcdef0123456789AAAA"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepHexInvalidCharacters() +{ + QString key("wlanwizard"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWepAscii64Valid() +{ + QString key("testi"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepAscii128Valid() +{ + QString key("wlanwizardjee"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWepAsciiInvalidCharacters() +{ + QString key("wlanwizardje"); + key.append(QChar(31)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWepLength9Invalid() +{ + QString key("123456789"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength11Invalid() +{ + QString key("12345678901"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength25Invalid() +{ + QString key("1234567890123456789012345"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength27Invalid() +{ + QString key("123456789012345678901234567"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength4Invalid() +{ + QString key("1234"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength6Invalid() +{ + QString key("123456"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength12Invalid() +{ + QString key("123456789012"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +void TestWlanWizard::testWepLength14Invalid() +{ + QString key("12345678901234"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWepKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWepInvalidLength); +} + +// ---------------------------------------------------------------------------- +// WPA test cases +// ---------------------------------------------------------------------------- +void TestWlanWizard::testWpaHexValid() +{ + QString key("1234567890123456789012345678abcdefabcdefabcdefABCDEFABCDEFABCDEF"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWpaHexInvalidCharacters() +{ + QString key("abcdefabcdefabcdefABCDEFABCDEFABCDEF123456789012345678901234567G"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} +void TestWlanWizard::testWpaAsciiLength8Valid() +{ + QString key("ictsucks"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWpaAsciiLength63Valid() +{ + QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-123"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testWpaAsciiLength64Invalid() +{ + QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-1234"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWpaAsciiInvalidCharacters() +{ + QString key("wizardrules"); + key.append(QChar(127)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testWpaLength7Invalid() +{ + QString key("wizards"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooShort); +} + +void TestWlanWizard::testWpaLength65Invalid() +{ + QString key("zxcvbnm,.-asdfghjkl'qwertyuiop1234567890qwertyuiopzxcvbnm,.-12345"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::validateWpaKey(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusWpaTooLong); +} + + +// ---------------------------------------------------------------------------- +// ASCII test cases +// ---------------------------------------------------------------------------- +void TestWlanWizard::testAsciiValidCharacters() +{ + QString key; + for (int i = 32 ; i <= 126 ; i++){ + key.append(QChar(i)); + } + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testAsciiInvalidCharactersLower() +{ + QString key("wizardrules"); + key.append(QChar(31)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testAsciiInvalidCharactersUpper() +{ + QString key("wizardrules"); + key.append(QChar(127)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isAscii(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + + +// ---------------------------------------------------------------------------- +// HEX test cases +// ---------------------------------------------------------------------------- +void TestWlanWizard::testHexValidCharacters() +{ + QString key("abcdefABCDEF1234567890"); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusOk); +} + +void TestWlanWizard::testHexInvalidCharactersDigitLower() +{ + QString key("afAF09"); + key.append(QChar(47)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharactersDigitUpper() +{ + QString key("abc"); + key.append(QChar(58)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_a_Lower() +{ + QString key("abc"); + key.append(QChar(96)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_f_Upper() +{ + QString key("abc"); + key.append(QChar(103)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_A_Lower() +{ + QString key("abc"); + key.append(QChar(64)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testHexInvalidCharacters_F_Upper() +{ + QString key("abc"); + key.append(QChar(71)); + WlanWizardUtils::KeyStatus status = WlanWizardUtils::isHex(key); + QCOMPARE(status, WlanWizardUtils::KeyStatusIllegalCharacters); +} + +void TestWlanWizard::testSsidValidCharacters() +{ + QString key("12345678901234567890123456789012"); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusOk); +} + +void TestWlanWizard::testSsidValidCharacters2() +{ + QString key("1"); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusOk); +} + +void TestWlanWizard::testSsidInvalidTooShort() +{ + QString key(""); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength); +} + +void TestWlanWizard::testSsidInvalidTooLong() +{ + QString key("123456789012345678901234567890123"); + WlanWizardUtils::SsidStatus status = WlanWizardUtils::validateSsid(key); + QCOMPARE(status, WlanWizardUtils::SsidStatusInvalidLength); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizard.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* This is the header file for testing Wlan Qt Utilities library. +*/ + +#ifndef TESTWLANWIZARD_H_ +#define TESTWLANWIZARD_H_ + +// System includes +#include + +// User includes + +// Forward declarations +class QSignalSpy; +class WlanQtUtils; + +// External data types + +// Constants + +class TestWlanWizard: public QObject +{ + Q_OBJECT + +private slots: + + // Functions from QTest framework. + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + + // WEP test cases + void testWepHex64Valid(); + void testWepHex128Valid(); + void testWepHexInvalidCharacters(); + + void testWepAscii64Valid(); + void testWepAscii128Valid(); + void testWepAsciiInvalidCharacters(); + void testWepLength9Invalid(); + void testWepLength11Invalid(); + void testWepLength25Invalid(); + void testWepLength27Invalid(); + void testWepLength4Invalid(); + void testWepLength6Invalid(); + void testWepLength12Invalid(); + void testWepLength14Invalid(); + + // WPA test cases + void testWpaHexValid(); + void testWpaHexInvalidCharacters(); + void testWpaAsciiLength8Valid(); + void testWpaAsciiLength63Valid(); + void testWpaAsciiLength64Invalid(); + void testWpaAsciiInvalidCharacters(); + void testWpaLength7Invalid(); + void testWpaLength65Invalid(); + + // ASCII test cases + void testAsciiValidCharacters(); + void testAsciiInvalidCharactersLower(); + void testAsciiInvalidCharactersUpper(); + + // HEX test cases + void testHexValidCharacters(); + void testHexInvalidCharactersDigitLower(); + void testHexInvalidCharactersDigitUpper(); + void testHexInvalidCharacters_a_Lower(); + void testHexInvalidCharacters_f_Upper(); + void testHexInvalidCharacters_A_Lower(); + void testHexInvalidCharacters_F_Upper(); + + // SSID test cases + void testSsidValidCharacters(); + void testSsidValidCharacters2(); + void testSsidInvalidTooShort(); + void testSsidInvalidTooLong(); + +private: + +}; + +#endif /* TESTWLANWIZARD_H_ */ + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,615 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard UT. +*/ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardconnect.h" +#include "testwlanwizardconnect_conf.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardpagessid.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + +/*! + * Connect to open: + * - verifies IAP settings + * - ICT success + * - Finish button pressed + */ +void TestWlanWizardConnect::tc_connect_to_open_success() +{ +#ifdef tc_connect_to_open_success_enabled + tc_connect_success("tc_connect_to_open_success", CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, false, ""); +#endif +} + +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_open_success_adhoc() +{ +#ifdef tc_connect_to_open_success_adhoc_enabled + tc_connect_success("tc_connect_to_open_success_adhoc", CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, false, ""); +#endif +} + +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_wep_success() +{ +#ifdef tc_connect_to_wep_success_enabled + tc_connect_success("tc_connect_to_wep_success", CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, false, "abcde"); +#endif +} + +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_wpa_psk_success() +{ +#ifdef tc_connect_to_wpa_psk_success_enabled + tc_connect_success("tc_connect_to_wpa_psk_success", CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, false, "password"); +#endif +} +/*! + * Connect to open + */ +void TestWlanWizardConnect::tc_connect_to_wpa2_psk_success() +{ +#ifdef tc_connect_to_wpa2_psk_success_enabled + tc_connect_success("tc_connect_to_wpa2_psk_success", CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWpa2, false, "password"); +#endif +} + +/*! + * Connect to open: + * - Opens + * - ICT success + * - Cancel pressed in summary page + */ +void TestWlanWizardConnect::tc_connect_to_open_success_cancel() +{ +#ifdef tc_connect_to_open_success_cancel_enabled + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mView->mWizard->setParameters( + "tc_connect_to_open_success_cancel", + CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, + false, + false); + + mView->showWizard(); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "tc_connect_to_open_success_cancel"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QTest::qWait(WaitTimeForUi); + + // Ignore previous calls + mWlanQtUtilsContext->calledMethods(); + + QCOMPARE( mouseClickCancel(), true ); + + QStringList calledMethods; + calledMethods << "disconnectIap" << "deleteIap"; + + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true); +#endif +} + +void TestWlanWizardConnect::tc_network_failure_OpenAuthFailed() +{ +#ifdef tc_network_failure_OpenAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_OpenAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanOpenAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthRequired() +{ +#ifdef tc_network_failure_SharedKeyAuthRequired_enabled + tc_network_error_codes( + "tc_network_failure_SharedKeyAuthRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanSharedKeyAuthRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_WpaAuthRequired() +{ +#ifdef tc_network_failure_WpaAuthRequired_enabled + tc_network_error_codes( + "tc_network_failure_WpaAuthRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanWpaAuthRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_WpaAuthFailed() +{ +#ifdef tc_network_failure_WpaAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_WpaAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWpa, + false, + "password", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanWpaAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_802dot1xAuthFailed() +{ +#ifdef tc_network_failure_802dot1xAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_802dot1xAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlan802dot1xAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_IllegalEncryptionKeys() +{ +#ifdef tc_network_failure_IllegalEncryptionKeys_enabled + tc_network_error_codes( + "tc_network_failure_IllegalEncryptionKeys", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanIllegalEncryptionKeys ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_PskModeRequired() +{ +#ifdef tc_network_failure_PskModeRequired_enabled + tc_network_error_codes( + "tc_network_failure_PskModeRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanPskModeRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_EapModeRequired() +{ +#ifdef tc_network_failure_EapModeRequired_enabled + tc_network_error_codes( + "tc_network_failure_EapModeRequired", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_authentication_unsuccessful"), + KErrWlanEapModeRequired ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_IllefalWpaPskKey() +{ +#ifdef tc_network_failure_IllefalWpaPskKey_enabled + tc_network_error_codes( + "tc_network_failure_IllefalWpaPskKey", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_incorrect_wpa_preshared_key_pleas"), + KErrWlanIllegalWpaPskKey ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_SharedKeyAuthFailed() +{ +#ifdef tc_network_failure_SharedKeyAuthFailed_enabled + tc_network_error_codes( + "tc_network_failure_SharedKeyAuthFailed", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"), + KErrWlanSharedKeyAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_ErrNone() +{ +#ifdef tc_network_failure_ErrNone_enabled + tc_network_error_codes( + "tc_network_failure_ErrNone", + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeOpen, + false, + "", + hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the"), + KErrWlanSharedKeyAuthFailed ); +#endif +} +void TestWlanWizardConnect::tc_network_failure_30180() +{ +#ifdef tc_network_failure_30180_enabled + const QString ssid("tc_network_failure_30180"); + tc_network_error_codes( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + false, + "abcde", + hbTrId("txt_occ_dialog_connection_failed"), + 30180 ); + + QCOMPARE( mouseClickPrevious(), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_connection_failed")), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QStringList calledMethods; + calledMethods + << "updateIap" + << "activeIap" + << "disconnectIap" + << "connectIap"; + + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + +#endif +} + +void TestWlanWizardConnect::tc_iap_creation_fails() +{ +#ifdef tc_iap_creation_fails_enabled + + const QString ssid("tc_iap_creation_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(-1); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, + false, + false); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret") ), true ); + + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QStringList calledMethods; + calledMethods << "WlanQtUtils" << "createIap"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + + QCOMPARE( mouseClickCancel(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalCancelled, 2), true); + QTest::qWait(WaitTimeForUi); +#endif +} + +void TestWlanWizardConnect::tc_cancel_key_query() +{ +#ifdef tc_cancel_key_query_enabled + + const QString ssid("tc_cancel_key_query"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + true, + false); + mView->showWizard(); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickCancel(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalCancelled), true); + + mWlanQtUtilsContext->emitWlanNetworkClosed(-1, KErrCancel); + callWlanWizard_startPageOperation(); + + QStringList calledMethods; + calledMethods << "WlanQtUtils"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); +#endif +} + +/*! + * Helpper test case for testing success case with compinations of provided + * parameters. + */ +void TestWlanWizardConnect::tc_connect_success(const QString &ssid, int networkMode, + int securityMode, bool hidden, QString key) +{ + + mWlanQtUtilsContext->setCreateWlanIapResult(2); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(2); + mWlanQtUtilsContext->setSignalIctResult(2, WlanQtUtils::IctPassed); + + mView->mWizard->setParameters( + ssid, + networkMode, + securityMode, + true, + false); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); + ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, hidden); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + QStringList calledMethods; + calledMethods << "WlanQtUtils"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + + mView->showWizard(); + if (securityMode == CMManagerShim::WlanSecModeWep || securityMode + == CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) { + // Key query short pwd + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + + if (securityMode == CMManagerShim::WlanSecModeWep) { + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); + QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true ); + } + else { + QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + } + QCOMPARE( mouseClickObject("dialog"), true ); + + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QTest::qWait(WaitTimeForUi); + } + else { + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QTest::qWait(WaitTimeForUi); + } + + QCOMPARE(verifySummaryPage( + ssid, + networkMode, + hidden, + securityMode, + true, + hbTrId("txt_occ_dblist_destination_val_internet")),true); + + calledMethods.clear(); + calledMethods << "createIap" << "activeIap" << "connectIap"; + QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods); + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickFinish(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalFinished, 2), true); +} + +/*! + * Helpper test case for testing success case with combinations of provided + * parameters. + */ +void TestWlanWizardConnect::tc_network_error_codes( + const QString &ssid, + int networkMode, + int securityMode, + bool hidden, + QString key, + const QString &errorString, + int errorCode) +{ + mWlanQtUtilsContext->setCreateWlanIapResult(2); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(2, errorCode); + mWlanQtUtilsContext->setActiveWlanIapResult(1); + mView->mWizard->setParameters( + ssid, + networkMode, + securityMode, + true, + false); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, networkMode); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); + ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, hidden); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + QStringList calledMethods; + calledMethods << "WlanQtUtils"; + QCOMPARE(mWlanQtUtilsContext->calledMethods(), calledMethods); + + mView->showWizard(); + if (securityMode == CMManagerShim::WlanSecModeWep || securityMode + == CMManagerShim::WlanSecModeWpa || securityMode == CMManagerShim::WlanSecModeWpa2) { + // Key query short pwd + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + + if (securityMode == CMManagerShim::WlanSecModeWep) { + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, key); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1); + QCOMPARE( insertTextToObject("lineEditKey", "abcde"), true ); + } + else { + QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, key); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true); + } + QCOMPARE( mouseClickObject("dialog"), true ); + + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + } + else { + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + } + + calledMethods.clear(); + calledMethods + << "createIap" + << "activeIap" + << "disconnectIap" + << "connectIap"; + QCOMPARE( mWlanQtUtilsContext->calledMethods(), calledMethods); + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); + QTest::qWait(WaitTimeForUi); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDCONNECT_H_ +#define TESTWLANWIZARDRNDCONNECT_H_ + +#include "testwlanwizardcontext.h" + +class TestWlanWizardConnect : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + void tc_connect_to_open_success(); + void tc_connect_to_open_success_adhoc(); + void tc_connect_to_wep_success(); + void tc_connect_to_wpa_psk_success(); + void tc_connect_to_wpa2_psk_success(); + void tc_connect_to_open_success_cancel(); + void tc_network_failure_OpenAuthFailed(); + void tc_network_failure_SharedKeyAuthRequired(); + void tc_network_failure_WpaAuthRequired(); + void tc_network_failure_WpaAuthFailed(); + void tc_network_failure_802dot1xAuthFailed(); + void tc_network_failure_IllegalEncryptionKeys(); + void tc_network_failure_PskModeRequired(); + void tc_network_failure_EapModeRequired(); + void tc_network_failure_IllefalWpaPskKey(); + void tc_network_failure_SharedKeyAuthFailed(); + void tc_network_failure_ErrNone(); + void tc_network_failure_30180(); + void tc_iap_creation_fails(); + void tc_cancel_key_query(); + +private: + void tc_connect_success( + const QString &ssid, + int networkMode, + int securityMode, + bool hidden, + QString key); + + void tc_network_error_codes( + const QString &ssid, + int networkMode, + int securityMode, + bool hidden, + QString key, + const QString &errorString, + int errorCode); +}; + +#endif /* TESTWLANWIZARDRNDCONNECT_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardconnect_conf.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants + + +#define tc_connect_to_open_success_enabled +#define tc_connect_to_open_success_adhoc_enabled; +#define tc_connect_to_wep_success_enabled; +#define tc_connect_to_wpa_psk_success_enabled; +#define tc_connect_to_wpa2_psk_success_enabled; +#define tc_connect_to_open_success_cancel_enabled +#define tc_network_failure_OpenAuthFailed_enabled +#define tc_network_failure_SharedKeyAuthRequired_enabled +#define tc_network_failure_WpaAuthRequired_enabled +#define tc_network_failure_WpaAuthFailed_enabled +#define tc_network_failure_802dot1xAuthFailed_enabled +#define tc_network_failure_IllegalEncryptionKeys_enabled +#define tc_network_failure_PskModeRequired_enabled +#define tc_network_failure_EapModeRequired_enabled +#define tc_network_failure_IllefalWpaPskKey_enabled +#define tc_network_failure_SharedKeyAuthFailed_enabled +#define tc_network_failure_ErrNone_enabled +#define tc_network_failure_30180_enabled +#define tc_iap_creation_fails_enabled +#define tc_cancel_key_query_enabled diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,968 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardcontext.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardpageinternal.h" +#include "wlanwizardhelper.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "eapqtconfiginterface_context.h" +#include "eapwizard.h" +#include "eapwizard_p.h" +#include "eapwizardpage.h" +#include "wpswizardpage.h" +#include "wlanmgmtclient_context.h" +#include "wpswizardstepfour.h" +#include "wpswizardstepfour_p.h" +#include "cwpsactiverunner.h" + +// External function prototypes + +// Local constants +class TestRadioButtonList: public HbRadioButtonList +{ +public: + void emitActivated(const QModelIndex &modelIndex) + { HbRadioButtonList::emitActivated(modelIndex); } +}; + + +// --------------------------------------------------------- +// FRAMEWORK FUNCTIONS +// --------------------------------------------------------- + +ContextWlanApList::ContextWlanApList() +{ + +} + +ContextWlanApList::~ContextWlanApList() +{ + clear(); +} + +void ContextWlanApList::Add(QString name, int netMode, int secMode, bool wpaPskInUse, + bool wpsSupported, int signalStrength) +{ + QSharedPointer temp = QSharedPointer(new WlanQtUtilsAp()); + temp->setValue(WlanQtUtilsAp::ConfIdSsid, name); + temp->setValue(WlanQtUtilsAp::ConfIdConnectionMode, netMode); + temp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, secMode); + temp->setValue(WlanQtUtilsAp::ConfIdWpaPskUse, wpaPskInUse); + temp->setValue(WlanQtUtilsAp::ConfIdWpsSupported, wpsSupported); + temp->setValue(WlanQtUtilsAp::ConfIdSignalStrength, signalStrength); + + mList.append(temp); +} + +void ContextWlanApList::clear() +{ + mList.clear(); +} + + +TestWlanWizardContext::TestWlanWizardContext() : + mView(NULL), + mMainWindow(NULL), + mWlanQtUtilsContext(NULL), + mEapQtUtilsContext(NULL), + mWlanMgmtClientContext(NULL), + mApList(NULL), + mApOpenList(NULL) +{ + +} +TestWlanWizardContext::~TestWlanWizardContext() +{ + +} + +/** + * This function will be called before the first test function is executed. + */ +void TestWlanWizardContext::initTestCase() +{ + qDebug("TestWlanWizardContext::initTestCase"); + + mMainWindow = new HbAutoTestMainWindow; + + mView = new TestView(); + + mMainWindow->addView(mView); + mMainWindow->setCurrentView(mView); + mMainWindow->installEventFilter(this); + mMainWindow->show(); + + QTest::qWait(1); + while (!mEvent) { + QTest::qWait(WaitTimeForUi); + } + mEvent = false; + mApList = new ContextWlanApList(); + mApOpenList = new ContextWlanApList(); + +} + +/** + * This function will be called after the last test function was executed. + */ +void TestWlanWizardContext::cleanupTestCase() +{ + qDebug("TestWlanWizardContext::cleanupTestCase"); + + qDebug("delete mApList"); + delete mApList; + mApList = NULL; + delete mApOpenList; + mApOpenList = NULL; + + qDebug("delete mMainWindow"); + mMainWindow->setAttribute( Qt::WA_DeleteOnClose, true ); + mMainWindow->close(); + mMainWindow = NULL; + QTest::qWait(WaitTimeForUi); + qDebug("TestWlanWizardContext::cleanupTestCase exit"); +} + +/** + * This function will be called before each test function is executed. + */ +void TestWlanWizardContext::init() +{ + qDebug("TestWlanWizardContext::init()"); + + mView->createWizard(); + mWlanQtUtilsContext = new WlanQtUtilsContext(mView->mWizard->d_ptr->mWlanQtUtils.data()); + + mEapQtUtilsContext = new EapQtConfigInterfaceContext(); + mEapQtUtilsContext->setObject(getEapQtConfig()); + + mWlanMgmtClientContext = new WlanMgmtClientContext(); + //mWlanMgmtClientContext->setObject(mWlanMgmtClient); + + WpsPageStepFour* wps = (WpsPageStepFour*)(mView->mWizard->d_ptr->mPages[WpsWizardPage::PageWpsWizardStep4]); + Q_ASSERT(wps); + mWlanMgmtClientContext->setObject(wps->d_ptr->mWpsActiveRunner->iWLANMgmtClient); +} + +/** + * This function will be called after each test function is executed. + */ +void TestWlanWizardContext::cleanup() +{ + qDebug("TestWlanWizardContext::cleanup()"); + + delete mWlanQtUtilsContext; + delete mEapQtUtilsContext; + delete mWlanMgmtClientContext; + + mView->deleteWizard(); + mApList->clear(); + mApOpenList->clear(); + QTest::qWait(1); +} + + +/*! + * Filter to catch focus event to the text editor widget. + */ +bool TestWlanWizardContext::eventFilter(QObject *obj, QEvent *event) +{ + if (obj == mMainWindow && event->type() == QEvent::Show) { + mMainWindow->removeEventFilter(this); + mEvent = true; + } + return false; +} + +QGraphicsWidget* TestWlanWizardContext::findChildItem(const QString &itemName, QGraphicsItem *widget) +{ + QList list = widget->childItems(); + for (int i = 0; i < list.size(); i++) { + QGraphicsItem* item = list[i]; + + QGraphicsWidget* widget = NULL; + if (item->isWidget()) { + widget = (QGraphicsWidget*)item; + } + if (widget && widget->objectName() == itemName) { + return widget; + } + else if ((item = findChildItem(itemName, item))) { + return (QGraphicsWidget*)item; + } + } + return 0; +} + +bool TestWlanWizardContext::verifyStatus(WizardStatusSignal status, int iapId) +{ + return mView->verifyStatus(status, iapId); +} + +bool TestWlanWizardContext::verifyCurrentPage(int pageId, int retries, int wait_ms) +{ + bool ret = true; + for (int i = 0; i < retries; i++) { + QTest::qWait(wait_ms); + WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; + HbWidget* current = qobject_cast (pPrivate->mStackedWidget->currentWidget()); + WlanWizardPage *page = pPrivate->mPageMapper[current]; + + // TODO: verify title in this method + + if (page == pPrivate->mPages[pageId]) { + switch(pageId) { + case WlanWizardPageInternal::PageNetworkMode: + return verifyDialogText("dialog_6", hbTrId("txt_occ_dialog_select_network_mode_and_status")); + + case WlanWizardPageInternal::PageNetworkSecurity: + return verifyDialogText("dialog_6", hbTrId("txt_occ_dialog_select_network_security_mode")); + + case WlanWizardPageInternal::PageSsid: + return verifyDialogText("dialog", hbTrId("txt_occ_dialog_insert_the_name_of_the_new_wlan_net")); + + case WlanWizardPageInternal::PageSummary: + if (pPrivate->mTitle->plainText() != hbTrId("txt_occ_title_wlan_setup_wizard_summary")){ + qWarning("TestWlanWizardContext::verifyCurrentPage: Invalid title"); + return false; + } + return true; + + case EapWizardPage::PageOuterType: + return verifyDialogText("title", hbTrId("txt_occ_title_select_eap_type")); + + case EapWizardPage::PageCertificateCa: + return verifyDialogText("title", hbTrId("txt_occ_title_select_authority_certificate")); + + case EapWizardPage::PageCertificateUser: + return verifyDialogText("title", hbTrId("txt_occ_title_select_user_certificate")); + + case EapWizardPage::PageNewPacStorePassword: + ret &= verifyDialogText("setlabel_55", hbTrId("txt_occ_setlabel_new_pac_store_password")); + ret &= verifyDialogText("setlabel_56", hbTrId("txt_occ_setlabel_confirm_password")); + return ret; + + case EapWizardPage::PagePromptPacStorePassword: + return verifyDialogText("setlabel_59", hbTrId("txt_occ_setlabel_eap_pac_store_password")); + + case WpsWizardPage::PageWpsWizardStep2: + return verifyDialogText("label", hbTrId("txt_occ_dialog_selected_network_supports_wifi_pro")); + break; + + case WpsWizardPage::PageWpsWizardStep3_Button: + return verifyDialogText("label_heading", hbTrId("txt_occ_dialog_first_press_button_on_the_wireless")); + break; + + case WpsWizardPage::PageWpsWizardStep3_Number: + // TODO: something better here?? + return true; + + case WpsWizardPage::PageWpsWizardStep4: + return verifyDialogText("label_heading", hbTrId("txt_occ_dialog_negotiating")); + + case WpsWizardPage::PageWpsWizardStep5: + return verifyDialogText("label", hbTrId("txt_occ_dialog_settings_received_for_multiple_wlan")); + + default: + return false; + } + } + } + qWarning("verifyCurrentPage: expected: %d", pageId); + return false; +} + +bool TestWlanWizardContext::verifyCurrentPageWithInfo( + int pageId, const QString &info, int retries, int wait_ms) +{ + bool ret = true; + for (int i = 0; i < retries; i++) { + QTest::qWait(wait_ms); + + WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; + HbWidget* current = qobject_cast (pPrivate->mStackedWidget->currentWidget()); + WlanWizardPage *page = pPrivate->mPageMapper[current]; + + // TODO: verify title in this method + + if (page == pPrivate->mPages[pageId]) { + switch(pageId) { + case WlanWizardPageInternal::PageGenericError: + return verifyDialogText("dialog", info); + + case WlanWizardPageInternal::PageKeyQuery: + return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_enter_key_for_1").arg(info)); + + case WlanWizardPageInternal::PageProcessSettings: + return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_checking_connection_to_1").arg(info)); + + case WlanWizardPageInternal::PageScanning: + return verifyDialogText("dialog", HbParameterLengthLimiter("txt_occ_dialog_searching").arg(info)); + + case EapWizardPage::PageUsernamePassword: + ret &= verifyDialogText( + "setlabel_55", + HbParameterLengthLimiter("txt_occ_setlabel_user_name_for_1").arg(info)); + ret &= verifyDialogText("setlabel_56", hbTrId("txt_occ_setlabel_eap_password")); + return ret; + + case EapWizardPage::PageIdentity: + ret &= verifyDialogText("setlabel_53", HbParameterLengthLimiter("txt_occ_setlabel_user_name_for_1").arg(info)); + ret &= verifyDialogText("setlabel_53_val", hbTrId("txt_occ_setlabel_user_name_val_generate_automatic")); + ret &= verifyDialogText("setlabel_54", hbTrId("txt_occ_setlabel_eap_realm")); + ret &= verifyDialogText("setlabel_54_val", hbTrId("txt_occ_setlabel_eap_realm_val_generate_automatically")); + return ret; + + case EapWizardPage::PageInnerTypePeap: + case EapWizardPage::PageInnerTypeEapTtls: + return verifyDialogText("title", HbParameterLengthLimiter("txt_occ_title_select_innear_eap_type_for_1").arg(info)); + + default: + return verifyCurrentPage(pageId, retries, wait_ms); + } + } + } + qWarning("verifyCurrentPage: expected: %d", pageId); + return false; +} + + +bool TestWlanWizardContext::verifyDialogText(const QString objName, const QString text) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbWidget* widget = qobject_cast ( + findChildItem(objName, current)); + + if (widget) { + HbLabel *label = qobject_cast(widget); + if (label) { + if(label->plainText() == text) { + if (!label->isVisible()){ + qWarning("verifyDialogText: not visible"); + return false; + } + return true; + + } else { + qWarning("verifyDialogText: not match"); + qDebug() << "expect: " << text; + qDebug() << "actual: " << label->plainText(); + return false; + } + } + HbCheckBox *checkBox = qobject_cast(widget); + + if (checkBox) { + if(checkBox->text() == text) { + if (!checkBox->isVisible()){ + qWarning("verifyDialogText: not visible"); + return false; + } + return true; + + } else { + qWarning("verifyDialogText: not match"); + qDebug() << "expect: " << text; + qDebug() << "actual: " << checkBox->text(); + return false; + } + } + } + + qWarning("verifyDialogText: object not found"); + + return false; +} + +bool TestWlanWizardContext::verifyActionButtons(ButtonStatus prevStatus, + ButtonStatus cancelStatus, + ButtonStatus nextStatus, + ButtonStatus finishStatus) +{ + WlanWizardPrivate *pPrivate = mView->mWizard->d_ptr; + ButtonStatus prevReally = ButtonHidden; + ButtonStatus cancelReally = ButtonHidden; + ButtonStatus nextReally = ButtonHidden; + ButtonStatus finishReally = ButtonHidden; + + if(pPrivate->mActionPrevious->isVisible()) { + if(pPrivate->mActionPrevious->isEnabled()) { + prevReally = ButtonEnabled; + } else { + prevReally = ButtonDisabled; + } + } + + if(pPrivate->mActionCancel->isVisible()) { + if(pPrivate->mActionCancel->isEnabled()) { + cancelReally = ButtonEnabled; + } else { + cancelReally = ButtonDisabled; + } + } + + if(pPrivate->mActionNext->isVisible()) { + if(pPrivate->mActionNext->isEnabled()) { + nextReally = ButtonEnabled; + } else { + nextReally = ButtonDisabled; + } + } + + if(pPrivate->mActionFinish->isVisible()) { + if(pPrivate->mActionFinish->isEnabled()) { + finishReally = ButtonEnabled; + } else { + finishReally = ButtonDisabled; + } + } + bool ret = true; + if (prevReally != prevStatus){ + qWarning("Previous Button: really: %d, status: %d", prevReally, prevStatus); + ret = false; + } + if (cancelReally != cancelStatus){ + qWarning("Cancel Button: really: %d, status: %d", cancelReally, cancelStatus); + ret = false; + } + if (nextReally != nextStatus){ + qWarning("Next Button: really: %d, status: %d", nextReally, nextStatus); + ret = false; + } + if (finishReally != finishStatus){ + qWarning("Finish Button: really: %d, status: %d", finishReally, finishStatus); + ret = false; + } + + return ret; +} + +bool TestWlanWizardContext::verifySummaryPage( + const QString &ssid, + int netMode, + bool hidden, + int secMode, + bool useWpaPsk, + const QString &destination, + int outerType, + int innerType, + bool eapFastProvMode) +{ + bool ret = true; + int i = 0; + HbListWidget* listWidget = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + if (!listWidget){ + qWarning("verifySummaryPage: ListWidget not found"); + return false; + } + + // VERIFY: NETWORK NAME + HbListWidgetItem *item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_network_name")) { + qWarning("verifySummaryPage: no match network name"); + ret = false; + } + + if (item->secondaryText() != ssid){ + qWarning("verifySummaryPage: no match ssid"); + ret = false; + } + + // VERIFY: NETWORK MODE + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_network_mode")) { + qWarning("verifySummaryPage: no match network mode"); + ret = false; + } + QString netModeString(toNetworkModeString(netMode, hidden)); + if (item->secondaryText() != netModeString){ + qWarning("verifySummaryPage: no match network mode value"); + qDebug() << "Actual: " << item->secondaryText(); + qDebug() << "Expected: " << netModeString; + ret = false; + } + + // VERIFY: SECURITY MODE + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_security_mode")) { + qWarning("verifySummaryPage: no match security mode"); + ret = false; + } + + if (item->secondaryText() != toSecurityModeString(secMode, useWpaPsk)){ + qWarning("verifySummaryPage: no match security mode value"); + ret = false; + } + + // VERIFY: EAP OUTER TYPE + if (outerType != -1) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_outer_eap")) { + qWarning("verifySummaryPage: no match eap outer type"); + ret = false; + } + if (item->secondaryText() != eapTypeToString(outerType)){ + qWarning("verifySummaryPage: no match eap outer type value"); + ret = false; + } + } + + // VERIFY: EAP INNER TYPE + if (innerType != -1) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_inner_eap")) { + qWarning("verifySummaryPage: no match eap inner type"); + ret = false; + } + if (item->secondaryText() != eapTypeToString(innerType)){ + qWarning("verifySummaryPage: no match eap inner type value"); + ret = false; + } + } + + // VERIFY: EAP FAST PROVISIONING MODE + if (eapFastProvMode) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_provisioning_mode_for_eapfast")) { + qWarning("verifySummaryPage: no match eap prov mode"); + ret = false; + } + if (item->secondaryText() != hbTrId("txt_occ_dblist_provisioning_mode_for_val_unauthent")){ + qWarning("verifySummaryPage: no match eap prov mode value"); + ret = false; + } + } + + // VERIFY: DESTINATION + if (destination.length() > 0) { + item = listWidget->item(i++); + if (item->text() != hbTrId("txt_occ_dblist_destination")) { + qWarning("verifySummaryPage: no match destination"); + ret = false; + } + if (item->secondaryText() != destination){ + qWarning("verifySummaryPage: no match destination value"); + ret = false; + } + } + + + return ret; +} + +bool TestWlanWizardContext::mouseClickObject(const QString objName) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbWidget* widget = (HbWidget*) findChildItem(objName, current); + + if (widget) { + HbAutoTest::mouseClick(mMainWindow, widget); + widget->clearFocus(); + widget->setFocus(); + return true; + } + qWarning("mouseClickObject: object not found"); + + return false; +} + +bool TestWlanWizardContext::insertTextToObject(const QString objName, const QString text) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbWidget* widget = (HbWidget*) findChildItem(objName, current); + + if (widget) { + for (int i = 0; i < text.size(); i++) { + HbAutoTest::keyPress(mMainWindow, text.at(i).toAscii(), 0, 10); + QTest::qWait(20); + } + return true; + } + qWarning("insertTextToObject: object not found"); + return false; +} + +bool TestWlanWizardContext::selectRadioButton(const QString objName, int index) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + TestRadioButtonList* widget = (TestRadioButtonList*) findChildItem(objName, current); + + if (widget) { + if (widget->items().length() <= index) { + qWarning("selectRadioButton: index out of range"); + return false; + } + widget->setSelected(index); + widget->emitActivated(widget->currentIndex()); + return true; + } + qWarning("selectRadioButton: object not found"); + + return false; +} + +bool TestWlanWizardContext::verifyRadioButtonState( + const QString objName, + int index, + const QString &text) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + HbRadioButtonList* widget = qobject_cast( + findChildItem(objName, current)); + + if (widget) { + if (widget->selected() != index) { + qWarning("verifyRadioButtonState: invalid index"); + return false; + } + + if (widget->items().at(index) != text) { + qWarning("verifyRadioButtonState: text does not match"); + return false; + } + + return true; + } + qWarning("verifyRadioButtonState: object not found"); + + return false; +} + +QStringList TestWlanWizardContext::verifyRadioButtons(const QString objName) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + HbRadioButtonList* widget = qobject_cast( + findChildItem(objName, current)); + + QStringList ret; + + if (widget) { + ret = widget->items(); + } + else { + qWarning("verifyRadioButtons: object not found"); + } + + return ret; +} + +int TestWlanWizardContext::verifySelectedRadioButton(const QString objName) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + + HbRadioButtonList* widget = qobject_cast( + findChildItem(objName, current)); + + int ret = ListNotFound; + + if (widget) { + ret = widget->selected(); + } + else { + qWarning("verifySelectedRadioButton: object not found"); + } + + return ret; +} + +bool TestWlanWizardContext::verifyCheckBoxState(const QString &objName, bool checked) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbCheckBox* widget = qobject_cast( + findChildItem(objName, current)); + + if (widget) { + if (widget->isChecked() != checked) { + qWarning("Checkbox in wrong state"); + return false; + } + return true; + } + qWarning("verifyCheckBoxState: object not found"); + return false; +} + +bool TestWlanWizardContext::selectCheckBoxState(const QString &objName, bool check) +{ + HbWidget* current = qobject_cast ( + mView->mWizard->d_ptr->mStackedWidget->currentWidget()); + HbCheckBox* widget = qobject_cast( + findChildItem(objName, current)); + + if (widget) { + if (check) { + widget->setCheckState(Qt::Checked); + } else { + widget->setCheckState(Qt::Unchecked); + } + return true; + + } + qWarning("selectCheckBoxState: object not found"); + return false; +} + +bool TestWlanWizardContext::mouseClickNext() +{ + if (mView->mWizard->d_ptr->mActionNext->isEnabled()) { + mView->mWizard->d_ptr->mActionNext->activate(QAction::Trigger); + return true; + } + qWarning("Next button not enabled"); + return false; +} + +bool TestWlanWizardContext::mouseClickPrevious() +{ + if (mView->mWizard->d_ptr->mActionPrevious->isEnabled()) { + mView->mWizard->d_ptr->mActionPrevious->activate(QAction::Trigger); + return true; + } + qWarning("mouseClickPrevious: Previous button not enabled"); + + return false; +} + +bool TestWlanWizardContext::mouseClickCancel() +{ + if (mView->mWizard->d_ptr->mActionCancel->isEnabled()) { + mView->mWizard->d_ptr->mActionCancel->activate(QAction::Trigger); + return true; + } + qWarning("mouseClickCancel: Cancel button not enabled"); + + return false; +} + +bool TestWlanWizardContext::mouseClickFinish() +{ + if (mView->mWizard->d_ptr->mActionFinish->isEnabled()) { + mView->mWizard->d_ptr->mActionFinish->activate(QAction::Trigger); + return true; + } + qWarning("mouseClickFinish: Finish button not enabled"); + + return false; +} + +QString TestWlanWizardContext::toNetworkModeString(int netMode, bool isHidden) +{ + QString ret; + switch (netMode) { + case CMManagerShim::Adhoc: + ret = hbTrId("txt_occ_dblist_network_mode_val_adhoc"); + break; + + default: + if (isHidden) { + ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_hi"); + } else { + ret = hbTrId("txt_occ_dblist_network_mode_val_infrastructure_pu"); + } + break; + } + return ret; +} + +QString TestWlanWizardContext::toSecurityModeString(int secMode, int useWpaPsk) +{ + QString ret; + switch (secMode) { + case CMManagerShim::WlanSecMode802_1x: + ret = hbTrId("txt_occ_dblist_security_mode_val_8021x"); + break; + + case CMManagerShim::WlanSecModeWep: + ret = hbTrId("txt_occ_dblist_security_mode_val_wep"); + break; + + case CMManagerShim::WlanSecModeWpa: + if (useWpaPsk) { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2psk"); + } else { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpawpa2_with_eap"); + } + break; + + case CMManagerShim::WlanSecModeWpa2: + if (useWpaPsk) { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_passwor"); + } else { + ret = hbTrId("txt_occ_dblist_security_mode_val_wpa2_with_eap"); + } + break; + + default: + Q_ASSERT(secMode == CMManagerShim::WlanSecModeOpen); + ret = hbTrId("txt_occ_dblist_security_mode_val_open"); + break; + } + return ret; +} + + +EapQtConfigInterface *TestWlanWizardContext::getEapQtConfig() +{ + return mView->mWizard->d_ptr->mEapWizard->d_ptr->mEapConfIf.data(); +} + +QString TestWlanWizardContext::eapTypeToString(int type) +{ + QCOMPARE(mView->mWizard->d_ptr->mEapWizard != NULL, true); + return mView->mWizard->d_ptr->mEapWizard->d_ptr->eapTypeToString(type); +} + +void TestWlanWizardContext::callWlanWizard_startPageOperation() +{ + mView->mWizard->d_ptr->startPageOperation(); +} + + +void TestWlanWizardContext::setWlanMgmtClientObject(CWlanMgmtClient* object) +{ + // TODO: mWlanMgmtClient = object; +} + +TestView::TestView() : mWizard(NULL) +{ + qDebug("TestView::TestView()"); +} + +TestView::~TestView() +{ + qDebug("TestView::~TestView()"); +} + +void TestView::createWizard() +{ + qDebug("TestView::createWizard"); + Q_ASSERT(mWizard == NULL); + mWizard = new WlanWizard(mainWindow()); + bool ok; + ok = connect( + mWizard, SIGNAL(finished(int, bool)), + this, SLOT(finished(int, bool)), + Qt::QueuedConnection); + Q_ASSERT(ok); + + ok = connect( + mWizard, SIGNAL(cancelled()), + this, SLOT(cancelled()), + Qt::QueuedConnection); + Q_ASSERT(ok); + + mWizardStatus = WizardStatusSignalNone; + mConnectedIapId = -100; +} + +void TestView::showWizard() +{ + qDebug("TestView::showWizard()"); + Q_ASSERT(mWizard); + mWizard->show(); +} + +void TestView::deleteWizard() +{ + qDebug("TestView::deleteWizard"); + + Q_ASSERT(mWizard != NULL); + QMetaObject::invokeMethod(mWizard, "deleteLater", Qt::QueuedConnection); + QTest::qWait(100); + mWizard = NULL; +} + +void TestView::finished(int iapId, bool connected) +{ + qDebug("TestView::complete(), iap id: %d, connected: %d", iapId, connected); + + if (mWizardStatus != WizardStatusSignalNone) { + qWarning("TestView::finished: multiple signals received"); + mWizardStatus = WizardStatusSignalUndefined; + } else { + mWizardStatus = WizardStatusSignalFinished; + mConnectedIapId = iapId; + } +} + +void TestView::cancelled() +{ + qDebug("TestView::cancelled()"); + if (mWizardStatus != WizardStatusSignalNone) { + qWarning("TestView::cancelled: multiple signals received"); + mWizardStatus = WizardStatusSignalUndefined; + } else { + mWizardStatus = WizardStatusSignalCancelled; + } +} + +bool TestView::verifyStatus(WizardStatusSignal status, int iapId ) +{ + // Since connections to cancelled and finished signals are queued + // we need to use qWait() here. + QTest::qWait(100); + bool ret = true; + if (status != mWizardStatus){ + qWarning("TestView::verifyStatus, status: expected: %d, actual: %d", status, mWizardStatus); + ret = false; + } + if (status == WizardStatusSignalFinished) { + if (iapId != mConnectedIapId) { + qWarning("TestView::verifyStatus, iapid: expected: %d, actual: %d", iapId, mConnectedIapId); + ret = false; + } + } + return ret; +} + + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardcontext.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDUICONTEXT_H_ +#define TESTWLANWIZARDRNDUICONTEXT_H_ + +#include +#include +#include + +class QGraphicsItem; +class HbAutoTestMainWindow; +class WlanWizard; +class WlanQtUtilsContext; +class WlanQtUtils; +class WlanQtUtilsAp; +class QString; +class EapWizard; +class EapQtConfigInterfaceContext; +class EapQtConfigInterface; +class WlanMgmtClientContext; +class CWlanMgmtClient; + +//! 1sec +#define WaitTimeForUi 500 + +enum WizardStatusSignal{ + WizardStatusSignalNone, + WizardStatusSignalFinished, + WizardStatusSignalCancelled, + WizardStatusSignalUndefined, +}; + +class ContextWlanApList +{ +public: + ContextWlanApList(); + ~ContextWlanApList(); + + void Add(QString name, + int netMode, + int secMode, + bool wpaPskInUse, + bool wpsSupported, + int signalStrength = 0); + + void clear(); + + const QList > &List() { return mList; } +private: + QList > mList; +}; + +class TestView: public HbView +{ +Q_OBJECT + +public: + + +public: + TestView(); + virtual ~TestView(); + + void createWizard(); + void showWizard(); + bool verifyStatus(WizardStatusSignal status, int iapId = -100); + +private slots: + void finished(int iapId, bool connected); + void cancelled(); + +public: + void deleteWizard(); + +public: + WlanWizard *mWizard; + +private: + WizardStatusSignal mWizardStatus; + int mConnectedIapId; +}; + + +class TestWlanWizardContext : public QObject +{ +Q_OBJECT +public: + TestWlanWizardContext(); + virtual ~TestWlanWizardContext(); + +public slots: + // Test framework functions + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +protected: + static const int ListNotFound = -2; + static const int ListNoneSelected = -1; + + enum ButtonStatus { + ButtonHidden, + ButtonDisabled, + ButtonEnabled + }; + /*! + * Reimplements QObject function that is invoked on any event. This + * function handles only a focus event to mSsid edit field. + * @param obj contains the object, where the event originates from. + * @param event contains the event id. + */ + bool eventFilter(QObject *obj, QEvent *event); + + QGraphicsWidget* findChildItem(const QString &itemName, QGraphicsItem *widget); + bool verifyStatus(WizardStatusSignal status, int iapId = -100); + bool verifyCurrentPage(int pageId, int retries = 10, int wait_ms = 200); + bool verifyCurrentPageWithInfo(int pageId, const QString &info, int retries = 10, int wait_ms = 200); + bool verifyDialogText(const QString objName, const QString text); + bool verifyActionButtonVisibility(bool prevVisible, bool cancelVisible, + bool nextVisible, bool finishVisible); + bool verifyActionButtons(ButtonStatus prevStatus, ButtonStatus cancelStatus, + ButtonStatus nextStatus, ButtonStatus finishStatus); + bool verifySummaryPage( + const QString &ssid, + int netMode, + bool hidden, + int secMode, + bool useWpaPsk, + const QString &destination = QString(), + int outerType = -1, + int innerType = -1, + bool eapFastProvMode = false); + + bool mouseClickObject(const QString objName); + bool insertTextToObject(const QString objName, const QString text); + bool selectRadioButton(const QString objName, int index); + bool verifyRadioButtonState(const QString objName, int index, const QString &text); + bool verifyCheckBoxState(const QString &objName, bool checked); + QStringList verifyRadioButtons(const QString objName); + int verifySelectedRadioButton(const QString objName); + bool selectCheckBoxState(const QString &objName, bool check); + + bool mouseClickNext(); + bool mouseClickPrevious(); + bool mouseClickCancel(); + bool mouseClickFinish(); + + QString toNetworkModeString(int netMode, bool isHidden); + QString toSecurityModeString(int secMode, int useWpaPsk); + + EapQtConfigInterface *getEapQtConfig(); + QString eapTypeToString(int type); + + void callWlanWizard_startPageOperation(); + +public: + static void setWlanMgmtClientObject(CWlanMgmtClient* object); + +public: + + static CWlanMgmtClient *mWlanMgmtClient; + +protected: + bool mEvent; + + // Test data + TestView *mView; + HbAutoTestMainWindow *mMainWindow; + WlanQtUtilsContext *mWlanQtUtilsContext; + EapQtConfigInterfaceContext *mEapQtUtilsContext; + WlanMgmtClientContext *mWlanMgmtClientContext; + ContextWlanApList *mApList; + ContextWlanApList *mApOpenList; +}; + +#endif /* TESTWLANWIZARDRNDUICONTEXT_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,1859 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard UT. +*/ + +// System includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardeap.h" +#include "testwlanwizardeap_conf.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanwizardpageinternal.h" +#include "eapwizardpage.h" +#include "eapqtvalidator_stub.h" + +#include "eapqtconfiginterface_context.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- +void TestWlanWizardEap::tc_eap_outer_page_orientation_change() +{ +#ifdef tc_eap_outer_page_orientation_change_enabled + + const QString ssid("tc_eap_outer_page_orientation_change"); + + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype(ButtonDisabled); + + mMainWindow->setOrientation(Qt::Horizontal, false); + QTest::qWait(WaitTimeForUi); + + verify_outertype(ButtonDisabled); + + mMainWindow->setOrientation(Qt::Vertical, false); + QTest::qWait(WaitTimeForUi); + + verify_outertype(ButtonDisabled); +#endif +} + +void TestWlanWizardEap::tc_eap_aka() +{ +#ifdef tc_eap_aka_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); +#endif +} + +void TestWlanWizardEap::tc_eap_sim() +{ +#ifdef tc_eap_sim_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapSim); +#endif +} + +void TestWlanWizardEap::tc_eap_leap() +{ +#ifdef tc_eap_leap_enabled + const QString username("user"); + const QString password("passwd"); + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createLeap(username,password); + + const QString ssid("tc_eap_leap"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_username_password_click_next(EapQtPluginHandle::PluginLeap, username, password); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginLeap),true); + + QTest::qWait(WaitTimeForUi); +#endif +} + +void TestWlanWizardEap::tc_eap_peap_gtc() +{ +#ifdef tc_eap_peap_gtc_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginPeap, + EapQtPluginHandle::PluginEapGtc); +#endif +} + +void TestWlanWizardEap::tc_eap_peap_mschapv2() +{ +#ifdef tc_eap_peap_mschapv2_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginPeap, + EapQtPluginHandle::PluginEapMschapv2); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2() +{ +#ifdef tc_eap_ttls_mschapv2_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_pap() +{ +#ifdef tc_eap_ttls_pap_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPap); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_gtc() +{ +#ifdef tc_eap_ttls_gtc_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginEapGtc); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserRejected() +{ +#ifdef tc_eap_aka_connect_KErrWlanUserRejected_enabled + tc_eap_aka_connect_error( + KErrWlanUserRejected, + HbParameterLengthLimiter("txt_occ_dialog_1_auth_failed_user_cert_rej").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanUserCertificateExpired() +{ +#ifdef tc_eap_aka_connect_KErrWlanUserCertificateExpired_enabled + tc_eap_aka_connect_error( + KErrWlanUserCertificateExpired, + HbParameterLengthLimiter("txt_occ_dialog_1_auth_failed_user_cert_exp").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanServerCertificateExpired() +{ +#ifdef tc_eap_aka_connect_KErrWlanServerCertificateExpired_enabled + tc_eap_aka_connect_error( + KErrWlanServerCertificateExpired, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed_server_ce").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanCerficateVerifyFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanCerficateVerifyFailed_enabled + tc_eap_aka_connect_error( + KErrWlanCerficateVerifyFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed_could_not").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoCipherSuite() +{ +#ifdef tc_eap_aka_connect_KErrWlanNoCipherSuite_enabled + tc_eap_aka_connect_error( + KErrWlanNoCipherSuite, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed_cipher_su").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanSimNotInstalled() +{ +#ifdef tc_eap_aka_connect_KErrWlanSimNotInstalled_enabled + tc_eap_aka_connect_error( + KErrWlanSimNotInstalled, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed_check_sim").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastPacStoreCorrupted, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed_reset_pac").arg( + eapTypeToString(EapQtPluginHandle::PluginEapFast))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapSimFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapSimFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapSimFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNotSubscribed() +{ +#ifdef tc_eap_aka_connect_KErrWlanNotSubscribed_enabled + tc_eap_aka_connect_error( + KErrWlanNotSubscribed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrCancel() +{ +#ifdef tc_eap_aka_connect_KErrCancel_enabled + tc_eap_aka_connect_error( + KErrCancel, + hbTrId("txt_occ_dialog_connection_failed")); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTlsFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapTlsFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapTlsFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapPeapFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapPeapFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapPeapFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapAkaFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapAkaFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapAkaFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapTtlsFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapTtlsFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapTtlsFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanLeapFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanLeapFailed_enabled + tc_eap_aka_connect_error( + KErrWlanLeapFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoUserCertificate() +{ +#ifdef tc_eap_aka_connect_KErrWlanNoUserCertificate_enabled + tc_eap_aka_connect_error( + KErrWlanNoUserCertificate, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastTunnelCompromiseError, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastUnexpextedTlvExhanged, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastNoMatchingPacForAid, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanEapFastAuthFailed() +{ +#ifdef tc_eap_aka_connect_KErrWlanEapFastAuthFailed_enabled + tc_eap_aka_connect_error( + KErrWlanEapFastAuthFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccessBarred() +{ +#ifdef tc_eap_aka_connect_KErrWlanAccessBarred_enabled + tc_eap_aka_connect_error( + KErrWlanAccessBarred, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanPasswordExpired() +{ +#ifdef tc_eap_aka_connect_KErrWlanPasswordExpired_enabled + tc_eap_aka_connect_error( + KErrWlanPasswordExpired, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanNoDialinPermissions() +{ +#ifdef tc_eap_aka_connect_KErrWlanNoDialinPermissions_enabled + tc_eap_aka_connect_error( + KErrWlanNoDialinPermissions, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanAccountDisabled() +{ +#ifdef tc_eap_aka_connect_KErrWlanAccountDisabled_enabled + tc_eap_aka_connect_error( + KErrWlanAccountDisabled, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_connect_KErrWlanRestrictedLogonHours() +{ +#ifdef tc_eap_aka_connect_KErrWlanRestrictedLogonHours_enabled + tc_eap_aka_connect_error( + KErrWlanRestrictedLogonHours, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapAka))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed() +{ +#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2, + KErrWlanEapGtcFailed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2() +{ +#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2, + KErrWlanEapMsChapv2, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed() +{ +#ifdef tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginPlainMschapv2, + KErrWlanNotSubscribed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginPlainMschapv2))); +#endif +} + +void TestWlanWizardEap::tc_eap_ttls_gtc_back_and_forward() +{ +#ifdef tc_eap_ttls_gtc_back_and_forward_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginEapGtc, + KErrWlanNotSubscribed, + HbParameterLengthLimiter("txt_occ_dialog_1_authentication_failed").arg( + eapTypeToString(EapQtPluginHandle::PluginEapGtc))); + + // Go back to outertype selection page + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_username_password(EapQtPluginHandle::PluginEapGtc); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_innertype( + EapQtPluginHandle::PluginEapTtls, + ButtonEnabled); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls)); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_outertype(ButtonEnabled); + + // Go forward to username & password page + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(); + + // Create new validators + mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTtls); + mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapGtc); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTtls)); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_innertype( + EapQtPluginHandle::PluginEapTtls, + ButtonEnabled); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + verify_username_password(EapQtPluginHandle::PluginEapGtc); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_set_outer_type_fails() +{ +#ifdef tc_eap_aka_set_outer_type_fails_enabled + const QString ssid("tc_eap_aka_set_outer_type_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + mEapQtUtilsContext->setSelectectedOuterTypesReturn(false); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_save_outer_configuration_fails() +{ +#ifdef tc_eap_aka_save_outer_configuration_fails_enabled + const QString ssid("tc_eap_aka_save_outer_configuration_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + mEapQtUtilsContext->setOuterConfigReturn(false); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_aka_set_configuration_reference_fails() +{ +#ifdef tc_eap_aka_set_configuration_reference_fails_enabled + const QString ssid("tc_eap_aka_set_configuration_reference_fails"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, KErrCancel); + + mEapQtUtilsContext->setConfigurationReference(3, false); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_peap_gtc_save_inner_configuration_fails() +{ +#ifdef tc_eap_peap_gtc_save_inner_configuration_fails_enabled + tc_eap_peap_ttls( + EapQtPluginHandle::PluginEapTtls, + EapQtPluginHandle::PluginEapGtc, + KErrGeneral, // Not used directly in sub test case + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"), + false ); +#endif +} + + +void TestWlanWizardEap::tc_eap_peap_identity_validators() +{ +#ifdef tc_eap_peap_identity_validators_enabled + const QString ssid("tc_eap_peap_identity_validators"); + const QString username("u"); + const QString password("p"); + const QString usernameIdentity("identity"); + const QString realm("realm.com"); + EapQtPluginHandle::Plugin outerType(EapQtPluginHandle::PluginPeap); + EapQtPluginHandle::Plugin innerType(EapQtPluginHandle::PluginEapGtc); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapTtlsPeap( + outerType, + true, + true, + usernameIdentity, + true, + realm, + innerType ); + + EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypePeap, EapQtConfig::Username); + EapQtValidatorStub* validatorRealm = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypePeap,EapQtConfig::Realm); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(true); + + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, eapTypeToString(outerType)), true ); + // Check box checked next enabled + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); + + // 1. Username validator returns false, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusInvalid); + validatorRealm->setReturnValue(EapQtValidator::StatusOk); + + QCOMPARE(selectCheckBoxState("setlabel_53_val", false), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 2. Username validator returns true, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusOk); + validatorRealm->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + // 3. back to valid state, checkboc checked + QCOMPARE(selectCheckBoxState("setlabel_53_val", true), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + // 4. Realm validator returns false, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusOk); + validatorRealm->setReturnValue(EapQtValidator::StatusInvalid); + + QCOMPARE(selectCheckBoxState("setlabel_54_val", false), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 5. Realm validator returns true, checkbox not checked + validatorUser->setReturnValue(EapQtValidator::StatusOk); + validatorRealm->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditRealm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditRealm", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + // 6. back to valid state, checkboc checked + QCOMPARE(selectCheckBoxState("setlabel_54_val", true), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_leap_user_password_validators() +{ +#ifdef tc_eap_leap_user_password_validators_enabled + const QString ssid("tc_eap_leap_user_password_validators"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createLeap(username,password); + + EapQtValidatorStub* validatorUser = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypeLeap, EapQtConfig::Username); + EapQtValidatorStub* validatorPassword = (EapQtValidatorStub*)mEapQtUtilsContext->validator( + EapQtExpandedEapType::TypeLeap, EapQtConfig::Password); + validatorUser->setReturnValue(EapQtValidator::StatusInvalid); + validatorPassword->setReturnValue(EapQtValidator::StatusInvalid); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + // 1. By default both validator return invalid + QCOMPARE( + verifyCurrentPageWithInfo( + EapWizardPage::PageUsernamePassword, + eapTypeToString(EapQtPluginHandle::PluginLeap)), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 2. User return ok, password invalid + validatorUser->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // 3. User return ok, password ok + validatorPassword->setReturnValue(EapQtValidator::StatusOk); + QCOMPARE( mouseClickObject("lineEditPassword"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPassword", password), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +#endif +} + +void TestWlanWizardEap::tc_eap_tls_no_user_certificate() +{ +#ifdef tc_eap_tls_no_user_certificate_enabled + + const QString ssid("tc_eap_tls_no_user_certificate"); + + QList caCerts; + QList userCerts; + + EapQtCertificateInfo caCert; + caCert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super Cert 1"); + caCerts.append(caCert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + -1); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page_select_and_click_next(ButtonDisabled, -1); + +#endif +} + +void TestWlanWizardEap::tc_eap_tls_one_user_certificate_with_ca_selection() +{ +#ifdef tc_eap_tls_one_user_certificate_with_ca_selection_enabled + const QString ssid("tc_eap_tls_one_user_certificate_with_ca_selection"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + + QList caCerts; + QList userCerts; + + EapQtCertificateInfo cert; + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert"); + caCerts.append(cert); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert"); + userCerts.append(cert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + 0); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page_select_and_click_next(ButtonEnabled, 0); + verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa2, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapTls),true); + +#endif +} + +void TestWlanWizardEap::tc_eap_tls_two_user_certificates() +{ +#ifdef tc_eap_tls_two_user_certificates_enabled + const QString ssid("tc_eap_tls_two_user_certificates"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + + QList caCerts; + QList userCerts; + + EapQtCertificateInfo cert; + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My CA Cert"); + caCerts.append(cert); + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My Super CA Cert"); + caCerts.append(cert); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert"); + userCerts.append(cert); + cert.setValue(EapQtCertificateInfo::CertificateLabel, "My User Cert Second"); + userCerts.append(cert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + 1); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page_select_and_click_next(ButtonDisabled, 1); + verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa2, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapTls),true); + +#endif +} + +void TestWlanWizardEap::tc_eap_tls_back_and_forward_certs_with_cert_update() +{ +#ifdef tc_eap_tls_back_and_forward_certs_with_cert_update_enabled + const QString ssid("tc_eap_tls_two_user_certificates"); + + const QString caCert1("My CA Cert"); + const QString caCert2("My CA Cert Second"); + + const QString userCert1("My User Cert"); + const QString userCert2("My User Cert Second"); + + QList caCerts; + QList userCerts; + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + + EapQtCertificateInfo cert; + cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert1); + caCerts.append(cert); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert1); + userCerts.append(cert); + + mEapQtUtilsContext->createEapTls( + caCerts, + 0, + userCerts, + 0); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(true); + verify_user_cert_page_select_and_click_next(ButtonEnabled, 0); + verify_identity_page(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + // backwards + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_user_cert_page(ButtonEnabled, userCert1, 0 ); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_outertype(ButtonEnabled); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, caCert2); + caCerts.append(cert); + mEapQtUtilsContext->setCertsCa(caCerts); + + cert.setValue(EapQtCertificateInfo::CertificateLabel, userCert2); + userCerts.append(cert); + mEapQtUtilsContext->setCertsUser(userCerts); + + mEapQtUtilsContext->createEapIdentifyValidators(EapQtPluginHandle::PluginEapTls); + + // Forward + QCOMPARE(mouseClickNext(), true); + verify_ca_cert_page_select_and_click_next(false); + verify_user_cert_page(ButtonDisabled); + + // backwards + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_ca_cert_page(caCert1, 1); + + QCOMPARE(mouseClickPrevious(), true); + QTest::qWait(WaitTimeForUi); + verify_outertype(ButtonEnabled); + + QCOMPARE(mouseClickNext(), true); + verify_ca_cert_page(caCert1, 1); + + QCOMPARE(mouseClickNext(), true); + verify_user_cert_page_select_and_click_next(ButtonDisabled, 0); + + verify_identity_and_click_next(eapTypeToString(EapQtPluginHandle::PluginEapTls)); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa2, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapTls),true); + +#endif +} + +void TestWlanWizardEap::tc_eap_sim_finish() +{ +#ifdef tc_eap_sim_finish_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); + + QCOMPARE( mouseClickFinish(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyStatus(WizardStatusSignalFinished, 3), true); +#endif +} + +void TestWlanWizardEap::tc_eap_sim_cancel() +{ +#ifdef tc_eap_sim_cancel_enabled + tc_eap_aka_sim(EapQtPluginHandle::PluginEapAka); + + QCOMPARE( mouseClickCancel(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE(verifyStatus(WizardStatusSignalCancelled), true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirmed() +{ +#ifdef tc_eap_fast_confirmed_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStatePasswordStored, + true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store() +{ +#ifdef tc_eap_fast_new_store_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStateStoreNotExists, + true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store_save_fails() +{ +#ifdef tc_eap_fast_new_store_save_fails_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStateStoreNotExists, + false); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store_and_validators() +{ +#ifdef tc_eap_fast_new_store_and_validators_enabled + const QString ssid("tc_eap_fast_new_store_and_validators"); + const QString username("user"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + "u", + "p"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore( + EapQtPacStoreConfig::PacStorePassword); + validator->setReturnValue(EapQtValidator::StatusInvalid); + + verify_outertype_select_first(ButtonDisabled); + verify_new_pac_store_password_page(ButtonDisabled); + + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + validator->setReturnValue(EapQtValidator::StatusOk); + + QCOMPARE( mouseClickObject("lineEditPassword"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPassword", username), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + +#endif +} + + +void TestWlanWizardEap::tc_eap_fast_new_store_back_and_forwards() +{ +#ifdef tc_eap_fast_new_store_back_and_forwards_enabled + const QString ssid("tc_eap_fast_new_store_back_and_forwards"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStateStoreNotExists); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + username, + password); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + + // backwards + QCOMPARE( mouseClickPrevious(), true ); + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickPrevious(), true ); + + mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2); + + // forwards + verify_outertype_select_first(ButtonEnabled); + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_new_store_read_config_fail() +{ +#ifdef tc_eap_fast_new_store_read_config_fail_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStateStoreNotExists, + true, + false); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirm_store() +{ +#ifdef tc_eap_fast_confirm_store_enabled + tc_eap_fast( + EapQtPacStoreConfig::PacStoreStatePasswordRequired, + true); +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirm_store_and_validators() +{ +#ifdef tc_eap_fast_confirm_store_and_validators_enabled + const QString ssid("tc_eap_fast_confirm_store_and_validators"); + const QString username_invalid("invalid"); + const QString username_valid("valid"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + "u", + "p"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + EapQtValidatorStub *validator = (EapQtValidatorStub*)mEapQtUtilsContext->validatorPacStore( + EapQtPacStoreConfig::PacStorePasswordConfirmation); + validator->setReturnValue(EapQtValidator::StatusInvalid); + + verify_outertype_select_first(ButtonDisabled); + verify_confirm_pac_store_password_page(ButtonEnabled); + + QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_invalid), true ); + QCOMPARE( mouseClickObject("labelError"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( mouseClickNext(), true ); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), true); + + + validator->setReturnValue(EapQtValidator::StatusOk); + + QCOMPARE( mouseClickObject("lineEditPasswordConfirm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPasswordConfirm", username_valid), true ); + QCOMPARE( mouseClickObject("labelError"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelError", hbTrId("txt_occ_info_incorrect_password")), false); + + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + +#endif +} + +void TestWlanWizardEap::tc_eap_fast_confirm_store_back_and_forwards() +{ +#ifdef tc_eap_fast_confirm_store_back_and_forwards_enabled + const QString ssid("tc_eap_fast_confirm_store_back_and_forwards"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(EapQtPacStoreConfig::PacStoreStatePasswordRequired); + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + username, + password); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); + + // backwards + QCOMPARE( mouseClickPrevious(), true ); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickPrevious(), true ); + + mEapQtUtilsContext->createInnerTypeValidators(EapQtPluginHandle::PluginEapMschapv2); + + // forwards + verify_outertype_select_first(ButtonEnabled); + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + verify_username_password(EapQtPluginHandle::PluginEapMschapv2); +#endif +} + + +// --------------------------------------------------------- +// HELPPER VERIFICATORS & NAVIGATORS +// --------------------------------------------------------- + +void TestWlanWizardEap::verify_outertype_select_first( + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + verify_outertype(nextButtonStatus); + + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_outertype( + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageOuterType), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + +void TestWlanWizardEap::verify_innertype_select_first( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + verify_innertype(outerType, nextButtonStatus); + + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_innertype( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus) +{ + int pageId; + if (outerType == EapQtPluginHandle::PluginPeap){ + pageId = EapWizardPage::PageInnerTypePeap; + + } else { + Q_ASSERT(outerType == EapQtPluginHandle::PluginEapTtls); + pageId = EapWizardPage::PageInnerTypeEapTtls; + } + QCOMPARE( verifyCurrentPageWithInfo(pageId, eapTypeToString(outerType)), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + +void TestWlanWizardEap::verify_username_password_click_next( + int type, + const QString &username, + const QString &password) +{ + verify_username_password(type); + + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditPassword"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditPassword", password), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("setlabel_56"), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_username_password(int type) +{ + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageUsernamePassword, eapTypeToString(type)), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +} + +void TestWlanWizardEap::verify_ca_cert_page_select_and_click_next(bool automatic) +{ + verify_ca_cert_page(); + + int index = 0; + if (automatic == false) { + index = 1; + } + QCOMPARE( selectRadioButton( "list", index ), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); +} + + +void TestWlanWizardEap::verify_ca_cert_page() +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( verifyRadioButtonState( + "list", + 0, + hbTrId("txt_occ_setlabel_val_select_automatically")), true); +} + +void TestWlanWizardEap::verify_ca_cert_page(const QString &text, int index) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateCa), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE( verifyRadioButtonState("list", index, text), true); +} + +void TestWlanWizardEap::verify_user_cert_page_select_and_click_next( + ButtonStatus nextButtonStatus, + int index) +{ + verify_user_cert_page(nextButtonStatus); + + if (index != -1){ + QCOMPARE( selectRadioButton( "list", index ), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); + } else { + QCOMPARE( + verifyDialogText( + "errorLabel", + hbTrId("txt_occ_dialog_no_certificates_installed_wizard_c")), true); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + } +} + +void TestWlanWizardEap::verify_user_cert_page(ButtonStatus nextButtonStatus) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + + +void TestWlanWizardEap::verify_user_cert_page( + ButtonStatus nextButtonStatus, + const QString &text, + int index) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageCertificateUser), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); + + QCOMPARE( verifyRadioButtonState("list", index, text), true); +} + +void TestWlanWizardEap::verify_identity_modify_and_click_next( + const QString &outerType, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm) +{ + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); + + QCOMPARE(selectCheckBoxState("setlabel_53_val", usernameAutomatic), true); + QCOMPARE(selectCheckBoxState("setlabel_54_val", realmAutomatic), true); + + QTest::qWait(WaitTimeForUi); + + QCOMPARE(verifyCheckBoxState("setlabel_53_val", usernameAutomatic), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", realmAutomatic), true); + + QCOMPARE( mouseClickObject("lineEditUsername"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditUsername", username), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditRealm"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditRealm", realm), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("setlabel_53"), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_identity_and_click_next(const QString &outerType) +{ + verify_identity_page(outerType); + + QCOMPARE(verifyCheckBoxState("setlabel_53_val", true), true); + QCOMPARE(verifyCheckBoxState("setlabel_54_val", true), true); + + QCOMPARE( mouseClickObject("setlabel_53"), true ); + QCOMPARE( mouseClickNext(), true ); +} + +void TestWlanWizardEap::verify_identity_page(const QString &outerType) +{ + QCOMPARE( verifyCurrentPageWithInfo(EapWizardPage::PageIdentity, outerType), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); +} + + +void TestWlanWizardEap::verify_new_pac_store_password_page( + ButtonStatus nextButtonStatus ) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PageNewPacStorePassword), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + + +void TestWlanWizardEap::verify_confirm_pac_store_password_page( + ButtonStatus nextButtonStatus) +{ + QCOMPARE( verifyCurrentPage(EapWizardPage::PagePromptPacStorePassword), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, nextButtonStatus, ButtonHidden), true ); +} + +// --------------------------------------------------------- +// SUBTEST CASES +// --------------------------------------------------------- + + +void TestWlanWizardEap::tc_eap_aka_sim(int type) +{ + // TODO: verify IAP settings + // TODO: verify call stack + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(type); + + const QString ssid("tc_eap_aka_sim"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecMode802_1x, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecMode802_1x, + true, + hbTrId("txt_occ_dblist_destination_val_internet"), + type),true); +} + +void TestWlanWizardEap::tc_eap_peap_ttls( + int outerType, + int innerType, + int errorCode, + const QString &errorString, + bool saveInnerConfReturn ) +{ + // TODO: verify IAP settings + // TODO: verify call stack + const QString ssid("tc_eap_peap_ttls"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + + if (errorCode == KErrNone) { + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + } else { + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode); + } + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapTtlsPeap( + (EapQtPluginHandle::Plugin)outerType, + true, + true, + QString(), //usernameIdentity, + true, + QString(), //realm, + (EapQtPluginHandle::Plugin)innerType ); + + mEapQtUtilsContext->createInner( + (EapQtPluginHandle::Plugin)outerType, + (EapQtPluginHandle::Plugin)innerType, + username, + password); + + mEapQtUtilsContext->setInnerConfigReturn(saveInnerConfReturn); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + verify_ca_cert_page_select_and_click_next(true); + verify_identity_and_click_next(eapTypeToString((EapQtPluginHandle::Plugin)outerType)); + verify_innertype_select_first( + (EapQtPluginHandle::Plugin)outerType, + ButtonDisabled); + + verify_username_password_click_next(innerType, username, password); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + if (errorCode == KErrNone){ + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + (EapQtPluginHandle::Plugin)outerType, + (EapQtPluginHandle::Plugin)innerType),true); + + } else { + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + } +} + +void TestWlanWizardEap::tc_eap_aka_connect_error( + int errorCode, + const QString &errorString) +{ + // TODO: verify IAP settings + // TODO: verify call stack + + const QString ssid(errorString); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(false); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(3, errorCode); + + mEapQtUtilsContext->setConfigurationReference(3, true); + mEapQtUtilsContext->createEapAkaSim(EapQtPluginHandle::PluginEapAka); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa2, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorString), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); +} + + +void TestWlanWizardEap::tc_eap_fast( + int pacStoreState, + bool savePacStoreReturn, + bool readPacStoreReturn) +{ + // TODO: verify IAP settings + // TODO: verify call stack + + const QString ssid("tc_eap_fast"); + const QString username("u"); + const QString password("p"); + + mWlanQtUtilsContext->setCreateWlanIapResult(4); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(4); + mWlanQtUtilsContext->setSignalIctResult(4, WlanQtUtils::IctPassed); + + mEapQtUtilsContext->setConfigurationReference(4, true); + mEapQtUtilsContext->createEapFast(pacStoreState); + mEapQtUtilsContext->setPacStoreConfigSaveReturn(savePacStoreReturn); + mEapQtUtilsContext->setPacStoreConfigReadReturn(readPacStoreReturn); + + if (!readPacStoreReturn) { + EapQtPacStoreConfig pacStoreConfig; + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStoreReset, + true); + + mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true); + } + + mEapQtUtilsContext->createInner( + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + username, + password); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeWpa, + false, + false); + + mView->showWizard(); + + verify_outertype_select_first(ButtonDisabled); + + if (!readPacStoreReturn) { + EapQtPacStoreConfig pacStoreConfig; + + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStorePassword, + ""); + + pacStoreConfig.setValue( + EapQtPacStoreConfig::PacStoreSavePassword, + true); + + + mEapQtUtilsContext->setPacStoreConfigSave(pacStoreConfig, true); + } + + switch (pacStoreState){ + case EapQtPacStoreConfig::PacStoreStateStoreNotExists: + verify_new_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + break; + + case EapQtPacStoreConfig::PacStoreStatePasswordRequired: + verify_confirm_pac_store_password_page(ButtonEnabled); + QCOMPARE( mouseClickNext(), true ); + break; + } + + verify_username_password_click_next(EapQtPluginHandle::PluginEapMschapv2,username,password); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPage::PageProcessSettings,ssid), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + if (savePacStoreReturn) { + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( verifySummaryPage( + ssid, + CMManagerShim::Infra, + false, + CMManagerShim::WlanSecModeWpa, + false, + hbTrId("txt_occ_dblist_destination_val_internet"), + EapQtPluginHandle::PluginEapFast, + EapQtPluginHandle::PluginEapMschapv2, + true) ,true); + } else { + QCOMPARE( + verifyCurrentPageWithInfo( + WlanWizardPageInternal::PageGenericError, + hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + } +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDEAP_H +#define TESTWLANWIZARDRNDEAP_H + +#include "testwlanwizardcontext.h" + +class TestWlanWizardEap : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + void tc_eap_outer_page_orientation_change(); + void tc_eap_aka(); + void tc_eap_sim(); + void tc_eap_leap(); + void tc_eap_peap_gtc(); + void tc_eap_peap_mschapv2(); + void tc_eap_ttls_mschapv2(); + void tc_eap_ttls_pap(); + void tc_eap_ttls_gtc(); + void tc_eap_aka_connect_KErrWlanUserRejected(); + void tc_eap_aka_connect_KErrWlanUserCertificateExpired(); + void tc_eap_aka_connect_KErrWlanServerCertificateExpired(); + void tc_eap_aka_connect_KErrWlanCerficateVerifyFailed(); + void tc_eap_aka_connect_KErrWlanNoCipherSuite(); + void tc_eap_aka_connect_KErrWlanSimNotInstalled(); + void tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted(); + void tc_eap_aka_connect_KErrWlanEapSimFailed(); + void tc_eap_aka_connect_KErrWlanNotSubscribed(); + void tc_eap_aka_connect_KErrCancel(); + void tc_eap_aka_connect_KErrWlanEapTlsFailed(); + void tc_eap_aka_connect_KErrWlanEapPeapFailed(); + void tc_eap_aka_connect_KErrWlanEapAkaFailed(); + void tc_eap_aka_connect_KErrWlanEapTtlsFailed(); + void tc_eap_aka_connect_KErrWlanLeapFailed(); + void tc_eap_aka_connect_KErrWlanNoUserCertificate(); + void tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError(); + void tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged(); + void tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled(); + void tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid(); + void tc_eap_aka_connect_KErrWlanEapFastAuthFailed(); + void tc_eap_aka_connect_KErrWlanAccessBarred(); + void tc_eap_aka_connect_KErrWlanPasswordExpired(); + void tc_eap_aka_connect_KErrWlanNoDialinPermissions(); + void tc_eap_aka_connect_KErrWlanAccountDisabled(); + void tc_eap_aka_connect_KErrWlanRestrictedLogonHours(); + void tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed(); + void tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2(); + void tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed(); + void tc_eap_ttls_gtc_back_and_forward(); + void tc_eap_aka_set_outer_type_fails(); + void tc_eap_aka_save_outer_configuration_fails(); + void tc_eap_aka_set_configuration_reference_fails(); + void tc_eap_peap_gtc_save_inner_configuration_fails(); + void tc_eap_peap_identity_validators(); + void tc_eap_leap_user_password_validators(); + void tc_eap_tls_no_user_certificate(); + void tc_eap_tls_one_user_certificate_with_ca_selection(); + void tc_eap_tls_two_user_certificates(); + void tc_eap_tls_back_and_forward_certs_with_cert_update(); + void tc_eap_sim_finish(); + void tc_eap_sim_cancel(); + void tc_eap_fast_confirmed(); + void tc_eap_fast_new_store(); + void tc_eap_fast_new_store_save_fails(); + void tc_eap_fast_new_store_and_validators(); + void tc_eap_fast_new_store_back_and_forwards(); + void tc_eap_fast_new_store_read_config_fail(); + void tc_eap_fast_confirm_store(); + void tc_eap_fast_confirm_store_and_validators(); + void tc_eap_fast_confirm_store_back_and_forwards(); + +private: // Helpper methods + void verify_outertype_select_first( + TestWlanWizardContext::ButtonStatus nextButtonStatus); + void verify_outertype( + TestWlanWizardContext::ButtonStatus nextButtonStatus); + + void verify_innertype_select_first( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus); + + void verify_innertype( + int outerType, + TestWlanWizardContext::ButtonStatus nextButtonStatus); + + void verify_username_password_click_next( + int type, + const QString &username, + const QString &password); + + void verify_username_password(int type); + + void verify_ca_cert_page_select_and_click_next(bool automatic); + void verify_ca_cert_page(); + void verify_ca_cert_page( const QString &text, int index); + + void verify_user_cert_page_select_and_click_next( + ButtonStatus nextButtonStatus, + int index); + + void verify_user_cert_page(ButtonStatus nextButtonStatus); + void verify_user_cert_page( + ButtonStatus nextButtonStatus, + const QString &text, + int index); + + void verify_identity_modify_and_click_next( + const QString &outerType, + bool usernameAutomatic, + const QString &username, + bool realmAutomatic, + const QString &realm); + void verify_identity_and_click_next(const QString &outerType); + void verify_identity_page(const QString &outerType); + + void verify_new_pac_store_password_page(ButtonStatus nextButtonStatus); + void verify_confirm_pac_store_password_page(ButtonStatus nextButtonStatus); + +private: // Helpper test cases + void tc_eap_aka_sim(int type); + + void tc_eap_peap_ttls( + int outerType, + int innerType, + int errorCode = 0, + const QString &errorString = QString(), + bool saveInnerConfReturn = true); + + void tc_eap_aka_connect_error( + int errorCode, + const QString &errorString); + + void tc_eap_fast( + int pacStoreState, + bool savePacStoreReturn, + bool readPacStoreReturn = true); + + +}; + +#endif /* TESTWLANWIZARDRNDEAP_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardeap_conf.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants + +#define tc_eap_outer_page_orientation_change_enabled +#define tc_eap_aka_enabled +#define tc_eap_sim_enabled +#define tc_eap_leap_enabled +#define tc_eap_peap_gtc_enabled +#define tc_eap_peap_mschapv2_enabled +#define tc_eap_ttls_mschapv2_enabled +#define tc_eap_ttls_pap_enabled +#define tc_eap_ttls_gtc_enabled +#define tc_eap_aka_connect_KErrWlanUserRejected_enabled +#define tc_eap_aka_connect_KErrWlanUserCertificateExpired_enabled +#define tc_eap_aka_connect_KErrWlanServerCertificateExpired_enabled +#define tc_eap_aka_connect_KErrWlanCerficateVerifyFailed_enabled +#define tc_eap_aka_connect_KErrWlanNoCipherSuite_enabled +#define tc_eap_aka_connect_KErrWlanSimNotInstalled_enabled +#define tc_eap_aka_connect_KErrWlanEapFastPacStoreCorrupted_enabled +#define tc_eap_aka_connect_KErrWlanEapSimFailed_enabled +#define tc_eap_aka_connect_KErrWlanNotSubscribed_enabled +#define tc_eap_aka_connect_KErrCancel_enabled +#define tc_eap_aka_connect_KErrWlanEapTlsFailed_enabled +#define tc_eap_aka_connect_KErrWlanEapPeapFailed_enabled +#define tc_eap_aka_connect_KErrWlanEapAkaFailed_enabled +#define tc_eap_aka_connect_KErrWlanEapTtlsFailed_enabled +#define tc_eap_aka_connect_KErrWlanLeapFailed_enabled +#define tc_eap_aka_connect_KErrWlanNoUserCertificate_enabled +#define tc_eap_aka_connect_KErrWlanEapFastTunnelCompromiseError_enabled +#define tc_eap_aka_connect_KErrWlanEapFastUnexpextedTlvExhanged_enabled +#define tc_eap_aka_connect_KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled_enabled +#define tc_eap_aka_connect_KErrWlanEapFastNoMatchingPacForAid_enabled +#define tc_eap_aka_connect_KErrWlanEapFastAuthFailed_enabled +#define tc_eap_aka_connect_KErrWlanAccessBarred_enabled +#define tc_eap_aka_connect_KErrWlanPasswordExpired_enabled +#define tc_eap_aka_connect_KErrWlanNoDialinPermissions_enabled +#define tc_eap_aka_connect_KErrWlanAccountDisabled_enabled +#define tc_eap_aka_connect_KErrWlanRestrictedLogonHours_enabled +#define tc_eap_ttls_mschapv2_connect_KErrWlanEapGtcFailed_enabled +#define tc_eap_ttls_mschapv2_connect_KErrWlanEapMsChapv2_enabled +#define tc_eap_ttls_mschapv2_connect_KErrWlanNotSubscribed_enabled +#define tc_eap_ttls_gtc_back_and_forward_enabled +#define tc_eap_aka_set_outer_type_fails_enabled +#define tc_eap_aka_save_outer_configuration_fails_enabled +#define tc_eap_aka_set_configuration_reference_fails_enabled +#define tc_eap_peap_gtc_save_inner_configuration_fails_enabled +#define tc_eap_peap_identity_validators_enabled +#define tc_eap_leap_user_password_validators_enabled +#define tc_eap_tls_no_user_certificate_enabled +#define tc_eap_tls_one_user_certificate_with_ca_selection_enabled +#define tc_eap_tls_two_user_certificates_enabled +#define tc_eap_tls_back_and_forward_certs_with_cert_update_enabled +#define tc_eap_sim_finish_enabled +#define tc_eap_sim_cancel_enabled +#define tc_eap_fast_confirmed_enabled +#define tc_eap_fast_new_store_enabled +#define tc_eap_fast_new_store_save_fails_enabled +#define tc_eap_fast_new_store_and_validators_enabled +#define tc_eap_fast_new_store_back_and_forwards_enabled +#define tc_eap_fast_new_store_read_config_fail_enabled +#define tc_eap_fast_confirm_store_enabled +#define tc_eap_fast_confirm_store_and_validators_enabled +#define tc_eap_fast_confirm_store_back_and_forwards_enabled + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,1260 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardmanual.h" +#include "testwlanwizardmanual_conf.h" +#include "hbautotest.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanwizardpagessid.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + + +void TestWlanWizardManual::tcStartWizard() +{ + qDebug("Start TestWlanWizardManual"); +} + +/*! + * + */ +void TestWlanWizardManual::tc_open_scan_results_received_at_scan_page() +{ +#ifdef tc_open_scan_results_received_at_scan_page_enabled + + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mWlanQtUtilsContext->setImmediateApScanResult(false); + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + mWlanQtUtilsContext->emitScanApReady(); + mWlanQtUtilsContext->setImmediateApScanResult(true); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_attempt_to_input_too_long_ssid() +{ +#ifdef tc_attempt_to_input_too_long_ssid_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanDirectResult("12345678901234567890123456789012", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "1234567890123456789012345678901234567890"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "12345678901234567890123456789012"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_succesful_press_cancel_at_summary() +{ +#ifdef tc_scan_succesful_press_cancel_at_summary_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + + QCOMPARE( mouseClickCancel(), true ); + + QTest::qWait(WaitTimeForUi); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_press_previous_at_scanning_page() +{ +#ifdef tc_press_previous_at_scanning_page_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + // Click previous button and next again + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_succesful_go_to_summary_and_finish() +{ +#ifdef tc_scan_succesful_go_to_summary_and_finish_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonDisabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + // Currently against the spec in http://wikis.in.nokia.com/pub/UXD/101ConnectionManager/occ_logical_flows_and_wireframes.pdf + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); + QCOMPARE( mouseClickFinish(), true ); +#endif +} + +/*! + * Stop verifying buttons for views that have been already verified. + */ +void TestWlanWizardManual::tc_wep_pwd_too_short_error_label() +{ +#ifdef tc_wep_pwd_too_short_error_label_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + + // Key query short pwd + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "password"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_key_is_of_incorrect_length_please")), true ); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + + // Key query success + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", ""), true ); + QCOMPARE( insertTextToObject("lineEditKey", "12345"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_press_previous_at_key_query() +{ +#ifdef tc_press_previous_at_key_query_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_manual_selection_with_press_previous() +{ +#ifdef tc_manual_selection_with_press_previous_enabled + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkMode, "huuhaa3421"), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkMode, "huuhaa3421"), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonHidden, ButtonEnabled), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_illegal_characters_in_wep_key() +{ +#ifdef tc_illegal_characters_in_wep_key_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "passworddd"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_illegal_characters_in_key_please_c")), true ); + QTest::qWait(WaitTimeForUi); + +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_too_short_wpa_key() +{ +#ifdef tc_too_short_wpa_key_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QTest::qWait(2000); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "1234"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyDialogText("labelErrorNote", hbTrId("txt_occ_dialog_preshared_key_too_short_at_least")), true ); + QTest::qWait(WaitTimeForUi); +#endif +} + +/*! + * wpa psk + */ +void TestWlanWizardManual::tc_wpa_psk_success() +{ +#ifdef tc_wpa_psk_success_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QTest::qWait(2000); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "1234567890"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * no wpa psk + */ +void TestWlanWizardManual::tc_wpa_no_psk_go_to_eap_start() +{ +#ifdef tc_wpa_no_psk_go_to_eap_start_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); +#endif +} + +/*! + * wpa2 psk + */ +void TestWlanWizardManual::tc_wpa2_psk_success() +{ +#ifdef tc_wpa2_psk_success_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QTest::qWait(2000); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); + + QCOMPARE( insertTextToObject("lineEditKey", "1234567890"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * wpa2 no psk + */ +void TestWlanWizardManual::tc_wpa2_no_psk_go_to_eap_start() +{ +#ifdef tc_wpa2_no_psk_go_to_eap_start_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); +#endif +} + +/*! + * Wlan network closed -> generic error + */ +void TestWlanWizardManual::tc_network_closed_generic_error() +{ +#ifdef tc_network_closed_generic_error_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkClosed(100, 1); + mWlanQtUtilsContext->setConnectionSuccessed(false); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_connection_failed")), true ); + +#endif +} + +/*! + * adhoc no psk + */ +void TestWlanWizardManual::tc_adhoc_network_no_psk() +{ +#ifdef tc_adhoc_network_no_psk_enabled + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + +#endif +} + +/*! + * 802_1x + */ +void TestWlanWizardManual::tc_secmode_802_1x_go_to_eap_start() +{ +#ifdef tc_secmode_802_1x_go_to_eap_start_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageEapStart), true ); +#endif +} + +/*! + * Wapi + */ +void TestWlanWizardManual::tc_sec_mode_wapi() +{ +#ifdef tc_sec_mode_wapi_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWapi, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * Multiple AP scan match results + */ +void TestWlanWizardManual::tc_multiple_open_scan_results_single_match() +{ +#ifdef tc_multiple_open_scan_results_single_match_enabled + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApOpenList->Add("foobar", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 300); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 200); + + mApList->Add("foobar", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 300); + + mWlanQtUtilsContext->setScanWlanApsResult(mApOpenList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("foobar", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "foobar"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "foobar"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "foobar"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_iap_creation_fail() +{ +#ifdef tc_iap_creation_fail_enabled + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(-1); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + + QStringList buttons; + buttons << hbTrId("txt_occ_dblist_val_infrastructure_public") + << hbTrId("txt_occ_list_infrastructure_hidden") + << hbTrId("txt_occ_list_adhoc_1"); + QCOMPARE( verifyRadioButtons("list"), buttons ); + + QCOMPARE( selectRadioButton( "list", 2 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( verifySelectedRadioButton("list"), ListNoneSelected ); + QCOMPARE( selectRadioButton( "list", 2 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageNetworkSecurity, "huuhaa3421"), true ); + + buttons.clear(); + buttons << hbTrId("txt_occ_list_open") + << hbTrId("txt_occ_list_wep_1"); + QCOMPARE( verifyRadioButtons("list"), buttons ); + + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret")), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_ap_status_not_ok() +{ +#ifdef tc_scan_ap_status_not_ok_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mWlanQtUtilsContext->setScanApStatus(WlanQtUtils::ScanStatusError); + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_scan_direct_status_not_ok() +{ +#ifdef tc_scan_direct_status_not_ok_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false); + + mWlanQtUtilsContext->setScanWlanApsResult(mApList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + //mWlanQtUtilsContext->setImmediateApScanResult(false); + mWlanQtUtilsContext->setScanDirectStatus(WlanQtUtils::ScanStatusError); + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); +#endif +} + +/*! + * Ict Result enumerator used. Hotspot. + */ +void TestWlanWizardManual::tc_ictresult_enumerated_hotspot() +{ +#ifdef tc_ictresult_enumerated_hotspot_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctHotspotPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(1000); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QTest::qWait(5000); +#endif +} + +/*! + * Ict Result enumerator used. Ict canceled. + */ +void TestWlanWizardManual::tc_ictresult_enumerated_cancel() +{ +#ifdef tc_ictresult_enumerated_cancel_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 400); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctCancelled); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(1000); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(1000); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); +#endif +} + +/*! + * Ict fails in this case + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_2_netmode_options() +{ +#ifdef tc_multiple_ssids_with_same_name_2_netmode_options_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, false, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctFailed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QStringList buttons; + buttons << hbTrId("txt_occ_list_infrastructure_hidden") + << hbTrId("txt_occ_list_adhoc_1"); + QCOMPARE( verifyRadioButtons("list"), buttons ); + + QTest::qWait(WaitTimeForUi); + QCOMPARE( selectRadioButton( "list", 1 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_press_previous() +{ +#ifdef tc_multiple_ssids_with_same_name_press_previous_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( selectRadioButton( "list", 1 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_all_sec_modes() +{ +#ifdef tc_multiple_ssids_with_same_name_all_sec_modes_enabled + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false, 500); + mApOpenList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApOpenList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + mApOpenList->Add("dippadappa", CMManagerShim::Infra, CMManagerShim::WlanSecModeOpen, false, false, 200); + + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa2, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Adhoc, CMManagerShim::WlanSecModeOpen, false, false, 400); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanApsResult(mApOpenList->List()); + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QStringList buttons; + buttons << hbTrId("txt_occ_dblist_val_infrastructure_public") + << hbTrId("txt_occ_list_infrastructure_hidden") + << hbTrId("txt_occ_list_adhoc_1"); + QCOMPARE( verifyRadioButtons("list"), buttons ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( mouseClickPrevious(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QCOMPARE( mouseClickNext(), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_orientation_switch() +{ +#ifdef tc_multiple_ssids_with_same_name_orientation_switch_enabled + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + // Add duplicates + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, true, false, 500); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, false, 300); + mApList->Add("huuhaa3421", CMManagerShim::Infra, CMManagerShim::WlanSecMode802_1x, false, false, 200); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa3421", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + + mMainWindow->setOrientation(Qt::Horizontal, false); + QTest::qWait(WaitTimeForUi); + mMainWindow->setOrientation(Qt::Vertical, false); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa3421"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa3421"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkSecurity), true ); + QCOMPARE( selectRadioButton( "list", 0 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageKeyQuery, "huuhaa3421"), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_wps_and_nonwps() +{ +#ifdef tc_multiple_ssids_with_same_name_wps_and_nonwps_enabled + mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, false, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, true, 300); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageNetworkMode), true ); + QStringList buttons; + buttons << hbTrId("txt_occ_list_infrastructure_hidden") + << hbTrId("txt_occ_list_wifi_protected_setup"); + QCOMPARE( verifyRadioButtons("list"), buttons ); + QCOMPARE( selectRadioButton( "list", 1 ), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageWpsStart), true ); +#endif +} + +/*! + * + */ +void TestWlanWizardManual::tc_multiple_ssids_with_same_name_two_wps_aps() +{ +#ifdef tc_multiple_ssids_with_same_name_two_wps_aps_enabled + mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWpa, false, true, 100); + + // Add all five kinds of security modes. + mApList->Add("huuhaa", CMManagerShim::Infra, CMManagerShim::WlanSecModeWep, true, true, 300); + + mWlanQtUtilsContext->setScanWlanDirectResult("huuhaa", mApList->List()); + mWlanQtUtilsContext->setCreateWlanIapResult(100); + mWlanQtUtilsContext->setSignalIctResult(100, WlanQtUtils::IctPassed); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(100); + mWlanQtUtilsContext->setConnectionSuccessed(true); + + mView->showWizard(); + + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSsid), true ); + + QCOMPARE( mouseClickObject("lineEditKey"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( insertTextToObject("lineEditKey", "huuhaa"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickObject("dialog"), true ); + QTest::qWait(WaitTimeForUi); + QCOMPARE( mouseClickNext(), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageScanning, "huuhaa"), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageWpsStart), true ); +#endif +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNMANUAL_H_ +#define TESTWLANWIZARDRNMANUAL_H_ + +#include "testwlanwizardcontext.h" + +class TestWlanWizardManual : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + // Test cases + void tcStartWizard(); + void tc_open_scan_results_received_at_scan_page(); + void tc_attempt_to_input_too_long_ssid(); + void tc_scan_succesful_press_cancel_at_summary(); + void tc_press_previous_at_scanning_page(); + void tc_scan_succesful_go_to_summary_and_finish(); + void tc_wep_pwd_too_short_error_label(); + void tc_press_previous_at_key_query(); + void tc_manual_selection_with_press_previous(); + void tc_illegal_characters_in_wep_key(); + void tc_too_short_wpa_key(); + void tc_wpa_psk_success(); + void tc_wpa_no_psk_go_to_eap_start(); + void tc_wpa2_psk_success(); + void tc_wpa2_no_psk_go_to_eap_start(); + void tc_network_closed_generic_error(); + void tc_adhoc_network_no_psk(); + void tc_secmode_802_1x_go_to_eap_start(); + void tc_sec_mode_wapi(); + void tc_multiple_open_scan_results_single_match(); + void tc_iap_creation_fail(); + void tc_scan_ap_status_not_ok(); + void tc_scan_direct_status_not_ok(); + void tc_ictresult_enumerated_hotspot(); + void tc_ictresult_enumerated_cancel(); + void tc_multiple_ssids_with_same_name_2_netmode_options(); + void tc_multiple_ssids_with_same_name_press_previous(); + void tc_multiple_ssids_with_same_name_all_sec_modes(); + void tc_multiple_ssids_with_same_name_orientation_switch(); + void tc_multiple_ssids_with_same_name_wps_and_nonwps(); + void tc_multiple_ssids_with_same_name_two_wps_aps(); + +}; + +#endif /* TESTWLANWIZARDRNMANUAL_H_ */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardmanual_conf.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants +#define tc_open_scan_results_received_at_scan_page_enabled +#define tc_attempt_to_input_too_long_ssid_enabled +#define tc_scan_succesful_press_cancel_at_summary_enabled +#define tc_press_previous_at_scanning_page_enabled +#define tc_scan_succesful_go_to_summary_and_finish_enabled +#define tc_wep_pwd_too_short_error_label_enabled +#define tc_press_previous_at_key_query_enabled +#define tc_manual_selection_with_press_previous_enabled +#define tc_illegal_characters_in_wep_key_enabled +#define tc_too_short_wpa_key_enabled +#define tc_wpa_psk_success_enabled +#define tc_wpa_no_psk_go_to_eap_start_enabled +#define tc_wpa2_psk_success_enabled +#define tc_wpa2_no_psk_go_to_eap_start_enabled +#define tc_network_closed_generic_error_enabled +#define tc_adhoc_network_no_psk_enabled +#define tc_secmode_802_1x_go_to_eap_start_enabled +#define tc_sec_mode_wapi_enabled +#define tc_multiple_open_scan_results_single_match_enabled +#define tc_iap_creation_fail_enabled +#define tc_scan_ap_status_not_ok_enabled +#define tc_scan_direct_status_not_ok_enabled +#define tc_ictresult_enumerated_hotspot_enabled +#define tc_ictresult_enumerated_cancel_enabled +#define tc_multiple_ssids_with_same_name_2_netmode_options_enabled +#define tc_multiple_ssids_with_same_name_press_previous_enabled +#define tc_multiple_ssids_with_same_name_all_sec_modes_enabled +#define tc_multiple_ssids_with_same_name_orientation_switch_enabled +#define tc_multiple_ssids_with_same_name_wps_and_nonwps_enabled +#define tc_multiple_ssids_with_same_name_two_wps_aps_enabled diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,496 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WLAN Wizard UT. +*/ + +// System includes +#include +#include +#include +#include +#include + +// User includes +#include "testwlanwizardwps.h" +#include "testwlanwizardwps_conf.h" +#include "wlanwizard.h" +#include "wlanwizard_p.h" +#include "wlanqtutils_context.h" +#include "wlanqtutils.h" +#include "wlanqtutilsap.h" +#include "wlanwizardpageinternal.h" +#include "wpswizardpage.h" + +#include "wlanmgmtclient_context.h" + +// External function prototypes + +// Local constants + + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------- +// TEST CASES +// --------------------------------------------------------- + +void TestWlanWizardWps::tcConfigureManualOpen() +{ +#ifdef tcConfigureManualOpen_enabled + const QString ssid("tcConfigureManualOpen"); + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, CMManagerShim::Infra); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeOpen); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); + ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, false); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Infra, + CMManagerShim::WlanSecModeOpen, + false, + true); + + mView->showWizard(); + verifyModeSelection(); + QCOMPARE(selectRadioButton("radioButtonList", 2), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); +#endif +} + +void TestWlanWizardWps::tcPushButtonOpen() +{ +#ifdef tcPushButtonOpen_enabled + tcPushButton( + "tcPushButtonOpen", + EWlanIapSecurityModeAllowUnsecure, + CMManagerShim::WlanSecModeOpen, + EWlanOperatingModeInfrastructure, + CMManagerShim::Infra, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep1() +{ +#ifdef tcPushButtonWep1_enabled + tcPushButton( + "tcPushButtonWep1", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep2() +{ +#ifdef tcPushButtonWep2_enabled + tcPushButton( + "tcPushButtonWep2", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey2, + CMManagerShim::WepKeyIndex2); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep3() +{ +#ifdef tcPushButtonWep3_enabled + tcPushButton( + "tcPushButtonWep3", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey3, + CMManagerShim::WepKeyIndex3); +#endif +} + +void TestWlanWizardWps::tcPushButtonWep4() +{ +#ifdef tcPushButtonWep4_enabled + tcPushButton( + "tcPushButtonWep4", + EWlanIapSecurityModeWep, + CMManagerShim::WlanSecModeWep, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey4, + CMManagerShim::WepKeyIndex4); +#endif +} + +void TestWlanWizardWps::tcPushButtonWpa() +{ +#ifdef tcPushButtonWpa_enabled + tcPushButton( + "tcPushButtonWpa", + EWlanIapSecurityModeWpa, + CMManagerShim::WlanSecModeWpa, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPushButtonWpa2() +{ +#ifdef tcPushButtonWpa2_enabled + tcPushButton( + "tcPushButtonWpa2", + EWlanIapSecurityModeWpa2Only, + CMManagerShim::WlanSecModeWpa2, + EWlanOperatingModeAdhoc, + CMManagerShim::Adhoc, + EWlanDefaultWepKey1, + CMManagerShim::WepKeyIndex1); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError_enabled + tcPinCode_failure( + KErrWlanProtectedSetupOOBInterfaceReadError, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure_enabled + tcPinCode_failure( + KErrWlanProtectedSetupDecryptionCRCFailure, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetup2_4ChannelNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetup5_0ChannelNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure_enabled + tcPinCode_failure( + KErrWlanProtectedSetupNetworkAuthFailure, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupNoDHCPResponse() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupNoDHCPResponse_enabled + tcPinCode_failure( + KErrWlanProtectedSetupNoDHCPResponse, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig_enabled + tcPinCode_failure( + KErrWlanProtectedSetupFailedDHCPConfig, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupIPAddressConflict() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupIPAddressConflict_enabled + tcPinCode_failure( + KErrWlanProtectedSetupIPAddressConflict, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar_enabled + tcPinCode_failure( + KErrWlanProtectedSetupCouldNotConnectToRegistrar, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected_enabled + tcPinCode_failure( + KErrWlanProtectedSetupMultiplePBCSessionsDetected, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected_enabled + tcPinCode_failure( + KErrWlanProtectedSetupRogueActivitySuspected, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDeviceBusy() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupDeviceBusy_enabled + tcPinCode_failure( + KErrWlanProtectedSetupDeviceBusy, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupSetupLocked() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupSetupLocked_enabled + tcPinCode_failure( + KErrWlanProtectedSetupSetupLocked, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupMessageTimeout() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupMessageTimeout_enabled + tcPinCode_failure( + KErrWlanProtectedSetupMessageTimeout, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout_enabled + tcPinCode_failure( + KErrWlanProtectedSetupRegistrationSessionTimeout, + hbTrId("txt_occ_dialog_configuration_failed_please_try_ag")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure_enabled + tcPinCode_failure( + KErrWlanProtectedSetupDevicePasswordAuthFailure, + hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetupPINMethodNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); +#endif +} + +void TestWlanWizardWps::tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported() +{ +#ifdef tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported_enabled + tcPinCode_failure( + KErrWlanProtectedSetupPBMethodNotSupported, + hbTrId("txt_occ_dialog_configuration_failed_authenticatio")); +#endif +} + +void TestWlanWizardWps::verifyModeSelection() +{ + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep2 ), true ); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QStringList list; + list << hbTrId("txt_occ_list_use_pushbutton") + << hbTrId("txt_occ_list_use_pin_code") + << hbTrId("txt_occ_list_configure_manually"); + + QCOMPARE(verifyRadioButtons("radioButtonList"), list); +} + + +void TestWlanWizardWps::tcPushButton( + const QString &ssid, + int secModeWlan, + int secModeCmm, + int operModeWlan, + int operModeCmm, + int defaultWepKeyIndexWlan, + int defaultWepKeyIndexCmm) +{ + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + WlanQtUtilsAp ap; + ap.setValue(WlanQtUtilsAp::ConfIdConnectionMode, operModeCmm); + ap.setValue(WlanQtUtilsAp::ConfIdSecurityMode, secModeCmm); + ap.setValue(WlanQtUtilsAp::ConfIdSsid, ssid); + ap.setValue(WlanQtUtilsAp::ConfIdHidden, false); + ap.setValue(WlanQtUtilsAp::ConfIdWlanScanSSID, false); + + // Default values + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true ); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 ); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString()); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString()); + + if (secModeCmm == CMManagerShim::WlanSecModeWep){ + ap.setValue(WlanQtUtilsAp::ConfIdWepKey1, "wepkey1"); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey2, "wepkey2"); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey3, "wepkey3"); + ap.setValue(WlanQtUtilsAp::ConfIdWepKey4, "wepkey4"); + ap.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, defaultWepKeyIndexCmm ); + } else if (secModeCmm == CMManagerShim::WlanSecModeWpa || + secModeCmm == CMManagerShim::WlanSecModeWpa2) { + ap.setValue(WlanQtUtilsAp::ConfIdWpaPsk, "wpapsk"); + } + + mWlanMgmtClientContext->setRunProtectedSetup(ssid, KErrNone); + mWlanMgmtClientContext->appendResult( + ssid, + secModeWlan, + operModeWlan, + defaultWepKeyIndexWlan, + "wepkey1", + "wepkey2", + "wepkey3", + "wepkey4", + "wpapsk"); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + false, + true); + + mView->showWizard(); + verifyModeSelection(); + + QCOMPARE(selectRadioButton("radioButtonList", 0), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep3_Button), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE( mouseClickNext(), true); + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep4), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageProcessSettings, ssid), true ); + QCOMPARE( verifyCurrentPage(WlanWizardPageInternal::PageSummary, 10, 500), true ); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( mWlanQtUtilsContext->verifyWlanIapSettings(ap), true); +} + + +void TestWlanWizardWps::tcPinCode_failure( + int errorCode, + const QString &errorText) +{ + const QString ssid("tcPinCode_failure"); + + mWlanQtUtilsContext->setCreateWlanIapResult(3); + mWlanQtUtilsContext->setConnectionSuccessed(true); + mWlanQtUtilsContext->setSignalWlanNetworkOpened(3); + mWlanQtUtilsContext->setSignalIctResult(3, WlanQtUtils::IctPassed); + + mWlanMgmtClientContext->setRunProtectedSetup(ssid, errorCode); + + mView->mWizard->setParameters( + ssid, + CMManagerShim::Adhoc, + CMManagerShim::WlanSecModeWep, + false, + true); + + mView->showWizard(); + verifyModeSelection(); + + QCOMPARE(selectRadioButton("radioButtonList", 1), true); + QTest::qWait(WaitTimeForUi); + QCOMPARE( verifyActionButtons(ButtonHidden, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep3_Number), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonEnabled, ButtonHidden), true ); + + QCOMPARE(mouseClickNext(), true); + QTest::qWait(WaitTimeForUi); + + QCOMPARE( verifyCurrentPage(WpsWizardPage::PageWpsWizardStep4), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + + QCOMPARE( verifyCurrentPageWithInfo(WlanWizardPageInternal::PageGenericError, errorText), true ); + QCOMPARE( verifyActionButtons(ButtonEnabled, ButtonEnabled, ButtonDisabled, ButtonHidden), true ); + QTest::qWait(WaitTimeForUi); +} diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +#ifndef TESTWLANWIZARDRNDWPS_H +#define TESTWLANWIZARDRNDWPS_H + +#include "testwlanwizardcontext.h" + +class TestWlanWizardWps : public TestWlanWizardContext +{ +Q_OBJECT + +private slots: + void tcConfigureManualOpen(); + void tcPushButtonOpen(); + void tcPushButtonWep1(); + void tcPushButtonWep2(); + void tcPushButtonWep3(); + void tcPushButtonWep4(); + void tcPushButtonWpa(); + void tcPushButtonWpa2(); + void tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError(); + void tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure(); + void tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported(); + void tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported(); + void tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure(); + void tcPinCode_KErrWlanProtectedSetupNoDHCPResponse(); + void tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig(); + void tcPinCode_KErrWlanProtectedSetupIPAddressConflict(); + void tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar(); + void tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected(); + void tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected(); + void tcPinCode_KErrWlanProtectedSetupDeviceBusy(); + void tcPinCode_KErrWlanProtectedSetupSetupLocked(); + void tcPinCode_KErrWlanProtectedSetupMessageTimeout(); + void tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout(); + void tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure(); + void tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported(); + void tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported(); + /* + void tcPushButton_KErrNone_back_forward_KErrNone(); + void tcPinCodeMultipleResults(); + void tcPinCodeMultipleResults_back_and_forward(); + */ + +private: // Helper methods + void verifyModeSelection(); + +private: // Helper test cases + void tcPushButton( + const QString &ssid, + int secModeWlan, + int secModeCmm, + int operModeWlan, + int operModeCmm, + int defaultWepKeyIndexWlan, + int defaultWepKeyIndexCmm); + + void tcPinCode_failure( + int errorCode, + const QString &errorText); + + + +}; + +#endif /* TESTWLANWIZARDRNDWPS_H */ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps_conf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/testwlanwizardwps_conf.h Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + */ + +// System includes + +// User includes + +// External function prototypes + +// Local constants + +#define tcConfigureManualOpen_enabled +#define tcPushButtonOpen_enabled +#define tcPushButtonWep1_enabled +#define tcPushButtonWep2_enabled +#define tcPushButtonWep3_enabled +#define tcPushButtonWep4_enabled +#define tcPushButtonWpa_enabled +#define tcPushButtonWpa2_enabled +#define tcPinCode_KErrWlanProtectedSetupOOBInterfaceReadError_enabled +#define tcPinCode_KErrWlanProtectedSetupDecryptionCRCFailure_enabled +#define tcPinCode_KErrWlanProtectedSetup2_4ChannelNotSupported_enabled +#define tcPinCode_KErrWlanProtectedSetup5_0ChannelNotSupported_enabled +#define tcPinCode_KErrWlanProtectedSetupNetworkAuthFailure_enabled +#define tcPinCode_KErrWlanProtectedSetupNoDHCPResponse_enabled +#define tcPinCode_KErrWlanProtectedSetupFailedDHCPConfig_enabled +#define tcPinCode_KErrWlanProtectedSetupIPAddressConflict_enabled +#define tcPinCode_KErrWlanProtectedSetupCouldNotConnectToRegistrar_enabled +#define tcPinCode_KErrWlanProtectedSetupMultiplePBCSessionsDetected_enabled +#define tcPinCode_KErrWlanProtectedSetupRogueActivitySuspected_enabled +#define tcPinCode_KErrWlanProtectedSetupDeviceBusy_enabled +#define tcPinCode_KErrWlanProtectedSetupSetupLocked_enabled +#define tcPinCode_KErrWlanProtectedSetupMessageTimeout_enabled +#define tcPinCode_KErrWlanProtectedSetupRegistrationSessionTimeout_enabled +#define tcPinCode_KErrWlanProtectedSetupDevicePasswordAuthFailure_enabled +#define tcPinCode_KErrWlanProtectedSetupPINMethodNotSupported_enabled +#define tcPinCode_KErrWlanProtectedSetupPBMethodNotSupported_enabled + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/tsrc/ut/ut.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/wlanwizard/tsrc/ut/ut.pri Mon Aug 23 13:30:09 2010 +0300 @@ -0,0 +1,40 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# +# Description: +# UT for Wlan wizard testing +# + +HEADERS += \ + ut/hbautotest.h \ + ut/testwlanwizard.h \ + ut/testwlanwizardeap.h \ + ut/testwlanwizardeap_conf.h \ + ut/testwlanwizardcontext.h \ + ut/testwlanwizardmanual.h \ + ut/testwlanwizardmanual_conf.h \ + ut/testwlanwizardconnect.h \ + ut/testwlanwizardconnect_conf.h \ + ut/testwlanwizardwps.h \ + ut/testwlanwizardwps_conf.h + +SOURCES += \ + ut/main.cpp \ + ut/hbautotest.cpp \ + ut/testwlanwizardeap.cpp \ + ut/testwlanwizardcontext.cpp \ + ut/testwlanwizardconnect.cpp \ + ut/testwlanwizardmanual.cpp \ + ut/testwlanwizard.cpp \ + ut/testwlanwizardwps.cpp diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wlanwizard/wlanwizard.pro --- a/wlanutilities/wlanwizard/wlanwizard.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wlanwizard/wlanwizard.pro Mon Aug 23 13:30:09 2010 +0300 @@ -29,6 +29,14 @@ RESOURCES += resources/resource.qrc +DOCML += \ + resources/occ_wlan_wizard_main.docml \ + resources/occ_add_wlan_05.docml \ + resources/occ_add_wlan_06.docml \ + resources/occ_add_wlan_02_03.docml \ + resources/occ_add_wlan_01_04.docml \ + resources/occ_add_wlan_error.docml + TRANSLATIONS = wlanwizard.ts HEADERS += \ diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h --- a/wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wpswizard/inc/wpswizardstepthreebutton.h Mon Aug 23 13:30:09 2010 +0300 @@ -61,8 +61,6 @@ public slots: - void loadDocmlSection(Qt::Orientation orientation); - protected: protected slots: diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h --- a/wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wpswizard/inc/wpswizardstepthreenumber.h Mon Aug 23 13:30:09 2010 +0300 @@ -67,7 +67,6 @@ signals: public slots: - void loadDocmlSection(Qt::Orientation orientation); protected: diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wpswizard/resources/wpswizard_resource.qrc --- a/wlanutilities/wpswizard/resources/wpswizard_resource.qrc Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wpswizard/resources/wpswizard_resource.qrc Mon Aug 23 13:30:09 2010 +0300 @@ -1,8 +1,8 @@ - occ_wps_01_05.docml - occ_wps_02_03.docml - occ_wps_P4.docml + occ_wps_01_05.docml.bin + occ_wps_02_03.docml.bin + occ_wps_P4.docml.bin diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wpswizard/src/wpswizardstepfour_p.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -1,20 +1,19 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * WPS Wizard Page: Step 4 progress bar display - * - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* WPS Wizard Page: Step 4 progress bar display +*/ //System Includes @@ -53,13 +52,14 @@ mWpsActiveRunner(NULL), q_ptr(pageStepFour) { - OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this ); + OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this); + // start the framework. CWpsActiveRunner* runner = NULL; QT_TRAP_THROWING(runner = CWpsActiveRunner::NewL(*this)); mWpsActiveRunner.reset(runner); - OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this ); + OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this); } /*! @@ -67,8 +67,8 @@ */ WpsPageStepFourPrivate::~WpsPageStepFourPrivate() { - OstTraceFunctionEntry1( DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this ); - OstTraceFunctionExit1( DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this ); + OstTraceFunctionEntry1(DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_ENTRY, this); + OstTraceFunctionExit1(DUP1_WPSPAGESTEPFOURPRIVATE_WPSPAGESTEPFOURPRIVATE_EXIT, this); } /*! @@ -79,16 +79,18 @@ */ void WpsPageStepFourPrivate::StartSetup(QString ssid, int pin) { - OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_STARTSETUP_ENTRY, this ); + OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_STARTSETUP_ENTRY, this); + TPtrC ptrName(reinterpret_cast (ssid.constData())); RBuf8 ssidName; - ssidName.Create(ptrName.Length()); + QT_TRAP_THROWING(ssidName.CreateL(ptrName.Length())); ssidName.Copy(ptrName); mWpsActiveRunner->StartSetup(ssidName, pin); ssidName.Close(); - OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_STARTSETUP_EXIT, this ); + + OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_STARTSETUP_EXIT, this); } /*! @@ -101,26 +103,24 @@ QList& aCredentials, TInt aError) { - OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ENTRY, this ); + OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ENTRY, this); // mWpsErrorCode = aError; if (aError == KErrNone) { q_ptr->setCredentials(aCredentials, aCredentials.count()); - } - else if (aError == KErrCancel) { + } else if (aError == KErrCancel) { // operation was cancelled - - } - else { + } else { OstTrace1( TRACE_ERROR, WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_ERROR, "WpsPageStepFourPrivate::WpsActiveRunnerStopped;Error=%d", - aError ); + aError); q_ptr->handleError(aError); - } - OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_EXIT, this ); + } + + OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_WPSACTIVERUNNERSTOPPED_EXIT, this); } /*! @@ -128,8 +128,10 @@ */ void WpsPageStepFourPrivate::Cancel() { - OstTraceFunctionEntry1( WPSPAGESTEPFOURPRIVATE_CANCEL_ENTRY, this ); + OstTraceFunctionEntry1(WPSPAGESTEPFOURPRIVATE_CANCEL_ENTRY, this); + mWpsActiveRunner->DoCancel(); - OstTraceFunctionExit1( WPSPAGESTEPFOURPRIVATE_CANCEL_EXIT, this ); + + OstTraceFunctionExit1(WPSPAGESTEPFOURPRIVATE_CANCEL_EXIT, this); } diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wpswizard/src/wpswizardstepthreebutton.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -89,9 +89,6 @@ mLoader->load(":/docml/occ_wps_02_03.docml", &ok); Q_ASSERT(ok); - // Initialize orientation - loadDocmlSection(mWizard->mainWindow()->orientation()); - mWidget = qobject_cast (mLoader->findWidget("occ_wps_P2")); Q_ASSERT(mWidget); @@ -99,13 +96,6 @@ Q_ASSERT(mHeading); mHeading->setPlainText(hbTrId("txt_occ_dialog_first_press_button_on_the_wireless")); - - bool connectOk = connect( - mWizard->mainWindow(), - SIGNAL(orientationChanged(Qt::Orientation)), - this, - SLOT(loadDocmlSection(Qt::Orientation))); - Q_ASSERT(connectOk); } OstTraceFunctionExit1(WPSPAGESTEPTHREEBUTTON_INITIALIZEPAGE_EXIT, this); @@ -142,24 +132,5 @@ return (PageWpsWizardStep3_Button - PageWpsWizardStep2); } -/*! - Loads docml at initialization phase and when HbMainWindow sends - orientation() signal. - - @param [in] orientation orientation to be loaded. - */ -void WpsPageStepThreeButton::loadDocmlSection(Qt::Orientation orientation) -{ - bool ok = false; - - // Load the orientation specific section - if (orientation == Qt::Horizontal) { - mLoader->load(":/docml/occ_wps_02_03.docml", "landscape", &ok); - Q_ASSERT(ok); - } else { - Q_ASSERT(orientation == Qt::Vertical); - mLoader->load(":/docml/occ_wps_02_03.docml", "portrait", &ok); - Q_ASSERT(ok); - } -} + diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp --- a/wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wpswizard/src/wpswizardstepthreenumber.cpp Mon Aug 23 13:30:09 2010 +0300 @@ -25,6 +25,7 @@ #include #include #include +#include // User includes #include "wpswizardstepthreenumber.h" @@ -92,21 +93,11 @@ mLoader->load(":/docml/occ_wps_02_03.docml", &ok); Q_ASSERT(ok); - // Initialize orientation - loadDocmlSection(mWizard->mainWindow()->orientation()); - mWidget = qobject_cast (mLoader->findWidget("occ_wps_P2")); Q_ASSERT(mWidget); mHeading= qobject_cast (mLoader->findWidget("label_heading")); Q_ASSERT(mHeading); - - bool connectOk = connect( - mWizard->mainWindow(), - SIGNAL(orientationChanged(Qt::Orientation)), - this, - SLOT(loadDocmlSection(Qt::Orientation))); - Q_ASSERT(connectOk); } OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_INITIALIZEPAGE_EXIT, this); @@ -166,9 +157,10 @@ bool WpsPageStepThreeNumber::showPage() { int randomNumber = computeRandNumber(); - mHeading->setPlainText(hbTrId( + mHeading->setPlainText( + HbParameterLengthLimiter( "txt_occ_dialog_enter_1_on_the_wireless_station_t").arg( - randomNumber)); + QString::number(randomNumber))); mWizard->setPin(randomNumber); return true; } @@ -224,25 +216,3 @@ OstTraceFunctionExit1(WPSPAGESTEPTHREENUMBER_COMPUTECHECKSUM_EXIT, this); return (10 - digit) % 10; } - -/*! - Loads docml at initialization phase and when HbMainWindow sends - orientation() signal. - - @param [in] orientation orientation to be loaded. - */ -void WpsPageStepThreeNumber::loadDocmlSection(Qt::Orientation orientation) -{ - bool ok = false; - - // Load the orientation specific section - if (orientation == Qt::Horizontal) { - mLoader->load(":/docml/occ_wps_02_03.docml", "landscape", &ok); - Q_ASSERT(ok); - } else { - Q_ASSERT(orientation == Qt::Vertical); - mLoader->load(":/docml/occ_wps_02_03.docml", "portrait", &ok); - Q_ASSERT(ok); - } -} - diff -r fb81b597edf1 -r bdc64aa9b954 wlanutilities/wpswizard/wpswizard.pro --- a/wlanutilities/wpswizard/wpswizard.pro Fri Aug 06 18:38:57 2010 +0300 +++ b/wlanutilities/wpswizard/wpswizard.pro Mon Aug 23 13:30:09 2010 +0300 @@ -25,6 +25,11 @@ RESOURCES += resources/wpswizard_resource.qrc TRANSLATIONS += wpswizardplugin.ts +DOCML += \ + resources/occ_wps_01_05.docml \ + resources/occ_wps_02_03.docml \ + resources/occ_wps_P4.docml + INCLUDEPATH += inc \ ../inc