diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-05-18 13:13:10 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-05-18 13:13:10 (GMT) |
commit | 3b7b05ce8db881acfdcf193b3c8fb3d4919eb1c2 (patch) | |
tree | b35fb5f723752378dd4fede93a6c35c0aeb85ad2 /tests/auto/qnetworkproxyfactory | |
parent | 1aeccd6bd14d7d9e098e333715f63e0225cd4a54 (diff) | |
parent | 2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (diff) | |
download | Qt-3b7b05ce8db881acfdcf193b3c8fb3d4919eb1c2.zip Qt-3b7b05ce8db881acfdcf193b3c8fb3d4919eb1c2.tar.gz Qt-3b7b05ce8db881acfdcf193b3c8fb3d4919eb1c2.tar.bz2 |
Merge remote-tracking branch 'origin/4.8'
Diffstat (limited to 'tests/auto/qnetworkproxyfactory')
-rw-r--r-- | tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index b04556c..7060c11 100644 --- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -46,6 +46,7 @@ #include <qcoreapplication.h> #include <qdebug.h> #include <qnetworkproxy.h> +#include <QThread> #include <QNetworkConfiguration> #include <QNetworkConfigurationManager> #include <QNetworkSession> @@ -77,6 +78,7 @@ public: }; private slots: + void systemProxyForQueryCalledFromThread(); void systemProxyForQuery() const; #ifndef QT_NO_BEARERMANAGEMENT void fromConfigurations(); @@ -136,6 +138,32 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const QFAIL("One or more system proxy lookup failures occurred."); } +class QSPFQThread : public QThread +{ +protected: + virtual void run() + { + proxies = QNetworkProxyFactory::systemProxyForQuery(query); + } +public: + QNetworkProxyQuery query; + QList<QNetworkProxy> proxies; +}; + +//regression test for QTBUG-18799 +void tst_QNetworkProxyFactory::systemProxyForQueryCalledFromThread() +{ + QUrl url(QLatin1String("http://qt.nokia.com")); + QNetworkProxyQuery query(url); + QSPFQThread thread; + thread.query = query; + connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + thread.start(); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(thread.isFinished()); + QCOMPARE(thread.proxies, QNetworkProxyFactory::systemProxyForQuery(query)); +} + #ifndef QT_NO_BEARERMANAGEMENT //Purpose of this test is just to check systemProxyForQuery doesn't hang or crash |