From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- ipc/ipdl/test/cxx/TestUrgency.cpp | 117 -------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 ipc/ipdl/test/cxx/TestUrgency.cpp (limited to 'ipc/ipdl/test/cxx/TestUrgency.cpp') diff --git a/ipc/ipdl/test/cxx/TestUrgency.cpp b/ipc/ipdl/test/cxx/TestUrgency.cpp deleted file mode 100644 index 840b9d71e9..0000000000 --- a/ipc/ipdl/test/cxx/TestUrgency.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "TestUrgency.h" - -#include "IPDLUnitTests.h" // fail etc. -#if defined(XP_UNIX) -# include -#else -# include -#endif - -namespace mozilla { -namespace _ipdltest { - -#if defined(XP_UNIX) -static void Sleep(int ms) { sleep(ms / 1000); } -#endif - -//----------------------------------------------------------------------------- -// parent - -TestUrgencyParent::TestUrgencyParent() : inreply_(false) { - MOZ_COUNT_CTOR(TestUrgencyParent); -} - -TestUrgencyParent::~TestUrgencyParent() { MOZ_COUNT_DTOR(TestUrgencyParent); } - -void TestUrgencyParent::Main() { - if (!SendStart()) fail("sending Start"); -} - -mozilla::ipc::IPCResult TestUrgencyParent::RecvTest1(uint32_t* value) { - if (!SendReply1(value)) fail("sending Reply1"); - if (*value != 99) fail("bad value"); - return IPC_OK(); -} - -mozilla::ipc::IPCResult TestUrgencyParent::RecvTest2() { - uint32_t value; - inreply_ = true; - if (!SendReply2(&value)) fail("sending Reply2"); - inreply_ = false; - if (value != 500) fail("bad value"); - return IPC_OK(); -} - -mozilla::ipc::IPCResult TestUrgencyParent::RecvTest3(uint32_t* value) { - if (inreply_) fail("nested non-urgent on top of urgent rpc"); - *value = 1000; - return IPC_OK(); -} - -mozilla::ipc::IPCResult TestUrgencyParent::RecvFinalTest_Begin() { - return IPC_OK(); -} - -//----------------------------------------------------------------------------- -// child - -enum { - kFirstTestBegin = 1, - kFirstTestGotReply, - kSecondTestBegin, - kSecondTestGotReply, -}; - -mozilla::ipc::IPCResult TestUrgencyChild::RecvStart() { - uint32_t result; - - // Send a synchronous message, expect to get an urgent message while - // blocked. - test_ = kFirstTestBegin; - if (!SendTest1(&result)) fail("calling SendTest1"); - if (result != 99) fail("bad result in RecvStart"); - if (test_ != kFirstTestGotReply) fail("never received urgent message"); - - // Initiate the next test by sending an asynchronous message, then becoming - // blocked. This tests that the urgent message is still delivered properly, - // and that the parent does not try to service the sync - test_ = kSecondTestBegin; - if (!SendTest2()) fail("calling SendTest2"); - if (!SendTest3(&result)) fail("calling SendTest3"); - if (test_ != kSecondTestGotReply) fail("never received urgent message #2"); - if (result != 1000) fail("wrong value from test3"); - - if (!SendFinalTest_Begin()) fail("Final test should have succeeded"); - - Close(); - - return IPC_OK(); -} - -mozilla::ipc::IPCResult TestUrgencyChild::RecvReply1(uint32_t* reply) { - if (test_ != kFirstTestBegin) fail("wrong test # in RecvReply1"); - - *reply = 99; - test_ = kFirstTestGotReply; - return IPC_OK(); -} - -mozilla::ipc::IPCResult TestUrgencyChild::RecvReply2(uint32_t* reply) { - if (test_ != kSecondTestBegin) fail("wrong test # in RecvReply2"); - - // sleep for 5 seconds so the parent process tries to deliver more messages. - Sleep(5000); - - *reply = 500; - test_ = kSecondTestGotReply; - return IPC_OK(); -} - -TestUrgencyChild::TestUrgencyChild() : test_(0) { - MOZ_COUNT_CTOR(TestUrgencyChild); -} - -TestUrgencyChild::~TestUrgencyChild() { MOZ_COUNT_DTOR(TestUrgencyChild); } - -} // namespace _ipdltest -} // namespace mozilla -- cgit v1.2.3