Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 #ifndef mozilla__ipdltest_TestShutdown_h
2 #define mozilla__ipdltest_TestShutdown_h 1
4 #include "mozilla/_ipdltest/IPDLUnitTests.h"
6 #include "mozilla/_ipdltest/PTestShutdownParent.h"
7 #include "mozilla/_ipdltest/PTestShutdownChild.h"
9 #include "mozilla/_ipdltest/PTestShutdownSubParent.h"
10 #include "mozilla/_ipdltest/PTestShutdownSubChild.h"
12 #include "mozilla/_ipdltest/PTestShutdownSubsubParent.h"
13 #include "mozilla/_ipdltest/PTestShutdownSubsubChild.h"
15 namespace mozilla {
16 namespace _ipdltest {
18 //-----------------------------------------------------------------------------
19 // Parent side
21 class TestShutdownSubsubParent :
22 public PTestShutdownSubsubParent
23 {
24 public:
25 TestShutdownSubsubParent(bool expectParentDeleted) :
26 mExpectParentDeleted(expectParentDeleted)
27 {
28 }
30 virtual ~TestShutdownSubsubParent()
31 {
32 }
34 protected:
35 virtual void
36 ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
38 private:
39 bool mExpectParentDeleted;
40 };
43 class TestShutdownSubParent :
44 public PTestShutdownSubParent
45 {
46 public:
47 TestShutdownSubParent(bool expectCrash) :
48 mExpectCrash(expectCrash),
49 mDeletedCount(0)
50 {
51 }
53 virtual ~TestShutdownSubParent()
54 {
55 if (2 != mDeletedCount)
56 fail("managees outliving manager!");
57 }
59 protected:
60 virtual bool
61 AnswerStackFrame() MOZ_OVERRIDE
62 {
63 return CallStackFrame();
64 }
66 virtual PTestShutdownSubsubParent*
67 AllocPTestShutdownSubsubParent(const bool& expectParentDelete) MOZ_OVERRIDE
68 {
69 return new TestShutdownSubsubParent(expectParentDelete);
70 }
72 virtual bool
73 DeallocPTestShutdownSubsubParent(PTestShutdownSubsubParent* actor) MOZ_OVERRIDE
74 {
75 delete actor;
76 ++mDeletedCount;
77 return true;
78 }
80 virtual void
81 ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
83 private:
84 bool mExpectCrash;
85 int mDeletedCount;
86 };
89 class TestShutdownParent :
90 public PTestShutdownParent
91 {
92 public:
93 TestShutdownParent()
94 {
95 }
96 virtual ~TestShutdownParent()
97 {
98 }
100 static bool RunTestInProcesses() { return true; }
101 // FIXME/bug 703323 Could work if modified
102 static bool RunTestInThreads() { return false; }
104 void Main();
106 protected:
107 virtual bool RecvSync() MOZ_OVERRIDE { return true; }
109 virtual PTestShutdownSubParent*
110 AllocPTestShutdownSubParent(const bool& expectCrash) MOZ_OVERRIDE
111 {
112 return new TestShutdownSubParent(expectCrash);
113 }
115 virtual bool
116 DeallocPTestShutdownSubParent(PTestShutdownSubParent* actor) MOZ_OVERRIDE
117 {
118 delete actor;
119 return true;
120 }
122 virtual void
123 ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
124 };
127 //-----------------------------------------------------------------------------
128 // Child side
130 class TestShutdownSubsubChild :
131 public PTestShutdownSubsubChild
132 {
133 public:
134 TestShutdownSubsubChild(bool expectParentDeleted) :
135 mExpectParentDeleted(expectParentDeleted)
136 {
137 }
138 virtual ~TestShutdownSubsubChild()
139 {
140 }
142 protected:
143 virtual void
144 ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
146 private:
147 bool mExpectParentDeleted;
148 };
151 class TestShutdownSubChild :
152 public PTestShutdownSubChild
153 {
154 public:
155 TestShutdownSubChild(bool expectCrash) : mExpectCrash(expectCrash)
156 {
157 }
159 virtual ~TestShutdownSubChild()
160 {
161 }
163 protected:
164 virtual bool AnswerStackFrame() MOZ_OVERRIDE;
166 virtual PTestShutdownSubsubChild*
167 AllocPTestShutdownSubsubChild(const bool& expectParentDelete) MOZ_OVERRIDE
168 {
169 return new TestShutdownSubsubChild(expectParentDelete);
170 }
172 virtual bool
173 DeallocPTestShutdownSubsubChild(PTestShutdownSubsubChild* actor) MOZ_OVERRIDE
174 {
175 delete actor;
176 return true;
177 }
179 virtual void
180 ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
182 private:
183 bool mExpectCrash;
184 };
187 class TestShutdownChild :
188 public PTestShutdownChild
189 {
190 public:
191 TestShutdownChild()
192 {
193 }
194 virtual ~TestShutdownChild()
195 {
196 }
198 protected:
199 virtual bool
200 RecvStart();
202 virtual PTestShutdownSubChild*
203 AllocPTestShutdownSubChild(
204 const bool& expectCrash) MOZ_OVERRIDE
205 {
206 return new TestShutdownSubChild(expectCrash);
207 }
209 virtual bool
210 DeallocPTestShutdownSubChild(PTestShutdownSubChild* actor) MOZ_OVERRIDE
211 {
212 delete actor;
213 return true;
214 }
216 virtual void
217 ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
218 };
221 } // namespace _ipdltest
222 } // namespace mozilla
225 #endif // ifndef mozilla__ipdltest_TestShutdown_h