|
1 #ifndef mozilla__ipdltest_TestRacyUndefer_h |
|
2 #define mozilla__ipdltest_TestRacyUndefer_h 1 |
|
3 |
|
4 #include "mozilla/_ipdltest/IPDLUnitTests.h" |
|
5 |
|
6 #include "mozilla/_ipdltest/PTestRacyUndeferParent.h" |
|
7 #include "mozilla/_ipdltest/PTestRacyUndeferChild.h" |
|
8 |
|
9 namespace mozilla { |
|
10 namespace _ipdltest { |
|
11 |
|
12 |
|
13 class TestRacyUndeferParent : |
|
14 public PTestRacyUndeferParent |
|
15 { |
|
16 public: |
|
17 TestRacyUndeferParent(); |
|
18 virtual ~TestRacyUndeferParent(); |
|
19 |
|
20 static bool RunTestInProcesses() { return true; } |
|
21 static bool RunTestInThreads() { return true; } |
|
22 |
|
23 void Main(); |
|
24 |
|
25 protected: |
|
26 virtual bool AnswerSpam() MOZ_OVERRIDE; |
|
27 |
|
28 virtual bool AnswerRaceWinTwice() MOZ_OVERRIDE; |
|
29 |
|
30 virtual bool RecvDone() MOZ_OVERRIDE; |
|
31 |
|
32 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
|
33 { |
|
34 if (NormalShutdown != why) |
|
35 fail("unexpected destruction!"); |
|
36 passed("ok"); |
|
37 QuitParent(); |
|
38 } |
|
39 }; |
|
40 |
|
41 |
|
42 class TestRacyUndeferChild : |
|
43 public PTestRacyUndeferChild |
|
44 { |
|
45 public: |
|
46 TestRacyUndeferChild(); |
|
47 virtual ~TestRacyUndeferChild(); |
|
48 |
|
49 protected: |
|
50 virtual bool RecvStart() MOZ_OVERRIDE; |
|
51 |
|
52 virtual bool RecvAwakenSpam() MOZ_OVERRIDE; |
|
53 virtual bool RecvAwakenRaceWinTwice() MOZ_OVERRIDE; |
|
54 |
|
55 virtual bool AnswerRace() MOZ_OVERRIDE; |
|
56 |
|
57 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
|
58 { |
|
59 if (NormalShutdown != why) |
|
60 fail("unexpected destruction!"); |
|
61 QuitChild(); |
|
62 } |
|
63 }; |
|
64 |
|
65 |
|
66 } // namespace _ipdltest |
|
67 } // namespace mozilla |
|
68 |
|
69 |
|
70 #endif // ifndef mozilla__ipdltest_TestRacyUndefer_h |