Commit graph

22 commits

Author SHA1 Message Date
Ashod Nakashian
82560d9657 wsd: test assertion macros
Because the new-style tests are intrustive,
the exception that CppUnit throws on assertion
failures is caught and processed with the
application logic, which is far from ideal,
because it's very difficult to find the
cause of failure.

What we'd like is a way to control what happens
when an test assertion fails, such that we can
properly log/print the failure, and even break
in the debugger.

The new macros allow us to control the behavior
at compile-time and have added flexibility.
For now, they log an assertion failure before
invoking the CPPUNIT macro, and support a
compile-time directive to assert, which is
useful for breaking in the debugger.

Change-Id: If464ba246e3ec747f31496a4215cb73ef735dfaf
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87625
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-03-14 15:45:00 +01:00
DarkByt31
dd014e7029 tdf#107038 Poco::Timestamp replacement with std::chrono
Util added getHttpTime
WhiteBoxTests added test for getHttpTime

Change-Id: Ifb6a3fb2dc9b059b925e7b881362b72759a8b56b
Reviewed-on: https://gerrit.libreoffice.org/79754
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-09-28 12:26:32 +02:00
Miklos Vajna
59c9f70c1f test: avoid UB in unit-wopi
==16414==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7f81f8df5510 at pc 0x0000005eb5a4 bp 0x7f81f8df54b0 sp 0x7f81f8df4c60
READ of size 23 at 0x7f81f8df5510 thread T3 (websrv_poll)
    #0 0x5eb5a3 in __interceptor_strlen.part.34 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:365
    #1 0x7f8201d22e47 in std::char_traits<char>::length(char const*) /home/vmiklos/git/libreoffice/lode/packages/gccbuild/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:320
    #2 0x7f8201d22e47 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) /home/vmiklos/git/libreoffice/lode/packages/gccbuild/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:511
    #3 0x7f81fcaa59c3 in WopiTestServer::handleHttpRequest(Poco::Net::HTTPRequest const&, Poco::MemoryInputStream&, std::shared_ptr<StreamSocket>&) /home/vmiklos/git/libreoffice/online-san/test/./WopiTestServer.hpp:237:28

Problem was that the test code assumed a 0-terminated buffer, but that
was not the reality. So specify the buffer size explicitly.

Change-Id: I9a9edfe5623a1136aa77c381d1d3d8b8e1ca2258
2019-08-07 09:11:09 +02:00
Jan Holesovsky
635f0627f2 Fix build.
Change-Id: I3e7dc00a8acdaf0ad1a07c0cd55ff7bff7b64295
2019-07-25 07:58:19 +02:00
Henry Castro
898c47fbb4 wsd: fix the exception "Bad URI syntax"
if the file name has '%' character it throws
exception "Bad URI syntax", so use the encoded
file name string

Change-Id: I6a8d841761b46ac49a6c79956ba215e1affa53e5
Reviewed-on: https://gerrit.libreoffice.org/72385
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit b934c70f4f1f9f3ee4f873570633a3b1ec931652)
Reviewed-on: https://gerrit.libreoffice.org/72890
2019-05-24 08:57:36 +02:00
Michael Meeks
046ab32e46 Use compile-time rather than run-time string concatenation.
Saves some time & space.

Change-Id: If1e62056447fb7e8f26e8cf107451876adf3fecb
2019-05-20 12:30:01 +01:00
merttumer
0dbf9bcf27 Added RenameFile Support for WOPI
This patch concerns rename file operation when the integration
supports it
Signed-off-by: merttumer <mert.tumer@collabora.com>

Change-Id: Ibb4f615b91dda2491bfcd4d4738198d69eca4e6f
Reviewed-on: https://gerrit.libreoffice.org/71587
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Signed-off-by: merttumer <mert.tumer@collabora.com>
2019-05-13 22:29:40 +03:00
Eduard Ardeleanu
d87146d3fa fix: saveAs breaks when '%' character is used within the filename
Change-Id: I2df059abd67be88acae8bd44ae2c74be7778a595
Reviewed-on: https://gerrit.libreoffice.org/69424
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2019-03-19 18:31:15 +01:00
Miklos Vajna
b773f11bdb WopiTestServer: make members private
Change-Id: If042fab5b69faf7c7dff975a95810cb96d8f02b0
2018-12-13 08:49:09 +01:00
Miklos Vajna
8316a650d6 test: avoid some unnecessary value parameters 2018-10-17 09:34:18 +02:00
Pranav Kant
40a56e31dd Unbreak some wopi tests; use fractional fractional iso8601
And we read the "LastModifiedTime" from the JSON payload in PutFile
response, not from the headers. Change that so that wsd now reads the
correct time.

Change-Id: Ic930ef4cfb2744367d04ba460fa1cbeb045b7356
2018-02-09 01:14:18 +05:30
Pranav Kant
39f11ab4f7 document conflict: unit test
Change-Id: I4ea310fe5adb198bc7b5e083f6bd4b0431c0cdef
2018-02-09 00:22:57 +05:30
Pranav Kant
cb0d652899 Try to act like a wopi test server bit more realistically
Change-Id: If10a65a3e7740a752057f63072f1ada1be3552e7
2018-02-09 00:22:57 +05:30
Pranav Kant
5bd4d67818 versionrestore: unit test; checks if wsd saves a modified document
See comment for more details

Change-Id: If79537c4ca61926f06015ad6827a473d18a2a79f
2018-02-08 19:57:20 +05:30
Pranav Kant
4aa496e913 Unused variable
Change-Id: Ice363f65d2ce3af818cf28396449b6d0402d6fc7
2018-02-08 17:43:54 +05:30
Pranav Kant
5476774af1 wsd: Use a close request flag to break out of doc broker poll thread
... instead of directly stop()ing it. The close request approach also
makes sure that outgoing document is saved to storage.

Change-Id: I44f61db00dbd326dec80f59f4a2cbb617048aa94
Reviewed-on: https://gerrit.libreoffice.org/49122
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-07 14:30:33 +01:00
Jan Holesovsky
b20faa8bdc Save As: Advertise the correct size when uploading the new file.
Change-Id: I9b20c4bdb7ddc848437edceae1a77ddb49d55133
Reviewed-on: https://gerrit.libreoffice.org/44357
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2017-11-10 11:08:53 +01:00
Jan Holesovsky
6745464c70 tdf#99744 SaveAs: Report back to loleaflet that the saveas succeeded.
Change-Id: I670c8b4503c1a4c0a88001a1343f6dec2974e044
2017-10-26 11:11:38 +02:00
Jan Holesovsky
7ff432a370 tdf#99744 SaveAs: Reimplementation of the PutRelativeFile going through Kit.
This is necessary so that changing of the file type works.

Includes a unit test.

Change-Id: Id01d44e555b6bac1002ff950de461fd330602f63
2017-10-26 11:11:38 +02:00
Jan Holesovsky
043528f839 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>
2017-09-27 23:53:20 +02:00
Jan Holesovsky
3141cfc99b PutFile ext: X-LOOL-WOPI-IsModifiedByUser unit test.
Change-Id: I0b1ffc74dbbc771f0dcb68f87d46af3ba469ae9e
Reviewed-on: https://gerrit.libreoffice.org/42855
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-09-27 16:37:16 +02:00
Jan Holesovsky
a711d5b60c Separate the fake wopi server to an own class.
Change-Id: Ibb1b06c491be0065aa12a05a43959165d6c86398
Reviewed-on: https://gerrit.libreoffice.org/42853
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-09-27 16:36:21 +02:00