ipc/ipdl/test/cxx/TestDataStructures.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 #ifndef mozilla__ipdltest_TestDataStructures_h
     2 #define mozilla__ipdltest_TestDataStructures_h 1
     4 #include "mozilla/_ipdltest/IPDLUnitTests.h"
     6 #include "mozilla/_ipdltest/PTestDataStructuresParent.h"
     7 #include "mozilla/_ipdltest/PTestDataStructuresChild.h"
     9 #include "mozilla/_ipdltest/PTestDataStructuresSubParent.h"
    10 #include "mozilla/_ipdltest/PTestDataStructuresSubChild.h"
    12 namespace mozilla {
    13 namespace _ipdltest {
    15 //-----------------------------------------------------------------------------
    16 // Subprotocol actors
    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 };
    35 //-----------------------------------------------------------------------------
    36 // Main actors
    38 class TestDataStructuresParent :
    39     public PTestDataStructuresParent
    40 {
    41 public:
    42     TestDataStructuresParent();
    43     virtual ~TestDataStructuresParent();
    45     static bool RunTestInProcesses() { return true; }
    46     static bool RunTestInThreads() { return true; }
    48     void Main();
    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     }
    58     virtual bool DeallocPTestDataStructuresSubParent(PTestDataStructuresSubParent* actor) MOZ_OVERRIDE;
    60     virtual bool RecvTest1(
    61             const InfallibleTArray<int>& i1,
    62             InfallibleTArray<int>* o1) MOZ_OVERRIDE;
    64     virtual bool RecvTest2(
    65             const InfallibleTArray<PTestDataStructuresSubParent*>& i1,
    66             InfallibleTArray<PTestDataStructuresSubParent*>* o1) MOZ_OVERRIDE;
    68     virtual bool RecvTest3(
    69             const IntDouble& i1,
    70             const IntDouble& i2,
    71             IntDouble* o1,
    72             IntDouble* o2) MOZ_OVERRIDE;
    74     virtual bool RecvTest4(
    75             const InfallibleTArray<IntDouble>& i1,
    76             InfallibleTArray<IntDouble>* o1) MOZ_OVERRIDE;
    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;
    86     virtual bool RecvTest6(
    87             const InfallibleTArray<IntDoubleArrays>& i1,
    88             InfallibleTArray<IntDoubleArrays>* o1) MOZ_OVERRIDE;
    91     virtual bool RecvTest7_0(const ActorWrapper& i1,
    92                              ActorWrapper* o1) MOZ_OVERRIDE;
    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;
   102     virtual bool RecvTest8(
   103             const InfallibleTArray<Actors>& i1,
   104             InfallibleTArray<Actors>* o1) MOZ_OVERRIDE;
   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;
   116     virtual bool RecvTest10(
   117             const InfallibleTArray<Unions>& i1,
   118             InfallibleTArray<Unions>* o1) MOZ_OVERRIDE;
   120     virtual bool RecvTest11(
   121             const SIntDouble& i,
   122             SIntDouble* o) MOZ_OVERRIDE;
   124     virtual bool RecvTest12(
   125             const SIntDoubleArrays& i,
   126             SIntDoubleArrays* o) MOZ_OVERRIDE;
   128     virtual bool RecvTest13(
   129             const SActors& i,
   130             SActors* o) MOZ_OVERRIDE;
   132     virtual bool RecvTest14(
   133             const Structs& i,
   134             Structs* o) MOZ_OVERRIDE;
   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;
   148     virtual bool RecvTest16(
   149             const WithUnions& i,
   150             WithUnions* o) MOZ_OVERRIDE;
   152     virtual bool RecvTest17(const InfallibleTArray<Op>& sa) MOZ_OVERRIDE;
   154     virtual bool RecvTest18(const InfallibleTArray<nsIntRegion>& ra) MOZ_OVERRIDE;
   156     virtual bool RecvDummy(const ShmemUnion& su, ShmemUnion* rsu) MOZ_OVERRIDE
   157     {
   158         *rsu = su;
   159         return true;
   160     }
   162     virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
   163     {
   164         if (NormalShutdown != why)
   165             fail("unexpected destruction!");  
   166         passed("ok");
   167         QuitParent();
   168     }
   170 private:
   171     InfallibleTArray<PTestDataStructuresSubParent*> mKids;
   172 };
   175 class TestDataStructuresChild :
   176     public PTestDataStructuresChild
   177 {
   178 public:
   179     TestDataStructuresChild();
   180     virtual ~TestDataStructuresChild();
   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     }
   190     virtual bool DeallocPTestDataStructuresSubChild(PTestDataStructuresSubChild* actor) MOZ_OVERRIDE
   191     {
   192         delete actor;
   193         return true;
   194     }
   196     virtual bool RecvStart() MOZ_OVERRIDE;
   198     virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
   199     {
   200         if (NormalShutdown != why)
   201             fail("unexpected destruction!");
   202         QuitChild();
   203     }
   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();
   226     InfallibleTArray<PTestDataStructuresSubChild*> mKids;
   227 };
   230 } // namespace _ipdltest
   231 } // namespace mozilla
   234 #endif // ifndef mozilla__ipdltest_TestDataStructures_h

mercurial