diff options
author | Jan Holesovsky <kendy@collabora.com> | 2017-09-27 19:57:22 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-09-27 23:53:20 +0200 |
commit | 043528f8396fc8e5699628ece33ab7b95372e53a (patch) | |
tree | 4b80b5f7b5861c565d6a89afb873c1f144a84533 /test/UnitOAuth.cpp | |
parent | 67ebb9a48ed3131749858b070ec4d3c81906530a (diff) |
WopiTestServer: Share more code.
Change-Id: Ied539169f96608adb7095682bd8f0b7a70d28491
Reviewed-on: https://gerrit.libreoffice.org/42879
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'test/UnitOAuth.cpp')
-rw-r--r-- | test/UnitOAuth.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/test/UnitOAuth.cpp b/test/UnitOAuth.cpp index dfba4aa13..dcd2de651 100644 --- a/test/UnitOAuth.cpp +++ b/test/UnitOAuth.cpp @@ -98,20 +98,12 @@ public: case Phase::LoadToken: case Phase::LoadHeader: { - Poco::URI wopiURL(helpers::getTestServerURI() + - ((_phase == Phase::LoadToken)? "/wopi/files/0?access_token=s3hn3ct0k3v": - "/wopi/files/1?access_header=Authorization: Basic basic==")); - //wopiURL.setPort(_wopiSocket->address().port()); - std::string wopiSrc; - Poco::URI::encode(wopiURL.toString(), ":/?", wopiSrc); - Poco::URI loolUri(helpers::getTestServerURI()); - - LOG_INF("Connecting to the fake WOPI server: /lool/" << wopiSrc << "/ws"); - - std::unique_ptr<UnitWebSocket> ws(new UnitWebSocket("/lool/" + wopiSrc + "/ws")); - assert(ws.get()); + if (_phase == Phase::LoadToken) + initWebsocket("/wopi/files/0?access_token=s3hn3ct0k3v"); + else + initWebsocket("/wopi/files/1?access_header=Authorization: Basic basic=="); - helpers::sendTextFrame(*ws->getLOOLWebSocket(), "load url=" + wopiSrc, testName); + helpers::sendTextFrame(*_ws->getLOOLWebSocket(), "load url=" + _wopiSrc, testName); if (_phase == Phase::LoadToken) _phase = Phase::LoadHeader; |