Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristian Kamm <mail@ckamm.de>2018-06-13 15:20:21 +0300
committerckamm <mail@ckamm.de>2018-06-13 17:44:24 +0300
commitad2446b0360a22d412f30131bd9d6f2f20ac5134 (patch)
tree40d3c950fec4ebddf8704d4a9f5d608639fd18ab /test
parent9c66dbb2b77a581d56a4ef1000c8e55410e56cfb (diff)
Ensure GETFileJob notices finishing #6581
It could happen that readyRead was emitted for incoming data while the download was not yet finished. Then the network job could finish with no more data arriving - so readyRead wasn't emitted again. To fix this, the finished signal also gets connected to the readyRead slot.
Diffstat (limited to 'test')
-rw-r--r--test/syncenginetestutils.h7
-rw-r--r--test/testdownload.cpp3
-rw-r--r--test/testsyncengine.cpp3
3 files changed, 12 insertions, 1 deletions
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h
index 3957479d6..e0982bd15 100644
--- a/test/syncenginetestutils.h
+++ b/test/syncenginetestutils.h
@@ -729,10 +729,17 @@ public:
setError(InternalServerError, "Internal Server Fake Error");
emit metaDataChanged();
emit readyRead();
+ // finishing can come strictly after readyRead was called
+ QTimer::singleShot(5, this, &FakeErrorReply::slotSetFinished);
+ }
+
+public slots:
+ void slotSetFinished() {
setFinished(true);
emit finished();
}
+public:
void abort() override { }
qint64 readData(char *buf, qint64 max) override {
max = qMin<qint64>(max, _body.size());
diff --git a/test/testdownload.cpp b/test/testdownload.cpp
index 4d9098e41..3301e0e6d 100644
--- a/test/testdownload.cpp
+++ b/test/testdownload.cpp
@@ -112,7 +112,10 @@ private slots:
return nullptr;
});
+ bool timedOut = false;
+ QTimer::singleShot(10000, &fakeFolder.syncEngine(), [&]() { timedOut = true; fakeFolder.syncEngine().abort(); });
QVERIFY(!fakeFolder.syncOnce()); // Fail because A/broken
+ QVERIFY(!timedOut);
QCOMPARE(getItem(completeSpy, "A/broken")->_status, SyncFileItem::NormalError);
QVERIFY(getItem(completeSpy, "A/broken")->_errorString.contains(serverMessage));
}
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp
index 08a28e681..5628befdc 100644
--- a/test/testsyncengine.cpp
+++ b/test/testsyncengine.cpp
@@ -255,7 +255,8 @@ private slots:
} else if(item->_file == "Y/Z/d3") {
QVERIFY(item->_status != SyncFileItem::Success);
}
- QVERIFY(item->_file != "Y/Z/d9"); // we should have aborted the sync before d9 starts
+ // We do not know about the other files - maybe the sync was aborted,
+ // maybe they finished before the error caused the abort.
}
}