diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /ipc/ipdl/test/cxx/TestActorPunning.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'ipc/ipdl/test/cxx/TestActorPunning.cpp')
-rw-r--r-- | ipc/ipdl/test/cxx/TestActorPunning.cpp | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/ipc/ipdl/test/cxx/TestActorPunning.cpp b/ipc/ipdl/test/cxx/TestActorPunning.cpp new file mode 100644 index 000000000..eb6fa412f --- /dev/null +++ b/ipc/ipdl/test/cxx/TestActorPunning.cpp @@ -0,0 +1,128 @@ +#include "TestActorPunning.h" + +#include "IPDLUnitTests.h" // fail etc. +#include "mozilla/Unused.h" + +namespace mozilla { +namespace _ipdltest { + +//----------------------------------------------------------------------------- +// parent + +void +TestActorPunningParent::Main() +{ + if (!SendStart()) + fail("sending Start"); +} + +bool +TestActorPunningParent::RecvPun(PTestActorPunningSubParent* a, const Bad& bad) +{ + if (a->SendBad()) + fail("bad!"); + fail("shouldn't have received this message in the first place"); + return true; +} + +PTestActorPunningPunnedParent* +TestActorPunningParent::AllocPTestActorPunningPunnedParent() +{ + return new TestActorPunningPunnedParent(); +} + +bool +TestActorPunningParent::DeallocPTestActorPunningPunnedParent(PTestActorPunningPunnedParent* a) +{ + delete a; + return true; +} + +PTestActorPunningSubParent* +TestActorPunningParent::AllocPTestActorPunningSubParent() +{ + return new TestActorPunningSubParent(); +} + +bool +TestActorPunningParent::DeallocPTestActorPunningSubParent(PTestActorPunningSubParent* a) +{ + delete a; + return true; +} + +//----------------------------------------------------------------------------- +// child + +PTestActorPunningPunnedChild* +TestActorPunningChild::AllocPTestActorPunningPunnedChild() +{ + return new TestActorPunningPunnedChild(); +} + +bool +TestActorPunningChild::DeallocPTestActorPunningPunnedChild(PTestActorPunningPunnedChild*) +{ + fail("should have died by now"); + return true; +} + +PTestActorPunningSubChild* +TestActorPunningChild::AllocPTestActorPunningSubChild() +{ + return new TestActorPunningSubChild(); +} + +bool +TestActorPunningChild::DeallocPTestActorPunningSubChild(PTestActorPunningSubChild*) +{ + fail("should have died by now"); + return true; +} + +bool +TestActorPunningChild::RecvStart() +{ + SendPTestActorPunningSubConstructor(); + SendPTestActorPunningPunnedConstructor(); + PTestActorPunningSubChild* a = SendPTestActorPunningSubConstructor(); + // We can't assert whether this succeeds or fails, due to race + // conditions. + SendPun(a, Bad()); + return true; +} + +bool +TestActorPunningSubChild::RecvBad() +{ + fail("things are going really badly right now"); + return true; +} + + +} // namespace _ipdltest +} // namespace mozilla + +namespace IPC { +using namespace mozilla::_ipdltest; +using namespace mozilla::ipc; + +/*static*/ void +ParamTraits<Bad>::Write(Message* aMsg, const paramType& aParam) +{ + // Skip past the sentinel for the actor as well as the actor. + int32_t* ptr = aMsg->GetInt32PtrForTest(2 * sizeof(int32_t)); + ActorHandle* ah = reinterpret_cast<ActorHandle*>(ptr); + if (ah->mId != -3) + fail("guessed wrong offset (value is %d, should be -3)", ah->mId); + ah->mId = -2; +} + +/*static*/ bool +ParamTraits<Bad>::Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) +{ + return true; +} + +} // namespace IPC + |