diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2016-10-31 19:44:00 +0300 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2016-11-04 18:43:01 +0300 |
commit | 15f2b911d960dd88e86a388ccf1ced3eda0de4dd (patch) | |
tree | b43b632223591238686debdfbf8d93b87f5ac60e /test/syncenginetestutils.h | |
parent | c8014a0afdc0bcfa780165b681fc5da2ca573f74 (diff) |
ChunkingNG: remove stale files when resuming
Diffstat (limited to 'test/syncenginetestutils.h')
-rw-r--r-- | test/syncenginetestutils.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index 51d7ce421..cbcb5fab2 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -297,6 +297,12 @@ public: setOperation(op); open(QIODevice::ReadOnly); + QString fileName = getFilePathFromUrl(request.url()); + Q_ASSERT(!fileName.isNull()); // for root, it should be empty + const FileInfo *fileInfo = remoteRootFileInfo.find(fileName); + Q_ASSERT(fileInfo); + QString prefix = request.url().path().left(request.url().path().size() - fileName.size()); + // Don't care about the request and just return a full propfind const QString davUri{QStringLiteral("DAV:")}; const QString ocUri{QStringLiteral("http://owncloud.org/ns")}; @@ -310,7 +316,7 @@ public: auto writeFileResponse = [&](const FileInfo &fileInfo) { xml.writeStartElement(davUri, QStringLiteral("response")); - xml.writeTextElement(davUri, QStringLiteral("href"), "/owncloud/remote.php/webdav/" + fileInfo.path()); + xml.writeTextElement(davUri, QStringLiteral("href"), prefix + fileInfo.path()); xml.writeStartElement(davUri, QStringLiteral("propstat")); xml.writeStartElement(davUri, QStringLiteral("prop")); @@ -334,11 +340,6 @@ public: xml.writeEndElement(); // response }; - QString fileName = getFilePathFromUrl(request.url()); - Q_ASSERT(!fileName.isNull()); // for root, it should be empty - const FileInfo *fileInfo = remoteRootFileInfo.find(fileName); - Q_ASSERT(fileInfo); - writeFileResponse(*fileInfo); foreach(const FileInfo &childFileInfo, fileInfo->children) writeFileResponse(childFileInfo); @@ -400,6 +401,7 @@ public: } Q_INVOKABLE void respond() { + emit uploadProgress(fileInfo->size, fileInfo->size); setRawHeader("OC-ETag", fileInfo->etag.toLatin1()); setRawHeader("ETag", fileInfo->etag.toLatin1()); setRawHeader("X-OC-MTime", "accepted"); // Prevents Q_ASSERT(!_runningNow) since we'll call PropagateItemJob::done twice in that case. @@ -583,6 +585,7 @@ public: } while(true); Q_ASSERT(count > 1); // There should be at least two chunks, otherwise why would we use chunking? + QCOMPARE(sourceFolder->children.count(), count); // There should not be holes or extra files QString fileName = getFilePathFromUrl(QUrl::fromEncoded(request.rawHeader("Destination"))); Q_ASSERT(!fileName.isEmpty()); @@ -750,7 +753,7 @@ public: } FileInfo currentRemoteState() { return _fakeQnam->currentRemoteState(); } - FileInfo uploadState() { return _fakeQnam->uploadState(); } + FileInfo &uploadState() { return _fakeQnam->uploadState(); } QStringList &serverErrorPaths() { return _fakeQnam->errorPaths(); } |