summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-09 21:54:18 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-09 21:54:18 +1000
commite8aceff19523a2fb048690798d789f0ec248696d (patch)
tree2304fe2216d6fc4ebbeb6bad9cfdbe3fb24876c2 /tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
parent38644abb0d15188e2f79f323ba091328aa0bd4ba (diff)
parent939886720920f907884b8b32bf501354ed805857 (diff)
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-earth-staging
* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-earth-staging: Skip test on MacOS due to problems with corewlan plugin Fix QNetworkConfigurationManager usage outside main thread first Update QTBUG-17223 for Qt 4.8 fix tst_qnetworkreply::httpProxyCommands autotest Send User-Agent from the network request in http proxy CONNECT command Add autotests for configuration dependent network proxies Fix QNetworkReplyImpl error handling Enable per network configuration proxy settings in QNetworkAccessManager Allow a network configuration to be included in a proxy query Fix error handling in write for socks socket engine
Diffstat (limited to 'tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp')
-rw-r--r--tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
index 7787608485..c270eb8813 100644
--- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
+++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
@@ -62,6 +62,7 @@ public slots:
void cleanup();
private slots:
+ void usedInThread(); // this test must be first, or it will falsely pass
void allConfigurations();
void defaultConfiguration();
void configurationFromIdentifier();
@@ -329,6 +330,47 @@ void tst_QNetworkConfigurationManager::configurationFromIdentifier()
QVERIFY(!invalid.isValid());
}
+class QNCMTestThread : public QThread
+{
+protected:
+ virtual void run()
+ {
+ QNetworkConfigurationManager manager;
+ preScanConfigs = manager.allConfigurations();
+ QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
+ manager.updateConfigurations(); //initiate scans
+ QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
+ configs = manager.allConfigurations();
+ }
+public:
+ QList<QNetworkConfiguration> configs;
+ QList<QNetworkConfiguration> preScanConfigs;
+};
+
+// regression test for QTBUG-18795
+void tst_QNetworkConfigurationManager::usedInThread()
+{
+#if defined Q_OS_MAC && !defined (QT_NO_COREWLAN)
+ QSKIP("QTBUG-19070 Mac CoreWlan plugin is broken", SkipAll);
+#else
+ QNCMTestThread thread;
+ connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ thread.start();
+ QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY could take ~90 seconds to time out in the thread
+ QVERIFY(thread.isFinished());
+ qDebug() << "prescan:" << thread.preScanConfigs.count();
+ qDebug() << "postscan:" << thread.configs.count();
+
+ QNetworkConfigurationManager manager;
+ QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
+ QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
+ manager.updateConfigurations(); //initiate scans
+ QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
+ QList<QNetworkConfiguration> configs = manager.allConfigurations();
+ QCOMPARE(thread.configs, configs);
+ QCOMPARE(thread.preScanConfigs, preScanConfigs);
+#endif
+}
QTEST_MAIN(tst_QNetworkConfigurationManager)
#include "tst_qnetworkconfigurationmanager.moc"