michael@0: #include "TestMultiMgrs.h" michael@0: michael@0: #include "IPDLUnitTests.h" // fail etc. michael@0: michael@0: namespace mozilla { michael@0: namespace _ipdltest { michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // parent michael@0: michael@0: void michael@0: TestMultiMgrsParent::Main() michael@0: { michael@0: TestMultiMgrsLeftParent* leftie = new TestMultiMgrsLeftParent(); michael@0: if (!SendPTestMultiMgrsLeftConstructor(leftie)) michael@0: fail("error sending ctor"); michael@0: michael@0: TestMultiMgrsRightParent* rightie = new TestMultiMgrsRightParent(); michael@0: if (!SendPTestMultiMgrsRightConstructor(rightie)) michael@0: fail("error sending ctor"); michael@0: michael@0: TestMultiMgrsBottomParent* bottomL = new TestMultiMgrsBottomParent(); michael@0: if (!leftie->SendPTestMultiMgrsBottomConstructor(bottomL)) michael@0: fail("error sending ctor"); michael@0: michael@0: TestMultiMgrsBottomParent* bottomR = new TestMultiMgrsBottomParent(); michael@0: if (!rightie->SendPTestMultiMgrsBottomConstructor(bottomR)) michael@0: fail("error sending ctor"); michael@0: michael@0: if (!leftie->HasChild(bottomL)) michael@0: fail("leftie didn't have a child it was supposed to!"); michael@0: if (leftie->HasChild(bottomR)) michael@0: fail("leftie had rightie's child!"); michael@0: michael@0: if (!rightie->HasChild(bottomR)) michael@0: fail("rightie didn't have a child it was supposed to!"); michael@0: if (rightie->HasChild(bottomL)) michael@0: fail("rightie had rightie's child!"); michael@0: michael@0: if (!SendCheck()) michael@0: fail("couldn't kick off the child-side check"); michael@0: } michael@0: michael@0: bool michael@0: TestMultiMgrsParent::RecvOK() michael@0: { michael@0: Close(); michael@0: return true; michael@0: } michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: // child michael@0: michael@0: bool michael@0: TestMultiMgrsLeftChild::RecvPTestMultiMgrsBottomConstructor( michael@0: PTestMultiMgrsBottomChild* actor) michael@0: { michael@0: static_cast(Manager())->mBottomL = actor; michael@0: return true; michael@0: } michael@0: michael@0: bool michael@0: TestMultiMgrsRightChild::RecvPTestMultiMgrsBottomConstructor( michael@0: PTestMultiMgrsBottomChild* actor) michael@0: { michael@0: static_cast(Manager())->mBottomR = actor; michael@0: return true; michael@0: } michael@0: michael@0: bool michael@0: TestMultiMgrsChild::RecvCheck() michael@0: { michael@0: if (1 != ManagedPTestMultiMgrsLeftChild().Length()) michael@0: fail("where's leftie?"); michael@0: if (1 != ManagedPTestMultiMgrsRightChild().Length()) michael@0: fail("where's rightie?"); michael@0: michael@0: TestMultiMgrsLeftChild* leftie = michael@0: static_cast( michael@0: ManagedPTestMultiMgrsLeftChild()[0]); michael@0: TestMultiMgrsRightChild* rightie = michael@0: static_cast( michael@0: ManagedPTestMultiMgrsRightChild()[0]); michael@0: michael@0: if (!leftie->HasChild(mBottomL)) michael@0: fail("leftie didn't have a child it was supposed to!"); michael@0: if (leftie->HasChild(mBottomR)) michael@0: fail("leftie had rightie's child!"); michael@0: michael@0: if (!rightie->HasChild(mBottomR)) michael@0: fail("rightie didn't have a child it was supposed to!"); michael@0: if (rightie->HasChild(mBottomL)) michael@0: fail("rightie had leftie's child!"); michael@0: michael@0: if (!SendOK()) michael@0: fail("couldn't send OK()"); michael@0: michael@0: return true; michael@0: } michael@0: michael@0: michael@0: } // namespace _ipdltest michael@0: } // namespace mozilla