Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 #include "base/basictypes.h"
3 #include "TestRacyUndefer.h"
5 #include "IPDLUnitTests.h" // fail etc.
7 namespace mozilla {
8 namespace _ipdltest {
10 //-----------------------------------------------------------------------------
11 // parent
13 TestRacyUndeferParent::TestRacyUndeferParent()
14 {
15 MOZ_COUNT_CTOR(TestRacyUndeferParent);
16 }
18 TestRacyUndeferParent::~TestRacyUndeferParent()
19 {
20 MOZ_COUNT_DTOR(TestRacyUndeferParent);
21 }
23 void
24 TestRacyUndeferParent::Main()
25 {
26 if (!SendStart())
27 fail("sending Start");
28 }
30 bool
31 TestRacyUndeferParent::AnswerSpam()
32 {
33 static bool spammed = false;
34 static bool raced = false;
35 if (!spammed) {
36 spammed = true;
38 if (!SendAwakenSpam())
39 fail("sending AwakenSpam");
40 }
41 else if (!raced) {
42 raced = true;
44 if (!SendAwakenRaceWinTwice())
45 fail("sending WinRaceTwice");
47 if (!CallRace())
48 fail("calling Race1");
49 }
50 return true;
51 }
53 bool
54 TestRacyUndeferParent::AnswerRaceWinTwice()
55 {
56 return true;
57 }
59 bool
60 TestRacyUndeferParent::RecvDone()
61 {
62 Close();
63 return true;
64 }
67 //-----------------------------------------------------------------------------
68 // child
70 TestRacyUndeferChild::TestRacyUndeferChild()
71 {
72 MOZ_COUNT_CTOR(TestRacyUndeferChild);
73 }
75 TestRacyUndeferChild::~TestRacyUndeferChild()
76 {
77 MOZ_COUNT_DTOR(TestRacyUndeferChild);
78 }
80 bool
81 TestRacyUndeferChild::RecvStart()
82 {
83 if (!CallSpam())
84 fail("calling Spam");
86 if (!SendDone())
87 fail("sending Done");
89 return true;
90 }
92 bool
93 TestRacyUndeferChild::RecvAwakenSpam()
94 {
95 if (!CallSpam())
96 fail("calling Spam");
97 return true;
98 }
100 bool
101 TestRacyUndeferChild::RecvAwakenRaceWinTwice()
102 {
103 if (!CallRaceWinTwice())
104 fail("calling RaceWinTwice");
105 return true;
106 }
108 bool
109 TestRacyUndeferChild::AnswerRace()
110 {
111 return true;
112 }
114 } // namespace _ipdltest
115 } // namespace mozilla