michael@0: #ifndef mozilla__ipdltest_TestDataStructures_h michael@0: #define mozilla__ipdltest_TestDataStructures_h 1 michael@0: michael@0: #include "mozilla/_ipdltest/IPDLUnitTests.h" michael@0: michael@0: #include "mozilla/_ipdltest/PTestDataStructuresParent.h" michael@0: #include "mozilla/_ipdltest/PTestDataStructuresChild.h" michael@0: michael@0: #include "mozilla/_ipdltest/PTestDataStructuresSubParent.h" michael@0: #include "mozilla/_ipdltest/PTestDataStructuresSubChild.h" michael@0: michael@0: namespace mozilla { michael@0: namespace _ipdltest { michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // Subprotocol actors michael@0: michael@0: class TestDataStructuresSub : michael@0: public PTestDataStructuresSubParent, michael@0: public PTestDataStructuresSubChild michael@0: { michael@0: public: michael@0: TestDataStructuresSub(uint32_t i) : mI(i) michael@0: { } michael@0: virtual ~TestDataStructuresSub() michael@0: { } michael@0: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE michael@0: { michael@0: if (Deletion != why) michael@0: fail("unexpected destruction!"); michael@0: } michael@0: uint32_t mI; michael@0: }; michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // Main actors michael@0: michael@0: class TestDataStructuresParent : michael@0: public PTestDataStructuresParent michael@0: { michael@0: public: michael@0: TestDataStructuresParent(); michael@0: virtual ~TestDataStructuresParent(); michael@0: michael@0: static bool RunTestInProcesses() { return true; } michael@0: static bool RunTestInThreads() { return true; } michael@0: michael@0: void Main(); michael@0: michael@0: protected: michael@0: virtual PTestDataStructuresSubParent* AllocPTestDataStructuresSubParent(const int& i) MOZ_OVERRIDE michael@0: { michael@0: PTestDataStructuresSubParent* actor = new TestDataStructuresSub(i); michael@0: mKids.AppendElement(actor); michael@0: return actor; michael@0: } michael@0: michael@0: virtual bool DeallocPTestDataStructuresSubParent(PTestDataStructuresSubParent* actor) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest1( michael@0: const InfallibleTArray& i1, michael@0: InfallibleTArray* o1) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest2( michael@0: const InfallibleTArray& i1, michael@0: InfallibleTArray* o1) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest3( michael@0: const IntDouble& i1, michael@0: const IntDouble& i2, michael@0: IntDouble* o1, michael@0: IntDouble* o2) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest4( michael@0: const InfallibleTArray& i1, michael@0: InfallibleTArray* o1) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest5( michael@0: const IntDoubleArrays& i1, michael@0: const IntDoubleArrays& i2, michael@0: const IntDoubleArrays& i3, michael@0: IntDoubleArrays* o1, michael@0: IntDoubleArrays* o2, michael@0: IntDoubleArrays* o3) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest6( michael@0: const InfallibleTArray& i1, michael@0: InfallibleTArray* o1) MOZ_OVERRIDE; michael@0: michael@0: michael@0: virtual bool RecvTest7_0(const ActorWrapper& i1, michael@0: ActorWrapper* o1) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest7( michael@0: const Actors& i1, michael@0: const Actors& i2, michael@0: const Actors& i3, michael@0: Actors* o1, michael@0: Actors* o2, michael@0: Actors* o3) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest8( michael@0: const InfallibleTArray& i1, michael@0: InfallibleTArray* o1) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest9( michael@0: const Unions& i1, michael@0: const Unions& i2, michael@0: const Unions& i3, michael@0: const Unions& i4, michael@0: Unions* o1, michael@0: Unions* o2, michael@0: Unions* o3, michael@0: Unions* o4) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest10( michael@0: const InfallibleTArray& i1, michael@0: InfallibleTArray* o1) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest11( michael@0: const SIntDouble& i, michael@0: SIntDouble* o) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest12( michael@0: const SIntDoubleArrays& i, michael@0: SIntDoubleArrays* o) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest13( michael@0: const SActors& i, michael@0: SActors* o) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest14( michael@0: const Structs& i, michael@0: Structs* o) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest15( michael@0: const WithStructs& i1, michael@0: const WithStructs& i2, michael@0: const WithStructs& i3, michael@0: const WithStructs& i4, michael@0: const WithStructs& i5, michael@0: WithStructs* o1, michael@0: WithStructs* o2, michael@0: WithStructs* o3, michael@0: WithStructs* o4, michael@0: WithStructs* o5) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest16( michael@0: const WithUnions& i, michael@0: WithUnions* o) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest17(const InfallibleTArray& sa) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvTest18(const InfallibleTArray& ra) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvDummy(const ShmemUnion& su, ShmemUnion* rsu) MOZ_OVERRIDE michael@0: { michael@0: *rsu = su; michael@0: return true; michael@0: } michael@0: michael@0: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE michael@0: { michael@0: if (NormalShutdown != why) michael@0: fail("unexpected destruction!"); michael@0: passed("ok"); michael@0: QuitParent(); michael@0: } michael@0: michael@0: private: michael@0: InfallibleTArray mKids; michael@0: }; michael@0: michael@0: michael@0: class TestDataStructuresChild : michael@0: public PTestDataStructuresChild michael@0: { michael@0: public: michael@0: TestDataStructuresChild(); michael@0: virtual ~TestDataStructuresChild(); michael@0: michael@0: protected: michael@0: virtual PTestDataStructuresSubChild* AllocPTestDataStructuresSubChild(const int& i) MOZ_OVERRIDE michael@0: { michael@0: PTestDataStructuresSubChild* actor = new TestDataStructuresSub(i); michael@0: mKids.AppendElement(actor); michael@0: return actor; michael@0: } michael@0: michael@0: virtual bool DeallocPTestDataStructuresSubChild(PTestDataStructuresSubChild* actor) MOZ_OVERRIDE michael@0: { michael@0: delete actor; michael@0: return true; michael@0: } michael@0: michael@0: virtual bool RecvStart() MOZ_OVERRIDE; michael@0: michael@0: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE michael@0: { michael@0: if (NormalShutdown != why) michael@0: fail("unexpected destruction!"); michael@0: QuitChild(); michael@0: } michael@0: michael@0: private: michael@0: void Test1(); michael@0: void Test2(); michael@0: void Test3(); michael@0: void Test4(); michael@0: void Test5(); michael@0: void Test6(); michael@0: void Test7_0(); michael@0: void Test7(); michael@0: void Test8(); michael@0: void Test9(); michael@0: void Test10(); michael@0: void Test11(); michael@0: void Test12(); michael@0: void Test13(); michael@0: void Test14(); michael@0: void Test15(); michael@0: void Test16(); michael@0: void Test17(); michael@0: void Test18(); michael@0: michael@0: InfallibleTArray mKids; michael@0: }; michael@0: michael@0: michael@0: } // namespace _ipdltest michael@0: } // namespace mozilla michael@0: michael@0: michael@0: #endif // ifndef mozilla__ipdltest_TestDataStructures_h