summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp')
-rw-r--r--tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 82a4193e9d..90ab8e045d 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 <QNetworkConfiguration>
#include <QNetworkConfigurationManager>
#include <QNetworkSession>
@@ -57,6 +58,8 @@
Q_DECLARE_METATYPE(QNetworkConfiguration);
Q_DECLARE_METATYPE(QList<QNetworkProxy>);
+#include <QThread>
+
class tst_QNetworkProxyFactory : public QObject {
Q_OBJECT
@@ -77,6 +80,7 @@ public:
};
private slots:
+ void systemProxyForQueryCalledFromThread();
void systemProxyForQuery() const;
#ifndef QT_NO_BEARERMANAGEMENT
void fromConfigurations();
@@ -240,5 +244,32 @@ void tst_QNetworkProxyFactory::inNetworkAccessManager()
#endif //QT_NO_BEARERMANAGEMENT
+
+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));
+}
+
QTEST_MAIN(tst_QNetworkProxyFactory)
#include "tst_qnetworkproxyfactory.moc"