summaryrefslogtreecommitdiffstats
path: root/ipc/ipdl/test/cxx/TestDesc.cpp
blob: 696e5a4c5c5c890b90901ef57a8995efd17ff52a (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
#include "TestDesc.h"

#include "IPDLUnitTests.h"      // fail etc.

namespace mozilla {
namespace _ipdltest {

//-----------------------------------------------------------------------------
// parent
void
TestDescParent::Main()
{
    PTestDescSubParent* p = CallPTestDescSubConstructor(0);
    if (!p)
        fail("can't allocate Sub");

    PTestDescSubsubParent* pp = p->CallPTestDescSubsubConstructor();
    if (!pp)
        fail("can't allocate Subsub");

    if (!SendTest(pp))
        fail("can't send Subsub");
}

bool
TestDescParent::RecvOk(PTestDescSubsubParent* a)
{
    if (!a)
        fail("didn't receive Subsub");

    if (!PTestDescSubsubParent::Call__delete__(a))
        fail("deleting Subsub");

    Close();

    return true;
}


PTestDescSubParent*
TestDescParent::AllocPTestDescSubParent(PTestDescSubsubParent* dummy) {
    if (dummy)
        fail("actor supposed to be null");
    return new TestDescSubParent();
}
bool
TestDescParent::DeallocPTestDescSubParent(PTestDescSubParent* actor)
{
    delete actor;
    return true;
}

PTestDescSubsubParent*
TestDescSubParent::AllocPTestDescSubsubParent()
{
    return new TestDescSubsubParent();
}
bool
TestDescSubParent::DeallocPTestDescSubsubParent(PTestDescSubsubParent* actor)
{
    delete actor;
    return true;
}


//-----------------------------------------------------------------------------
// child

bool
TestDescChild::RecvTest(PTestDescSubsubChild* a)
{
    if (!a)
        fail("didn't receive Subsub");
    if (!SendOk(a))
        fail("couldn't send Ok()");
    return true;
}

PTestDescSubChild*
TestDescChild::AllocPTestDescSubChild(PTestDescSubsubChild* dummy) {
    if (dummy)
        fail("actor supposed to be null");
    return new TestDescSubChild();
}
bool
TestDescChild::DeallocPTestDescSubChild(PTestDescSubChild* actor)
{
    delete actor;
    return true;
}

PTestDescSubsubChild*
TestDescSubChild::AllocPTestDescSubsubChild()
{
    return new TestDescSubsubChild();
}
bool
TestDescSubChild::DeallocPTestDescSubsubChild(PTestDescSubsubChild* actor)
{
    delete actor;
    return true;
}

} // namespace _ipdltest
} // namespace mozilla