Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | #ifndef mozilla__ipdltest_TestJSON_h |
michael@0 | 2 | #define mozilla__ipdltest_TestJSON_h 1 |
michael@0 | 3 | |
michael@0 | 4 | #include "mozilla/_ipdltest/IPDLUnitTests.h" |
michael@0 | 5 | |
michael@0 | 6 | #include "mozilla/_ipdltest/PTestJSONParent.h" |
michael@0 | 7 | #include "mozilla/_ipdltest/PTestJSONChild.h" |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/_ipdltest/PTestHandleParent.h" |
michael@0 | 10 | #include "mozilla/_ipdltest/PTestHandleChild.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace _ipdltest { |
michael@0 | 14 | |
michael@0 | 15 | class TestHandleParent : |
michael@0 | 16 | public PTestHandleParent |
michael@0 | 17 | { |
michael@0 | 18 | public: |
michael@0 | 19 | TestHandleParent() { } |
michael@0 | 20 | virtual ~TestHandleParent() { } |
michael@0 | 21 | }; |
michael@0 | 22 | |
michael@0 | 23 | class TestJSONParent : |
michael@0 | 24 | public PTestJSONParent |
michael@0 | 25 | { |
michael@0 | 26 | public: |
michael@0 | 27 | TestJSONParent() { } |
michael@0 | 28 | virtual ~TestJSONParent() { } |
michael@0 | 29 | |
michael@0 | 30 | static bool RunTestInProcesses() { return true; } |
michael@0 | 31 | static bool RunTestInThreads() { return true; } |
michael@0 | 32 | |
michael@0 | 33 | void Main(); |
michael@0 | 34 | |
michael@0 | 35 | protected: |
michael@0 | 36 | virtual bool |
michael@0 | 37 | RecvTest(const JSONVariant& i, |
michael@0 | 38 | JSONVariant* o) MOZ_OVERRIDE; |
michael@0 | 39 | |
michael@0 | 40 | virtual PTestHandleParent* AllocPTestHandleParent() MOZ_OVERRIDE |
michael@0 | 41 | { |
michael@0 | 42 | return mKid = new TestHandleParent(); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | virtual bool DeallocPTestHandleParent(PTestHandleParent* actor) MOZ_OVERRIDE |
michael@0 | 46 | { |
michael@0 | 47 | delete actor; |
michael@0 | 48 | return true; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
michael@0 | 52 | { |
michael@0 | 53 | if (NormalShutdown != why) |
michael@0 | 54 | fail("unexpected destruction!"); |
michael@0 | 55 | passed("ok"); |
michael@0 | 56 | QuitParent(); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | PTestHandleParent* mKid; |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | class TestHandleChild : |
michael@0 | 64 | public PTestHandleChild |
michael@0 | 65 | { |
michael@0 | 66 | public: |
michael@0 | 67 | TestHandleChild() { } |
michael@0 | 68 | virtual ~TestHandleChild() { } |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | class TestJSONChild : |
michael@0 | 72 | public PTestJSONChild |
michael@0 | 73 | { |
michael@0 | 74 | public: |
michael@0 | 75 | TestJSONChild() { } |
michael@0 | 76 | virtual ~TestJSONChild() { } |
michael@0 | 77 | |
michael@0 | 78 | protected: |
michael@0 | 79 | virtual bool |
michael@0 | 80 | RecvStart() MOZ_OVERRIDE; |
michael@0 | 81 | |
michael@0 | 82 | virtual PTestHandleChild* AllocPTestHandleChild() MOZ_OVERRIDE |
michael@0 | 83 | { |
michael@0 | 84 | return mKid = new TestHandleChild(); |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | virtual bool DeallocPTestHandleChild(PTestHandleChild* actor) MOZ_OVERRIDE |
michael@0 | 88 | { |
michael@0 | 89 | delete actor; |
michael@0 | 90 | return true; |
michael@0 | 91 | } |
michael@0 | 92 | |
michael@0 | 93 | virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE |
michael@0 | 94 | { |
michael@0 | 95 | if (NormalShutdown != why) |
michael@0 | 96 | fail("unexpected destruction!"); |
michael@0 | 97 | QuitChild(); |
michael@0 | 98 | } |
michael@0 | 99 | |
michael@0 | 100 | PTestHandleChild* mKid; |
michael@0 | 101 | }; |
michael@0 | 102 | |
michael@0 | 103 | |
michael@0 | 104 | } // namespace _ipdltest |
michael@0 | 105 | } // namespace mozilla |
michael@0 | 106 | |
michael@0 | 107 | |
michael@0 | 108 | #endif // ifndef mozilla__ipdltest_TestJSON_h |