Commit Graph

42 Commits (master)

Author SHA1 Message Date
Ashod Nakashian fe3c3bc135 wsd: test: move WebSocketSession under test
WebSocketSession is used exclusively for tests,
so it's best that it is located in the test
directory.

Change-Id: I88333d619902df7991c3f26b94ed309246446ae0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-03-21 09:08:51 +00:00
Miklos Vajna 141e1ce7d0 cool#8023 Remove HTML marker in unit-copy-paste
This really just passed by accident in the past:

	Clipboard with 19 entries:
		[0] - size 5689 type: 'application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source (XML)"'
		[1] - size 159 type: 'application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object Descriptor (XML)";classname="47BBB4CB-CE4C-4E80-a591-42d9ae74950f";typename="Collabora OfficeDev 23.05 Spreadsheet";displayname="file:///tmp/user/docs/jexG9292sB0PuaWL/UnitCopyPaste1d0fdba5_empty.ods";viewaspect="1";width="6783";height="2712";posx="0";posy="0"'
		[2] - size 388 type: 'application/x-openoffice-gdimetafile;windows_formatname="GDIMetaFile"'
		[3] - size 1812 type: 'application/x-openoffice-emf;windows_formatname="Image EMF"'
		[4] - size 2222 type: 'application/x-openoffice-wmf;windows_formatname="Image WMF"'
		[5] - size 1073 type: 'image/png'
		[6] - size 79158 type: 'application/x-openoffice-bitmap;windows_formatname="Bitmap"'
		[7] - size 79158 type: 'image/bmp'
		[8] - size 1493 type: 'text/html'
		[9] - size 0 type: '    </tr>'
		[10] - size 0 type: '           <td align="left"><br></td>'
		[11] - size 0 type: '</table>'
		[12] - size 49 type: 'application/x-openoffice-sylk;windows_formatname="Sylk"'
		[13] - size 98 type: 'application/x-openoffice-link;windows_formatname="Link"'
		[14] - size 246 type: 'application/x-openoffice-dif;windows_formatname="DIF"'
		[15] - size 6 type: 'text/plain;charset=utf-8'
		[16] - size 6 type: 'application/x-libreoffice-tsvc'
		[17] - size 977 type: 'text/rtf'
		[18] - size 977 type: 'text/richtext'

Remove the marker, then sizes will match again.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I1edea3d3a64b9a54cc1c0a0cea703ae66c2aba82
2024-01-19 08:24:57 +01:00
Michael Meeks 7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Ashod Nakashian 22292d630f wsd: test: minor improvements to UnitCopyPaste
Change-Id: I0fe2390806ee736f44d76ab128e911b66b5e059b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-07-08 04:19:00 -04:00
Ashod Nakashian c0908ecc8c wsd: test: fix uninitialized member
Change-Id: I4c103e1e11ee022e25c2097fb29dc798dfc8b466
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-31 07:40:11 -04:00
Ashod Nakashian d4b27f6643 killpoco: replace HTTP status codes
We use our own status codes, which
are type-safe and use streaming
operators to serialize and log.

Change-Id: I0eba7b16694866b5a79476a7ef4b1b78f7f9c176
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-11 07:21:42 -04:00
Ashod Nakashian ada1dd1a0b wsd: test: better post-close check in UnitCopyPaste
At the end of the test we validate getting
the clipboard contents after disconnecting
and unloading the document. Unfortunately,
this relied on the speed at which unloading
happened.

Now we wait for the document to unload,
via the callback, before proceeding.
This makes the test more reliable and
harder to pass accidentally.

Change-Id: I4b7f4483c6827dc56689f739ec41a197759413f1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-12-21 19:41:38 -05:00
Ashod Nakashian a7541058ca wsd: test: do not assert after test failure
After failing a test, any assertion will simply
pile-on and add noise. There is little benefit
in seeing assertion failures (and especially
core-dumps) after a test has failed.

This change silently suppresses assertions if
a test has failed already.

Change-Id: I5146f12692c0275579510dfac7ef7b37d5af86d0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-12-12 08:00:05 -05:00
Ashod Nakashian fcb0f8557a wsd: test: killpoco for UnitCopyPaste
Change-Id: I655e29619b110fce23881dab29828ecb7966890e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 09:24:46 -04:00
Ashod Nakashian 52f2600cf9 wsd: test: embue all tests with a name and unify logs
Now the remaining tests that didn't have a name
get one and the logs are unified between old-
and new-style tests. Mostly.

