|
1 #ifndef mozilla__ipdltest_TestDataStructures_h |
|
2 #define mozilla__ipdltest_TestDataStructures_h 1 |
|
3 |
|
4 #include "mozilla/_ipdltest/IPDLUnitTests.h" |
|
5 |
|
6 #include "mozilla/_ipdltest/PTestDataStructuresParent.h" |
|
7 #include "mozilla/_ipdltest/PTestDataStructuresChild.h" |
|
8 |
|
9 #include "mozilla/_ipdltest/PTestDataStructuresSubParent.h" |
|
10 #include "mozilla/_ipdltest/PTestDataStructuresSubChild.h" |
|
11 |
|
12 namespace mozilla { |
|
13 namespace _ipdltest { |
|
14 |
|
15 //----------------------------------------------------------------------------- |
|
16 // Subprotocol actors |
|
17 |
|
18 class TestDataStructuresSub : |
|
19 public PTestDataStructuresSubParent, |
|
20 public PTestDataStructuresSubChild |
|
21 { |
|
22 public: |
|
23 TestDataStructuresSub(uint32_t i) : mI(i) |
|
24 { } |
|
25 virtual ~TestDataStructuresSub() |
|
26 { } |
|
27 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
|
28 { |
|
29 if (Deletion != why) |
|
30 fail("unexpected destruction!"); |
|
31 } |
|
32 uint32_t mI; |
|
33 }; |
|
34 |
|
35 //----------------------------------------------------------------------------- |
|
36 // Main actors |
|
37 |
|
38 class TestDataStructuresParent : |
|
39 public PTestDataStructuresParent |
|
40 { |
|
41 public: |
|
42 TestDataStructuresParent(); |
|
43 virtual ~TestDataStructuresParent(); |
|
44 |
|
45 static bool RunTestInProcesses() { return true; } |
|
46 static bool RunTestInThreads() { return true; } |
|
47 |
|
48 void Main(); |
|
49 |
|
50 protected: |
|
51 virtual PTestDataStructuresSubParent* AllocPTestDataStructuresSubParent(const int& i) MOZ_OVERRIDE |
|
52 { |
|
53 PTestDataStructuresSubParent* actor = new TestDataStructuresSub(i); |
|
54 mKids.AppendElement(actor); |
|
55 return actor; |
|
56 } |
|
57 |
|
58 virtual bool DeallocPTestDataStructuresSubParent(PTestDataStructuresSubParent* actor) MOZ_OVERRIDE; |
|
59 |
|
60 virtual bool RecvTest1( |
|
61 const InfallibleTArray<int>& i1, |
|
62 InfallibleTArray<int>* o1) MOZ_OVERRIDE; |
|
63 |
|
64 virtual bool RecvTest2( |
|
65 const InfallibleTArray<PTestDataStructuresSubParent*>& i1, |
|
66 InfallibleTArray<PTestDataStructuresSubParent*>* o1) MOZ_OVERRIDE; |
|
67 |
|
68 virtual bool RecvTest3( |
|
69 const IntDouble& i1, |
|
70 const IntDouble& i2, |
|
71 IntDouble* o1, |
|
72 IntDouble* o2) MOZ_OVERRIDE; |
|
73 |
|
74 virtual bool RecvTest4( |
|
75 const InfallibleTArray<IntDouble>& i1, |
|
76 InfallibleTArray<IntDouble>* o1) MOZ_OVERRIDE; |
|
77 |
|
78 virtual bool RecvTest5( |
|
79 const IntDoubleArrays& i1, |
|
80 const IntDoubleArrays& i2, |
|
81 const IntDoubleArrays& i3, |
|
82 IntDoubleArrays* o1, |
|
83 IntDoubleArrays* o2, |
|
84 IntDoubleArrays* o3) MOZ_OVERRIDE; |
|
85 |
|
86 virtual bool RecvTest6( |
|
87 const InfallibleTArray<IntDoubleArrays>& i1, |
|
88 InfallibleTArray<IntDoubleArrays>* o1) MOZ_OVERRIDE; |
|
89 |
|
90 |
|
91 virtual bool RecvTest7_0(const ActorWrapper& i1, |
|
92 ActorWrapper* o1) MOZ_OVERRIDE; |
|
93 |
|
94 virtual bool RecvTest7( |
|
95 const Actors& i1, |
|
96 const Actors& i2, |
|
97 const Actors& i3, |
|
98 Actors* o1, |
|
99 Actors* o2, |
|
100 Actors* o3) MOZ_OVERRIDE; |
|
101 |
|
102 virtual bool RecvTest8( |
|
103 const InfallibleTArray<Actors>& i1, |
|
104 InfallibleTArray<Actors>* o1) MOZ_OVERRIDE; |
|
105 |
|
106 virtual bool RecvTest9( |
|
107 const Unions& i1, |
|
108 const Unions& i2, |
|
109 const Unions& i3, |
|
110 const Unions& i4, |
|
111 Unions* o1, |
|
112 Unions* o2, |
|
113 Unions* o3, |
|
114 Unions* o4) MOZ_OVERRIDE; |
|
115 |
|
116 virtual bool RecvTest10( |
|
117 const InfallibleTArray<Unions>& i1, |
|
118 InfallibleTArray<Unions>* o1) MOZ_OVERRIDE; |
|
119 |
|
120 virtual bool RecvTest11( |
|
121 const SIntDouble& i, |
|
122 SIntDouble* o) MOZ_OVERRIDE; |
|
123 |
|
124 virtual bool RecvTest12( |
|
125 const SIntDoubleArrays& i, |
|
126 SIntDoubleArrays* o) MOZ_OVERRIDE; |
|
127 |
|
128 virtual bool RecvTest13( |
|
129 const SActors& i, |
|
130 SActors* o) MOZ_OVERRIDE; |
|
131 |
|
132 virtual bool RecvTest14( |
|
133 const Structs& i, |
|
134 Structs* o) MOZ_OVERRIDE; |
|
135 |
|
136 virtual bool RecvTest15( |
|
137 const WithStructs& i1, |
|
138 const WithStructs& i2, |
|
139 const WithStructs& i3, |
|
140 const WithStructs& i4, |
|
141 const WithStructs& i5, |
|
142 WithStructs* o1, |
|
143 WithStructs* o2, |
|
144 WithStructs* o3, |
|
145 WithStructs* o4, |
|
146 WithStructs* o5) MOZ_OVERRIDE; |
|
147 |
|
148 virtual bool RecvTest16( |
|
149 const WithUnions& i, |
|
150 WithUnions* o) MOZ_OVERRIDE; |
|
151 |
|
152 virtual bool RecvTest17(const InfallibleTArray<Op>& sa) MOZ_OVERRIDE; |
|
153 |
|
154 virtual bool RecvTest18(const InfallibleTArray<nsIntRegion>& ra) MOZ_OVERRIDE; |
|
155 |
|
156 virtual bool RecvDummy(const ShmemUnion& su, ShmemUnion* rsu) MOZ_OVERRIDE |
|
157 { |
|
158 *rsu = su; |
|
159 return true; |
|
160 } |
|
161 |
|
162 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
|
163 { |
|
164 if (NormalShutdown != why) |
|
165 fail("unexpected destruction!"); |
|
166 passed("ok"); |
|
167 QuitParent(); |
|
168 } |
|
169 |
|
170 private: |
|
171 InfallibleTArray<PTestDataStructuresSubParent*> mKids; |
|
172 }; |
|
173 |
|
174 |
|
175 class TestDataStructuresChild : |
|
176 public PTestDataStructuresChild |
|
177 { |
|
178 public: |
|
179 TestDataStructuresChild(); |
|
180 virtual ~TestDataStructuresChild(); |
|
181 |
|
182 protected: |
|
183 virtual PTestDataStructuresSubChild* AllocPTestDataStructuresSubChild(const int& i) MOZ_OVERRIDE |
|
184 { |
|
185 PTestDataStructuresSubChild* actor = new TestDataStructuresSub(i); |
|
186 mKids.AppendElement(actor); |
|
187 return actor; |
|
188 } |
|
189 |
|
190 virtual bool DeallocPTestDataStructuresSubChild(PTestDataStructuresSubChild* actor) MOZ_OVERRIDE |
|
191 { |
|
192 delete actor; |
|
193 return true; |
|
194 } |
|
195 |
|
196 virtual bool RecvStart() MOZ_OVERRIDE; |
|
197 |
|
198 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
|
199 { |
|
200 if (NormalShutdown != why) |
|
201 fail("unexpected destruction!"); |
|
202 QuitChild(); |
|
203 } |
|
204 |
|
205 private: |
|
206 void Test1(); |
|
207 void Test2(); |
|
208 void Test3(); |
|
209 void Test4(); |
|
210 void Test5(); |
|
211 void Test6(); |
|
212 void Test7_0(); |
|
213 void Test7(); |
|
214 void Test8(); |
|
215 void Test9(); |
|
216 void Test10(); |
|
217 void Test11(); |
|
218 void Test12(); |
|
219 void Test13(); |
|
220 void Test14(); |
|
221 void Test15(); |
|
222 void Test16(); |
|
223 void Test17(); |
|
224 void Test18(); |
|
225 |
|
226 InfallibleTArray<PTestDataStructuresSubChild*> mKids; |
|
227 }; |
|
228 |
|
229 |
|
230 } // namespace _ipdltest |
|
231 } // namespace mozilla |
|
232 |
|
233 |
|
234 #endif // ifndef mozilla__ipdltest_TestDataStructures_h |