Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 #include "TestMultiMgrs.h"
3 #include "IPDLUnitTests.h" // fail etc.
5 namespace mozilla {
6 namespace _ipdltest {
8 //-----------------------------------------------------------------------------
9 // parent
11 void
12 TestMultiMgrsParent::Main()
13 {
14 TestMultiMgrsLeftParent* leftie = new TestMultiMgrsLeftParent();
15 if (!SendPTestMultiMgrsLeftConstructor(leftie))
16 fail("error sending ctor");
18 TestMultiMgrsRightParent* rightie = new TestMultiMgrsRightParent();
19 if (!SendPTestMultiMgrsRightConstructor(rightie))
20 fail("error sending ctor");
22 TestMultiMgrsBottomParent* bottomL = new TestMultiMgrsBottomParent();
23 if (!leftie->SendPTestMultiMgrsBottomConstructor(bottomL))
24 fail("error sending ctor");
26 TestMultiMgrsBottomParent* bottomR = new TestMultiMgrsBottomParent();
27 if (!rightie->SendPTestMultiMgrsBottomConstructor(bottomR))
28 fail("error sending ctor");
30 if (!leftie->HasChild(bottomL))
31 fail("leftie didn't have a child it was supposed to!");
32 if (leftie->HasChild(bottomR))
33 fail("leftie had rightie's child!");
35 if (!rightie->HasChild(bottomR))
36 fail("rightie didn't have a child it was supposed to!");
37 if (rightie->HasChild(bottomL))
38 fail("rightie had rightie's child!");
40 if (!SendCheck())
41 fail("couldn't kick off the child-side check");
42 }
44 bool
45 TestMultiMgrsParent::RecvOK()
46 {
47 Close();
48 return true;
49 }
51 //-----------------------------------------------------------------------------
52 // child
54 bool
55 TestMultiMgrsLeftChild::RecvPTestMultiMgrsBottomConstructor(
56 PTestMultiMgrsBottomChild* actor)
57 {
58 static_cast<TestMultiMgrsChild*>(Manager())->mBottomL = actor;
59 return true;
60 }
62 bool
63 TestMultiMgrsRightChild::RecvPTestMultiMgrsBottomConstructor(
64 PTestMultiMgrsBottomChild* actor)
65 {
66 static_cast<TestMultiMgrsChild*>(Manager())->mBottomR = actor;
67 return true;
68 }
70 bool
71 TestMultiMgrsChild::RecvCheck()
72 {
73 if (1 != ManagedPTestMultiMgrsLeftChild().Length())
74 fail("where's leftie?");
75 if (1 != ManagedPTestMultiMgrsRightChild().Length())
76 fail("where's rightie?");
78 TestMultiMgrsLeftChild* leftie =
79 static_cast<TestMultiMgrsLeftChild*>(
80 ManagedPTestMultiMgrsLeftChild()[0]);
81 TestMultiMgrsRightChild* rightie =
82 static_cast<TestMultiMgrsRightChild*>(
83 ManagedPTestMultiMgrsRightChild()[0]);
85 if (!leftie->HasChild(mBottomL))
86 fail("leftie didn't have a child it was supposed to!");
87 if (leftie->HasChild(mBottomR))
88 fail("leftie had rightie's child!");
90 if (!rightie->HasChild(mBottomR))
91 fail("rightie didn't have a child it was supposed to!");
92 if (rightie->HasChild(mBottomL))
93 fail("rightie had leftie's child!");
95 if (!SendOK())
96 fail("couldn't send OK()");
98 return true;
99 }
102 } // namespace _ipdltest
103 } // namespace mozilla