mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1751995
- Remove TestRPC r=ipc-reviewers,nika
If I understand the test correctly, this doesn't really test anything that other tests don't cover already. Differential Revision: https://phabricator.services.mozilla.com/D202060
This commit is contained in:
parent
6e72f2020b
commit
befb85aa99
@ -1,24 +0,0 @@
|
||||
include "mozilla/_ipdltest/TestRPC.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
[ManualDealloc, NestedUpTo=inside_sync, ChildImpl="TestRPCChild", ParentImpl="TestRPCParent"]
|
||||
sync protocol PTestRPC
|
||||
{
|
||||
parent:
|
||||
[Nested=inside_sync] sync Test1_Start() returns (uint32_t result);
|
||||
[Nested=inside_sync] sync Test1_InnerEvent() returns (uint32_t result);
|
||||
async Test2_Start();
|
||||
[Nested=inside_sync] sync Test2_OutOfOrder();
|
||||
|
||||
child:
|
||||
async Start();
|
||||
[Nested=inside_sync] sync Test1_InnerQuery() returns (uint32_t result);
|
||||
[Nested=inside_sync] sync Test1_NoReenter() returns (uint32_t result);
|
||||
[Nested=inside_sync] sync Test2_FirstUrgent();
|
||||
[Nested=inside_sync] sync Test2_SecondUrgent();
|
||||
};
|
||||
|
||||
} // namespace _ipdltest
|
||||
} // namespace mozilla
|
@ -1,107 +0,0 @@
|
||||
#include "TestRPC.h"
|
||||
|
||||
#include "IPDLUnitTests.h" // fail etc.
|
||||
#if defined(XP_UNIX)
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// parent
|
||||
|
||||
TestRPCParent::TestRPCParent()
|
||||
: reentered_(false), resolved_first_cpow_(false) {
|
||||
MOZ_COUNT_CTOR(TestRPCParent);
|
||||
}
|
||||
|
||||
TestRPCParent::~TestRPCParent() { MOZ_COUNT_DTOR(TestRPCParent); }
|
||||
|
||||
void TestRPCParent::Main() {
|
||||
if (!SendStart()) fail("sending Start");
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCParent::RecvTest1_Start(uint32_t* aResult) {
|
||||
uint32_t result;
|
||||
if (!SendTest1_InnerQuery(&result)) fail("SendTest1_InnerQuery");
|
||||
if (result != 300) fail("Wrong result (expected 300)");
|
||||
|
||||
*aResult = 100;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCParent::RecvTest1_InnerEvent(uint32_t* aResult) {
|
||||
uint32_t result;
|
||||
if (!SendTest1_NoReenter(&result)) fail("SendTest1_NoReenter");
|
||||
if (result != 400) fail("Wrong result (expected 400)");
|
||||
|
||||
*aResult = 200;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCParent::RecvTest2_Start() {
|
||||
// Send a CPOW. During this time, we must NOT process the RPC message, as
|
||||
// we could start receiving CPOW replies out-of-order.
|
||||
if (!SendTest2_FirstUrgent()) fail("SendTest2_FirstUrgent");
|
||||
|
||||
MOZ_ASSERT(!reentered_);
|
||||
resolved_first_cpow_ = true;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCParent::RecvTest2_OutOfOrder() {
|
||||
// Send a CPOW. If this RPC call was initiated while waiting for the first
|
||||
// CPOW to resolve, replies will be processed out of order, and we'll crash.
|
||||
if (!SendTest2_SecondUrgent()) fail("SendTest2_SecondUrgent");
|
||||
|
||||
reentered_ = true;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// child
|
||||
|
||||
TestRPCChild::TestRPCChild() { MOZ_COUNT_CTOR(TestRPCChild); }
|
||||
|
||||
TestRPCChild::~TestRPCChild() { MOZ_COUNT_DTOR(TestRPCChild); }
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCChild::RecvStart() {
|
||||
uint32_t result;
|
||||
if (!SendTest1_Start(&result)) fail("SendTest1_Start");
|
||||
if (result != 100) fail("Wrong result (expected 100)");
|
||||
|
||||
if (!SendTest2_Start()) fail("SendTest2_Start");
|
||||
|
||||
if (!SendTest2_OutOfOrder()) fail("SendTest2_OutOfOrder");
|
||||
|
||||
Close();
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCChild::RecvTest1_InnerQuery(uint32_t* aResult) {
|
||||
uint32_t result;
|
||||
if (!SendTest1_InnerEvent(&result)) fail("SendTest1_InnerEvent");
|
||||
if (result != 200) fail("Wrong result (expected 200)");
|
||||
|
||||
*aResult = 300;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCChild::RecvTest1_NoReenter(uint32_t* aResult) {
|
||||
*aResult = 400;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCChild::RecvTest2_FirstUrgent() {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult TestRPCChild::RecvTest2_SecondUrgent() {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
} // namespace _ipdltest
|
||||
} // namespace mozilla
|
@ -1,60 +0,0 @@
|
||||
#ifndef mozilla__ipdltest_TestRPC_h
|
||||
#define mozilla__ipdltest_TestRPC_h 1
|
||||
|
||||
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
||||
|
||||
#include "mozilla/_ipdltest/PTestRPCParent.h"
|
||||
#include "mozilla/_ipdltest/PTestRPCChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace _ipdltest {
|
||||
|
||||
class TestRPCParent : public PTestRPCParent {
|
||||
public:
|
||||
TestRPCParent();
|
||||
virtual ~TestRPCParent();
|
||||
|
||||
static bool RunTestInProcesses() { return true; }
|
||||
static bool RunTestInThreads() { return false; }
|
||||
|
||||
void Main();
|
||||
|
||||
mozilla::ipc::IPCResult RecvTest1_Start(uint32_t* aResult);
|
||||
mozilla::ipc::IPCResult RecvTest1_InnerEvent(uint32_t* aResult);
|
||||
mozilla::ipc::IPCResult RecvTest2_Start();
|
||||
mozilla::ipc::IPCResult RecvTest2_OutOfOrder();
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) override {
|
||||
if (NormalShutdown != why) fail("unexpected destruction!");
|
||||
if (!reentered_) fail("never processed raced RPC call!");
|
||||
if (!resolved_first_cpow_) fail("never resolved first CPOW!");
|
||||
passed("ok");
|
||||
QuitParent();
|
||||
}
|
||||
|
||||
private:
|
||||
bool reentered_;
|
||||
bool resolved_first_cpow_;
|
||||
};
|
||||
|
||||
class TestRPCChild : public PTestRPCChild {
|
||||
public:
|
||||
TestRPCChild();
|
||||
virtual ~TestRPCChild();
|
||||
|
||||
mozilla::ipc::IPCResult RecvStart();
|
||||
mozilla::ipc::IPCResult RecvTest1_InnerQuery(uint32_t* aResult);
|
||||
mozilla::ipc::IPCResult RecvTest1_NoReenter(uint32_t* aResult);
|
||||
mozilla::ipc::IPCResult RecvTest2_FirstUrgent();
|
||||
mozilla::ipc::IPCResult RecvTest2_SecondUrgent();
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) override {
|
||||
if (NormalShutdown != why) fail("unexpected destruction!");
|
||||
QuitChild();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace _ipdltest
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // ifndef mozilla__ipdltest_TestRPC_h
|
@ -12,7 +12,6 @@ EXPORTS.mozilla._ipdltest += [
|
||||
"IPDLUnitTestTypes.h",
|
||||
"IPDLUnitTestUtils.h",
|
||||
"TestOffMainThreadPainting.h",
|
||||
"TestRPC.h",
|
||||
"TestSanity.h",
|
||||
"TestSelfManageRoot.h",
|
||||
"TestShmem.h",
|
||||
@ -28,7 +27,6 @@ EXPORTS.mozilla._ipdltest += [
|
||||
|
||||
SOURCES += [
|
||||
"TestOffMainThreadPainting.cpp",
|
||||
"TestRPC.cpp",
|
||||
"TestSanity.cpp",
|
||||
"TestSelfManageRoot.cpp",
|
||||
"TestShmem.cpp",
|
||||
@ -55,7 +53,6 @@ IPDL_SOURCES += [
|
||||
"PTestIndirectProtocolParamSecond.ipdl",
|
||||
"PTestPaintThread.ipdl",
|
||||
"PTestPriority.ipdl",
|
||||
"PTestRPC.ipdl",
|
||||
"PTestSanity.ipdl",
|
||||
"PTestSelfManage.ipdl",
|
||||
"PTestSelfManageRoot.ipdl",
|
||||
|
Loading…
Reference in New Issue
Block a user