1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/ipdl/test/cxx/TestSanity.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +#include "TestSanity.h" 1.5 + 1.6 +#include "IPDLUnitTests.h" // fail etc. 1.7 + 1.8 +namespace mozilla { 1.9 +namespace _ipdltest { 1.10 + 1.11 +//----------------------------------------------------------------------------- 1.12 +// parent 1.13 + 1.14 +TestSanityParent::TestSanityParent() 1.15 +{ 1.16 + MOZ_COUNT_CTOR(TestSanityParent); 1.17 +} 1.18 + 1.19 +TestSanityParent::~TestSanityParent() 1.20 +{ 1.21 + MOZ_COUNT_DTOR(TestSanityParent); 1.22 +} 1.23 + 1.24 +void 1.25 +TestSanityParent::Main() 1.26 +{ 1.27 + if (!SendPing(0, 0.5f, 0)) 1.28 + fail("sending Ping"); 1.29 +} 1.30 + 1.31 + 1.32 +bool 1.33 +TestSanityParent::RecvPong(const int& one, const float& zeroPtTwoFive, 1.34 + const uint8_t&/*unused*/) 1.35 +{ 1.36 + if (1 != one) 1.37 + fail("invalid argument `%d', should have been `1'", one); 1.38 + 1.39 + if (0.25f != zeroPtTwoFive) 1.40 + fail("invalid argument `%g', should have been `0.25'", zeroPtTwoFive); 1.41 + 1.42 + Close(); 1.43 + 1.44 + return true; 1.45 +} 1.46 + 1.47 + 1.48 +//----------------------------------------------------------------------------- 1.49 +// child 1.50 + 1.51 +TestSanityChild::TestSanityChild() 1.52 +{ 1.53 + MOZ_COUNT_CTOR(TestSanityChild); 1.54 +} 1.55 + 1.56 +TestSanityChild::~TestSanityChild() 1.57 +{ 1.58 + MOZ_COUNT_DTOR(TestSanityChild); 1.59 +} 1.60 + 1.61 +bool 1.62 +TestSanityChild::RecvPing(const int& zero, const float& zeroPtFive, 1.63 + const int8_t&/*unused*/) 1.64 +{ 1.65 + if (0 != zero) 1.66 + fail("invalid argument `%d', should have been `0'", zero); 1.67 + 1.68 + if (0.5f != zeroPtFive) 1.69 + fail("invalid argument `%g', should have been `0.5'", zeroPtFive); 1.70 + 1.71 + if (!SendPong(1, 0.25f, 0)) 1.72 + fail("sending Pong"); 1.73 + return true; 1.74 +} 1.75 + 1.76 + 1.77 +} // namespace _ipdltest 1.78 +} // namespace mozilla