2009-10-06 11:02:26 -07:00
|
|
|
#include "TestSanity.h"
|
|
|
|
|
|
|
|
#include "IPDLUnitTests.h" // fail etc.
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace _ipdltest {
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// parent
|
|
|
|
|
|
|
|
TestSanityParent::TestSanityParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(TestSanityParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
TestSanityParent::~TestSanityParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(TestSanityParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TestSanityParent::Main()
|
|
|
|
{
|
2010-01-25 14:47:39 -08:00
|
|
|
if (!SendPing(0, 0.5f, 0))
|
2009-10-06 11:02:26 -07:00
|
|
|
fail("sending Ping");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
2010-01-25 14:47:39 -08:00
|
|
|
TestSanityParent::RecvPong(const int& one, const float& zeroPtTwoFive,
|
2010-01-25 15:18:11 -08:00
|
|
|
const PRUint8&/*unused*/)
|
2009-10-06 11:02:26 -07:00
|
|
|
{
|
|
|
|
if (1 != one)
|
|
|
|
fail("invalid argument `%d', should have been `1'", one);
|
|
|
|
|
2009-11-06 12:24:35 -08:00
|
|
|
if (0.25f != zeroPtTwoFive)
|
|
|
|
fail("invalid argument `%g', should have been `0.25'", zeroPtTwoFive);
|
|
|
|
|
2009-12-03 00:16:28 -08:00
|
|
|
Close();
|
2009-10-06 11:02:26 -07:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// child
|
|
|
|
|
|
|
|
TestSanityChild::TestSanityChild()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(TestSanityChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
TestSanityChild::~TestSanityChild()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(TestSanityChild);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2010-01-25 14:47:39 -08:00
|
|
|
TestSanityChild::RecvPing(const int& zero, const float& zeroPtFive,
|
2010-01-25 15:18:11 -08:00
|
|
|
const PRInt8&/*unused*/)
|
2009-10-06 11:02:26 -07:00
|
|
|
{
|
|
|
|
if (0 != zero)
|
|
|
|
fail("invalid argument `%d', should have been `0'", zero);
|
|
|
|
|
2009-11-06 12:24:35 -08:00
|
|
|
if (0.5f != zeroPtFive)
|
|
|
|
fail("invalid argument `%g', should have been `0.5'", zeroPtFive);
|
|
|
|
|
2010-01-25 14:47:39 -08:00
|
|
|
if (!SendPong(1, 0.25f, 0))
|
2009-10-06 11:02:26 -07:00
|
|
|
fail("sending Pong");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace _ipdltest
|
|
|
|
} // namespace mozilla
|