2011-06-03 11:33:56 -07:00
|
|
|
#ifndef mozilla__ipdltest_TestBridgeMain_h
|
|
|
|
#define mozilla__ipdltest_TestBridgeMain_h 1
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/PTestBridgeMainParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestBridgeMainChild.h"
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/PTestBridgeSubParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestBridgeSubChild.h"
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/PTestBridgeMainSubParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestBridgeMainSubChild.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace _ipdltest {
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// "Main" process
|
|
|
|
//
|
|
|
|
class TestBridgeMainParent :
|
|
|
|
public PTestBridgeMainParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestBridgeMainParent() {}
|
|
|
|
virtual ~TestBridgeMainParent() {}
|
|
|
|
|
2011-11-30 08:27:22 -08:00
|
|
|
static bool RunTestInProcesses() { return true; }
|
|
|
|
static bool RunTestInThreads() { return false; }
|
|
|
|
|
2011-06-03 11:33:56 -07:00
|
|
|
void Main();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual PTestBridgeMainSubParent*
|
|
|
|
AllocPTestBridgeMainSub(Transport* transport,
|
2012-07-06 11:15:45 -07:00
|
|
|
ProcessId otherProcess) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class TestBridgeMainSubParent :
|
|
|
|
public PTestBridgeMainSubParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestBridgeMainSubParent(Transport* aTransport)
|
|
|
|
: mTransport(aTransport)
|
|
|
|
{}
|
|
|
|
virtual ~TestBridgeMainSubParent() {}
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvHello() MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvHelloSync() MOZ_OVERRIDE;
|
|
|
|
virtual bool AnswerHelloRpc() MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
|
|
|
Transport* mTransport;
|
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// "Sub" process --- child of "main"
|
|
|
|
//
|
|
|
|
class TestBridgeSubParent;
|
|
|
|
|
|
|
|
class TestBridgeMainChild :
|
|
|
|
public PTestBridgeMainChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestBridgeMainChild();
|
|
|
|
virtual ~TestBridgeMainChild() {}
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvStart() MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
|
|
|
IPDLUnitTestSubprocess* mSubprocess;
|
|
|
|
};
|
|
|
|
|
|
|
|
class TestBridgeSubParent :
|
|
|
|
public PTestBridgeSubParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestBridgeSubParent() {}
|
|
|
|
virtual ~TestBridgeSubParent() {}
|
|
|
|
|
|
|
|
void Main();
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvBridgeEm() MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// "Subsub" process --- child of "sub"
|
|
|
|
//
|
|
|
|
class TestBridgeSubChild :
|
|
|
|
public PTestBridgeSubChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestBridgeSubChild();
|
|
|
|
virtual ~TestBridgeSubChild() {}
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvPing() MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
|
|
|
virtual PTestBridgeMainSubChild*
|
|
|
|
AllocPTestBridgeMainSub(Transport* transport,
|
2012-07-06 11:15:45 -07:00
|
|
|
ProcessId otherProcess) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
class TestBridgeMainSubChild :
|
|
|
|
public PTestBridgeMainSubChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestBridgeMainSubChild(Transport* aTransport)
|
|
|
|
: mGotHi(false)
|
|
|
|
, mTransport(aTransport)
|
|
|
|
{}
|
|
|
|
virtual ~TestBridgeMainSubChild() {}
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual bool RecvHi() MOZ_OVERRIDE;
|
|
|
|
virtual bool AnswerHiRpc() MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
2012-07-06 11:15:45 -07:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2011-06-03 11:33:56 -07:00
|
|
|
|
|
|
|
bool mGotHi;
|
|
|
|
Transport* mTransport;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace _ipdltest
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ifndef mozilla__ipdltest_TestBridgeMain_h
|