gecko/ipc/ipdl/test/cxx/TestBlockChild.h
Chris Jones 0d9ee803ce Bug 540886, part 3: IPDL/C++ test for BlockChild()/UnblockChild(). r=bnewman
--HG--
extra : transplant_source : h%0DM%F8%C5s%82%97%28%AEH%91%86%00%0E%99%A0%05T%1B
2010-01-27 00:41:33 -06:00

97 lines
1.8 KiB
C++

#ifndef mozilla__ipdltest_TestBlockChild_h
#define mozilla__ipdltest_TestBlockChild_h 1
#include "mozilla/_ipdltest/IPDLUnitTests.h"
#include "mozilla/_ipdltest/PTestBlockChildParent.h"
#include "mozilla/_ipdltest/PTestBlockChildChild.h"
namespace mozilla {
namespace _ipdltest {
class TestBlockChildParent :
public PTestBlockChildParent
{
public:
TestBlockChildParent() : mChildBlocked(false),
mGotP1(false),
mGotP2(false)
{ }
virtual ~TestBlockChildParent() { }
void Main();
protected:
NS_OVERRIDE
virtual bool AnswerStackFrame();
NS_OVERRIDE
virtual bool RecvP1();
NS_OVERRIDE
virtual bool RecvP2();
NS_OVERRIDE
virtual bool RecvDone();
NS_OVERRIDE
virtual void ActorDestroy(ActorDestroyReason why)
{
if (NormalShutdown != why)
fail("unexpected destruction!");
passed("ok");
QuitParent();
}
private:
void BlockChildInLowerFrame();
bool mChildBlocked;
bool mGotP1;
bool mGotP2;
bool mGotP3;
};
class TestBlockChildChild :
public PTestBlockChildChild
{
public:
TestBlockChildChild() { }
virtual ~TestBlockChildChild() { }
protected:
NS_OVERRIDE
virtual bool RecvPoke1();
NS_OVERRIDE
virtual bool AnswerStackFrame();
NS_OVERRIDE
virtual bool RecvPoke2();
NS_OVERRIDE
virtual bool RecvLastPoke();
NS_OVERRIDE
virtual void ActorDestroy(ActorDestroyReason why)
{
if (NormalShutdown != why)
fail("unexpected destruction!");
QuitChild();
}
private:
void OnPoke1();
void OnPoke2();
void OnLastPoke();
};
} // namespace _ipdltest
} // namespace mozilla
#endif // ifndef mozilla__ipdltest_TestBlockChild_h