michael@0: #include "TestSanity.h" michael@0: michael@0: #include "IPDLUnitTests.h" // fail etc. michael@0: michael@0: namespace mozilla { michael@0: namespace _ipdltest { michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // parent michael@0: michael@0: TestSanityParent::TestSanityParent() michael@0: { michael@0: MOZ_COUNT_CTOR(TestSanityParent); michael@0: } michael@0: michael@0: TestSanityParent::~TestSanityParent() michael@0: { michael@0: MOZ_COUNT_DTOR(TestSanityParent); michael@0: } michael@0: michael@0: void michael@0: TestSanityParent::Main() michael@0: { michael@0: if (!SendPing(0, 0.5f, 0)) michael@0: fail("sending Ping"); michael@0: } michael@0: michael@0: michael@0: bool michael@0: TestSanityParent::RecvPong(const int& one, const float& zeroPtTwoFive, michael@0: const uint8_t&/*unused*/) michael@0: { michael@0: if (1 != one) michael@0: fail("invalid argument `%d', should have been `1'", one); michael@0: michael@0: if (0.25f != zeroPtTwoFive) michael@0: fail("invalid argument `%g', should have been `0.25'", zeroPtTwoFive); michael@0: michael@0: Close(); michael@0: michael@0: return true; michael@0: } michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // child michael@0: michael@0: TestSanityChild::TestSanityChild() michael@0: { michael@0: MOZ_COUNT_CTOR(TestSanityChild); michael@0: } michael@0: michael@0: TestSanityChild::~TestSanityChild() michael@0: { michael@0: MOZ_COUNT_DTOR(TestSanityChild); michael@0: } michael@0: michael@0: bool michael@0: TestSanityChild::RecvPing(const int& zero, const float& zeroPtFive, michael@0: const int8_t&/*unused*/) michael@0: { michael@0: if (0 != zero) michael@0: fail("invalid argument `%d', should have been `0'", zero); michael@0: michael@0: if (0.5f != zeroPtFive) michael@0: fail("invalid argument `%g', should have been `0.5'", zeroPtFive); michael@0: michael@0: if (!SendPong(1, 0.25f, 0)) michael@0: fail("sending Pong"); michael@0: return true; michael@0: } michael@0: michael@0: michael@0: } // namespace _ipdltest michael@0: } // namespace mozilla