diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /ipc/ipdl/test/cxx/TestDesc.cpp | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ipc/ipdl/test/cxx/TestDesc.cpp')
-rw-r--r-- | ipc/ipdl/test/cxx/TestDesc.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/ipc/ipdl/test/cxx/TestDesc.cpp b/ipc/ipdl/test/cxx/TestDesc.cpp new file mode 100644 index 0000000000..2ae199457d --- /dev/null +++ b/ipc/ipdl/test/cxx/TestDesc.cpp @@ -0,0 +1,78 @@ +#include "TestDesc.h" + +#include "IPDLUnitTests.h" // fail etc. + +namespace mozilla { +namespace _ipdltest { + +//----------------------------------------------------------------------------- +// parent +void TestDescParent::Main() { + PTestDescSubParent* p = CallPTestDescSubConstructor(0); + if (!p) fail("can't allocate Sub"); + + PTestDescSubsubParent* pp = p->CallPTestDescSubsubConstructor(); + if (!pp) fail("can't allocate Subsub"); + + if (!SendTest(pp)) fail("can't send Subsub"); +} + +mozilla::ipc::IPCResult TestDescParent::RecvOk(PTestDescSubsubParent* a) { + if (!a) fail("didn't receive Subsub"); + + if (!PTestDescSubsubParent::Call__delete__(a)) fail("deleting Subsub"); + + Close(); + + return IPC_OK(); +} + +PTestDescSubParent* TestDescParent::AllocPTestDescSubParent( + PTestDescSubsubParent* dummy) { + if (dummy) fail("actor supposed to be null"); + return new TestDescSubParent(); +} +bool TestDescParent::DeallocPTestDescSubParent(PTestDescSubParent* actor) { + delete actor; + return true; +} + +PTestDescSubsubParent* TestDescSubParent::AllocPTestDescSubsubParent() { + return new TestDescSubsubParent(); +} +bool TestDescSubParent::DeallocPTestDescSubsubParent( + PTestDescSubsubParent* actor) { + delete actor; + return true; +} + +//----------------------------------------------------------------------------- +// child + +mozilla::ipc::IPCResult TestDescChild::RecvTest(PTestDescSubsubChild* a) { + if (!a) fail("didn't receive Subsub"); + if (!SendOk(a)) fail("couldn't send Ok()"); + return IPC_OK(); +} + +PTestDescSubChild* TestDescChild::AllocPTestDescSubChild( + PTestDescSubsubChild* dummy) { + if (dummy) fail("actor supposed to be null"); + return new TestDescSubChild(); +} +bool TestDescChild::DeallocPTestDescSubChild(PTestDescSubChild* actor) { + delete actor; + return true; +} + +PTestDescSubsubChild* TestDescSubChild::AllocPTestDescSubsubChild() { + return new TestDescSubsubChild(); +} +bool TestDescSubChild::DeallocPTestDescSubsubChild( + PTestDescSubsubChild* actor) { + delete actor; + return true; +} + +} // namespace _ipdltest +} // namespace mozilla |