[Libreoffice-commits] online.git: 2 commits - test/Makefile.am test/UnitRequests.cpp wsd/LOOLWebSocket.hpp
Pranav Kant
pranavk at collabora.co.uk
Fri Dec 16 06:03:58 UTC 2016
test/Makefile.am | 6 +--
test/UnitRequests.cpp | 99 --------------------------------------------------
wsd/LOOLWebSocket.hpp | 2 +
3 files changed, 4 insertions(+), 103 deletions(-)
New commits:
commit 9b37eed7274398a539cd5151fd0b6aa174228bd4
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Fri Dec 16 11:32:16 2016 +0530
Add missing config.h
Change-Id: Ib63c0bdfc8126fea211c5311c957985de6b00129
diff --git a/wsd/LOOLWebSocket.hpp b/wsd/LOOLWebSocket.hpp
index bc51321..28d74ae 100644
--- a/wsd/LOOLWebSocket.hpp
+++ b/wsd/LOOLWebSocket.hpp
@@ -10,6 +10,8 @@
#ifndef INCLUDED_LOOLWEBSOCKET_HPP
#define INCLUDED_LOOLWEBSOCKET_HPP
+#include "config.h"
+
#include <cstdlib>
#include <mutex>
#include <thread>
commit dd498ed0791032d35fdcdacc2d8ce0568f29d6d3
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Thu Dec 15 22:58:21 2016 +0530
Bin this unit test
This was added while debugging some problem with forward slashes
in docurl in websocket endpoint automatically being decoded on
some machines. But it turned out it was due to the apache server
setting. So, this test serves no purpose now and tests something
really obvious.
Change-Id: I4658354d53c481cf7554804383892f501bc408cd
diff --git a/test/Makefile.am b/test/Makefile.am
index 992830e..2a285bc 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-fonts.la \
unit-admin.la unit-tilecache.la \
- unit-fuzz.la unit-requests.la \
- unit-oob.la
+ unit-fuzz.la unit-oob.la
MAGIC_TO_FORCE_SHLIB_CREATION = -rpath /dummy
AM_LDFLAGS = -pthread -module $(MAGIC_TO_FORCE_SHLIB_CREATION)
@@ -51,7 +50,6 @@ unittest_SOURCES = TileQueueTests.cpp WhiteBoxTests.cpp test.cpp $(wsd_sources)
unittest_LDADD = $(CPPUNIT_LIBS)
# unit test modules:
-unit_requests_la_SOURCES = UnitRequests.cpp
unit_oob_la_SOURCES = UnitOOB.cpp
unit_fuzz_la_SOURCES = UnitFuzz.cpp
unit_admin_la_SOURCES = UnitAdmin.cpp
@@ -72,7 +70,7 @@ if HAVE_LO_PATH
check-local:
./run_unit.sh --log-file test.log --trs-file test.trs
# FIXME unit-fonts.la is unstable, disabled for now.
-TESTS = unit-oob.la unit-tilecache.la unit-storage.la unit-timeout.la unit-prefork.la unit-admin.la unit-requests.la
+TESTS = unit-oob.la unit-tilecache.la unit-storage.la unit-timeout.la unit-prefork.la unit-admin.la
else
TESTS = ${top_builddir}/test/test
endif
diff --git a/test/UnitRequests.cpp b/test/UnitRequests.cpp
deleted file mode 100644
index 2bb7b6f..0000000
--- a/test/UnitRequests.cpp
+++ /dev/null
@@ -1,99 +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 <iostream>
-
-#include <Poco/Net/HTTPClientSession.h>
-#include <Poco/Net/HTTPResponse.h>
-#include <Poco/Net/HTTPServerRequest.h>
-#include <Poco/URI.h>
-
-#include "Log.hpp"
-#include "Unit.hpp"
-#include "UnitHTTP.hpp"
-#include "helpers.hpp"
-
-using namespace helpers;
-
-// Inside the WSD process
-class UnitRequests : public UnitWSD
-{
- enum {
- PHASE_LOAD,
- PHASE_FILTER,
- PHASE_FILTERED
- } _phase;
-
- TestResult _testResult;
- std::unique_ptr<UnitWebSocket> _ws;
-public:
- UnitRequests() :
- _phase(PHASE_LOAD)
- {
- std::cerr << "UnitRequests startup\n";
- }
-
- virtual bool filterHandleRequest(
- TestRequest type,
- Poco::Net::HTTPServerRequest& request,
- Poco::Net::HTTPServerResponse& /*response*/) override
- {
- if (_phase == PHASE_FILTER && type == UnitWSD::TestRequest::TEST_REQ_CLIENT)
- {
- std::string uri = request.getURI();
- // Get the embedded document URL: '/lool/docUrl/ws/'
- uri = uri.substr(uri.find("lool/") + std::string("lool/").size());
- uri = uri.substr(0, uri.find("/ws"));
- Poco::URI requestUri(uri);
- _testResult = TestResult::TEST_OK;
- // If this is a simple encoded string, it would be treated as
- // relative, otherwise non-relative.
- // We require this embedded url to be encoded as otherwise it would
- // be treated as a resource on the server due to the presence of
- // un-encoded '/'
- if (!requestUri.isRelative())
- {
- _testResult = TestResult::TEST_FAILED;
- }
-
- _phase = PHASE_FILTERED;
- }
- return false;
- }
-
- void loadDocument()
- {
- std::string docPath;
- std::string docURL;
- getDocumentPathAndURL("empty.odt", docPath, docURL);
- _ws = std::unique_ptr<UnitWebSocket>(new UnitWebSocket(docURL));
- assert(_ws.get());
- }
-
- virtual void invokeTest() override
- {
- switch(_phase)
- {
- case PHASE_LOAD:
- _phase = PHASE_FILTER;
- loadDocument();
- break;
- case PHASE_FILTER:
- break;
- case PHASE_FILTERED:
- exitTest(_testResult);
- break;
- }
- }
-};
-
-UnitBase *unit_create_wsd(void)
-{
- return new UnitRequests();
-}
More information about the Libreoffice-commits
mailing list