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 <timur.pocheptsov@qt.io>
This commit is contained in:
parent
793f0ddec2
commit
1394610c79
@ -5773,6 +5773,15 @@ void tst_QNetworkReply::proxyChange()
|
|||||||
QNetworkRequest req(QUrl("http://" + QtNetworkSettings::serverName()));
|
QNetworkRequest req(QUrl("http://" + QtNetworkSettings::serverName()));
|
||||||
proxyServer.doClose = false;
|
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);
|
manager.setProxy(dummyProxy);
|
||||||
QNetworkReplyPtr reply1(manager.get(req));
|
QNetworkReplyPtr reply1(manager.get(req));
|
||||||
connect(reply1, SIGNAL(finished()), &helper, SLOT(finishedSlot()));
|
connect(reply1, SIGNAL(finished()), &helper, SLOT(finishedSlot()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user