|
1 #include "TestMultiMgrs.h" |
|
2 |
|
3 #include "IPDLUnitTests.h" // fail etc. |
|
4 |
|
5 namespace mozilla { |
|
6 namespace _ipdltest { |
|
7 |
|
8 //----------------------------------------------------------------------------- |
|
9 // parent |
|
10 |
|
11 void |
|
12 TestMultiMgrsParent::Main() |
|
13 { |
|
14 TestMultiMgrsLeftParent* leftie = new TestMultiMgrsLeftParent(); |
|
15 if (!SendPTestMultiMgrsLeftConstructor(leftie)) |
|
16 fail("error sending ctor"); |
|
17 |
|
18 TestMultiMgrsRightParent* rightie = new TestMultiMgrsRightParent(); |
|
19 if (!SendPTestMultiMgrsRightConstructor(rightie)) |
|
20 fail("error sending ctor"); |
|
21 |
|
22 TestMultiMgrsBottomParent* bottomL = new TestMultiMgrsBottomParent(); |
|
23 if (!leftie->SendPTestMultiMgrsBottomConstructor(bottomL)) |
|
24 fail("error sending ctor"); |
|
25 |
|
26 TestMultiMgrsBottomParent* bottomR = new TestMultiMgrsBottomParent(); |
|
27 if (!rightie->SendPTestMultiMgrsBottomConstructor(bottomR)) |
|
28 fail("error sending ctor"); |
|
29 |
|
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!"); |
|
34 |
|
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!"); |
|
39 |
|
40 if (!SendCheck()) |
|
41 fail("couldn't kick off the child-side check"); |
|
42 } |
|
43 |
|
44 bool |
|
45 TestMultiMgrsParent::RecvOK() |
|
46 { |
|
47 Close(); |
|
48 return true; |
|
49 } |
|
50 |
|
51 //----------------------------------------------------------------------------- |
|
52 // child |
|
53 |
|
54 bool |
|
55 TestMultiMgrsLeftChild::RecvPTestMultiMgrsBottomConstructor( |
|
56 PTestMultiMgrsBottomChild* actor) |
|
57 { |
|
58 static_cast<TestMultiMgrsChild*>(Manager())->mBottomL = actor; |
|
59 return true; |
|
60 } |
|
61 |
|
62 bool |
|
63 TestMultiMgrsRightChild::RecvPTestMultiMgrsBottomConstructor( |
|
64 PTestMultiMgrsBottomChild* actor) |
|
65 { |
|
66 static_cast<TestMultiMgrsChild*>(Manager())->mBottomR = actor; |
|
67 return true; |
|
68 } |
|
69 |
|
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?"); |
|
77 |
|
78 TestMultiMgrsLeftChild* leftie = |
|
79 static_cast<TestMultiMgrsLeftChild*>( |
|
80 ManagedPTestMultiMgrsLeftChild()[0]); |
|
81 TestMultiMgrsRightChild* rightie = |
|
82 static_cast<TestMultiMgrsRightChild*>( |
|
83 ManagedPTestMultiMgrsRightChild()[0]); |
|
84 |
|
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!"); |
|
89 |
|
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!"); |
|
94 |
|
95 if (!SendOK()) |
|
96 fail("couldn't send OK()"); |
|
97 |
|
98 return true; |
|
99 } |
|
100 |
|
101 |
|
102 } // namespace _ipdltest |
|
103 } // namespace mozilla |