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