Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | #include "TestMultiMgrs.h" |
michael@0 | 2 | |
michael@0 | 3 | #include "IPDLUnitTests.h" // fail etc. |
michael@0 | 4 | |
michael@0 | 5 | namespace mozilla { |
michael@0 | 6 | namespace _ipdltest { |
michael@0 | 7 | |
michael@0 | 8 | //----------------------------------------------------------------------------- |
michael@0 | 9 | // parent |
michael@0 | 10 | |
michael@0 | 11 | void |
michael@0 | 12 | TestMultiMgrsParent::Main() |
michael@0 | 13 | { |
michael@0 | 14 | TestMultiMgrsLeftParent* leftie = new TestMultiMgrsLeftParent(); |
michael@0 | 15 | if (!SendPTestMultiMgrsLeftConstructor(leftie)) |
michael@0 | 16 | fail("error sending ctor"); |
michael@0 | 17 | |
michael@0 | 18 | TestMultiMgrsRightParent* rightie = new TestMultiMgrsRightParent(); |
michael@0 | 19 | if (!SendPTestMultiMgrsRightConstructor(rightie)) |
michael@0 | 20 | fail("error sending ctor"); |
michael@0 | 21 | |
michael@0 | 22 | TestMultiMgrsBottomParent* bottomL = new TestMultiMgrsBottomParent(); |
michael@0 | 23 | if (!leftie->SendPTestMultiMgrsBottomConstructor(bottomL)) |
michael@0 | 24 | fail("error sending ctor"); |
michael@0 | 25 | |
michael@0 | 26 | TestMultiMgrsBottomParent* bottomR = new TestMultiMgrsBottomParent(); |
michael@0 | 27 | if (!rightie->SendPTestMultiMgrsBottomConstructor(bottomR)) |
michael@0 | 28 | fail("error sending ctor"); |
michael@0 | 29 | |
michael@0 | 30 | if (!leftie->HasChild(bottomL)) |
michael@0 | 31 | fail("leftie didn't have a child it was supposed to!"); |
michael@0 | 32 | if (leftie->HasChild(bottomR)) |
michael@0 | 33 | fail("leftie had rightie's child!"); |
michael@0 | 34 | |
michael@0 | 35 | if (!rightie->HasChild(bottomR)) |
michael@0 | 36 | fail("rightie didn't have a child it was supposed to!"); |
michael@0 | 37 | if (rightie->HasChild(bottomL)) |
michael@0 | 38 | fail("rightie had rightie's child!"); |
michael@0 | 39 | |
michael@0 | 40 | if (!SendCheck()) |
michael@0 | 41 | fail("couldn't kick off the child-side check"); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | bool |
michael@0 | 45 | TestMultiMgrsParent::RecvOK() |
michael@0 | 46 | { |
michael@0 | 47 | Close(); |
michael@0 | 48 | return true; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | //----------------------------------------------------------------------------- |
michael@0 | 52 | // child |
michael@0 | 53 | |
michael@0 | 54 | bool |
michael@0 | 55 | TestMultiMgrsLeftChild::RecvPTestMultiMgrsBottomConstructor( |
michael@0 | 56 | PTestMultiMgrsBottomChild* actor) |
michael@0 | 57 | { |
michael@0 | 58 | static_cast<TestMultiMgrsChild*>(Manager())->mBottomL = actor; |
michael@0 | 59 | return true; |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | bool |
michael@0 | 63 | TestMultiMgrsRightChild::RecvPTestMultiMgrsBottomConstructor( |
michael@0 | 64 | PTestMultiMgrsBottomChild* actor) |
michael@0 | 65 | { |
michael@0 | 66 | static_cast<TestMultiMgrsChild*>(Manager())->mBottomR = actor; |
michael@0 | 67 | return true; |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | bool |
michael@0 | 71 | TestMultiMgrsChild::RecvCheck() |
michael@0 | 72 | { |
michael@0 | 73 | if (1 != ManagedPTestMultiMgrsLeftChild().Length()) |
michael@0 | 74 | fail("where's leftie?"); |
michael@0 | 75 | if (1 != ManagedPTestMultiMgrsRightChild().Length()) |
michael@0 | 76 | fail("where's rightie?"); |
michael@0 | 77 | |
michael@0 | 78 | TestMultiMgrsLeftChild* leftie = |
michael@0 | 79 | static_cast<TestMultiMgrsLeftChild*>( |
michael@0 | 80 | ManagedPTestMultiMgrsLeftChild()[0]); |
michael@0 | 81 | TestMultiMgrsRightChild* rightie = |
michael@0 | 82 | static_cast<TestMultiMgrsRightChild*>( |
michael@0 | 83 | ManagedPTestMultiMgrsRightChild()[0]); |
michael@0 | 84 | |
michael@0 | 85 | if (!leftie->HasChild(mBottomL)) |
michael@0 | 86 | fail("leftie didn't have a child it was supposed to!"); |
michael@0 | 87 | if (leftie->HasChild(mBottomR)) |
michael@0 | 88 | fail("leftie had rightie's child!"); |
michael@0 | 89 | |
michael@0 | 90 | if (!rightie->HasChild(mBottomR)) |
michael@0 | 91 | fail("rightie didn't have a child it was supposed to!"); |
michael@0 | 92 | if (rightie->HasChild(mBottomL)) |
michael@0 | 93 | fail("rightie had leftie's child!"); |
michael@0 | 94 | |
michael@0 | 95 | if (!SendOK()) |
michael@0 | 96 | fail("couldn't send OK()"); |
michael@0 | 97 | |
michael@0 | 98 | return true; |
michael@0 | 99 | } |
michael@0 | 100 | |
michael@0 | 101 | |
michael@0 | 102 | } // namespace _ipdltest |
michael@0 | 103 | } // namespace mozilla |