ipc/ipdl/test/cxx/TestHangs.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:669ec74f45dd
1 #ifndef mozilla__ipdltest_TestHangs_h
2 #define mozilla__ipdltest_TestHangs_h 1
3
4 #include "mozilla/_ipdltest/IPDLUnitTests.h"
5
6 #include "mozilla/_ipdltest/PTestHangsParent.h"
7 #include "mozilla/_ipdltest/PTestHangsChild.h"
8
9 namespace mozilla {
10 namespace _ipdltest {
11
12
13 class TestHangsParent :
14 public PTestHangsParent
15 {
16 public:
17 TestHangsParent();
18 virtual ~TestHangsParent();
19
20 static bool RunTestInProcesses() { return true; }
21
22 // FIXME/bug 703320 Disabled because parent kills child proc, not
23 // clear how that should work in threads.
24 static bool RunTestInThreads() { return false; }
25
26 void Main();
27
28 protected:
29 virtual bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
30
31 virtual bool RecvNonce() {
32 return true;
33 }
34
35 virtual bool AnswerStackFrame() MOZ_OVERRIDE;
36
37 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
38 {
39 if (AbnormalShutdown != why)
40 fail("unexpected destruction!");
41 passed("ok");
42 QuitParent();
43 }
44
45 void CleanUp();
46
47 bool mDetectedHang;
48 };
49
50
51 class TestHangsChild :
52 public PTestHangsChild
53 {
54 public:
55 TestHangsChild();
56 virtual ~TestHangsChild();
57
58 protected:
59 virtual bool RecvStart() MOZ_OVERRIDE {
60 if (!SendNonce())
61 fail("sending Nonce");
62 return true;
63 }
64
65 virtual bool AnswerStackFrame() MOZ_OVERRIDE
66 {
67 if (CallStackFrame())
68 fail("should have failed");
69 return true;
70 }
71
72 virtual bool AnswerHang() MOZ_OVERRIDE;
73
74 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
75 {
76 if (AbnormalShutdown != why)
77 fail("unexpected destruction!");
78 QuitChild();
79 }
80 };
81
82
83 } // namespace _ipdltest
84 } // namespace mozilla
85
86
87 #endif // ifndef mozilla__ipdltest_TestHangs_h

mercurial