diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2017-03-31 15:54:26 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2017-03-31 15:55:14 +0100 |
commit | b70b17130435da4ea1b1ddacd46297407a3858df (patch) | |
tree | 462151307193e3cfbf5a380dfa62e35c8ca211ec /test | |
parent | Prefork children correctly on start, rather than after a delay. (diff) | |
download | online-b70b17130435da4ea1b1ddacd46297407a3858df.tar.gz online-b70b17130435da4ea1b1ddacd46297407a3858df.zip |
Tests: enable tilecache test and bin socket buffer size test.
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 6 | ||||
-rw-r--r-- | test/UnitMinSocketBufferSize.cpp | 86 |
2 files changed, 2 insertions, 90 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 6be2a53566..41aa678105 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -16,8 +16,7 @@ noinst_LTLIBRARIES = \ unit-timeout.la unit-prefork.la \ unit-storage.la \ unit-admin.la unit-tilecache.la \ - unit-fuzz.la unit-oob.la \ - unit-minsocketbuffersize.la + unit-fuzz.la unit-oob.la MAGIC_TO_FORCE_SHLIB_CREATION = -rpath /dummy AM_LDFLAGS = -pthread -module $(MAGIC_TO_FORCE_SHLIB_CREATION) $(ZLIB_LIBS) @@ -61,7 +60,6 @@ unit_timeout_la_SOURCES = UnitTimeout.cpp unit_prefork_la_SOURCES = UnitPrefork.cpp unit_storage_la_SOURCES = UnitStorage.cpp unit_tilecache_la_SOURCES = UnitTileCache.cpp -unit_minsocketbuffersize_la_SOURCES = UnitMinSocketBufferSize.cpp if HAVE_LO_PATH SYSTEM_STAMP = @SYSTEMPLATE_PATH@/system_stamp @@ -74,7 +72,7 @@ check-local: ./run_unit.sh --log-file test.log --trs-file test.trs # FIXME 2: unit-oob.la fails with symbol undefined: # UnitWSD::testHandleRequest(UnitWSD::TestRequest, UnitHTTPServerRequest&, UnitHTTPServerResponse&) , -TESTS = unit-prefork.la # unit-tilecache.la unit-storage.la unit-timeout.la unit-admin.la unit-minsocketbuffersize.la +TESTS = unit-prefork.la unit-tilecache.la # unit-timeout.la # unit-storage.la unit-admin.la else TESTS = ${top_builddir}/test/test endif diff --git a/test/UnitMinSocketBufferSize.cpp b/test/UnitMinSocketBufferSize.cpp deleted file mode 100644 index 6bfb678b22..0000000000 --- a/test/UnitMinSocketBufferSize.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include "config.h" - -#include "Log.hpp" -#include "Protocol.hpp" -#include "Unit.hpp" -#include "UnitHTTP.hpp" -#include "helpers.hpp" - -using namespace helpers; - -class UnitMinSocketBufferSize: public UnitWSD -{ - enum class Phase { - Load, // load the document - Request, // Request tiles etc. - CheckResponse // Check if we got correct response - } _phase; - std::string _docURL, _docPath; - std::unique_ptr<UnitWebSocket> _ws; -public: - UnitMinSocketBufferSize() : - _phase(Phase::Load) - { - } - - virtual void invokeTest() - { - switch (_phase) - { - case Phase::Load: - { - getDocumentPathAndURL("Example.odt", _docPath, _docURL, "unitMinSocketBufferSize "); - _ws = std::unique_ptr<UnitWebSocket>(new UnitWebSocket(_docURL)); - assert(_ws.get()); - - _phase = Phase::Request; - LOG_DBG("Document loaded successfully."); - break; - } - case Phase::Request: - { - const std::string loadMsg = "load url=" + _docURL; - const std::string tilecombineMsg = "tilecombine part=0 width=256 height=256 tileposx=0,3840,7680,11520,0,3840,7680,11520,0,3840,7680,11520,0,3840,7680,11520,0,3840,7680,11520 tileposy=0,0,0,0,3840,3840,3840,3840,7680,7680,7680,7680,11520,11520,11520,11520,15360,15360,15360,15360 tilewidth=3840 tileheight=3840"; - _ws->getLOOLWebSocket()->sendFrame(loadMsg.data(), loadMsg.size()); - _ws->getLOOLWebSocket()->sendFrame(tilecombineMsg.data(), tilecombineMsg.size()); - - LOG_DBG("Tilecombine request sent"); - _phase = Phase::CheckResponse; - break; - } - case Phase::CheckResponse: - LOG_DBG("Checking if get back all the tiles"); - int nTiles = 20; - bool success = true; - while (nTiles--) - { - const auto tile = getResponseMessage(*_ws->getLOOLWebSocket(), "tile: part=0 width=256 height=256", "Waiting for tiles ..."); - const auto firstLine = LOOLProtocol::getFirstLine(tile); - LOG_DBG("Tile received " << firstLine); - if (!LOOLProtocol::matchPrefix("tile:", firstLine)) - { - success = false; - } - } - - exitTest(success ? TestResult::Ok : TestResult::Failed); - break; - } - } -}; - -UnitBase *unit_create_wsd(void) -{ - return new UnitMinSocketBufferSize(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |