fix tst_qnetworkreply::httpProxyCommands autotest

Due to architecture changes in Qt 4.8, clearing the proxy before the
request is complete causes the http connection to not use any proxy.
The issue is that the proxy isn't resolved until after the bearer has
been started (which is correct in the general case, as system proxy
is unknown until that time).

Also increased the test's timeout from 1 second to 15, as starting a
bearer can be slow.

Reviewed-by: Markus Goetz
This commit is contained in:
Shane Kearns 2011-05-05 15:31:49 +01:00 committed by Markus Goetz
parent e01faeb5c7
commit 9c1293283e

View File

@ -4973,16 +4973,21 @@ void tst_QNetworkReply::httpProxyCommands()
QNetworkRequest request(url);
request.setRawHeader("User-Agent", "QNetworkReplyAutoTest/1.0");
QNetworkReplyPtr reply = manager.get(request);
manager.setProxy(QNetworkProxy());
//clearing the proxy here causes the test to fail.
//the proxy isn't used until after the bearer has been started
//which is correct in general, because system proxy isn't known until that time.
//removing this line is safe, as the proxy is also reset by the cleanup() function
//manager.setProxy(QNetworkProxy());
// wait for the finished signal
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
QTestEventLoop::instance().enterLoop(1);
QTestEventLoop::instance().enterLoop(15);
QVERIFY(!QTestEventLoop::instance().timeout());
//qDebug() << reply->error() << reply->errorString();
//qDebug() << proxyServer.receivedData;
// we don't really care if the request succeeded
// especially since it won't succeed in the HTTPS case