Test for bug 671189.

This commit is contained in:
Chris Jones 2011-07-13 22:43:43 -07:00
parent dc9d5133ae
commit 0a3bf2d34a
5 changed files with 167 additions and 2 deletions

View File

@ -83,8 +83,9 @@ IPDLTESTS = \
TestShmem \
TestShutdown \
TestStackHooks \
TestSyncWakeup \
TestSyncError \
TestSyncHang \
TestSyncWakeup \
$(NULL)
ifeq ($(OS_ARCH),Linux)

View File

@ -0,0 +1,28 @@
namespace mozilla {
namespace _ipdltest {
sync protocol PTestSyncError {
child:
Start();
parent:
sync Error();
__delete__();
state START:
send Start goto SYNC_ERROR;
state SYNC_ERROR:
recv Error goto DEAD;
state DEAD:
recv __delete__;
};
} // namespace mozilla
} // namespace _ipdltest

View File

@ -0,0 +1,61 @@
#include "TestSyncError.h"
#include "IPDLUnitTests.h" // fail etc.
namespace mozilla {
namespace _ipdltest {
//-----------------------------------------------------------------------------
// parent
TestSyncErrorParent::TestSyncErrorParent()
{
MOZ_COUNT_CTOR(TestSyncErrorParent);
}
TestSyncErrorParent::~TestSyncErrorParent()
{
MOZ_COUNT_DTOR(TestSyncErrorParent);
}
void
TestSyncErrorParent::Main()
{
if (!SendStart())
fail("sending Start");
}
bool
TestSyncErrorParent::RecvError()
{
return false;
}
//-----------------------------------------------------------------------------
// child
TestSyncErrorChild::TestSyncErrorChild()
{
MOZ_COUNT_CTOR(TestSyncErrorChild);
}
TestSyncErrorChild::~TestSyncErrorChild()
{
MOZ_COUNT_DTOR(TestSyncErrorChild);
}
bool
TestSyncErrorChild::RecvStart()
{
if (SendError())
fail("Error() should have return false");
Close();
return true;
}
} // namespace _ipdltest
} // namespace mozilla

View File

@ -0,0 +1,74 @@
#ifndef mozilla__ipdltest_TestSyncError_h
#define mozilla__ipdltest_TestSyncError_h 1
#include "mozilla/_ipdltest/IPDLUnitTests.h"
#include "mozilla/_ipdltest/PTestSyncErrorParent.h"
#include "mozilla/_ipdltest/PTestSyncErrorChild.h"
namespace mozilla {
namespace _ipdltest {
class TestSyncErrorParent :
public PTestSyncErrorParent
{
public:
TestSyncErrorParent();
virtual ~TestSyncErrorParent();
void Main();
protected:
NS_OVERRIDE
virtual bool RecvError();
NS_OVERRIDE
virtual void ProcessingError(Result what)
{
// Ignore errors
}
NS_OVERRIDE
virtual void ActorDestroy(ActorDestroyReason why)
{
if (NormalShutdown != why)
fail("unexpected destruction!");
passed("ok");
QuitParent();
}
};
class TestSyncErrorChild :
public PTestSyncErrorChild
{
public:
TestSyncErrorChild();
virtual ~TestSyncErrorChild();
protected:
NS_OVERRIDE
virtual bool RecvStart();
NS_OVERRIDE
virtual void ProcessingError(Result what)
{
// Ignore errors
}
NS_OVERRIDE
virtual void ActorDestroy(ActorDestroyReason why)
{
if (NormalShutdown != why)
fail("unexpected destruction!");
QuitChild();
}
};
} // namespace _ipdltest
} // namespace mozilla
#endif // ifndef mozilla__ipdltest_TestSyncError_h

View File

@ -40,7 +40,8 @@ IPDLSRCS = \
PTestShutdownSub.ipdl \
PTestShutdownSubsub.ipdl \
PTestStackHooks.ipdl \
PTestSyncWakeup.ipdl \
PTestSyncError.ipdl \
PTestSyncHang.ipdl \
PTestSyncWakeup.ipdl \
PTestSysVShmem.ipdl \
$(NULL)