diff -r 000000000000 -r 6474c204b198 ipc/ipdl/test/cxx/TestRacyReentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ipc/ipdl/test/cxx/TestRacyReentry.cpp Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,84 @@ +#include "TestRacyReentry.h" + +#include "IPDLUnitTests.h" // fail etc. + +namespace mozilla { +namespace _ipdltest { + +//----------------------------------------------------------------------------- +// parent + +TestRacyReentryParent::TestRacyReentryParent() : mRecvdE(false) +{ + MOZ_COUNT_CTOR(TestRacyReentryParent); +} + +TestRacyReentryParent::~TestRacyReentryParent() +{ + MOZ_COUNT_DTOR(TestRacyReentryParent); +} + +void +TestRacyReentryParent::Main() +{ + if (!SendStart()) + fail("sending Start"); + + if (!SendN()) + fail("sending N"); +} + +bool +TestRacyReentryParent::AnswerE() +{ + if (!mRecvdE) { + mRecvdE = true; + return true; + } + + if (!CallH()) + fail("calling H"); + + return true; +} + +//----------------------------------------------------------------------------- +// child + +TestRacyReentryChild::TestRacyReentryChild() +{ + MOZ_COUNT_CTOR(TestRacyReentryChild); +} + +TestRacyReentryChild::~TestRacyReentryChild() +{ + MOZ_COUNT_DTOR(TestRacyReentryChild); +} + +bool +TestRacyReentryChild::RecvStart() +{ + if (!CallE()) + fail("calling E"); + + Close(); + + return true; +} + +bool +TestRacyReentryChild::RecvN() +{ + if (!CallE()) + fail("calling E"); + return true; +} + +bool +TestRacyReentryChild::AnswerH() +{ + return true; +} + +} // namespace _ipdltest +} // namespace mozilla