1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef mozilla_TestUniquePtrIPC_h 7 #define mozilla_TestUniquePtrIPC_h 8 9 #include "mozilla/_ipdltest/IPDLUnitTests.h" 10 11 #include "mozilla/_ipdltest/PTestUniquePtrIPCParent.h" 12 #include "mozilla/_ipdltest/PTestUniquePtrIPCChild.h" 13 14 namespace mozilla { 15 namespace _ipdltest { 16 17 class TestUniquePtrIPCParent : public PTestUniquePtrIPCParent { 18 public: MOZ_COUNTED_DEFAULT_CTOR(TestUniquePtrIPCParent)19 MOZ_COUNTED_DEFAULT_CTOR(TestUniquePtrIPCParent) 20 MOZ_COUNTED_DTOR_OVERRIDE(TestUniquePtrIPCParent) 21 22 static bool RunTestInProcesses() { return true; } RunTestInThreads()23 static bool RunTestInThreads() { return false; } 24 25 void Main(); 26 ShouldContinueFromReplyTimeout()27 bool ShouldContinueFromReplyTimeout() override { return false; } 28 ActorDestroy(ActorDestroyReason why)29 virtual void ActorDestroy(ActorDestroyReason why) override { 30 if (NormalShutdown != why) { 31 fail("Abnormal shutdown of parent"); 32 } 33 passed("ok"); 34 QuitParent(); 35 } 36 }; 37 38 class TestUniquePtrIPCChild : public PTestUniquePtrIPCChild { 39 public: 40 MOZ_COUNTED_DEFAULT_CTOR(TestUniquePtrIPCChild) 41 MOZ_COUNTED_DTOR_OVERRIDE(TestUniquePtrIPCChild) 42 43 mozilla::ipc::IPCResult RecvTestMessage(UniquePtr<int>&& aA1, 44 UniquePtr<DummyStruct>&& aA2, 45 const DummyStruct& aA3, 46 UniquePtr<int>&& aA4); 47 48 mozilla::ipc::IPCResult RecvTestSendReference(UniquePtr<DummyStruct>&& aA); 49 ActorDestroy(ActorDestroyReason why)50 virtual void ActorDestroy(ActorDestroyReason why) override { 51 if (NormalShutdown != why) { 52 fail("Abnormal shutdown of child"); 53 } 54 QuitChild(); 55 } 56 }; 57 58 } // namespace _ipdltest 59 } // namespace mozilla 60 61 #endif // mozilla_TestUniquePtrIPC_h 62