From 8413073fe3946ed37f6424f179898af63767f060 Mon Sep 17 00:00:00 2001
From: Norwegian Rock Cat <qt-info@nokia.com>
Date: Tue, 19 May 2009 13:08:16 +0200
Subject: Don't "hope" that a connection gets picked up; do it right!

While downloadProgress and uploadProgress both work on local files.
There still may be a delay before the connection is actually picked up.
This usually is caught by the processEvents(), but could be missed.
Therefore, do a wait if we don't have any pending connections and work
in ALL cases.

Reviewed-by: Markus Goetz
---
 tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index bb199b9..d651ce5 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -2637,7 +2637,8 @@ void tst_QNetworkReply::downloadProgress()
     QVERIFY(spy.isValid());
 
     QCoreApplication::instance()->processEvents();
-    server.waitForNewConnection(0); // ignore result, since processEvents may have got it
+    if (!server.hasPendingConnections())
+        server.waitForNewConnection(1000);
     QVERIFY(server.hasPendingConnections());
     QCOMPARE(spy.count(), 0);
 
@@ -2691,7 +2692,8 @@ void tst_QNetworkReply::uploadProgress()
     QVERIFY(finished.isValid());
 
     QCoreApplication::instance()->processEvents();
-    server.waitForNewConnection(0); // ignore result, since processEvents may have got it
+    if (!server.hasPendingConnections())
+        server.waitForNewConnection(1000);
     QVERIFY(server.hasPendingConnections());
 
     QTcpSocket *receiver = server.nextPendingConnection();
-- 
cgit v0.12