summaryrefslogtreecommitdiffstats
path: root/ipc/ipdl/test/cxx/TestStackHooks.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /ipc/ipdl/test/cxx/TestStackHooks.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-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/TestStackHooks.cpp')
-rw-r--r--ipc/ipdl/test/cxx/TestStackHooks.cpp122
1 files changed, 0 insertions, 122 deletions
diff --git a/ipc/ipdl/test/cxx/TestStackHooks.cpp b/ipc/ipdl/test/cxx/TestStackHooks.cpp
deleted file mode 100644
index 9800ac54e7..0000000000
--- a/ipc/ipdl/test/cxx/TestStackHooks.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#include "TestStackHooks.h"
-
-#include "base/task.h"
-#include "IPDLUnitTests.h" // fail etc.
-
-namespace mozilla {
-namespace _ipdltest {
-
-//-----------------------------------------------------------------------------
-// parent
-
-TestStackHooksParent::TestStackHooksParent()
- : mOnStack(false), mIncallDepth(0) {
- MOZ_COUNT_CTOR(TestStackHooksParent);
-}
-
-TestStackHooksParent::~TestStackHooksParent() {
- MOZ_COUNT_DTOR(TestStackHooksParent);
-}
-
-void TestStackHooksParent::Main() {
- if (!SendStart()) fail("sending Start()");
-}
-
-mozilla::ipc::IPCResult TestStackHooksParent::AnswerStackFrame() {
- if (!mOnStack) fail("not on C++ stack?!");
-
- if (!CallStackFrame()) fail("calling StackFrame()");
-
- if (!mOnStack) fail("not on C++ stack?!");
-
- if (1 != mIncallDepth) fail("missed EnteredCall or ExitedCall hook");
-
- return IPC_OK();
-}
-
-//-----------------------------------------------------------------------------
-// child
-
-TestStackHooksChild::TestStackHooksChild()
- : mOnStack(false),
- mEntered(0),
- mExited(0),
- mIncallDepth(0),
- mNumAnswerStackFrame(0) {
- MOZ_COUNT_CTOR(TestStackHooksChild);
-}
-
-TestStackHooksChild::~TestStackHooksChild() {
- MOZ_COUNT_DTOR(TestStackHooksChild);
-}
-
-namespace {
-void RunTestsFn() {
- static_cast<TestStackHooksChild*>(gChildActor)->RunTests();
-}
-} // namespace
-
-mozilla::ipc::IPCResult TestStackHooksChild::RecvStart() {
- if (!mOnStack) fail("missed stack notification");
-
- if (0 != mIncallDepth) fail("EnteredCall/ExitedCall malfunction");
-
- // kick off tests from a runnable so that we can start with
- // MessageChannel code on the C++ stack
- MessageLoop::current()->PostTask(
- NewRunnableFunction("RunTestsFn", RunTestsFn));
-
- return IPC_OK();
-}
-
-mozilla::ipc::IPCResult TestStackHooksChild::AnswerStackFrame() {
- ++mNumAnswerStackFrame;
-
- if (!mOnStack) fail("missed stack notification");
-
- if (1 != mIncallDepth) fail("missed EnteredCall or ExitedCall hook");
-
- if (mNumAnswerStackFrame == 1) {
- if (!SendAsync()) fail("sending Async()");
- } else if (mNumAnswerStackFrame == 2) {
- if (!SendSync()) fail("sending Sync()");
- } else {
- fail("unexpected state");
- }
-
- if (!mOnStack) fail("bad stack exit notification");
-
- return IPC_OK();
-}
-
-void TestStackHooksChild::RunTests() {
- // 1 because of RecvStart()
- if (1 != mEntered) fail("missed stack notification");
- if (mOnStack) fail("spurious stack notification");
- if (0 != mIncallDepth) fail("EnteredCall/ExitedCall malfunction");
-
- if (!SendAsync()) fail("sending Async()");
- if (mOnStack) fail("spurious stack notification");
- if (0 != mIncallDepth) fail("EnteredCall/ExitedCall malfunction");
- if (2 != mEntered) fail("missed stack notification");
-
- if (!SendSync()) fail("sending Sync()");
- if (mOnStack) fail("spurious stack notification");
- if (0 != mIncallDepth) fail("EnteredCall/ExitedCall malfunction");
- if (3 != mEntered) fail("missed stack notification");
-
- if (!CallRpc()) fail("calling RPC()");
- if (mOnStack) fail("spurious stack notification");
- if (0 != mIncallDepth) fail("EnteredCall/ExitedCall malfunction");
- if (4 != mEntered) fail("missed stack notification");
-
- if (!CallStackFrame()) fail("calling StackFrame()");
- if (mOnStack) fail("spurious stack notification");
- if (0 != mIncallDepth) fail("EnteredCall/ExitedCall malfunction");
- if (5 != mEntered) fail("missed stack notification");
-
- Close();
-}
-
-} // namespace _ipdltest
-} // namespace mozilla