ipc/ipdl/test/cxx/TestRacyReentry.cpp

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:d2caa01eeba7
1 #include "TestRacyReentry.h"
2
3 #include "IPDLUnitTests.h" // fail etc.
4
5 namespace mozilla {
6 namespace _ipdltest {
7
8 //-----------------------------------------------------------------------------
9 // parent
10
11 TestRacyReentryParent::TestRacyReentryParent() : mRecvdE(false)
12 {
13 MOZ_COUNT_CTOR(TestRacyReentryParent);
14 }
15
16 TestRacyReentryParent::~TestRacyReentryParent()
17 {
18 MOZ_COUNT_DTOR(TestRacyReentryParent);
19 }
20
21 void
22 TestRacyReentryParent::Main()
23 {
24 if (!SendStart())
25 fail("sending Start");
26
27 if (!SendN())
28 fail("sending N");
29 }
30
31 bool
32 TestRacyReentryParent::AnswerE()
33 {
34 if (!mRecvdE) {
35 mRecvdE = true;
36 return true;
37 }
38
39 if (!CallH())
40 fail("calling H");
41
42 return true;
43 }
44
45 //-----------------------------------------------------------------------------
46 // child
47
48 TestRacyReentryChild::TestRacyReentryChild()
49 {
50 MOZ_COUNT_CTOR(TestRacyReentryChild);
51 }
52
53 TestRacyReentryChild::~TestRacyReentryChild()
54 {
55 MOZ_COUNT_DTOR(TestRacyReentryChild);
56 }
57
58 bool
59 TestRacyReentryChild::RecvStart()
60 {
61 if (!CallE())
62 fail("calling E");
63
64 Close();
65
66 return true;
67 }
68
69 bool
70 TestRacyReentryChild::RecvN()
71 {
72 if (!CallE())
73 fail("calling E");
74 return true;
75 }
76
77 bool
78 TestRacyReentryChild::AnswerH()
79 {
80 return true;
81 }
82
83 } // namespace _ipdltest
84 } // namespace mozilla

mercurial