This makes sure that all logs and assertions
properly log the test name and make test
failures easier to debug and fix.

Change-Id: Id159ffacc81642a6ec594c5143498408adab67cf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00
Andras Timar f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Ashod Nakashian 17cdf3766d wsd: test: improve the stability of UnitCopyPaste
The .uno:Copy command has to get executed before
we can read the clipboard. Since .uno commands
are executed asynchronously, it possible to
invoke getClipboard before having the data
copied into it, thereby failing the test.

Here we wait for the first sign that the
.uno commands have been executed, although
we can't know if they have finished or not.

This improves the test reliability significantly.

Change-Id: I7da1e4a32092c05dfb533571ea50d5edbc07f554
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian f20b1f3899 wsd: test: better logging in copy/paste
Change-Id: Ia9561f6603b79336b908fade40d49465c2288a4b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian b47c81e7a8 wsd: improved WebSocketSession interface
SocketPoll is captured as weak_ptr into
WebSocketSession and a much better shutdown
support is now available. The new logic
can do async-shutdown after flushing and
will do sync-shutdown if SocketPoll is
no longer around.

Change-Id: Ia206cab58a13f20f7aeb3a6d8c57afee731c8231
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian 0f94eb261c wsd: test: killpoco in UnitCopyPaste
Change-Id: I2657a095e0a9d79b678c826db46b9c69d9aac056
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian 37e6ed0a51 wsd: test: dump clipboard state in test to the log
Change-Id: I337703d899ef6e85a9a0960d4cce8c174fc2f2f6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-12 09:06:38 -04:00
Ashod Nakashian 9a2acf2558 wsd: test: better loggin in UnitCopyPaste
Change-Id: Idf684249b87b9b73d21fd6ee101364bf49ae7a5d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-07 11:36:10 -04:00
Ashod Nakashian 5c6cd3aaec wsd: test: properly include config.h in the tests
When config.h is not included, the build
configuration is missing from the translation
unit in question. This affects ENABLE_SSL,
for one.

Also, HttpRequest.hpp depends on LOOLWSD_VERSION,
which is defined in config.h.

The config.h header must be included in all
trasnlation-units, and must be the first include.
This is to avoid conflicts and/or mismatching
binaries built with different compile-time values.

We also statically assert if LOOLWSD_VERSION
is not defined, to help the error message.

Change-Id: Ic4b45de879f3360a07e9507fdf04abfa4cec6a71
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Ashod Nakashian 65f71a2efb wsd: better logging of hex data dumps
And guard http data dumping with debug directives.

Change-Id: I22a725ba49bfb0399a27889ce9732dfe061e2563
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-13 19:34:02 -05:00
Ashod Nakashian 5467a7f7ef wsd: simplify and document dumpHex
Change-Id: I636dd6548b0712a72dfc162eb7381e3e7ac18b5a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-13 19:34:02 -05:00
Ashod Nakashian 95bb52d945 wsd: test: better logging
Change-Id: I3d17afb2e76f1d4b2b27182a6419482801342e8c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-08 22:49:53 -05:00
Ashod Nakashian 43eaf4d8df wsd: test: better exception handling in UnitCopyPaste
invokeWSDTest is called in an exception-safe scope
and logs errors before failing tests. No need to
have the same logic here.

Also improve the exception handling and reporting
in the fetchClipboardAssert helper.

Change-Id: I306aedc3f50f93bf8a5448f1d098e5ce884ceb37
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-08 22:49:53 -05:00
Ashod Nakashian 6e88701702 wsd: test: assert when failing copy-paste test
The assertion will include much more info than
simply flagging for failure, which helps in
troubleshooting failures.

