summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkproxyfactory
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-05-18 15:13:10 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-18 15:13:10 +0200
commit3b7b05ce8db881acfdcf193b3c8fb3d4919eb1c2 (patch)
treeb35fb5f723752378dd4fede93a6c35c0aeb85ad2 /tests/auto/qnetworkproxyfactory
parent1aeccd6bd14d7d9e098e333715f63e0225cd4a54 (diff)
parent2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (diff)
Merge remote-tracking branch 'origin/4.8'
Diffstat (limited to 'tests/auto/qnetworkproxyfactory')
-rw-r--r--tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index b04556c53e..7060c119d3 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