From 1394610c79dad72a490be79b5af3869437375a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 13 Sep 2017 11:45:25 +0200 Subject: Workaround for proxyChange failing when run alone The issue itself is not really worth fixing (the very first request being supposed to have a different proxy than any of the other following requests before a session has been initiated), but we can at least make the test pass when it is run alone. Task-number: QTBUG-63134 Change-Id: I6c7df5c5653541031811e6bff562572061afae0f Reviewed-by: Timur Pocheptsov --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/network/access') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 855b1f9041..e995b69f60 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -5773,6 +5773,15 @@ void tst_QNetworkReply::proxyChange() QNetworkRequest req(QUrl("http://" + QtNetworkSettings::serverName())); proxyServer.doClose = false; + { + // Needed to initialize a network session in QNAM. Without an initialized session the GET + // will be deferred until later, and the proxy will be unset first. This caused the test to + // fail in standalone runs (it passed in CI because the same QNAM instance is used for the + // entire test). + QNetworkReplyPtr temporary(manager.get(req)); + waitForFinish(temporary); + } + manager.setProxy(dummyProxy); QNetworkReplyPtr reply1(manager.get(req)); connect(reply1, SIGNAL(finished()), &helper, SLOT(finishedSlot())); -- cgit v1.2.3