Change-Id: I6bd649e5334a90e9feaf0d72347790088f70c1b3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-01 21:50:18 -05:00
Ashod Nakashian ff68273549 wsd: test: logging in copy-paste test instead of cerr
Change-Id: Ia80721179c37ef159cb0c8206ba13f650ad03244
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-01 21:50:18 -05:00
Ashod Nakashian 96c9e03b88 wsd: test: catch and fail WSD tests when exceptions are thrown
Change-Id: Ifaabb6387d86c5a80e00cd5de34093520a1e9d66
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-28 12:04:53 -04:00
Ayhan Yalçınsoy 42c56919b3 Remove Poco/TimeStamp.h left-over part-2
Change-Id: I2d5ce91cab57fb0806f4edb7045207cf32de99bb
Signed-off-by: Ayhan Yalçınsoy <ayhanyalcinsoy@pisilinux.org>
2020-10-27 11:56:51 +03:00
Andras Timar 0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
Ashod Nakashian 4a57654d88 wsd: avoid unnecessary string ops
Change-Id: Ia5a6f2d7a260edaf8bb294693be12a434a2c30fe
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96376
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-23 06:41:58 +02:00
Ashod Nakashian 224ef08c7f wsd: single-char string literals -> char
More readable and typically more efficient.

Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-06-02 01:31:26 +02:00
Pranam Lashkari d7bc9ff2e4 killpoco: removed StringTokenizer from test directory
removed use of Poco::StringTokenizer from the test directory using LOOLProtocol::tokenize and std::vecor<std::string>

Change-Id: I20fc2e0ef0d0d8fc959fee7972aa095f2581c181
Reviewed-on: https://gerrit.libreoffice.org/82565
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2019-11-13 09:20:25 +01:00
Michael Meeks 9e791fb0d4 clipboard: persist selections for a while after a view closes.
re-factor ClientSession state to be a simpler state machine.
Have a nice disconnect / disconnected handshake on view close.

Change-Id: Ie933cc5c7dfab46c66f4d38a4d75c459aa1cff87
2019-08-05 22:21:54 -04:00
Michael Meeks b3415abea0 clipboard: test two separate views' clipboards.
Change-Id: Ie6f2eeb1f1dd3c762cca847f4c77a5cd7d39f70a
2019-08-05 21:36:49 -04:00
Michael Meeks 095edb28e2 Adapt to new 'getClipboard' API - works on clipboard not selection.
Vital for a working 'cut'.

Change-Id: I980a4d65ef14eb922343d1d321177a9b3e1629f3
2019-08-05 21:28:09 -04:00
Michael Meeks 13469e8b00 clipboard - set it with a post now.
Change-Id: I6b9234988185984335408da502f479ccda8a95a7
2019-08-05 21:18:44 -04:00
Michael Meeks 15af6cf042 clipboard: test for set-clipboard endpoint (disabled).
Change-Id: I3bc31dfb231aaacc01ddd717b39abdebd26a76bb
2019-08-05 21:18:36 -04:00
Michael Meeks 4347883c65 clipboard: add more unit tests.
Change-Id: Id1841935927e451e6aa15489c303dd9f01ac21b4
2019-08-05 21:18:31 -04:00
Michael Meeks 149b861975 clipboard: a more helpful calc test.
Change-Id: Ibe0e583a2019e7bc5968dd8f73cf4e4a07d363b2
2019-08-05 21:18:27 -04:00
Michael Meeks ba4907b791 clipboard: factor out parsing, and add checks in unit test.
Change-Id: I8c23b10769293b07cc94fdc0d6110e9d540a16b9
2019-08-05 21:18:20 -04:00
Michael Meeks 9726ce6f77 Various copy/paste fixes, unit test passing, parsing of result.
Change-Id: I9168853dd011e86896c3bd474a4d05ee82c0e336
2019-08-05 21:18:12 -04:00
Michael Meeks c7956349f6 More work getting the unit test closer to passing.
Change-Id: If2ec0d5465a84e11dec1f5c5b9839a369b393784
2019-08-05 21:16:37 -04:00
Michael Meeks 245e509413 clipboard: start of rotating clipboard key management.
Change-Id: I8caab267ec5391e2cd7cb20907fa080111cc70dd
2019-08-05 21:16:37 -04:00
Michael Meeks c36da1cd97 Implement getClipboard and start of a unit test.
includes Change-Id: I47d38f9285c855dcc6fbeeb73d35f22a46a30c05

Change-Id: I60b84bef1cf832ec5c191d664afd90a080b7ffbc
2019-08-05 20:25:49 -04:00