blob: 12ea8fdc117009e01d3cd582c88d68e7ae17fe0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
#include "TestFailedCtor.h"
#include "IPDLUnitTests.h" // fail etc.
namespace mozilla {
namespace _ipdltest {
//-----------------------------------------------------------------------------
// parent
void
TestFailedCtorParent::Main()
{
PTestFailedCtorSubParent* p = CallPTestFailedCtorSubConstructor();
if (p)
fail("expected ctor to fail");
Close();
}
PTestFailedCtorSubParent*
TestFailedCtorParent::AllocPTestFailedCtorSubParent()
{
return new TestFailedCtorSubParent();
}
bool
TestFailedCtorParent::DeallocPTestFailedCtorSubParent(PTestFailedCtorSubParent* actor)
{
delete actor;
return true;
}
PTestFailedCtorSubsubParent*
TestFailedCtorSubParent::AllocPTestFailedCtorSubsubParent()
{
TestFailedCtorSubsub* a = new TestFailedCtorSubsub();
if (!mOne) {
return mOne = a;
} else if (!mTwo) {
return mTwo = a;
} else if (!mThree) {
return mThree = a;
} else {
fail("unexpected Alloc()");
return nullptr;
}
}
bool
TestFailedCtorSubParent::DeallocPTestFailedCtorSubsubParent(PTestFailedCtorSubsubParent* actor)
{
static_cast<TestFailedCtorSubsub*>(actor)->mDealloced = true;
return true;
}
void
TestFailedCtorSubParent::ActorDestroy(ActorDestroyReason why)
{
if (mOne->mWhy != Deletion)
fail("Subsub one got wrong ActorDestroyReason");
if (mTwo->mWhy != AncestorDeletion)
fail("Subsub two got wrong ActorDestroyReason");
if (mThree->mWhy != AncestorDeletion)
fail("Subsub three got wrong ActorDestroyReason");
if (FailedConstructor != why)
fail("unexpected destruction!");
}
TestFailedCtorSubParent::~TestFailedCtorSubParent()
{
if (!(mOne->mDealloced && mTwo->mDealloced && mThree->mDealloced))
fail("Not all subsubs were Dealloc'd");
delete mOne;
delete mTwo;
delete mThree;
}
//-----------------------------------------------------------------------------
// child
PTestFailedCtorSubChild*
TestFailedCtorChild::AllocPTestFailedCtorSubChild()
{
return new TestFailedCtorSubChild();
}
bool
TestFailedCtorChild::AnswerPTestFailedCtorSubConstructor(PTestFailedCtorSubChild* actor)
{
PTestFailedCtorSubsubChild* c1 = actor->SendPTestFailedCtorSubsubConstructor();
PTestFailedCtorSubsubChild::Send__delete__(c1);
if (!actor->SendPTestFailedCtorSubsubConstructor() ||
!actor->SendPTestFailedCtorSubsubConstructor() ||
!actor->SendSync())
fail("setting up test");
// This causes our process to die
return false;
}
bool
TestFailedCtorChild::DeallocPTestFailedCtorSubChild(PTestFailedCtorSubChild* actor)
{
delete actor;
return true;
}
void
TestFailedCtorChild::ProcessingError(Result aCode, const char* aReason)
{
if (OtherPid() != base::GetCurrentProcId()) // thread-mode
_exit(0);
}
PTestFailedCtorSubsubChild*
TestFailedCtorSubChild::AllocPTestFailedCtorSubsubChild()
{
return new TestFailedCtorSubsub();
}
bool
TestFailedCtorSubChild::DeallocPTestFailedCtorSubsubChild(PTestFailedCtorSubsubChild* actor)
{
delete actor;
return true;
}
void
TestFailedCtorSubChild::ActorDestroy(ActorDestroyReason why)
{
}
} // namespace _ipdltest
} // namespace mozilla
|