We track the number of wopi requests done
during tests and compare with the expected,
in each test scenario. This ensures we don't
miss any expected/required wopi operation,
but also that we don't do more than the
necessary minimum.
Change-Id: I2474f54987a6a12c396b6c0566324772ee3300e6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Refactor UnitWOPIDocumentConflict.cpp into
WOPIUploadConflictCommon.hpp and reuse for both
DocumentConflict and SaveOnExit tests.
Change-Id: I54ec1e37e5e9c6298b12a2b2e596363683fb2e34
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Now we have multiple document conflict scenarios
that exercise different states of DocBroker and
verify correct behavior in all cases.
Change-Id: Ia1a65be686a0899776799c82c1ebfd405c92dcab
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When the last client connection is closed,
there is UI (or user) to provide input
on the document conflict dialog. In this
case, we detect that the situation is final
and unresolvable and we simply give up.
We log a warning and dump the document state
before terminating.
Change-Id: I111a446b8743a0d16b7ed8b39751a419036c927f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
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>
This introduces a new macro, WSD_CMD,
used in tests only, to send a command
while logging it and its file/line of
origin.
Makes the tests more readable and the
logs more informative.
Only a handful of tests updated.
Change-Id: I55a38b35d7140a1f31f20c3c904d7eff6b19346f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This makes the test less reliable on the timing of the
poll that pumps the phases by using the proper callbacks
for the different document events.
We need to wait until the document is fully loaded before
we modify it. Here we do that in onDocumentLoaded.
Change-Id: Ibf4a5b5601449b729b1e62b621f82c1957eb8a65
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This allows the UnitBase class to handle the messages
and dispatch to convenient handlers. This simplifies
the implementation of unit-tests and makes the
parsing more centralized than it is now.
Change-Id: Ice8f169ecfd12d49ee7cbd4fb9021a163b14f4ba
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This adds proper phases instead of arbitrary
sleeping and similar workarounds. Also,
each phase documents what it expects, so
debugging failures are now self-explanatory.
Change-Id: Id51f4c285c5cf98aceba3415f0ffe14bd7605acc
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
size_t in C and in C++ are not necessarily the same
type. The C++ size_t is in the std namespace. Since
we do include many C headers, and indeed some C++
runtime headers do define size_t for backwards
compatibility, it's easy to mix and match the two
types.
Also, 'using std::size_t;' isn't a great practice,
so removed.
This is not exhaustive, just some low-hanging cases.
Change-Id: I85a36b6fd1acd204274b1869de9bcb94c8b3cf13
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>