1181 0, |
1181 0, |
1182 KLinkLayerOpen)); |
1182 KLinkLayerOpen)); |
1183 |
1183 |
1184 // Connection test automatically started at this point. Call result function explicitly |
1184 // Connection test automatically started at this point. Call result function explicitly |
1185 // No interface exists that we could check that the IAP is moved to Internet SNAP correctly |
1185 // No interface exists that we could check that the IAP is moved to Internet SNAP correctly |
1186 #if 0 // TODO: Make this work with the new WLAN login interface |
1186 wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsPassed); |
1187 TBuf<5> string; |
1187 |
1188 wlanQtUtils_->d_ptr->mConnTestWrapper->d_ptr_->ConnectivityObserver(EConnectionOk, string); |
1188 subTestSignalWaitAndTake(signalIctResult_, &arguments); |
1189 |
|
1190 subTestSignalWaitAndTake(signalIctResult_, &arguments); |
|
1191 QCOMPARE(arguments.at(0).toInt(), iapId); |
1189 QCOMPARE(arguments.at(0).toInt(), iapId); |
1192 QCOMPARE(arguments.at(1).toBool(), true); |
1190 QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctPassed); |
1193 #endif |
|
1194 } |
1191 } |
1195 |
1192 |
1196 /** |
1193 /** |
1197 * This function tests ICT when connection test fails. |
1194 * This function tests ICT when connection test fails. |
1198 */ |
1195 */ |
1199 void TestWlanQtUtils::testConnectionTestErr() |
1196 void TestWlanQtUtils::testConnectionTestErr() |
1200 { |
1197 { |
1201 // Create and connect an IAP and request ICT to be run |
1198 // Create and connect an IAP and request ICT to be run |
1202 QScopedPointer<WlanQtUtilsAp> wlanAp(subTestNewAp()); |
1199 QScopedPointer<WlanQtUtilsAp> wlanAp(subTestNewAp()); |
1203 wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestErr"); |
1200 wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestErr1"); |
1204 wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); |
1201 wlanAp->setValue(WlanQtUtilsAp::ConfIdSecurityMode, CMManagerShim::WlanSecModeWpa); |
1205 |
1202 |
1206 int iapId = wlanQtUtils_->createIap(wlanAp.data()); |
1203 int iapId = wlanQtUtils_->createIap(wlanAp.data()); |
1207 wlanQtUtils_->connectIap(iapId, true); |
1204 wlanQtUtils_->connectIap(iapId, true); |
1208 |
1205 |
1223 0, |
1220 0, |
1224 KLinkLayerOpen)); |
1221 KLinkLayerOpen)); |
1225 |
1222 |
1226 // Connection test automatically started at this point. Call result function explicitly |
1223 // Connection test automatically started at this point. Call result function explicitly |
1227 // No interface exists that we could check that IAP is not moved to another SNAP |
1224 // No interface exists that we could check that IAP is not moved to another SNAP |
1228 #if 0 // TODO: Make this work with the new WLAN login interface |
1225 wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsFailed); |
1229 TBuf<5> string; |
1226 |
1230 wlanQtUtils_->d_ptr->mConnTestWrapper->d_ptr_->ConnectivityObserver(EHttpAuthenticationNeeded, string); |
1227 subTestSignalWaitAndTake(signalIctResult_, &arguments); |
1231 |
|
1232 subTestSignalWaitAndTake(signalIctResult_, &arguments); |
|
1233 QCOMPARE(arguments.at(0).toInt(), iapId); |
1228 QCOMPARE(arguments.at(0).toInt(), iapId); |
1234 QCOMPARE(arguments.at(1).toBool(), false); |
1229 QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctFailed); |
1235 #endif |
1230 |
|
1231 // Repeat with cancel status |
|
1232 // Send event for connection status change -> closed. |
|
1233 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( |
|
1234 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), |
|
1235 0, |
|
1236 KLinkLayerClosed)); |
|
1237 |
|
1238 // Send event for connection deletion. |
|
1239 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( |
|
1240 EConnMonDeleteConnection, |
|
1241 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); |
|
1242 |
|
1243 subTestSignalWaitAndTake(signalWlanNetworkClosed_, &arguments); |
|
1244 QCOMPARE(arguments.at(0).toInt(), iapId); |
|
1245 QCOMPARE(arguments.at(1).toInt(), KErrNone); |
|
1246 |
|
1247 wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestErr2"); |
|
1248 |
|
1249 iapId = wlanQtUtils_->createIap(wlanAp.data()); |
|
1250 wlanQtUtils_->connectIap(iapId, true); |
|
1251 |
|
1252 testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, iapId); |
|
1253 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( |
|
1254 EConnMonCreateConnection, |
|
1255 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); |
|
1256 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( |
|
1257 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), |
|
1258 0, |
|
1259 KConnectionOpen)); |
|
1260 subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); |
|
1261 QCOMPARE(arguments.at(0).toInt(), iapId); |
|
1262 |
|
1263 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( |
|
1264 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), |
|
1265 0, |
|
1266 KLinkLayerOpen)); |
|
1267 |
|
1268 // Connection test automatically started at this point. Call result function explicitly |
|
1269 // No interface exists that we could check that IAP is not moved to another SNAP |
|
1270 wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsCanceled); |
|
1271 |
|
1272 subTestSignalWaitAndTake(signalIctResult_, &arguments); |
|
1273 QCOMPARE(arguments.at(0).toInt(), iapId); |
|
1274 QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctCancelled); |
|
1275 } |
|
1276 |
|
1277 /** |
|
1278 * This function tests ICT when connection test passes in hotspot case. |
|
1279 */ |
|
1280 void TestWlanQtUtils::testConnectionTestHotspot() |
|
1281 { |
|
1282 // Create new IAP to test |
|
1283 QScopedPointer<WlanQtUtilsAp> wlanAp(subTestNewAp()); |
|
1284 wlanAp->setValue(WlanQtUtilsAp::ConfIdSsid, "testConnectionTestHotspot"); |
|
1285 int iapId = wlanQtUtils_->createIap(wlanAp.data()); |
|
1286 QVERIFY(iapId != WlanQtUtils::IapIdNone); |
|
1287 |
|
1288 testContext.esock_.startRetValue_ = KErrNone; |
|
1289 |
|
1290 // Esock stub completes connection creation immediately |
|
1291 wlanQtUtils_->connectIap(iapId, true); |
|
1292 |
|
1293 // Connection creation in ConnMon interface |
|
1294 testContext.connMon_.activeConnections_.createDefaultActiveConnList(1, iapId); |
|
1295 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonEventBase( |
|
1296 EConnMonCreateConnection, |
|
1297 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId())); |
|
1298 |
|
1299 // Connection status change in ConnMon interface |
|
1300 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( |
|
1301 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), |
|
1302 0, |
|
1303 KConnectionOpen)); |
|
1304 |
|
1305 // Receive signal for connection opening (caused by connectIap, which completed immediately) |
|
1306 QList<QVariant> arguments; |
|
1307 subTestSignalWaitAndTake(signalWlanNetworkOpened_, &arguments); |
|
1308 QCOMPARE(arguments.at(0).toInt(), iapId); |
|
1309 |
|
1310 // Connection status change to opened in ConnMon interface. Sub test cases between test |
|
1311 // cases check that no extra signals are sent |
|
1312 wlanQtUtils_->d_ptr->mConMonWrapper->d_ptrInfo->EventL(CConnMonConnectionStatusChange( |
|
1313 testContext.connMon_.activeConnections_.activeConnList_[0]->connectionId(), |
|
1314 0, |
|
1315 KLinkLayerOpen)); |
|
1316 |
|
1317 // Connection test automatically started at this point. |
|
1318 // Call hotspot case slot explicitly |
|
1319 wlanQtUtils_->d_ptr->updateIctHotspotCase(); |
|
1320 |
|
1321 // Call result function explicitly |
|
1322 // No interface exists that we could check that the IAP is not moved to another SNAP |
|
1323 wlanQtUtils_->d_ptr->updateIctResult(IctsWlanLoginInterface::IctsHotspotPassed); |
|
1324 |
|
1325 subTestSignalWaitAndTake(signalIctResult_, &arguments); |
|
1326 QCOMPARE(arguments.at(0).toInt(), iapId); |
|
1327 QCOMPARE(arguments.at(1).toInt(), (int)WlanQtUtils::IctHotspotPassed); |
1236 } |
1328 } |
1237 |
1329 |
1238 /** |
1330 /** |
1239 * This function tests that Gprs connection events are ignored. |
1331 * This function tests that Gprs connection events are ignored. |
1240 */ |
1332 */ |