Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #ifndef mozilla__ipdltest_TestHangs_h
2 #define mozilla__ipdltest_TestHangs_h 1
4 #include "mozilla/_ipdltest/IPDLUnitTests.h"
6 #include "mozilla/_ipdltest/PTestHangsParent.h"
7 #include "mozilla/_ipdltest/PTestHangsChild.h"
9 namespace mozilla {
10 namespace _ipdltest {
13 class TestHangsParent :
14 public PTestHangsParent
15 {
16 public:
17 TestHangsParent();
18 virtual ~TestHangsParent();
20 static bool RunTestInProcesses() { return true; }
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; }
26 void Main();
28 protected:
29 virtual bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
31 virtual bool RecvNonce() {
32 return true;
33 }
35 virtual bool AnswerStackFrame() MOZ_OVERRIDE;
37 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
38 {
39 if (AbnormalShutdown != why)
40 fail("unexpected destruction!");
41 passed("ok");
42 QuitParent();
43 }
45 void CleanUp();
47 bool mDetectedHang;
48 };
51 class TestHangsChild :
52 public PTestHangsChild
53 {
54 public:
55 TestHangsChild();
56 virtual ~TestHangsChild();
58 protected:
59 virtual bool RecvStart() MOZ_OVERRIDE {
60 if (!SendNonce())
61 fail("sending Nonce");
62 return true;
63 }
65 virtual bool AnswerStackFrame() MOZ_OVERRIDE
66 {
67 if (CallStackFrame())
68 fail("should have failed");
69 return true;
70 }
72 virtual bool AnswerHang() MOZ_OVERRIDE;
74 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE
75 {
76 if (AbnormalShutdown != why)
77 fail("unexpected destruction!");
78 QuitChild();
79 }
80 };
83 } // namespace _ipdltest
84 } // namespace mozilla
87 #endif // ifndef mozilla__ipdltest_TestHangs_h