summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShane Kearns <ext-shane.2.kearns@nokia.com>2012-05-28 16:27:58 +0100
committerQt by Nokia <qt-info@nokia.com>2012-06-14 05:26:37 +0200
commit46e40214cfd62c935a20cddc7e9ae6fb45ba1884 (patch)
tree43b2b348cdd6ddb191b6f450aabf86e0fda7d1cf /tests
parentd6d9c8bf3245ec3d1ff05ae45d54baac64d76cec (diff)
choke uploadProgress signals
The QNetworkReply::uploadProgress signal is intended for updating UI elements such as a progress bar. Limit the signal emissions to 10 per second to prevent overloading the UI with updates. As with the downloadProgress choke, this is implemented by dropping signals that occur within 100ms of the previous emission. The 100% signal is always emitted (bytesSent == bytesTotal) When the upload size is initially unknown, this behaviour is still provided by the upload device emitting a suitable readProgress signal when EOF is reached. Task-number: QTBUG-20449 Change-Id: I77e03c8a49109106e1c375ee00380293fd326b63 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index bc2a95d102..2226f99432 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -4528,7 +4528,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
void tst_QNetworkReply::ioPostToHttpUploadProgress()
{
- QFile sourceFile(testDataDir + "/bigfile");
+ //test file must be larger than OS socket buffers (~830kB on MacOS 10.6)
+ QFile sourceFile(testDataDir + "/image1.jpg");
QVERIFY(sourceFile.open(QIODevice::ReadOnly));
// emulate a minimal http server
@@ -4553,6 +4554,7 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress()
incomingSocket->setReadBufferSize(1*1024);
QTestEventLoop::instance().enterLoop(5);
// some progress should have been made
+ QVERIFY(!spy.isEmpty());
QList<QVariant> args = spy.last();
QVERIFY(!args.isEmpty());
QVERIFY(args.at(0).toLongLong() > 0);
@@ -4563,6 +4565,7 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress()
incomingSocket->setReadBufferSize(0);
QTestEventLoop::instance().enterLoop(10);
// progress should be finished
+ QVERIFY(!spy.isEmpty());
QList<QVariant> args3 = spy.last();
QVERIFY(!args3.isEmpty());
// More progress than before