summaryrefslogtreecommitdiffstats
path: root/tests/auto/qnetworkproxyfactory
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-05-24 18:06:51 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-05-24 18:06:51 (GMT)
commitf37c49985f2382b86fe91f7b7224c8fd92961ac9 (patch)
tree9a05328fa1dc668a7d3d7143f99de39e5f795387 /tests/auto/qnetworkproxyfactory
parent16b11332931caef92bd103d854fac4dff3ff771e (diff)
parent534f5098c577f262b4b01d1c21cd0ec1af0f25f1 (diff)
downloadQt-f37c49985f2382b86fe91f7b7224c8fd92961ac9.zip
Qt-f37c49985f2382b86fe91f7b7224c8fd92961ac9.tar.gz
Qt-f37c49985f2382b86fe91f7b7224c8fd92961ac9.tar.bz2
Merge branch '4.8' of scm.dev.nokia.troll.no:qt/qt into 4.8
Conflicts: src/gui/text/qrawfont.cpp src/gui/text/qtextlayout.cpp src/gui/util/qscroller.cpp src/gui/widgets/qlineedit.cpp
Diffstat (limited to 'tests/auto/qnetworkproxyfactory')
-rw-r--r--tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp68
1 files changed, 49 insertions, 19 deletions
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 82a4193..136d4d8 100644
--- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
+++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
@@ -7,29 +7,29 @@
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
**
**
**
@@ -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
@@ -146,6 +174,10 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const
void tst_QNetworkProxyFactory::fromConfigurations()
{
QNetworkConfigurationManager manager;
+ //update is done to get the active / discovered states
+ manager.updateConfigurations();
+ connect(&manager, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
QList<QNetworkProxy> proxies;
QUrl url(QLatin1String("http://qt.nokia.com"));
//get from known configurations
@@ -233,8 +265,6 @@ void tst_QNetworkProxyFactory::inNetworkAccessManager()
foreach (QNetworkProxy proxy, proxies) {
qDebug() << formatProxyName(proxy);
}
- if (config.type() != QNetworkConfiguration::InternetAccessPoint)
- QEXPECT_FAIL("","QNetworkProxyFactory::systemProxyForQuery doesn't work for service networks yet", Continue);
QCOMPARE(factory->returnedList, proxies);
}