2010-05-22 12:35:37 -07:00
|
|
|
#ifndef mozilla__ipdltest_TestDataStructures_h
|
|
|
|
#define mozilla__ipdltest_TestDataStructures_h 1
|
2009-10-16 16:31:53 -07:00
|
|
|
|
2009-12-03 00:16:28 -08:00
|
|
|
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
2009-10-16 16:31:53 -07:00
|
|
|
|
2010-05-22 12:35:37 -07:00
|
|
|
#include "mozilla/_ipdltest/PTestDataStructuresParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestDataStructuresChild.h"
|
2009-10-16 16:31:53 -07:00
|
|
|
|
2010-05-22 12:35:37 -07:00
|
|
|
#include "mozilla/_ipdltest/PTestDataStructuresSubParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestDataStructuresSubChild.h"
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace _ipdltest {
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Subprotocol actors
|
|
|
|
|
2010-05-22 12:35:37 -07:00
|
|
|
class TestDataStructuresSub :
|
|
|
|
public PTestDataStructuresSubParent,
|
|
|
|
public PTestDataStructuresSubChild
|
2009-10-16 16:31:53 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-09-17 01:37:20 -07:00
|
|
|
TestDataStructuresSub(uint32_t i) : mI(i)
|
2009-10-16 16:31:53 -07:00
|
|
|
{ }
|
2010-05-22 12:35:37 -07:00
|
|
|
virtual ~TestDataStructuresSub()
|
2009-10-16 16:31:53 -07:00
|
|
|
{ }
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
2012-07-13 10:53:00 -07:00
|
|
|
{
|
|
|
|
if (Deletion != why)
|
|
|
|
fail("unexpected destruction!");
|
|
|
|
}
|
2012-09-17 01:37:20 -07:00
|
|
|
uint32_t mI;
|
2009-10-16 16:31:53 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Main actors
|
|
|
|
|
2010-05-22 12:35:37 -07:00
|
|
|
class TestDataStructuresParent :
|
|
|
|
public PTestDataStructuresParent
|
2009-10-16 16:31:53 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-05-22 12:35:37 -07:00
|
|
|
TestDataStructuresParent();
|
|
|
|
virtual ~TestDataStructuresParent();
|
2009-10-16 16:31:53 -07:00
|
|
|
|
2011-11-30 08:27:22 -08:00
|
|
|
static bool RunTestInProcesses() { return true; }
|
|
|
|
static bool RunTestInThreads() { return true; }
|
|
|
|
|
2009-10-16 16:31:53 -07:00
|
|
|
void Main();
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual PTestDataStructuresSubParent* AllocPTestDataStructuresSub(const int& i) MOZ_OVERRIDE
|
2009-10-16 16:31:53 -07:00
|
|
|
{
|
2010-05-22 12:35:37 -07:00
|
|
|
PTestDataStructuresSubParent* actor = new TestDataStructuresSub(i);
|
2009-10-16 16:31:53 -07:00
|
|
|
mKids.AppendElement(actor);
|
|
|
|
return actor;
|
|
|
|
}
|
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool DeallocPTestDataStructuresSub(PTestDataStructuresSubParent* actor) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest1(
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<int>& i1,
|
2012-07-06 11:15:45 -07:00
|
|
|
InfallibleTArray<int>* o1) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest2(
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<PTestDataStructuresSubParent*>& i1,
|
2012-07-06 11:15:45 -07:00
|
|
|
InfallibleTArray<PTestDataStructuresSubParent*>* o1) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest3(
|
|
|
|
const IntDouble& i1,
|
|
|
|
const IntDouble& i2,
|
|
|
|
IntDouble* o1,
|
2012-07-06 11:15:45 -07:00
|
|
|
IntDouble* o2) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest4(
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<IntDouble>& i1,
|
2012-07-06 11:15:45 -07:00
|
|
|
InfallibleTArray<IntDouble>* o1) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest5(
|
|
|
|
const IntDoubleArrays& i1,
|
|
|
|
const IntDoubleArrays& i2,
|
|
|
|
const IntDoubleArrays& i3,
|
|
|
|
IntDoubleArrays* o1,
|
|
|
|
IntDoubleArrays* o2,
|
2012-07-06 11:15:45 -07:00
|
|
|
IntDoubleArrays* o3) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest6(
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<IntDoubleArrays>& i1,
|
2012-07-06 11:15:45 -07:00
|
|
|
InfallibleTArray<IntDoubleArrays>* o1) MOZ_OVERRIDE;
|
|
|
|
|
2009-10-16 16:31:53 -07:00
|
|
|
|
2012-07-12 05:51:57 -07:00
|
|
|
virtual bool RecvTest7_0(const ActorWrapper& i1,
|
2012-07-06 11:15:45 -07:00
|
|
|
ActorWrapper* o1) MOZ_OVERRIDE;
|
2012-07-12 05:51:57 -07:00
|
|
|
|
2009-10-16 16:31:53 -07:00
|
|
|
virtual bool RecvTest7(
|
|
|
|
const Actors& i1,
|
|
|
|
const Actors& i2,
|
|
|
|
const Actors& i3,
|
|
|
|
Actors* o1,
|
|
|
|
Actors* o2,
|
2012-07-06 11:15:45 -07:00
|
|
|
Actors* o3) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest8(
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<Actors>& i1,
|
2012-07-06 11:15:45 -07:00
|
|
|
InfallibleTArray<Actors>* o1) MOZ_OVERRIDE;
|
2009-12-03 00:16:28 -08:00
|
|
|
|
2009-10-16 16:31:53 -07:00
|
|
|
virtual bool RecvTest9(
|
|
|
|
const Unions& i1,
|
|
|
|
const Unions& i2,
|
|
|
|
const Unions& i3,
|
|
|
|
const Unions& i4,
|
|
|
|
Unions* o1,
|
|
|
|
Unions* o2,
|
|
|
|
Unions* o3,
|
2012-07-06 11:15:45 -07:00
|
|
|
Unions* o4) MOZ_OVERRIDE;
|
2009-12-03 00:16:28 -08:00
|
|
|
|
2009-10-16 16:31:53 -07:00
|
|
|
virtual bool RecvTest10(
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<Unions>& i1,
|
2012-07-06 11:15:45 -07:00
|
|
|
InfallibleTArray<Unions>* o1) MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
2010-05-22 12:35:37 -07:00
|
|
|
virtual bool RecvTest11(
|
|
|
|
const SIntDouble& i,
|
2012-07-06 11:15:45 -07:00
|
|
|
SIntDouble* o) MOZ_OVERRIDE;
|
2010-05-22 12:35:37 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest12(
|
|
|
|
const SIntDoubleArrays& i,
|
2012-07-06 11:15:45 -07:00
|
|
|
SIntDoubleArrays* o) MOZ_OVERRIDE;
|
2010-05-22 12:35:37 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest13(
|
|
|
|
const SActors& i,
|
2012-07-06 11:15:45 -07:00
|
|
|
SActors* o) MOZ_OVERRIDE;
|
2010-05-22 12:35:37 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest14(
|
|
|
|
const Structs& i,
|
2012-07-06 11:15:45 -07:00
|
|
|
Structs* o) MOZ_OVERRIDE;
|
2010-05-22 12:35:37 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest15(
|
|
|
|
const WithStructs& i1,
|
|
|
|
const WithStructs& i2,
|
|
|
|
const WithStructs& i3,
|
|
|
|
const WithStructs& i4,
|
|
|
|
const WithStructs& i5,
|
|
|
|
WithStructs* o1,
|
|
|
|
WithStructs* o2,
|
|
|
|
WithStructs* o3,
|
|
|
|
WithStructs* o4,
|
2012-07-06 11:15:45 -07:00
|
|
|
WithStructs* o5) MOZ_OVERRIDE;
|
2010-05-22 12:35:37 -07:00
|
|
|
|
|
|
|
virtual bool RecvTest16(
|
|
|
|
const WithUnions& i,
|
2012-07-06 11:15:45 -07:00
|
|
|
WithUnions* o) MOZ_OVERRIDE;
|
2010-05-22 12:35:37 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvTest17(const InfallibleTArray<Op>& sa) MOZ_OVERRIDE;
|
2010-06-02 10:56:34 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvTest18(const InfallibleTArray<nsIntRegion>& ra) MOZ_OVERRIDE;
|
2010-06-21 13:35:48 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvDummy(const ShmemUnion& su, ShmemUnion* rsu) MOZ_OVERRIDE
|
2010-09-08 11:27:52 -07:00
|
|
|
{
|
|
|
|
*rsu = su;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
2009-12-03 00:16:28 -08:00
|
|
|
{
|
|
|
|
if (NormalShutdown != why)
|
|
|
|
fail("unexpected destruction!");
|
|
|
|
passed("ok");
|
|
|
|
QuitParent();
|
|
|
|
}
|
|
|
|
|
2009-10-16 16:31:53 -07:00
|
|
|
private:
|
2010-11-08 18:49:00 -08:00
|
|
|
InfallibleTArray<PTestDataStructuresSubParent*> mKids;
|
2009-10-16 16:31:53 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-05-22 12:35:37 -07:00
|
|
|
class TestDataStructuresChild :
|
|
|
|
public PTestDataStructuresChild
|
2009-10-16 16:31:53 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-05-22 12:35:37 -07:00
|
|
|
TestDataStructuresChild();
|
|
|
|
virtual ~TestDataStructuresChild();
|
2009-10-16 16:31:53 -07:00
|
|
|
|
|
|
|
protected:
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual PTestDataStructuresSubChild* AllocPTestDataStructuresSub(const int& i) MOZ_OVERRIDE
|
2009-10-16 16:31:53 -07:00
|
|
|
{
|
2010-05-22 12:35:37 -07:00
|
|
|
PTestDataStructuresSubChild* actor = new TestDataStructuresSub(i);
|
2009-10-16 16:31:53 -07:00
|
|
|
mKids.AppendElement(actor);
|
|
|
|
return actor;
|
|
|
|
}
|
2009-12-03 00:16:28 -08:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool DeallocPTestDataStructuresSub(PTestDataStructuresSubChild* actor) MOZ_OVERRIDE
|
2009-10-16 16:31:53 -07:00
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvStart() MOZ_OVERRIDE;
|
2009-10-16 16:31:53 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
2009-12-03 00:16:28 -08:00
|
|
|
{
|
|
|
|
if (NormalShutdown != why)
|
|
|
|
fail("unexpected destruction!");
|
|
|
|
QuitChild();
|
|
|
|
}
|
|
|
|
|
2009-10-16 16:31:53 -07:00
|
|
|
private:
|
|
|
|
void Test1();
|
|
|
|
void Test2();
|
|
|
|
void Test3();
|
|
|
|
void Test4();
|
|
|
|
void Test5();
|
|
|
|
void Test6();
|
2012-07-12 05:51:57 -07:00
|
|
|
void Test7_0();
|
2009-10-16 16:31:53 -07:00
|
|
|
void Test7();
|
|
|
|
void Test8();
|
|
|
|
void Test9();
|
|
|
|
void Test10();
|
2010-05-22 12:35:37 -07:00
|
|
|
void Test11();
|
|
|
|
void Test12();
|
|
|
|
void Test13();
|
|
|
|
void Test14();
|
|
|
|
void Test15();
|
|
|
|
void Test16();
|
2010-06-02 10:56:34 -07:00
|
|
|
void Test17();
|
2010-06-21 13:35:48 -07:00
|
|
|
void Test18();
|
2010-05-22 12:35:37 -07:00
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
InfallibleTArray<PTestDataStructuresSubChild*> mKids;
|
2009-10-16 16:31:53 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace _ipdltest
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
|
2010-05-22 12:35:37 -07:00
|
|
|
#endif // ifndef mozilla__ipdltest_TestDataStructures_h
|