ipc/ipdl/test/cxx/TestDataStructures.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/ipdl/test/cxx/TestDataStructures.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,234 @@
     1.4 +#ifndef mozilla__ipdltest_TestDataStructures_h
     1.5 +#define mozilla__ipdltest_TestDataStructures_h 1
     1.6 +
     1.7 +#include "mozilla/_ipdltest/IPDLUnitTests.h"
     1.8 +
     1.9 +#include "mozilla/_ipdltest/PTestDataStructuresParent.h"
    1.10 +#include "mozilla/_ipdltest/PTestDataStructuresChild.h"
    1.11 +
    1.12 +#include "mozilla/_ipdltest/PTestDataStructuresSubParent.h"
    1.13 +#include "mozilla/_ipdltest/PTestDataStructuresSubChild.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace _ipdltest {
    1.17 +
    1.18 +//-----------------------------------------------------------------------------
    1.19 +// Subprotocol actors
    1.20 +
    1.21 +class TestDataStructuresSub :
    1.22 +        public PTestDataStructuresSubParent,
    1.23 +        public PTestDataStructuresSubChild
    1.24 +{
    1.25 +public:
    1.26 +    TestDataStructuresSub(uint32_t i) : mI(i)
    1.27 +    { }
    1.28 +    virtual ~TestDataStructuresSub()
    1.29 +    { }
    1.30 +    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
    1.31 +    {
    1.32 +      if (Deletion != why)
    1.33 +        fail("unexpected destruction!");
    1.34 +    }
    1.35 +  uint32_t mI;
    1.36 +};
    1.37 +
    1.38 +//-----------------------------------------------------------------------------
    1.39 +// Main actors
    1.40 +
    1.41 +class TestDataStructuresParent :
    1.42 +    public PTestDataStructuresParent
    1.43 +{
    1.44 +public:
    1.45 +    TestDataStructuresParent();
    1.46 +    virtual ~TestDataStructuresParent();
    1.47 +
    1.48 +    static bool RunTestInProcesses() { return true; }
    1.49 +    static bool RunTestInThreads() { return true; }
    1.50 +
    1.51 +    void Main();
    1.52 +
    1.53 +protected:
    1.54 +    virtual PTestDataStructuresSubParent* AllocPTestDataStructuresSubParent(const int& i) MOZ_OVERRIDE
    1.55 +    {
    1.56 +        PTestDataStructuresSubParent* actor = new TestDataStructuresSub(i);
    1.57 +        mKids.AppendElement(actor);
    1.58 +        return actor;
    1.59 +    }
    1.60 +
    1.61 +    virtual bool DeallocPTestDataStructuresSubParent(PTestDataStructuresSubParent* actor) MOZ_OVERRIDE;
    1.62 +
    1.63 +    virtual bool RecvTest1(
    1.64 +            const InfallibleTArray<int>& i1,
    1.65 +            InfallibleTArray<int>* o1) MOZ_OVERRIDE;
    1.66 +
    1.67 +    virtual bool RecvTest2(
    1.68 +            const InfallibleTArray<PTestDataStructuresSubParent*>& i1,
    1.69 +            InfallibleTArray<PTestDataStructuresSubParent*>* o1) MOZ_OVERRIDE;
    1.70 +
    1.71 +    virtual bool RecvTest3(
    1.72 +            const IntDouble& i1,
    1.73 +            const IntDouble& i2,
    1.74 +            IntDouble* o1,
    1.75 +            IntDouble* o2) MOZ_OVERRIDE;
    1.76 +
    1.77 +    virtual bool RecvTest4(
    1.78 +            const InfallibleTArray<IntDouble>& i1,
    1.79 +            InfallibleTArray<IntDouble>* o1) MOZ_OVERRIDE;
    1.80 +
    1.81 +    virtual bool RecvTest5(
    1.82 +            const IntDoubleArrays& i1,
    1.83 +            const IntDoubleArrays& i2,
    1.84 +            const IntDoubleArrays& i3,
    1.85 +            IntDoubleArrays* o1,
    1.86 +            IntDoubleArrays* o2,
    1.87 +            IntDoubleArrays* o3) MOZ_OVERRIDE;
    1.88 +
    1.89 +    virtual bool RecvTest6(
    1.90 +            const InfallibleTArray<IntDoubleArrays>& i1,
    1.91 +            InfallibleTArray<IntDoubleArrays>* o1) MOZ_OVERRIDE;
    1.92 +
    1.93 +
    1.94 +    virtual bool RecvTest7_0(const ActorWrapper& i1,
    1.95 +                             ActorWrapper* o1) MOZ_OVERRIDE;
    1.96 +
    1.97 +    virtual bool RecvTest7(
    1.98 +            const Actors& i1,
    1.99 +            const Actors& i2,
   1.100 +            const Actors& i3,
   1.101 +            Actors* o1,
   1.102 +            Actors* o2,
   1.103 +            Actors* o3) MOZ_OVERRIDE;
   1.104 +
   1.105 +    virtual bool RecvTest8(
   1.106 +            const InfallibleTArray<Actors>& i1,
   1.107 +            InfallibleTArray<Actors>* o1) MOZ_OVERRIDE;
   1.108 +
   1.109 +    virtual bool RecvTest9(
   1.110 +            const Unions& i1,
   1.111 +            const Unions& i2,
   1.112 +            const Unions& i3,
   1.113 +            const Unions& i4,
   1.114 +            Unions* o1,
   1.115 +            Unions* o2,
   1.116 +            Unions* o3,
   1.117 +            Unions* o4) MOZ_OVERRIDE;
   1.118 +
   1.119 +    virtual bool RecvTest10(
   1.120 +            const InfallibleTArray<Unions>& i1,
   1.121 +            InfallibleTArray<Unions>* o1) MOZ_OVERRIDE;
   1.122 +
   1.123 +    virtual bool RecvTest11(
   1.124 +            const SIntDouble& i,
   1.125 +            SIntDouble* o) MOZ_OVERRIDE;
   1.126 +
   1.127 +    virtual bool RecvTest12(
   1.128 +            const SIntDoubleArrays& i,
   1.129 +            SIntDoubleArrays* o) MOZ_OVERRIDE;
   1.130 +
   1.131 +    virtual bool RecvTest13(
   1.132 +            const SActors& i,
   1.133 +            SActors* o) MOZ_OVERRIDE;
   1.134 +
   1.135 +    virtual bool RecvTest14(
   1.136 +            const Structs& i,
   1.137 +            Structs* o) MOZ_OVERRIDE;
   1.138 +
   1.139 +    virtual bool RecvTest15(
   1.140 +            const WithStructs& i1,
   1.141 +            const WithStructs& i2,
   1.142 +            const WithStructs& i3,
   1.143 +            const WithStructs& i4,
   1.144 +            const WithStructs& i5,
   1.145 +            WithStructs* o1,
   1.146 +            WithStructs* o2,
   1.147 +            WithStructs* o3,
   1.148 +            WithStructs* o4,
   1.149 +            WithStructs* o5) MOZ_OVERRIDE;
   1.150 +
   1.151 +    virtual bool RecvTest16(
   1.152 +            const WithUnions& i,
   1.153 +            WithUnions* o) MOZ_OVERRIDE;
   1.154 +
   1.155 +    virtual bool RecvTest17(const InfallibleTArray<Op>& sa) MOZ_OVERRIDE;
   1.156 +
   1.157 +    virtual bool RecvTest18(const InfallibleTArray<nsIntRegion>& ra) MOZ_OVERRIDE;
   1.158 +
   1.159 +    virtual bool RecvDummy(const ShmemUnion& su, ShmemUnion* rsu) MOZ_OVERRIDE
   1.160 +    {
   1.161 +        *rsu = su;
   1.162 +        return true;
   1.163 +    }
   1.164 +
   1.165 +    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
   1.166 +    {
   1.167 +        if (NormalShutdown != why)
   1.168 +            fail("unexpected destruction!");  
   1.169 +        passed("ok");
   1.170 +        QuitParent();
   1.171 +    }
   1.172 +
   1.173 +private:
   1.174 +    InfallibleTArray<PTestDataStructuresSubParent*> mKids;
   1.175 +};
   1.176 +
   1.177 +
   1.178 +class TestDataStructuresChild :
   1.179 +    public PTestDataStructuresChild
   1.180 +{
   1.181 +public:
   1.182 +    TestDataStructuresChild();
   1.183 +    virtual ~TestDataStructuresChild();
   1.184 +
   1.185 +protected:
   1.186 +    virtual PTestDataStructuresSubChild* AllocPTestDataStructuresSubChild(const int& i) MOZ_OVERRIDE
   1.187 +    {
   1.188 +        PTestDataStructuresSubChild* actor = new TestDataStructuresSub(i);
   1.189 +        mKids.AppendElement(actor);
   1.190 +        return actor;
   1.191 +    }
   1.192 +
   1.193 +    virtual bool DeallocPTestDataStructuresSubChild(PTestDataStructuresSubChild* actor) MOZ_OVERRIDE
   1.194 +    {
   1.195 +        delete actor;
   1.196 +        return true;
   1.197 +    }
   1.198 +
   1.199 +    virtual bool RecvStart() MOZ_OVERRIDE;
   1.200 +
   1.201 +    virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
   1.202 +    {
   1.203 +        if (NormalShutdown != why)
   1.204 +            fail("unexpected destruction!");
   1.205 +        QuitChild();
   1.206 +    }
   1.207 +
   1.208 +private:
   1.209 +    void Test1();
   1.210 +    void Test2();
   1.211 +    void Test3();
   1.212 +    void Test4();
   1.213 +    void Test5();
   1.214 +    void Test6();
   1.215 +    void Test7_0();
   1.216 +    void Test7();
   1.217 +    void Test8();
   1.218 +    void Test9();
   1.219 +    void Test10();
   1.220 +    void Test11();
   1.221 +    void Test12();
   1.222 +    void Test13();
   1.223 +    void Test14();
   1.224 +    void Test15();
   1.225 +    void Test16();
   1.226 +    void Test17();
   1.227 +    void Test18();
   1.228 +
   1.229 +    InfallibleTArray<PTestDataStructuresSubChild*> mKids;
   1.230 +};
   1.231 +
   1.232 +
   1.233 +} // namespace _ipdltest
   1.234 +} // namespace mozilla
   1.235 +
   1.236 +
   1.237 +#endif // ifndef mozilla__ipdltest_TestDataStructures_h

mercurial