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.
michael@0 | 1 | #ifndef mozilla__ipdltest_TestRPC_h |
michael@0 | 2 | #define mozilla__ipdltest_TestRPC_h 1 |
michael@0 | 3 | |
michael@0 | 4 | #include "mozilla/_ipdltest/IPDLUnitTests.h" |
michael@0 | 5 | |
michael@0 | 6 | #include "mozilla/_ipdltest/PTestRPCParent.h" |
michael@0 | 7 | #include "mozilla/_ipdltest/PTestRPCChild.h" |
michael@0 | 8 | |
michael@0 | 9 | namespace mozilla { |
michael@0 | 10 | namespace _ipdltest { |
michael@0 | 11 | |
michael@0 | 12 | |
michael@0 | 13 | class TestRPCParent : |
michael@0 | 14 | public PTestRPCParent |
michael@0 | 15 | { |
michael@0 | 16 | public: |
michael@0 | 17 | TestRPCParent(); |
michael@0 | 18 | virtual ~TestRPCParent(); |
michael@0 | 19 | |
michael@0 | 20 | static bool RunTestInProcesses() { return true; } |
michael@0 | 21 | static bool RunTestInThreads() { return true; } |
michael@0 | 22 | |
michael@0 | 23 | void Main(); |
michael@0 | 24 | |
michael@0 | 25 | bool AnswerTest1_Start(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 26 | bool AnswerTest1_InnerEvent(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 27 | bool RecvTest2_Start() MOZ_OVERRIDE; |
michael@0 | 28 | bool AnswerTest2_OutOfOrder() MOZ_OVERRIDE; |
michael@0 | 29 | bool RecvTest3_Start(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 30 | bool AnswerTest3_InnerEvent(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 31 | bool AnswerTest4_Start(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 32 | bool AnswerTest4_Inner(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 33 | |
michael@0 | 34 | virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
michael@0 | 35 | { |
michael@0 | 36 | if (NormalShutdown != why) |
michael@0 | 37 | fail("unexpected destruction!"); |
michael@0 | 38 | if (!reentered_) |
michael@0 | 39 | fail("never processed raced RPC call!"); |
michael@0 | 40 | if (!resolved_first_cpow_) |
michael@0 | 41 | fail("never resolved first CPOW!"); |
michael@0 | 42 | passed("ok"); |
michael@0 | 43 | QuitParent(); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | private: |
michael@0 | 47 | bool reentered_; |
michael@0 | 48 | bool resolved_first_cpow_; |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | |
michael@0 | 52 | class TestRPCChild : |
michael@0 | 53 | public PTestRPCChild |
michael@0 | 54 | { |
michael@0 | 55 | public: |
michael@0 | 56 | TestRPCChild(); |
michael@0 | 57 | virtual ~TestRPCChild(); |
michael@0 | 58 | |
michael@0 | 59 | bool RecvStart() MOZ_OVERRIDE; |
michael@0 | 60 | bool AnswerTest1_InnerQuery(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 61 | bool AnswerTest1_NoReenter(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 62 | bool AnswerTest2_FirstUrgent() MOZ_OVERRIDE; |
michael@0 | 63 | bool AnswerTest2_SecondUrgent() MOZ_OVERRIDE; |
michael@0 | 64 | bool AnswerTest3_WakeUp(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 65 | bool AnswerTest4_WakeUp(uint32_t* aResult) MOZ_OVERRIDE; |
michael@0 | 66 | |
michael@0 | 67 | virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
michael@0 | 68 | { |
michael@0 | 69 | if (NormalShutdown != why) |
michael@0 | 70 | fail("unexpected destruction!"); |
michael@0 | 71 | QuitChild(); |
michael@0 | 72 | } |
michael@0 | 73 | }; |
michael@0 | 74 | |
michael@0 | 75 | |
michael@0 | 76 | } // namespace _ipdltest |
michael@0 | 77 | } // namespace mozilla |
michael@0 | 78 | |
michael@0 | 79 | |
michael@0 | 80 | #endif // ifndef mozilla__ipdltest_TestRPC_h |