|
1 #include "TestBadActor.h" |
|
2 #include "IPDLUnitTests.h" |
|
3 #include "mozilla/unused.h" |
|
4 |
|
5 namespace mozilla { |
|
6 namespace _ipdltest { |
|
7 |
|
8 void |
|
9 TestBadActorParent::Main() |
|
10 { |
|
11 // This test is designed to test a race condition where the child sends us |
|
12 // a message on an actor that we've already destroyed. The child process |
|
13 // should die, and the parent process should not abort. |
|
14 |
|
15 PTestBadActorSubParent* child = SendPTestBadActorSubConstructor(); |
|
16 if (!child) |
|
17 fail("Sending constructor"); |
|
18 |
|
19 unused << child->Call__delete__(child); |
|
20 } |
|
21 |
|
22 PTestBadActorSubParent* |
|
23 TestBadActorParent::AllocPTestBadActorSubParent() |
|
24 { |
|
25 return new TestBadActorSubParent(); |
|
26 } |
|
27 |
|
28 bool |
|
29 TestBadActorSubParent::RecvPing() |
|
30 { |
|
31 fail("Shouldn't have received ping."); |
|
32 return false; |
|
33 } |
|
34 |
|
35 PTestBadActorSubChild* |
|
36 TestBadActorChild::AllocPTestBadActorSubChild() |
|
37 { |
|
38 return new TestBadActorSubChild(); |
|
39 } |
|
40 |
|
41 bool |
|
42 TestBadActorChild::RecvPTestBadActorSubConstructor(PTestBadActorSubChild* actor) |
|
43 { |
|
44 if (!actor->SendPing()) { |
|
45 fail("Couldn't send ping to an actor which supposedly isn't dead yet."); |
|
46 } |
|
47 return true; |
|
48 } |
|
49 |
|
50 } // namespace _ipdltest |
|
51 } // namespace mozilla |