summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkproxyfactory
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-05-31 14:04:19 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-06-13 11:37:50 (GMT)
commitefba403423db53ed480bd88be4dcd650f8ae831a (patch)
treedd10c314f81223f16cd48a254bcee2840118dab2 /tests/auto/qnetworkproxyfactory
parent5bb3af94428d85c9d08b3c4cfb31c4071604b06d (diff)
downloadQt-efba403423db53ed480bd88be4dcd650f8ae831a.zip
Qt-efba403423db53ed480bd88be4dcd650f8ae831a.tar.gz
Qt-efba403423db53ed480bd88be4dcd650f8ae831a.tar.bz2
Revert "Revert "Fix QNetworkConfigurationManager usage outside main thread first""
This reverts commit daba0c0d588c55e3f1591ab8ce0ef0946d1447fd.
Diffstat (limited to 'tests/auto/qnetworkproxyfactory')
-rw-r--r--tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 954b369..c56fedb 100644
--- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
+++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,14 +41,17 @@
#include <QtTest/QTest>
+#include <QtTest/QTestEventLoop>
#include <qcoreapplication.h>
#include <qdebug.h>
#include <qnetworkproxy.h>
+#include <QThread>
class tst_QNetworkProxyFactory : public QObject {
Q_OBJECT
private slots:
+ void systemProxyForQueryCalledFromThread();
void systemProxyForQuery() const;
private:
@@ -96,5 +99,31 @@ 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));
+}
+
QTEST_MAIN(tst_QNetworkProxyFactory)
#include "tst_qnetworkproxyfactory.moc"