1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/ipdl/test/cxx/TestMultiMgrs.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,103 @@ 1.4 +#include "TestMultiMgrs.h" 1.5 + 1.6 +#include "IPDLUnitTests.h" // fail etc. 1.7 + 1.8 +namespace mozilla { 1.9 +namespace _ipdltest { 1.10 + 1.11 +//----------------------------------------------------------------------------- 1.12 +// parent 1.13 + 1.14 +void 1.15 +TestMultiMgrsParent::Main() 1.16 +{ 1.17 + TestMultiMgrsLeftParent* leftie = new TestMultiMgrsLeftParent(); 1.18 + if (!SendPTestMultiMgrsLeftConstructor(leftie)) 1.19 + fail("error sending ctor"); 1.20 + 1.21 + TestMultiMgrsRightParent* rightie = new TestMultiMgrsRightParent(); 1.22 + if (!SendPTestMultiMgrsRightConstructor(rightie)) 1.23 + fail("error sending ctor"); 1.24 + 1.25 + TestMultiMgrsBottomParent* bottomL = new TestMultiMgrsBottomParent(); 1.26 + if (!leftie->SendPTestMultiMgrsBottomConstructor(bottomL)) 1.27 + fail("error sending ctor"); 1.28 + 1.29 + TestMultiMgrsBottomParent* bottomR = new TestMultiMgrsBottomParent(); 1.30 + if (!rightie->SendPTestMultiMgrsBottomConstructor(bottomR)) 1.31 + fail("error sending ctor"); 1.32 + 1.33 + if (!leftie->HasChild(bottomL)) 1.34 + fail("leftie didn't have a child it was supposed to!"); 1.35 + if (leftie->HasChild(bottomR)) 1.36 + fail("leftie had rightie's child!"); 1.37 + 1.38 + if (!rightie->HasChild(bottomR)) 1.39 + fail("rightie didn't have a child it was supposed to!"); 1.40 + if (rightie->HasChild(bottomL)) 1.41 + fail("rightie had rightie's child!"); 1.42 + 1.43 + if (!SendCheck()) 1.44 + fail("couldn't kick off the child-side check"); 1.45 +} 1.46 + 1.47 +bool 1.48 +TestMultiMgrsParent::RecvOK() 1.49 +{ 1.50 + Close(); 1.51 + return true; 1.52 +} 1.53 + 1.54 +//----------------------------------------------------------------------------- 1.55 +// child 1.56 + 1.57 +bool 1.58 +TestMultiMgrsLeftChild::RecvPTestMultiMgrsBottomConstructor( 1.59 + PTestMultiMgrsBottomChild* actor) 1.60 +{ 1.61 + static_cast<TestMultiMgrsChild*>(Manager())->mBottomL = actor; 1.62 + return true; 1.63 +} 1.64 + 1.65 +bool 1.66 +TestMultiMgrsRightChild::RecvPTestMultiMgrsBottomConstructor( 1.67 + PTestMultiMgrsBottomChild* actor) 1.68 +{ 1.69 + static_cast<TestMultiMgrsChild*>(Manager())->mBottomR = actor; 1.70 + return true; 1.71 +} 1.72 + 1.73 +bool 1.74 +TestMultiMgrsChild::RecvCheck() 1.75 +{ 1.76 + if (1 != ManagedPTestMultiMgrsLeftChild().Length()) 1.77 + fail("where's leftie?"); 1.78 + if (1 != ManagedPTestMultiMgrsRightChild().Length()) 1.79 + fail("where's rightie?"); 1.80 + 1.81 + TestMultiMgrsLeftChild* leftie = 1.82 + static_cast<TestMultiMgrsLeftChild*>( 1.83 + ManagedPTestMultiMgrsLeftChild()[0]); 1.84 + TestMultiMgrsRightChild* rightie = 1.85 + static_cast<TestMultiMgrsRightChild*>( 1.86 + ManagedPTestMultiMgrsRightChild()[0]); 1.87 + 1.88 + if (!leftie->HasChild(mBottomL)) 1.89 + fail("leftie didn't have a child it was supposed to!"); 1.90 + if (leftie->HasChild(mBottomR)) 1.91 + fail("leftie had rightie's child!"); 1.92 + 1.93 + if (!rightie->HasChild(mBottomR)) 1.94 + fail("rightie didn't have a child it was supposed to!"); 1.95 + if (rightie->HasChild(mBottomL)) 1.96 + fail("rightie had leftie's child!"); 1.97 + 1.98 + if (!SendOK()) 1.99 + fail("couldn't send OK()"); 1.100 + 1.101 + return true; 1.102 +} 1.103 + 1.104 + 1.105 +} // namespace _ipdltest 1.106 +} // namespace mozilla