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