2010-04-27 01:11:48 +00:00
|
|
|
#ifndef mozilla__ipdltest_TestSelfManageRoot_h
|
|
|
|
#define mozilla__ipdltest_TestSelfManageRoot_h 1
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/PTestSelfManageRootParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestSelfManageRootChild.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestSelfManageParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestSelfManageChild.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace _ipdltest {
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Parent side
|
|
|
|
|
|
|
|
class TestSelfManageParent :
|
|
|
|
public PTestSelfManageParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestSelfManageParent() {
|
|
|
|
MOZ_COUNT_CTOR(TestSelfManageParent);
|
|
|
|
}
|
|
|
|
virtual ~TestSelfManageParent() {
|
|
|
|
MOZ_COUNT_DTOR(TestSelfManageParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
ActorDestroyReason mWhy;
|
|
|
|
|
|
|
|
protected:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual PTestSelfManageParent* AllocPTestSelfManageParent() override {
|
2010-04-27 01:11:48 +00:00
|
|
|
return new TestSelfManageParent();
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool DeallocPTestSelfManageParent(PTestSelfManageParent* a) override {
|
2010-04-27 01:11:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) override {
|
2010-04-27 01:11:48 +00:00
|
|
|
mWhy = why;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class TestSelfManageRootParent :
|
|
|
|
public PTestSelfManageRootParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestSelfManageRootParent() {
|
|
|
|
MOZ_COUNT_CTOR(TestSelfManageRootParent);
|
|
|
|
}
|
|
|
|
virtual ~TestSelfManageRootParent() {
|
|
|
|
MOZ_COUNT_DTOR(TestSelfManageRootParent);
|
|
|
|
}
|
|
|
|
|
2011-11-30 16:27:22 +00:00
|
|
|
static bool RunTestInProcesses() { return true; }
|
|
|
|
static bool RunTestInThreads() { return true; }
|
|
|
|
|
2010-04-27 01:11:48 +00:00
|
|
|
void Main();
|
|
|
|
|
|
|
|
protected:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual PTestSelfManageParent* AllocPTestSelfManageParent() override {
|
2010-04-27 01:11:48 +00:00
|
|
|
return new TestSelfManageParent();
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool DeallocPTestSelfManageParent(PTestSelfManageParent* a) override {
|
2010-04-27 01:11:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) override
|
2010-04-27 01:11:48 +00:00
|
|
|
{
|
|
|
|
if (NormalShutdown != why)
|
|
|
|
fail("unexpected destruction!");
|
|
|
|
passed("ok");
|
|
|
|
QuitParent();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Child side
|
|
|
|
|
|
|
|
class TestSelfManageChild :
|
|
|
|
public PTestSelfManageChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestSelfManageChild() {
|
|
|
|
MOZ_COUNT_CTOR(TestSelfManageChild);
|
|
|
|
}
|
|
|
|
virtual ~TestSelfManageChild() {
|
|
|
|
MOZ_COUNT_DTOR(TestSelfManageChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual PTestSelfManageChild* AllocPTestSelfManageChild() override {
|
2010-04-27 01:11:48 +00:00
|
|
|
return new TestSelfManageChild();
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool DeallocPTestSelfManageChild(PTestSelfManageChild* a) override {
|
2010-04-27 01:11:48 +00:00
|
|
|
delete a;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) override { }
|
2010-04-27 01:11:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class TestSelfManageRootChild :
|
|
|
|
public PTestSelfManageRootChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestSelfManageRootChild() {
|
|
|
|
MOZ_COUNT_CTOR(TestSelfManageRootChild);
|
|
|
|
}
|
|
|
|
virtual ~TestSelfManageRootChild() {
|
|
|
|
MOZ_COUNT_DTOR(TestSelfManageRootChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Main();
|
|
|
|
|
|
|
|
protected:
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual PTestSelfManageChild* AllocPTestSelfManageChild() override {
|
2010-04-27 01:11:48 +00:00
|
|
|
return new TestSelfManageChild();
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool DeallocPTestSelfManageChild(PTestSelfManageChild* a) override {
|
2010-04-27 01:11:48 +00:00
|
|
|
delete a;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) override
|
2010-04-27 01:11:48 +00:00
|
|
|
{
|
|
|
|
if (NormalShutdown != why)
|
|
|
|
fail("unexpected destruction!");
|
|
|
|
QuitChild();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace _ipdltest
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ifndef mozilla__ipdltest_TestSelfManageRoot_h
|