mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 05:11:03 +00:00
1beb91ad2b
- Bug 1262671 - IPC sentinel checking (r=froydnj) (2bd39988fe) - Bug 1262671 - IPC ReadData/ReadBytes elimination (r=froydnj) (85b47baffd) - Bug 1272415: Don't include task.h everywhere. r=froydnj (6198aedfed) - Bug 1273312 - Add task.h to ipdl unit tests (r=khuey) (42b8d3bb90) - Bug 1268616 - Part 1: Check max message size before resizing. r=billm (6889a43e16) - Bug 1268616 - Part 2: Stop sending messages that are too large. r=billm (a68e6624be) - Bug 1268616 - Part 3: Reduce the maxmimum IPC message size. r=billm (581076632e) - Bug 1262671 - Use BufferList for Pickle (r=froydnj) (f61d8b233d) - Bug 1262671 - Introduce MFBT BufferList class (r=froydnj) (cb1aca1708) - mfbt: BufferList: VC2013 fix (93da0d98f7)
169 lines
3.6 KiB
C++
169 lines
3.6 KiB
C++
#include "TestStackHooks.h"
|
|
|
|
#include "base/task.h"
|
|
#include "IPDLUnitTests.h" // fail etc.
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
namespace _ipdltest {
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// parent
|
|
|
|
TestStackHooksParent::TestStackHooksParent() :
|
|
mOnStack(false), mIncallDepth(0)
|
|
{
|
|
MOZ_COUNT_CTOR(TestStackHooksParent);
|
|
}
|
|
|
|
TestStackHooksParent::~TestStackHooksParent()
|
|
{
|
|
MOZ_COUNT_DTOR(TestStackHooksParent);
|
|
}
|
|
|
|
void
|
|
TestStackHooksParent::Main()
|
|
{
|
|
if (!SendStart())
|
|
fail("sending Start()");
|
|
}
|
|
|
|
|
|
bool
|
|
TestStackHooksParent::AnswerStackFrame()
|
|
{
|
|
if (!mOnStack)
|
|
fail("not on C++ stack?!");
|
|
|
|
if (!CallStackFrame())
|
|
fail("calling StackFrame()");
|
|
|
|
if (!mOnStack)
|
|
fail("not on C++ stack?!");
|
|
|
|
if (1 != mIncallDepth)
|
|
fail("missed EnteredCall or ExitedCall hook");
|
|
|
|
return true;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// child
|
|
|
|
TestStackHooksChild::TestStackHooksChild() :
|
|
mOnStack(false),
|
|
mEntered(0),
|
|
mExited(0),
|
|
mIncallDepth(0)
|
|
{
|
|
MOZ_COUNT_CTOR(TestStackHooksChild);
|
|
}
|
|
|
|
TestStackHooksChild::~TestStackHooksChild()
|
|
{
|
|
MOZ_COUNT_DTOR(TestStackHooksChild);
|
|
}
|
|
|
|
namespace {
|
|
void RunTestsFn() {
|
|
static_cast<TestStackHooksChild*>(gChildActor)->RunTests();
|
|
}
|
|
}
|
|
|
|
bool
|
|
TestStackHooksChild::RecvStart()
|
|
{
|
|
if (!mOnStack)
|
|
fail("missed stack notification");
|
|
|
|
if (0 != mIncallDepth)
|
|
fail("EnteredCall/ExitedCall malfunction");
|
|
|
|
// kick off tests from a runnable so that we can start with
|
|
// MessageChannel code on the C++ stack
|
|
MessageLoop::current()->PostTask(NewRunnableFunction(RunTestsFn));
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
TestStackHooksChild::AnswerStackFrame()
|
|
{
|
|
if (!mOnStack)
|
|
fail("missed stack notification");
|
|
|
|
if (1 != mIncallDepth)
|
|
fail("missed EnteredCall or ExitedCall hook");
|
|
|
|
if (PTestStackHooks::TEST4_3 == state()) {
|
|
if (!SendAsync())
|
|
fail("sending Async()");
|
|
}
|
|
else if (PTestStackHooks::TEST5_3 == state()) {
|
|
if (!SendSync())
|
|
fail("sending Sync()");
|
|
}
|
|
else {
|
|
fail("unexpected state");
|
|
}
|
|
|
|
if (!mOnStack)
|
|
fail("bad stack exit notification");
|
|
|
|
return true;
|
|
}
|
|
|
|
void
|
|
TestStackHooksChild::RunTests()
|
|
{
|
|
// 1 because of RecvStart()
|
|
if (1 != mEntered)
|
|
fail("missed stack notification");
|
|
if (mOnStack)
|
|
fail("spurious stack notification");
|
|
if (0 != mIncallDepth)
|
|
fail("EnteredCall/ExitedCall malfunction");
|
|
|
|
if (!SendAsync())
|
|
fail("sending Async()");
|
|
if (mOnStack)
|
|
fail("spurious stack notification");
|
|
if (0 != mIncallDepth)
|
|
fail("EnteredCall/ExitedCall malfunction");
|
|
if (2 != mEntered)
|
|
fail("missed stack notification");
|
|
|
|
if (!SendSync())
|
|
fail("sending Sync()");
|
|
if (mOnStack)
|
|
fail("spurious stack notification");
|
|
if (0 != mIncallDepth)
|
|
fail("EnteredCall/ExitedCall malfunction");
|
|
if (3 != mEntered)
|
|
fail("missed stack notification");
|
|
|
|
if (!CallRpc())
|
|
fail("calling RPC()");
|
|
if (mOnStack)
|
|
fail("spurious stack notification");
|
|
if (0 != mIncallDepth)
|
|
fail("EnteredCall/ExitedCall malfunction");
|
|
if (4 != mEntered)
|
|
fail("missed stack notification");
|
|
|
|
if (!CallStackFrame())
|
|
fail("calling StackFrame()");
|
|
if (mOnStack)
|
|
fail("spurious stack notification");
|
|
if (0 != mIncallDepth)
|
|
fail("EnteredCall/ExitedCall malfunction");
|
|
if (5 != mEntered)
|
|
fail("missed stack notification");
|
|
|
|
Close();
|
|
}
|
|
|
|
} // namespace _ipdltest
|
|
} // namespace mozilla
|