Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 #include "TestSanity.h"
3 #include "IPDLUnitTests.h" // fail etc.
5 namespace mozilla {
6 namespace _ipdltest {
8 //-----------------------------------------------------------------------------
9 // parent
11 TestSanityParent::TestSanityParent()
12 {
13 MOZ_COUNT_CTOR(TestSanityParent);
14 }
16 TestSanityParent::~TestSanityParent()
17 {
18 MOZ_COUNT_DTOR(TestSanityParent);
19 }
21 void
22 TestSanityParent::Main()
23 {
24 if (!SendPing(0, 0.5f, 0))
25 fail("sending Ping");
26 }
29 bool
30 TestSanityParent::RecvPong(const int& one, const float& zeroPtTwoFive,
31 const uint8_t&/*unused*/)
32 {
33 if (1 != one)
34 fail("invalid argument `%d', should have been `1'", one);
36 if (0.25f != zeroPtTwoFive)
37 fail("invalid argument `%g', should have been `0.25'", zeroPtTwoFive);
39 Close();
41 return true;
42 }
45 //-----------------------------------------------------------------------------
46 // child
48 TestSanityChild::TestSanityChild()
49 {
50 MOZ_COUNT_CTOR(TestSanityChild);
51 }
53 TestSanityChild::~TestSanityChild()
54 {
55 MOZ_COUNT_DTOR(TestSanityChild);
56 }
58 bool
59 TestSanityChild::RecvPing(const int& zero, const float& zeroPtFive,
60 const int8_t&/*unused*/)
61 {
62 if (0 != zero)
63 fail("invalid argument `%d', should have been `0'", zero);
65 if (0.5f != zeroPtFive)
66 fail("invalid argument `%g', should have been `0.5'", zeroPtFive);
68 if (!SendPong(1, 0.25f, 0))
69 fail("sending Pong");
70 return true;
71 }
74 } // namespace _ipdltest
75 } // namespace mozilla