2010-02-11 23:32:17 +03:00
|
|
|
#ifndef mozilla__ipdltest_TestHangs_h
|
|
|
|
#define mozilla__ipdltest_TestHangs_h 1
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/IPDLUnitTests.h"
|
|
|
|
|
|
|
|
#include "mozilla/_ipdltest/PTestHangsParent.h"
|
|
|
|
#include "mozilla/_ipdltest/PTestHangsChild.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace _ipdltest {
|
|
|
|
|
|
|
|
|
|
|
|
class TestHangsParent :
|
|
|
|
public PTestHangsParent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestHangsParent();
|
|
|
|
virtual ~TestHangsParent();
|
|
|
|
|
2011-11-30 20:27:22 +04:00
|
|
|
static bool RunTestInProcesses() { return true; }
|
|
|
|
|
|
|
|
// FIXME/bug 703320 Disabled because parent kills child proc, not
|
|
|
|
// clear how that should work in threads.
|
|
|
|
static bool RunTestInThreads() { return false; }
|
|
|
|
|
2010-02-11 23:32:17 +03:00
|
|
|
void Main();
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 22:15:45 +04:00
|
|
|
virtual bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
|
2010-02-11 23:32:17 +03:00
|
|
|
|
2010-03-11 10:35:28 +03:00
|
|
|
virtual bool RecvNonce() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 22:15:45 +04:00
|
|
|
virtual bool AnswerStackFrame() MOZ_OVERRIDE;
|
2010-02-11 23:32:17 +03:00
|
|
|
|
2012-07-06 22:15:45 +04:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
2010-02-11 23:32:17 +03:00
|
|
|
{
|
|
|
|
if (AbnormalShutdown != why)
|
|
|
|
fail("unexpected destruction!");
|
|
|
|
passed("ok");
|
|
|
|
QuitParent();
|
|
|
|
}
|
|
|
|
|
2010-03-11 10:35:28 +03:00
|
|
|
void CleanUp();
|
|
|
|
|
|
|
|
bool mDetectedHang;
|
2010-02-11 23:32:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class TestHangsChild :
|
|
|
|
public PTestHangsChild
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TestHangsChild();
|
|
|
|
virtual ~TestHangsChild();
|
|
|
|
|
|
|
|
protected:
|
2012-07-06 22:15:45 +04:00
|
|
|
virtual bool RecvStart() MOZ_OVERRIDE {
|
2010-03-11 10:35:28 +03:00
|
|
|
if (!SendNonce())
|
|
|
|
fail("sending Nonce");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 22:15:45 +04:00
|
|
|
virtual bool AnswerStackFrame() MOZ_OVERRIDE
|
2010-02-11 23:32:17 +03:00
|
|
|
{
|
2010-03-11 10:35:28 +03:00
|
|
|
if (CallStackFrame())
|
|
|
|
fail("should have failed");
|
2010-02-11 23:32:17 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 22:15:45 +04:00
|
|
|
virtual bool AnswerHang() MOZ_OVERRIDE;
|
2010-02-11 23:32:17 +03:00
|
|
|
|
2012-07-06 22:15:45 +04:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
|
2010-02-11 23:32:17 +03:00
|
|
|
{
|
2010-03-11 10:35:28 +03:00
|
|
|
if (AbnormalShutdown != why)
|
|
|
|
fail("unexpected destruction!");
|
|
|
|
QuitChild();
|
2010-02-11 23:32:17 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace _ipdltest
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ifndef mozilla__ipdltest_TestHangs_h
|