mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
124 lines
2.3 KiB
C++
124 lines
2.3 KiB
C++
#ifndef mozilla__ipdltest_TestStackHooks_h
|
|
#define mozilla__ipdltest_TestStackHooks_h 1
|
|
|
|
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestStackHooksParent.h"
|
|
#include "mozilla/_ipdltest/PTestStackHooksChild.h"
|
|
|
|
namespace mozilla {
|
|
namespace _ipdltest {
|
|
|
|
|
|
class TestStackHooksParent :
|
|
public PTestStackHooksParent
|
|
{
|
|
public:
|
|
TestStackHooksParent();
|
|
virtual ~TestStackHooksParent();
|
|
|
|
void Main();
|
|
|
|
protected:
|
|
NS_OVERRIDE
|
|
virtual bool RecvAsync() {
|
|
if (!mOnStack)
|
|
fail("not on C++ stack?!");
|
|
return true;
|
|
}
|
|
|
|
NS_OVERRIDE
|
|
virtual bool RecvSync() {
|
|
if (!mOnStack)
|
|
fail("not on C++ stack?!");
|
|
return true;
|
|
}
|
|
|
|
NS_OVERRIDE
|
|
virtual bool AnswerRpc() {
|
|
if (!mOnStack)
|
|
fail("not on C++ stack?!");
|
|
return true;
|
|
}
|
|
|
|
NS_OVERRIDE
|
|
virtual bool AnswerStackFrame();
|
|
|
|
NS_OVERRIDE
|
|
virtual void ActorDestroy(ActorDestroyReason why)
|
|
{
|
|
if (NormalShutdown != why)
|
|
fail("unexpected destruction!");
|
|
passed("ok");
|
|
QuitParent();
|
|
}
|
|
|
|
NS_OVERRIDE
|
|
virtual void EnteredCxxStack() {
|
|
mOnStack = true;
|
|
}
|
|
NS_OVERRIDE
|
|
virtual void ExitedCxxStack() {
|
|
mOnStack = false;
|
|
}
|
|
|
|
private:
|
|
bool mOnStack;
|
|
};
|
|
|
|
|
|
class TestStackHooksChild :
|
|
public PTestStackHooksChild
|
|
{
|
|
public:
|
|
TestStackHooksChild();
|
|
virtual ~TestStackHooksChild();
|
|
|
|
void RunTests();
|
|
|
|
protected:
|
|
NS_OVERRIDE
|
|
virtual bool RecvStart();
|
|
|
|
NS_OVERRIDE
|
|
virtual bool AnswerStackFrame();
|
|
|
|
NS_OVERRIDE
|
|
virtual void ActorDestroy(ActorDestroyReason why)
|
|
{
|
|
if (NormalShutdown != why)
|
|
fail("unexpected destruction!");
|
|
|
|
if (mEntered != mExited)
|
|
fail("unbalanced enter/exit notifications");
|
|
|
|
if (mOnStack)
|
|
fail("computing mOnStack went awry; should have failed above assertion");
|
|
|
|
QuitChild();
|
|
}
|
|
|
|
NS_OVERRIDE
|
|
virtual void EnteredCxxStack() {
|
|
++mEntered;
|
|
mOnStack = true;
|
|
}
|
|
NS_OVERRIDE
|
|
virtual void ExitedCxxStack() {
|
|
++mExited;
|
|
mOnStack = false;
|
|
}
|
|
|
|
private:
|
|
bool mOnStack;
|
|
int mEntered;
|
|
int mExited;
|
|
};
|
|
|
|
|
|
} // namespace _ipdltest
|
|
} // namespace mozilla
|
|
|
|
|
|
#endif // ifndef mozilla__ipdltest_TestStackHooks_h
|