1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/ipdl/test/cxx/TestRacyUndefer.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 1.4 +#ifndef mozilla__ipdltest_TestRacyUndefer_h 1.5 +#define mozilla__ipdltest_TestRacyUndefer_h 1 1.6 + 1.7 +#include "mozilla/_ipdltest/IPDLUnitTests.h" 1.8 + 1.9 +#include "mozilla/_ipdltest/PTestRacyUndeferParent.h" 1.10 +#include "mozilla/_ipdltest/PTestRacyUndeferChild.h" 1.11 + 1.12 +namespace mozilla { 1.13 +namespace _ipdltest { 1.14 + 1.15 + 1.16 +class TestRacyUndeferParent : 1.17 + public PTestRacyUndeferParent 1.18 +{ 1.19 +public: 1.20 + TestRacyUndeferParent(); 1.21 + virtual ~TestRacyUndeferParent(); 1.22 + 1.23 + static bool RunTestInProcesses() { return true; } 1.24 + static bool RunTestInThreads() { return true; } 1.25 + 1.26 + void Main(); 1.27 + 1.28 +protected: 1.29 + virtual bool AnswerSpam() MOZ_OVERRIDE; 1.30 + 1.31 + virtual bool AnswerRaceWinTwice() MOZ_OVERRIDE; 1.32 + 1.33 + virtual bool RecvDone() MOZ_OVERRIDE; 1.34 + 1.35 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE 1.36 + { 1.37 + if (NormalShutdown != why) 1.38 + fail("unexpected destruction!"); 1.39 + passed("ok"); 1.40 + QuitParent(); 1.41 + } 1.42 +}; 1.43 + 1.44 + 1.45 +class TestRacyUndeferChild : 1.46 + public PTestRacyUndeferChild 1.47 +{ 1.48 +public: 1.49 + TestRacyUndeferChild(); 1.50 + virtual ~TestRacyUndeferChild(); 1.51 + 1.52 +protected: 1.53 + virtual bool RecvStart() MOZ_OVERRIDE; 1.54 + 1.55 + virtual bool RecvAwakenSpam() MOZ_OVERRIDE; 1.56 + virtual bool RecvAwakenRaceWinTwice() MOZ_OVERRIDE; 1.57 + 1.58 + virtual bool AnswerRace() MOZ_OVERRIDE; 1.59 + 1.60 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE 1.61 + { 1.62 + if (NormalShutdown != why) 1.63 + fail("unexpected destruction!"); 1.64 + QuitChild(); 1.65 + } 1.66 +}; 1.67 + 1.68 + 1.69 +} // namespace _ipdltest 1.70 +} // namespace mozilla 1.71 + 1.72 + 1.73 +#endif // ifndef mozilla__ipdltest_TestRacyUndefer_h