|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "wlansettingstest.h" |
|
20 |
|
21 //constructor |
|
22 WlanSettingsTest::WlanSettingsTest() |
|
23 { |
|
24 mSecuritySettings.reset(new WlanSettings); |
|
25 |
|
26 //Initialise the wlansettings |
|
27 mSecuritySettings->init(); |
|
28 } |
|
29 |
|
30 |
|
31 //Test Scenario : 1 |
|
32 void WlanSettingsTest::test_setWlanPowerMode() |
|
33 { |
|
34 int powerSavingOption(ETrue); |
|
35 |
|
36 int error = mSecuritySettings->setWlanPowerSaving(powerSavingOption); |
|
37 |
|
38 QVERIFY(error == KErrNone); |
|
39 } |
|
40 |
|
41 /////////////////////////////////////////Manual WLan joining Mode////////////////////////////////////////////////// |
|
42 |
|
43 //Test Scenario : 2 |
|
44 void WlanSettingsTest::test_CheckJoinWlanModeManual() |
|
45 { |
|
46 mJoinWlanMode = WlanSettings::EScanNetworkUserDefined; |
|
47 int error = mSecuritySettings->setJoinWlanMode(mJoinWlanMode); |
|
48 |
|
49 QVERIFY(error == KErrNone); |
|
50 |
|
51 //Load the Settings |
|
52 int loadError = mSecuritySettings->loadSettings(); |
|
53 QVERIFY(loadError == KErrNone); |
|
54 |
|
55 //Verify Mode |
|
56 int mode = mSecuritySettings->joinWlanMode(); |
|
57 QVERIFY(mode == mJoinWlanMode ); |
|
58 } |
|
59 |
|
60 /////////////////////////////////////////User-defined Scan Interval///////////////////////////////////// |
|
61 //Test Scenario : 3 |
|
62 void WlanSettingsTest::test_CheckWlanScanIntervalManual() |
|
63 { |
|
64 |
|
65 mScanIntervalManual = 16; |
|
66 |
|
67 //Set some user-defined Interval |
|
68 int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalManual); |
|
69 QVERIFY(setError == KErrNone); |
|
70 |
|
71 //Load the Settings |
|
72 int loadError = mSecuritySettings->loadSettings(); |
|
73 QVERIFY(loadError == KErrNone); |
|
74 |
|
75 //Check if the interval set is right |
|
76 uint scanIntervalset = mSecuritySettings->scanInterval(); |
|
77 QVERIFY(scanIntervalset == mScanIntervalManual); |
|
78 |
|
79 //Verify the Network type, based on the scan interval set |
|
80 int networkType = mSecuritySettings->scanNetworkType(); |
|
81 QVERIFY(networkType == WlanSettings::EScanNetworkUserDefined); |
|
82 |
|
83 } |
|
84 |
|
85 |
|
86 //////////////////////////////////////////Automatic WLAN joining Mode/////////////////////////////////////////// |
|
87 |
|
88 //Test Scenario : 4 |
|
89 void WlanSettingsTest::test_CheckJoinWlanModeAuto() |
|
90 { |
|
91 mJoinWlanMode = WlanSettings::EScanNetworkAuto; |
|
92 int error = mSecuritySettings->setJoinWlanMode(mJoinWlanMode); |
|
93 |
|
94 QVERIFY(error == KErrNone); |
|
95 |
|
96 |
|
97 //Load the Settings |
|
98 int loadError = mSecuritySettings->loadSettings(); |
|
99 QVERIFY(loadError == KErrNone); |
|
100 |
|
101 |
|
102 //Verify Mode |
|
103 int mode = mSecuritySettings->joinWlanMode(); |
|
104 QVERIFY(mode == mJoinWlanMode ); |
|
105 |
|
106 } |
|
107 |
|
108 ///////////////////////////////////////Automatic Scan Interval///////////////////////////////////////// |
|
109 //Test Scenario : 5 |
|
110 void WlanSettingsTest::test_CheckWlanScanIntervalAuto() |
|
111 { |
|
112 uint KDefaultScanInterval(5); |
|
113 |
|
114 mScanIntervalAuto = WlanSettings::ScanNetworkAuto; |
|
115 |
|
116 //Set the Auto Interval |
|
117 int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalAuto); |
|
118 QVERIFY(setError == KErrNone); |
|
119 |
|
120 //Load the Settings |
|
121 int loadError = mSecuritySettings->loadSettings(); |
|
122 QVERIFY(loadError == KErrNone); |
|
123 |
|
124 //Check the Auto Interval |
|
125 uint scanIntervalset = mSecuritySettings->scanInterval(); |
|
126 QVERIFY(scanIntervalset == KDefaultScanInterval ); |
|
127 |
|
128 //Verify the Network type, based on the scan interval set |
|
129 int networkType = mSecuritySettings->scanNetworkType(); |
|
130 QVERIFY(networkType == WlanSettings::EScanNetworkAuto); |
|
131 } |
|
132 |
|
133 //Test Scenario : 6 |
|
134 void WlanSettingsTest::test_CheckManualIntervalValidity() |
|
135 { |
|
136 uint KDefaultScanInterval(5); |
|
137 //Invalid User defined Interval |
|
138 mScanIntervalManual = 45; |
|
139 |
|
140 int setError = mSecuritySettings->setWlanScanInterval(mScanIntervalManual); |
|
141 QVERIFY(setError == KErrNone); |
|
142 |
|
143 //Load the Settings |
|
144 int loadError = mSecuritySettings->loadSettings(); |
|
145 QVERIFY(loadError == KErrNone); |
|
146 |
|
147 //Validate ;When User-defined Interval is invalid,Auto Interval should have been set |
|
148 uint scanIntervalset = mSecuritySettings->scanInterval(); |
|
149 QVERIFY(scanIntervalset == KDefaultScanInterval); |
|
150 |
|
151 } |
|
152 |
|
153 //Test Scenario : 7 |
|
154 void WlanSettingsTest::test_CheckWlanPowerSavingMode() |
|
155 { |
|
156 int wlanPowerSavingMode(ETrue); |
|
157 |
|
158 int setError = mSecuritySettings->setWlanPowerSaving(wlanPowerSavingMode); |
|
159 QVERIFY(setError == KErrNone); |
|
160 |
|
161 //Verify Power saving mode parameter |
|
162 int powerSavingMode = mSecuritySettings->isWlanPowerSavingEnabled(); |
|
163 QVERIFY(powerSavingMode == wlanPowerSavingMode); |
|
164 } |
|
165 |
|
166 //Delete data members |
|
167 WlanSettingsTest::~WlanSettingsTest() |
|
168 { |
|
169 |
|
170 } |