1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/ipdl/test/cxx/TestCrashCleanup.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +#ifndef mozilla__ipdltest_TestCrashCleanup_h 1.5 +#define mozilla__ipdltest_TestCrashCleanup_h 1 1.6 + 1.7 +#include "mozilla/_ipdltest/IPDLUnitTests.h" 1.8 + 1.9 +#include "mozilla/_ipdltest/PTestCrashCleanupParent.h" 1.10 +#include "mozilla/_ipdltest/PTestCrashCleanupChild.h" 1.11 + 1.12 +namespace mozilla { 1.13 +namespace _ipdltest { 1.14 + 1.15 + 1.16 +class TestCrashCleanupParent : 1.17 + public PTestCrashCleanupParent 1.18 +{ 1.19 +public: 1.20 + TestCrashCleanupParent(); 1.21 + virtual ~TestCrashCleanupParent(); 1.22 + 1.23 + static bool RunTestInProcesses() { return true; } 1.24 + static bool RunTestInThreads() { return false; } 1.25 + 1.26 + void Main(); 1.27 + 1.28 +protected: 1.29 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE 1.30 + { 1.31 + if (AbnormalShutdown != why) 1.32 + fail("unexpected destruction!"); 1.33 + mCleanedUp = true; 1.34 + } 1.35 + 1.36 + bool mCleanedUp; 1.37 +}; 1.38 + 1.39 + 1.40 +class TestCrashCleanupChild : 1.41 + public PTestCrashCleanupChild 1.42 +{ 1.43 +public: 1.44 + TestCrashCleanupChild(); 1.45 + virtual ~TestCrashCleanupChild(); 1.46 + 1.47 +protected: 1.48 + virtual bool AnswerDIEDIEDIE() MOZ_OVERRIDE; 1.49 + 1.50 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE 1.51 + { 1.52 + fail("should have 'crashed'!"); 1.53 + } 1.54 +}; 1.55 + 1.56 + 1.57 +} // namespace _ipdltest 1.58 +} // namespace mozilla 1.59 + 1.60 + 1.61 +#endif // ifndef mozilla__ipdltest_TestCrashCleanup_h