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/TestCancel.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/TestCancel.cpp')
-rw-r--r-- | ipc/ipdl/test/cxx/TestCancel.cpp | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/ipc/ipdl/test/cxx/TestCancel.cpp b/ipc/ipdl/test/cxx/TestCancel.cpp new file mode 100644 index 000000000..8f983b3de --- /dev/null +++ b/ipc/ipdl/test/cxx/TestCancel.cpp @@ -0,0 +1,168 @@ +#include "TestCancel.h" + +#include "IPDLUnitTests.h" // fail etc. + +namespace mozilla { +namespace _ipdltest { + +//----------------------------------------------------------------------------- +// parent + +TestCancelParent::TestCancelParent() +{ + MOZ_COUNT_CTOR(TestCancelParent); +} + +TestCancelParent::~TestCancelParent() +{ + MOZ_COUNT_DTOR(TestCancelParent); +} + +void +TestCancelParent::Main() +{ + if (SendTest1_1()) + fail("sending Test1_1"); + + uint32_t value = 0; + if (!SendCheckChild(&value)) + fail("Test1 CheckChild"); + + if (value != 12) + fail("Test1 CheckChild reply"); +} + +bool +TestCancelParent::RecvDone1() +{ + if (!SendStart2()) + fail("sending Start2"); + + return true; +} + +bool +TestCancelParent::RecvTest2_1() +{ + if (SendTest2_2()) + fail("sending Test2_2"); + + return true; +} + +bool +TestCancelParent::RecvStart3() +{ + if (SendTest3_1()) + fail("sending Test3_1"); + + uint32_t value = 0; + if (!SendCheckChild(&value)) + fail("Test1 CheckChild"); + + if (value != 12) + fail("Test1 CheckChild reply"); + + return true; +} + +bool +TestCancelParent::RecvTest3_2() +{ + GetIPCChannel()->CancelCurrentTransaction(); + return true; +} + +bool +TestCancelParent::RecvDone() +{ + MessageLoop::current()->PostTask( + NewNonOwningRunnableMethod(this, &TestCancelParent::Close)); + return true; +} + +bool +TestCancelParent::RecvCheckParent(uint32_t *reply) +{ + *reply = 12; + return true; +} + +//----------------------------------------------------------------------------- +// child + +bool +TestCancelChild::RecvTest1_1() +{ + GetIPCChannel()->CancelCurrentTransaction(); + + uint32_t value = 0; + if (!SendCheckParent(&value)) + fail("Test1 CheckParent"); + + if (value != 12) + fail("Test1 CheckParent reply"); + + if (!SendDone1()) + fail("Test1 CheckParent"); + + return true; +} + +bool +TestCancelChild::RecvStart2() +{ + if (!SendTest2_1()) + fail("sending Test2_1"); + + if (!SendStart3()) + fail("sending Start3"); + + return true; +} + +bool +TestCancelChild::RecvTest2_2() +{ + GetIPCChannel()->CancelCurrentTransaction(); + return true; +} + +bool +TestCancelChild::RecvTest3_1() +{ + if (SendTest3_2()) + fail("sending Test3_2"); + + uint32_t value = 0; + if (!SendCheckParent(&value)) + fail("Test1 CheckParent"); + + if (value != 12) + fail("Test1 CheckParent reply"); + + if (!SendDone()) + fail("sending Done"); + + return true; +} + +bool +TestCancelChild::RecvCheckChild(uint32_t *reply) +{ + *reply = 12; + return true; +} + +TestCancelChild::TestCancelChild() +{ + MOZ_COUNT_CTOR(TestCancelChild); +} + +TestCancelChild::~TestCancelChild() +{ + MOZ_COUNT_DTOR(TestCancelChild); +} + +} // namespace _ipdltest +} // namespace mozilla |