diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /ipc/ipdl/test/cxx/TestAsyncReturns.cpp | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ipc/ipdl/test/cxx/TestAsyncReturns.cpp')
-rw-r--r-- | ipc/ipdl/test/cxx/TestAsyncReturns.cpp | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/ipc/ipdl/test/cxx/TestAsyncReturns.cpp b/ipc/ipdl/test/cxx/TestAsyncReturns.cpp deleted file mode 100644 index 76597143c0..0000000000 --- a/ipc/ipdl/test/cxx/TestAsyncReturns.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "TestAsyncReturns.h" - -#include "IPDLUnitTests.h" // fail etc. - -#include "mozilla/AbstractThread.h" -#include "mozilla/Unused.h" - -namespace mozilla { -namespace _ipdltest { - -static uint32_t sMagic1 = 0x105b59fb; -static uint32_t sMagic2 = 0x09b6f5e3; - -//----------------------------------------------------------------------------- -// parent - -TestAsyncReturnsParent::TestAsyncReturnsParent() { - MOZ_COUNT_CTOR(TestAsyncReturnsParent); -} - -TestAsyncReturnsParent::~TestAsyncReturnsParent() { - MOZ_COUNT_DTOR(TestAsyncReturnsParent); -} - -void TestAsyncReturnsParent::Main() { - SendNoReturn()->Then( - MessageLoop::current()->SerialEventTarget(), __func__, - [](bool unused) { fail("resolve handler should not be called"); }, - [](ResponseRejectReason&& aReason) { - // MozPromise asserts in debug build if the - // handler is not called - if (aReason != ResponseRejectReason::ChannelClosed) { - fail("reject with wrong reason"); - } - passed("reject handler called on channel close"); - }); - SendPing()->Then( - MessageLoop::current()->SerialEventTarget(), __func__, - [this](bool one) { - if (one) { - passed("take one argument"); - } else { - fail("get one argument but has wrong value"); - } - - // Also try with the callback-based API. - SendPing( - [this](bool one) { - if (one) { - passed("take one argument"); - } else { - fail("get one argument but has wrong value"); - } - Close(); - }, - [](ResponseRejectReason&& aReason) { fail("sending Ping"); }); - }, - [](ResponseRejectReason&& aReason) { fail("sending Ping"); }); -} - -mozilla::ipc::IPCResult TestAsyncReturnsParent::RecvPong( - PongResolver&& aResolve) { - aResolve(std::tuple<const uint32_t&, const uint32_t&>(sMagic1, sMagic2)); - return IPC_OK(); -} - -//----------------------------------------------------------------------------- -// child - -TestAsyncReturnsChild::TestAsyncReturnsChild() { - MOZ_COUNT_CTOR(TestAsyncReturnsChild); -} - -TestAsyncReturnsChild::~TestAsyncReturnsChild() { - MOZ_COUNT_DTOR(TestAsyncReturnsChild); -} - -mozilla::ipc::IPCResult TestAsyncReturnsChild::RecvNoReturn( - NoReturnResolver&& aResolve) { - // Not resolving the promise intentionally - return IPC_OK(); -} - -mozilla::ipc::IPCResult TestAsyncReturnsChild::RecvPing( - PingResolver&& aResolve) { - SendPong()->Then( - MessageLoop::current()->SerialEventTarget(), __func__, - [aResolve](const std::tuple<uint32_t, uint32_t>& aParam) { - if (std::get<0>(aParam) == sMagic1 && std::get<1>(aParam) == sMagic2) { - passed("take two arguments"); - } else { - fail("get two argument but has wrong value"); - } - aResolve(true); - }, - [](ResponseRejectReason&& aReason) { fail("sending Pong"); }); - return IPC_OK(); -} - -} // namespace _ipdltest -} // namespace mozilla |