summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-09-03 11:34:13 +0200
committerMichael Meeks <michael.meeks@collabora.com>2020-09-07 15:00:20 +0200
commit70827c372c31f5d11dc9578269cdd850eee639ef (patch)
treee4207613df11ceffde8a3e5026b108a08970e645 /test
parentnotebookar: make loading spinners less distractive (diff)
downloadonline-70827c372c31f5d11dc9578269cdd850eee639ef.tar.gz
online-70827c372c31f5d11dc9578269cdd850eee639ef.zip
Simplify download process
Use hash to identify download and pass that to the client. This allows us to reduce parameters for download requests. DocBroker maps download ids to URL in the file system. Change-Id: I254d4f0ccaf3cff9f038a817c8162510ae228bc5 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101992 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'test')
-rw-r--r--test/UnitSession.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/test/UnitSession.cpp b/test/UnitSession.cpp
index ec8d1f9bfc..bbff4a09e4 100644
--- a/test/UnitSession.cpp
+++ b/test/UnitSession.cpp
@@ -185,15 +185,11 @@ UnitBase::TestResult UnitSession::testSlideShow()
!response.empty());
StringVector tokens(Util::tokenize(response.substr(11), ' '));
- // "downloadas: jail= dir= name=slideshow.svg port= id=slideshow"
- const std::string jail = tokens[0].substr(std::string("jail=").size());
- const std::string dir = tokens[1].substr(std::string("dir=").size());
- const std::string name = tokens[2].substr(std::string("name=").size());
- const int port = std::stoi(tokens[3].substr(std::string("port=").size()));
- const std::string id = tokens[4].substr(std::string("id=").size());
- LOK_ASSERT(!jail.empty());
- LOK_ASSERT(!dir.empty());
- LOK_ASSERT_EQUAL(std::string("slideshow.svg"), name);
+ // "downloadas: downloadId= port= id=slideshow"
+ const std::string downloadId = tokens[0].substr(std::string("downloadId=").size());
+ const int port = std::stoi(tokens[1].substr(std::string("port=").size()));
+ const std::string id = tokens[2].substr(std::string("id=").size());
+ LOK_ASSERT(!downloadId.empty());
LOK_ASSERT_EQUAL(static_cast<int>(Poco::URI(helpers::getTestServerURI()).getPort()),
port);
LOK_ASSERT_EQUAL(std::string("slideshow"), id);
@@ -201,7 +197,7 @@ UnitBase::TestResult UnitSession::testSlideShow()
std::string encodedDoc;
Poco::URI::encode(documentPath, ":/?", encodedDoc);
const std::string ignoredSuffix = "%3FWOPISRC=madness"; // cf. iPhone.
- const std::string path = "/lool/" + encodedDoc + '/' + jail + '/' + dir + '/' + name + ignoredSuffix;
+ const std::string path = "/lool/" + encodedDoc + "/download/" + downloadId + '/' + ignoredSuffix;
std::unique_ptr<Poco::Net::HTTPClientSession> session(
helpers::createSession(Poco::URI(helpers::getTestServerURI())));
Poco::Net::HTTPRequest requestSVG(Poco::Net::HTTPRequest::HTTP_GET, path);