summaryrefslogtreecommitdiffstats
path: root/ipc/ipdl/test
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/ipdl/test')
-rw-r--r--ipc/ipdl/test/README.txt7
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.cpp27
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.h28
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.cpp19
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.h34
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTestTypes.h43
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTestUtils.h28
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTests.h85
-rw-r--r--ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp345
-rw-r--r--ipc/ipdl/test/cxx/Makefile.in45
-rw-r--r--ipc/ipdl/test/cxx/PTestIndirectProtocolParam.ipdlh15
-rw-r--r--ipc/ipdl/test/cxx/PTestIndirectProtocolParamFirst.ipdl20
-rw-r--r--ipc/ipdl/test/cxx/PTestIndirectProtocolParamManage.ipdl18
-rw-r--r--ipc/ipdl/test/cxx/PTestIndirectProtocolParamSecond.ipdl14
-rw-r--r--ipc/ipdl/test/cxx/PTestPaintThread.ipdl15
-rw-r--r--ipc/ipdl/test/cxx/PTestPriority.ipdl24
-rw-r--r--ipc/ipdl/test/cxx/README.txt61
-rw-r--r--ipc/ipdl/test/cxx/app/TestIPDL.cpp24
-rw-r--r--ipc/ipdl/test/cxx/app/moz.build20
-rw-r--r--ipc/ipdl/test/cxx/genIPDLUnitTests.py193
-rw-r--r--ipc/ipdl/test/cxx/moz.build38
-rw-r--r--ipc/ipdl/test/gtest/PTestUniquePtrIPC.ipdl16
-rw-r--r--ipc/ipdl/test/gtest/TestHangs.cpp14
-rw-r--r--ipc/ipdl/test/gtest/TestUniquePtrIPC.cpp27
-rw-r--r--ipc/ipdl/test/ipdl/error/IntrAsyncManagee.ipdl9
-rw-r--r--ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl10
-rw-r--r--ipc/ipdl/test/ipdl/error/IntrSyncManagee.ipdl9
-rw-r--r--ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl10
-rw-r--r--ipc/ipdl/test/ipdl/error/PIntrNested.ipdl7
-rw-r--r--ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl7
-rw-r--r--ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl7
-rw-r--r--ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl2
-rw-r--r--ipc/ipdl/test/ipdl/error/compressCtor.ipdl2
-rw-r--r--ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl2
-rw-r--r--ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl10
-rw-r--r--ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl2
-rw-r--r--ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl10
-rw-r--r--ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl9
-rw-r--r--ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl7
-rw-r--r--ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl2
-rw-r--r--ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl2
-rw-r--r--ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl4
-rw-r--r--ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl14
-rw-r--r--ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl2
-rw-r--r--ipc/ipdl/test/ipdl/ok/Pplugin.ipdl6
-rw-r--r--ipc/ipdl/test/ipdl/ok/Pshmem.ipdl4
-rw-r--r--ipc/ipdl/test/ipdl/sync-messages.ini14
47 files changed, 53 insertions, 1258 deletions
diff --git a/ipc/ipdl/test/README.txt b/ipc/ipdl/test/README.txt
index ca6db8bb3c..3b8444d50f 100644
--- a/ipc/ipdl/test/README.txt
+++ b/ipc/ipdl/test/README.txt
@@ -7,7 +7,10 @@ specifications, and successfully rejecting erroneous specifications.
To run these tests yourself locally, the correct invocation is
make -C obj-dir/ipc/ipdl/test/ipdl check
+or
+ mach build ipc/ipdl/test/ipdl check
-The second category (cxx/) is C++ tests of IPDL semantics. These
-tests check that async/sync/rpc semantics are implemented correctly,
+
+The second category (gtest/) is C++ tests of IPDL semantics. These
+tests check that async/sync semantics are implemented correctly,
ctors/dtors behave as they should, etc.
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.cpp b/ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.cpp
deleted file mode 100644
index 7683808535..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ipc/IOThreadChild.h"
-
-#include "IPDLUnitTestProcessChild.h"
-#include "IPDLUnitTests.h"
-
-#include "nsRegion.h"
-
-using mozilla::ipc::IOThreadChild;
-
-namespace mozilla {
-namespace _ipdltest {
-
-bool IPDLUnitTestProcessChild::Init(int aArgc, char* aArgv[]) {
- // FIXME(nika): this is quite clearly broken and needs to be fixed.
- IPDLUnitTestChildInit(IOThreadChild::TakeChannel(), ParentPid(),
- IOThreadChild::message_loop());
-
- return true;
-}
-
-} // namespace _ipdltest
-} // namespace mozilla
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.h b/ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.h
deleted file mode 100644
index 94578e3520..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTestProcessChild.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla__ipdltest_IPDLUnitTestThreadChild_h
-#define mozilla__ipdltest_IPDLUnitTestThreadChild_h 1
-
-#include "mozilla/ipc/ProcessChild.h"
-
-namespace mozilla {
-namespace _ipdltest {
-
-class IPDLUnitTestProcessChild : public mozilla::ipc::ProcessChild {
- typedef mozilla::ipc::ProcessChild ProcessChild;
-
- public:
- using ProcessChild::ProcessChild;
-
- ~IPDLUnitTestProcessChild() {}
-
- virtual bool Init(int aArgc, char* aArgv[]) override;
-};
-
-} // namespace _ipdltest
-} // namespace mozilla
-
-#endif // ifndef mozilla__ipdltest_IPDLUnitTestThreadChild_h
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.cpp b/ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.cpp
deleted file mode 100644
index 660e5928d3..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "IPDLUnitTestSubprocess.h"
-
-using mozilla::ipc::GeckoChildProcessHost;
-
-namespace mozilla {
-namespace _ipdltest {
-
-IPDLUnitTestSubprocess::IPDLUnitTestSubprocess()
- : GeckoChildProcessHost(GeckoProcessType_IPDLUnitTest) {}
-
-IPDLUnitTestSubprocess::~IPDLUnitTestSubprocess() {}
-
-} // namespace _ipdltest
-} // namespace mozilla
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.h b/ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.h
deleted file mode 100644
index 384cf25ce9..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTestSubprocess.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla__ipdltest_IPDLUnitTestTestSubprocess_h
-#define mozilla__ipdltest_IPDLUnitTestTestSubprocess_h 1
-
-#include "mozilla/ipc/GeckoChildProcessHost.h"
-
-namespace mozilla {
-namespace _ipdltest {
-//-----------------------------------------------------------------------------
-
-class IPDLUnitTestSubprocess : public mozilla::ipc::GeckoChildProcessHost {
- public:
- IPDLUnitTestSubprocess();
-
- /**
- * Asynchronously launch the plugin process.
- */
- // Could override parent Launch, but don't need to here
- // bool Launch();
-
- private:
- ~IPDLUnitTestSubprocess();
-
- DISALLOW_EVIL_CONSTRUCTORS(IPDLUnitTestSubprocess);
-};
-
-} // namespace _ipdltest
-} // namespace mozilla
-
-#endif // ifndef mozilla__ipdltest_IPDLUnitTestTestSubprocess_h
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTestTypes.h b/ipc/ipdl/test/cxx/IPDLUnitTestTypes.h
deleted file mode 100644
index 02696f7df7..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTestTypes.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla__ipdltest_IPDLUnitTestTypes_h
-#define mozilla__ipdltest_IPDLUnitTestTypes_h
-
-#include "mozilla/ipc/ProtocolUtils.h" // ActorDestroyReason
-
-namespace mozilla {
-namespace _ipdltest {
-
-struct DirtyRect {
- int x;
- int y;
- int w;
- int h;
-};
-
-} // namespace _ipdltest
-} // namespace mozilla
-
-namespace IPC {
-template <>
-struct ParamTraits<mozilla::_ipdltest::DirtyRect> {
- typedef mozilla::_ipdltest::DirtyRect paramType;
- static void Write(MessageWriter* aWriter, const paramType& aParam) {
- WriteParam(aWriter, aParam.x);
- WriteParam(aWriter, aParam.y);
- WriteParam(aWriter, aParam.w);
- WriteParam(aWriter, aParam.h);
- }
- static bool Read(MessageReader* aReader, void** aIter, paramType* aResult) {
- return (ReadParam(aReader, aIter, &aResult->x) &&
- ReadParam(aReader, aIter, &aResult->y) &&
- ReadParam(aReader, aIter, &aResult->w) &&
- ReadParam(aReader, aIter, &aResult->h));
- }
-};
-} // namespace IPC
-
-#endif // ifndef mozilla__ipdltest_IPDLUnitTestTypes_h
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTestUtils.h b/ipc/ipdl/test/cxx/IPDLUnitTestUtils.h
deleted file mode 100644
index e454ae7b61..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTestUtils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-
-#ifndef mozilla__ipdltest_IPDLUnitTestUtils
-#define mozilla__ipdltest_IPDLUnitTestUtils 1
-
-#include "ipc/IPCMessageUtils.h"
-
-namespace mozilla {
-namespace _ipdltest {
-
-struct Bad {};
-
-} // namespace _ipdltest
-} // namespace mozilla
-
-namespace IPC {
-
-template <>
-struct ParamTraits<mozilla::_ipdltest::Bad> {
- typedef mozilla::_ipdltest::Bad paramType;
-
- // Defined in TestActorPunning.cpp.
- static void Write(MessageWriter* aWriter, const paramType& aParam);
- static bool Read(MessageReader* aReader, paramType* aResult);
-};
-
-} // namespace IPC
-
-#endif // mozilla__ipdltest_IPDLUnitTestUtils
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTests.h b/ipc/ipdl/test/cxx/IPDLUnitTests.h
deleted file mode 100644
index 28fc4ee372..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTests.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla__ipdltest_IPDLUnitTests_h
-#define mozilla__ipdltest_IPDLUnitTests_h 1
-
-#include "base/message_loop.h"
-#include "base/process.h"
-#include "chrome/common/ipc_channel.h"
-
-#include "nsCOMPtr.h"
-#include "nsDebug.h"
-#include "nsServiceManagerUtils.h" // do_GetService()
-#include "nsWidgetsCID.h" // NS_APPSHELL_CID
-#include "nsXULAppAPI.h"
-
-#define MOZ_IPDL_TESTFAIL_LABEL "TEST-UNEXPECTED-FAIL"
-#define MOZ_IPDL_TESTPASS_LABEL "TEST-PASS"
-#define MOZ_IPDL_TESTINFO_LABEL "TEST-INFO"
-
-namespace mozilla {
-namespace _ipdltest {
-
-//-----------------------------------------------------------------------------
-// both processes
-const char* IPDLUnitTestName();
-
-// NB: these are named like the similar functions in
-// xpcom/test/TestHarness.h. The names should nominally be kept in
-// sync.
-
-inline void fail(const char* fmt, ...) {
- va_list ap;
-
- fprintf(stderr, MOZ_IPDL_TESTFAIL_LABEL " | %s | ", IPDLUnitTestName());
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-
- fputc('\n', stderr);
-
- MOZ_CRASH("failed test");
-}
-
-inline void passed(const char* fmt, ...) {
- va_list ap;
-
- printf(MOZ_IPDL_TESTPASS_LABEL " | %s | ", IPDLUnitTestName());
-
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
-
- fputc('\n', stdout);
-}
-
-//-----------------------------------------------------------------------------
-// parent process only
-
-class IPDLUnitTestSubprocess;
-
-extern void* gParentActor;
-extern IPDLUnitTestSubprocess* gSubprocess;
-
-void IPDLUnitTestMain(void* aData);
-
-void QuitParent();
-
-//-----------------------------------------------------------------------------
-// child process only
-
-extern void* gChildActor;
-
-void IPDLUnitTestChildInit(IPC::Channel* transport, base::ProcessId parentPid,
- MessageLoop* worker);
-
-void QuitChild();
-
-} // namespace _ipdltest
-} // namespace mozilla
-
-#endif // ifndef mozilla__ipdltest_IPDLUnitTests_h
diff --git a/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp b/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp
deleted file mode 100644
index 113e7cd287..0000000000
--- a/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-//
-// Autogenerated from Python template. Hands off.
-//
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "IPDLUnitTests.h"
-
-#include "base/command_line.h"
-#include "base/string_util.h"
-#include "base/task.h"
-#include "base/thread.h"
-
-#include "nsRegion.h"
-
-#include "IPDLUnitTestSubprocess.h"
-
-// clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${INCLUDES}
-//-----------------------------------------------------------------------------
-// clang-format on
-
-using namespace std;
-
-using base::Thread;
-
-namespace mozilla {
-namespace _ipdltest {
-
-void* gParentActor;
-IPDLUnitTestSubprocess* gSubprocess;
-
-void* gChildActor;
-
-// Note: in threaded mode, this will be non-null (for both parent and
-// child, since they share one set of globals).
-Thread* gChildThread;
-MessageLoop* gParentMessageLoop;
-bool gParentDone;
-bool gChildDone;
-
-void DeleteChildActor();
-
-//-----------------------------------------------------------------------------
-// data/functions accessed by both parent and child processes
-
-char* gIPDLUnitTestName = nullptr;
-
-const char* IPDLUnitTestName() {
- if (!gIPDLUnitTestName) {
-#if defined(XP_WIN)
- vector<wstring> args = CommandLine::ForCurrentProcess()->GetLooseValues();
- gIPDLUnitTestName = ::strdup(WideToUTF8(args[0]).c_str());
-#else
- vector<string> argv = CommandLine::ForCurrentProcess()->argv();
- gIPDLUnitTestName = ::moz_xstrdup(argv[1].c_str());
-#endif
- }
- return gIPDLUnitTestName;
-}
-
-} // namespace _ipdltest
-} // namespace mozilla
-
-namespace {
-
-enum IPDLUnitTestType {
- NoneTest = 0,
-
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${ENUM_VALUES}
-
- LastTest = ${LAST_ENUM}
-//-----------------------------------------------------------------------------
-//clang-format on
-};
-
-IPDLUnitTestType IPDLUnitTestFromString(const char* const aString) {
- if (!aString) return static_cast<IPDLUnitTestType>(0);
-// clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${STRING_TO_ENUMS}
-//-----------------------------------------------------------------------------
- // clang-format on
- else return static_cast<IPDLUnitTestType>(0);
-}
-
-IPDLUnitTestType IPDLUnitTest() {
- return IPDLUnitTestFromString(::mozilla::_ipdltest::IPDLUnitTestName());
-}
-
-} // namespace
-
-//-----------------------------------------------------------------------------
-// parent process only
-
-namespace mozilla {
-namespace _ipdltest {
-
-void DeferredParentShutdown();
-
-void IPDLUnitTestThreadMain(char* testString);
-
-void IPDLUnitTestMain(void* aData) {
- char* testString = reinterpret_cast<char*>(aData);
-
- // Check if we are to run the test using threads instead:
- const char* prefix = "thread:";
- const int prefixLen = strlen(prefix);
- if (!strncmp(testString, prefix, prefixLen)) {
- IPDLUnitTestThreadMain(testString + prefixLen);
- return;
- }
-
- IPDLUnitTestType test = IPDLUnitTestFromString(testString);
- if (!test) {
- // use this instead of |fail()| because we don't know what the test is
- fprintf(stderr, MOZ_IPDL_TESTFAIL_LABEL "| %s | unknown unit test %s\n",
- "<--->", testString);
- MOZ_CRASH("can't continue");
- }
- gIPDLUnitTestName = testString;
-
- // Check whether this test is enabled for processes:
- switch (test) {
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${PARENT_ENABLED_CASES_PROC}
-//-----------------------------------------------------------------------------
- // clang-format on
-
- default:
- fail("not reached");
- return; // unreached
- }
-
- printf(MOZ_IPDL_TESTINFO_LABEL "| running test | %s\n", gIPDLUnitTestName);
-
- std::vector<std::string> testCaseArgs;
- testCaseArgs.push_back(testString);
-
- gSubprocess = new IPDLUnitTestSubprocess();
- if (!gSubprocess->SyncLaunch(testCaseArgs))
- fail("problem launching subprocess");
-
- IPC::Channel* transport = gSubprocess->GetChannel();
- if (!transport) fail("no transport");
-
- base::ProcessId child = base::GetProcId(gSubprocess->GetChildProcessHandle());
-
- switch (test) {
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${PARENT_MAIN_CASES_PROC}
-//-----------------------------------------------------------------------------
- // clang-format on
-
- default:
- fail("not reached");
- return; // unreached
- }
-}
-
-void IPDLUnitTestThreadMain(char* testString) {
- IPDLUnitTestType test = IPDLUnitTestFromString(testString);
- if (!test) {
- // use this instead of |fail()| because we don't know what the test is
- fprintf(stderr, MOZ_IPDL_TESTFAIL_LABEL "| %s | unknown unit test %s\n",
- "<--->", testString);
- MOZ_CRASH("can't continue");
- }
- gIPDLUnitTestName = testString;
-
- // Check whether this test is enabled for threads:
- switch (test) {
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${PARENT_ENABLED_CASES_THREAD}
-//-----------------------------------------------------------------------------
- // clang-format on
-
- default:
- fail("not reached");
- return; // unreached
- }
-
- printf(MOZ_IPDL_TESTINFO_LABEL "| running test | %s\n", gIPDLUnitTestName);
-
- std::vector<std::string> testCaseArgs;
- testCaseArgs.push_back(testString);
-
- gChildThread = new Thread("ParentThread");
- if (!gChildThread->Start()) fail("starting parent thread");
-
- gParentMessageLoop = MessageLoop::current();
- MessageLoop* childMessageLoop = gChildThread->message_loop();
-
- switch (test) {
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${PARENT_MAIN_CASES_THREAD}
-//-----------------------------------------------------------------------------
- // clang-format on
-
- default:
- fail("not reached");
- return; // unreached
- }
-}
-
-void DeleteParentActor() {
- if (!gParentActor) return;
-
- switch (IPDLUnitTest()) {
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${PARENT_DELETE_CASES}
-//-----------------------------------------------------------------------------
- // clang-format on
- default:
- ::mozilla::_ipdltest::fail("???");
- }
-}
-
-void QuitXPCOM() {
- DeleteParentActor();
-
- static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
- nsCOMPtr<nsIAppShell> appShell(do_GetService(kAppShellCID));
- appShell->Exit();
-}
-
-void DeleteSubprocess(MessageLoop* uiLoop) {
- // pong to QuitXPCOM
- gSubprocess->Destroy();
- gSubprocess = nullptr;
- uiLoop->PostTask(NewRunnableFunction("QuitXPCOM", QuitXPCOM));
-}
-
-void DeferredParentShutdown() {
- // ping to DeleteSubprocess
- XRE_GetIOMessageLoop()->PostTask(NewRunnableFunction(
- "DeleteSubprocess", DeleteSubprocess, MessageLoop::current()));
-}
-
-void TryThreadedShutdown() {
- // Stop if either:
- // - the child has not finished,
- // - the parent has not finished,
- // - or this code has already executed.
- // Remember: this TryThreadedShutdown() task is enqueued
- // by both parent and child (though always on parent's msg loop).
- if (!gChildDone || !gParentDone || !gChildThread) return;
-
- delete gChildThread;
- gChildThread = 0;
- DeferredParentShutdown();
-}
-
-void ChildCompleted() {
- // Executes on the parent message loop once child has completed.
- gChildDone = true;
- TryThreadedShutdown();
-}
-
-void QuitParent() {
- if (gChildThread) {
- gParentDone = true;
- MessageLoop::current()->PostTask(
- NewRunnableFunction("TryThreadedShutdown", TryThreadedShutdown));
- } else {
- // defer "real" shutdown to avoid *Channel::Close() racing with the
- // deletion of the subprocess
- MessageLoop::current()->PostTask(
- NewRunnableFunction("DeferredParentShutdown", DeferredParentShutdown));
- }
-}
-
-static void ChildDie() {
- DeleteChildActor();
- XRE_ShutdownChildProcess();
-}
-
-void QuitChild() {
- if (gChildThread) { // Threaded-mode test
- gParentMessageLoop->PostTask(
- NewRunnableFunction("ChildCompleted", ChildCompleted));
- } else { // Process-mode test
- MessageLoop::current()->PostTask(NewRunnableFunction("ChildDie", ChildDie));
- }
-}
-
-} // namespace _ipdltest
-} // namespace mozilla
-
-//-----------------------------------------------------------------------------
-// child process only
-
-namespace mozilla {
-namespace _ipdltest {
-
-void DeleteChildActor() {
- if (!gChildActor) return;
-
- switch (IPDLUnitTest()) {
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${CHILD_DELETE_CASES}
-//-----------------------------------------------------------------------------
- // clang-format on
- default:
- ::mozilla::_ipdltest::fail("???");
- }
-}
-
-void IPDLUnitTestChildInit(IPC::Channel* transport, base::ProcessId parentPid,
- MessageLoop* worker) {
- switch (IPDLUnitTest()) {
- // clang-format off
-//-----------------------------------------------------------------------------
-//===== TEMPLATED =====
-${CHILD_INIT_CASES}
-//-----------------------------------------------------------------------------
- // clang-format on
-
- default:
- fail("not reached");
- return; // unreached
- }
-}
-
-} // namespace _ipdltest
-} // namespace mozilla
diff --git a/ipc/ipdl/test/cxx/Makefile.in b/ipc/ipdl/test/cxx/Makefile.in
deleted file mode 100644
index b32533a648..0000000000
--- a/ipc/ipdl/test/cxx/Makefile.in
+++ /dev/null
@@ -1,45 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-IPDLTESTSRCS = $(filter Test%,$(CPPSRCS))
-IPDLTESTS = $(IPDLTESTSRCS:.cpp=)
-
-EXTRA_PROTOCOLS = \
- TestEndpointBridgeSub \
- $(NULL)
-
-IPDLTESTHDRS = $(addprefix $(srcdir)/,$(addsuffix .h,$(IPDLTESTS)))
-
-TESTER_TEMPLATE := $(srcdir)/IPDLUnitTests.template.cpp
-GENTESTER := $(srcdir)/genIPDLUnitTests.py
-
-include $(topsrcdir)/config/rules.mk
-
-
-IPDLUNITTEST_BIN = $(DEPTH)/dist/bin/ipdlunittest$(BIN_SUFFIX)
-
-IPDLUnitTests.cpp : Makefile.in moz.build $(GENTESTER) $(TESTER_TEMPLATE) $(IPDLTESTHDRS)
- $(PYTHON3) $(GENTESTER) $(TESTER_TEMPLATE) -t $(IPDLTESTS) -e $(EXTRA_PROTOCOLS) > $@
-
-check-proc::
- @$(EXIT_ON_ERROR) \
- for test in $(IPDLTESTS); do \
- $(RUN_TEST_PROGRAM) $(IPDLUNITTEST_BIN) $$test ; \
- done
-
-check-thread::
- @$(EXIT_ON_ERROR) \
- for test in $(IPDLTESTS); do \
- $(RUN_TEST_PROGRAM) $(IPDLUNITTEST_BIN) thread:$$test ; \
- done
-
-check:: check-proc check-thread
-
-check-valgrind::
- @$(EXIT_ON_ERROR) \
- for test in $(IPDLTESTS); do \
- $(RUN_TEST_PROGRAM) -g -d \
- valgrind -a '--leak-check=full --trace-children=yes -q' \
- $(IPDLUNITTEST_BIN) $$test ; \
- done
diff --git a/ipc/ipdl/test/cxx/PTestIndirectProtocolParam.ipdlh b/ipc/ipdl/test/cxx/PTestIndirectProtocolParam.ipdlh
deleted file mode 100644
index a81fcdee46..0000000000
--- a/ipc/ipdl/test/cxx/PTestIndirectProtocolParam.ipdlh
+++ /dev/null
@@ -1,15 +0,0 @@
-include protocol PTestIndirectProtocolParamSecond;
-
-namespace mozilla {
-namespace _ipdltest {
-
-struct IndirectParamStruct {
- PTestIndirectProtocolParamSecond actor;
-};
-
-union IndirectParamUnion {
- IndirectParamStruct;
-};
-
-}
-}
diff --git a/ipc/ipdl/test/cxx/PTestIndirectProtocolParamFirst.ipdl b/ipc/ipdl/test/cxx/PTestIndirectProtocolParamFirst.ipdl
deleted file mode 100644
index 5364d79ffb..0000000000
--- a/ipc/ipdl/test/cxx/PTestIndirectProtocolParamFirst.ipdl
+++ /dev/null
@@ -1,20 +0,0 @@
-include protocol PTestIndirectProtocolParamManage;
-// FIXME/bug 792908 protocol PTestIndirectProtocolParamSecond is
-// already included in PTestIndirectProtocolParam.ipdlh
-include protocol PTestIndirectProtocolParamSecond;
-include PTestIndirectProtocolParam;
-
-namespace mozilla {
-namespace _ipdltest {
-
-[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
-sync protocol PTestIndirectProtocolParamFirst {
- manager PTestIndirectProtocolParamManage;
-parent:
- sync Test(IndirectParamUnion actor);
-both:
- async __delete__();
-};
-
-}
-}
diff --git a/ipc/ipdl/test/cxx/PTestIndirectProtocolParamManage.ipdl b/ipc/ipdl/test/cxx/PTestIndirectProtocolParamManage.ipdl
deleted file mode 100644
index 8d3c6f81b1..0000000000
--- a/ipc/ipdl/test/cxx/PTestIndirectProtocolParamManage.ipdl
+++ /dev/null
@@ -1,18 +0,0 @@
-include protocol PTestIndirectProtocolParamFirst;
-include protocol PTestIndirectProtocolParamSecond;
-
-namespace mozilla {
-namespace _ipdltest {
-
-[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
-sync protocol PTestIndirectProtocolParamManage {
- manages PTestIndirectProtocolParamFirst;
- manages PTestIndirectProtocolParamSecond;
-both:
- async PTestIndirectProtocolParamFirst();
- async PTestIndirectProtocolParamSecond();
- async __delete__();
-};
-
-}
-}
diff --git a/ipc/ipdl/test/cxx/PTestIndirectProtocolParamSecond.ipdl b/ipc/ipdl/test/cxx/PTestIndirectProtocolParamSecond.ipdl
deleted file mode 100644
index 27545ca2cb..0000000000
--- a/ipc/ipdl/test/cxx/PTestIndirectProtocolParamSecond.ipdl
+++ /dev/null
@@ -1,14 +0,0 @@
-include protocol PTestIndirectProtocolParamManage;
-
-namespace mozilla {
-namespace _ipdltest {
-
-[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
-sync protocol PTestIndirectProtocolParamSecond {
- manager PTestIndirectProtocolParamManage;
-both:
- async __delete__();
-};
-
-}
-}
diff --git a/ipc/ipdl/test/cxx/PTestPaintThread.ipdl b/ipc/ipdl/test/cxx/PTestPaintThread.ipdl
deleted file mode 100644
index 00d46c9757..0000000000
--- a/ipc/ipdl/test/cxx/PTestPaintThread.ipdl
+++ /dev/null
@@ -1,15 +0,0 @@
-include "mozilla/_ipdltest/TestOffMainThreadPainting.h";
-
-namespace mozilla {
-namespace _ipdltest {
-
-// This is supposed to be analagous to PPaintingBridge.
-[ManualDealloc, ChildImpl="TestPaintThreadChild", ParentImpl="TestPaintThreadParent"]
-sync protocol PTestPaintThread
-{
-parent:
- sync FinishedPaint(uint64_t aTxnId);
-};
-
-} // namespace mozilla
-} // namespace _ipdltest
diff --git a/ipc/ipdl/test/cxx/PTestPriority.ipdl b/ipc/ipdl/test/cxx/PTestPriority.ipdl
deleted file mode 100644
index 8b85368072..0000000000
--- a/ipc/ipdl/test/cxx/PTestPriority.ipdl
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace mozilla {
-namespace _ipdltest {
-
-[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
-sync protocol PTestPriority {
-parent:
- [Priority=input] async PMsg1();
- [Priority=input] sync PMsg2();
- [Priority=vsync] async PMsg3();
- [Priority=vsync] sync PMsg4();
- [Priority=mediumhigh] async PMsg5();
- [Priority=mediumhigh] sync PMsg6();
- [Priority=control] async PMsg7();
- [Priority=control] sync PMsg8();
-
-child:
- [Priority=input] async CMsg1();
- [Priority=vsync] async CMsg2();
- [Priority=mediumhigh] async CMsg3();
- [Priority=control] async CMsg4();
-};
-
-} // namespace _ipdltest
-} // namespace mozilla
diff --git a/ipc/ipdl/test/cxx/README.txt b/ipc/ipdl/test/cxx/README.txt
deleted file mode 100644
index 0fe6c07320..0000000000
--- a/ipc/ipdl/test/cxx/README.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-To add a new IPDL C++ unit test, you need to create (at least) the
-following files (for a test "TestFoo"):
-
- - PTestFoo.ipdl, specifying the top-level protocol used for the test
-
- - TestFoo.h, declaring the top-level parent/child actors used for
- the test
-
- - TestFoo.cpp, defining the top-level actors
-
- - (make sure all are in the namespace mozilla::_ipdltest)
-
-Next
-
- - add PTestFoo.ipdl to ipdl.mk
-
- - append TestFoo to the variable IPDLTESTS in Makefile.in
-
-You must define three methods in your |TestFooParent| class:
-
- - static methods |bool RunTestInProcesses()| and
- |bool RunTestInThreads()|. These methods control whether
- to execute the test using actors in separate processes and
- threads respectively. Generally, both should return true.
-
- - an instance method |void Main()|. The test harness wil first
- initialize the processes or threads, create and open both actors,
- and then kick off the test using |Main()|. Make sure you define
- it.
-
-If your test passes its criteria, please call
-|MOZ_IPDL_TESTPASS("msg")| and "exit gracefully".
-
-If your tests fails, please call |MOZ_IPDL_TESTFAIL("msg")| and "exit
-ungracefully", preferably by abort()ing.
-
-
-If all goes well, running
-
- make -C $OBJDIR/ipc/ipdl/test/cxx
-
-will update the file IPDLUnitTests.cpp (the test launcher), and your
-new code will be built automatically.
-
-
-You can launch your new test by invoking one of
-
- make -C $OBJDIR/ipc/ipdl/test/cxx check-proc (test process-based tests)
- make -C $OBJDIR/ipc/ipdl/test/cxx check-threads (test thread-based tests)
- make -C $OBJDIR/ipc/ipdl/test/cxx check (tests both)
-
-If you want to launch only your test, run
-
- cd $OBJDIR/dist/bin
- ./run-mozilla.sh ./ipdlunittest TestFoo (test in two processes, if appl.)
- ./run-mozilla.sh ./ipdlunittest thread:TestFoo (test in two threads, if appl.)
-
-
-For a bare-bones example of adding a test, take a look at
-PTestSanity.ipdl, TestSanity.h, TestSanity.cpp, and how "TestSanity"
-is included in ipdl.mk and Makefile.in.
diff --git a/ipc/ipdl/test/cxx/app/TestIPDL.cpp b/ipc/ipdl/test/cxx/app/TestIPDL.cpp
deleted file mode 100644
index 3891aead62..0000000000
--- a/ipc/ipdl/test/cxx/app/TestIPDL.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#define MOZ_IPDL_TESTS
-#include "mozilla/Bootstrap.h"
-
-#if defined(XP_WIN)
-# include <windows.h>
-# include "nsWindowsWMain.cpp"
-#endif
-
-using namespace mozilla;
-
-int main(int argc, char** argv) {
- // the first argument specifies which IPDL test case/suite to load
- if (argc < 2) return 1;
-
- Bootstrap::UniquePtr bootstrap = GetBootstrap();
- if (!bootstrap) {
- return 2;
- }
- return bootstrap->XRE_RunIPDLTest(argc, argv);
-}
diff --git a/ipc/ipdl/test/cxx/app/moz.build b/ipc/ipdl/test/cxx/app/moz.build
deleted file mode 100644
index 909360062a..0000000000
--- a/ipc/ipdl/test/cxx/app/moz.build
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-GeckoProgram("ipdlunittest", linkage="dependent")
-
-SOURCES += [
- "TestIPDL.cpp",
-]
-include("/ipc/chromium/chromium-config.mozbuild")
-
-LOCAL_INCLUDES += [
- "/toolkit/xre",
- "/xpcom/base",
-]
-
-if CONFIG["CC_TYPE"] == "clang-cl":
- WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"]
diff --git a/ipc/ipdl/test/cxx/genIPDLUnitTests.py b/ipc/ipdl/test/cxx/genIPDLUnitTests.py
deleted file mode 100644
index 160b90a031..0000000000
--- a/ipc/ipdl/test/cxx/genIPDLUnitTests.py
+++ /dev/null
@@ -1,193 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import string
-import sys
-
-
-def usage():
- print(
- """
-%s template_file -t unit_tests... -e extra_protocols...
-
- TEMPLATE_FILE is used to generate to generate the unit-tester .cpp
- UNIT_TESTS are the top-level protocols defining unit tests
- EXTRA_PROTOCOLS are top-level protocols for subprocesses that can be
- spawned in tests but are not unit tests in and of
- themselves
-"""
- % (sys.argv[0]),
- file=sys.stderr,
- )
- sys.exit(1)
-
-
-def main(argv):
- template = argv[1]
-
- if argv[2] != "-t":
- usage()
- i = 3
- unittests = []
- while argv[i] != "-e":
- unittests.append(argv[i])
- i += 1
-
- extras = argv[(i + 1) :]
-
- includes = "\n".join(['#include "%s.h"' % (t) for t in unittests])
-
- enum_values = "\n".join([" %s," % (t) for t in unittests + extras])
- last_enum = unittests[-1]
-
- string_to_enums = "\n".join(
- [
- """ else if (!strcmp(aString, "%s"))
- return %s;"""
- % (t, t)
- for t in unittests + extras
- ]
- )
-
- enum_to_strings = "\n".join(
- [
- """ case %s:
- return "%s";"""
- % (t, t)
- for t in unittests + extras
- ]
- )
-
- parent_delete_cases = "\n".join(
- [
- """ case %s: {
- delete reinterpret_cast<%sParent*>(gParentActor);
- return;
- }
-"""
- % (t, t)
- for t in unittests
- ]
- )
-
- parent_enabled_cases_proc = "\n".join(
- [
- """ case %s: {
- if (!%sParent::RunTestInProcesses()) {
- passed("N/A to proc");
- DeferredParentShutdown();
- return;
- }
- break;
- }
-"""
- % (t, t)
- for t in unittests
- ]
- )
-
- parent_main_cases_proc = "\n".join(
- [
- """ case %s: {
- %sParent** parent =
- reinterpret_cast<%sParent**>(&gParentActor);
- *parent = new %sParent();
- (*parent)->Open(transport, child);
- return (*parent)->Main();
- }
-"""
- % (t, t, t, t)
- for t in unittests
- ]
- )
-
- parent_enabled_cases_thread = "\n".join(
- [
- """ case %s: {
- if (!%sParent::RunTestInThreads()) {
- passed("N/A to threads");
- DeferredParentShutdown();
- return;
- }
- break;
- }
-"""
- % (t, t)
- for t in unittests
- ]
- )
-
- parent_main_cases_thread = "\n".join(
- [
- """ case %s: {
- %sParent** parent =
- reinterpret_cast<%sParent**>(&gParentActor);
- *parent = new %sParent();
-
- %sChild** child =
- reinterpret_cast<%sChild**>(&gChildActor);
- *child = new %sChild();
-
- ::mozilla::ipc::MessageChannel *childChannel = (*child)->GetIPCChannel();
- ::mozilla::ipc::Side parentSide =
- ::mozilla::ipc::ParentSide;
-
- (*parent)->Open(childChannel, childMessageLoop, parentSide);
- return (*parent)->Main();
- }
-"""
- % (t, t, t, t, t, t, t)
- for t in unittests
- ]
- )
-
- child_delete_cases = "\n".join(
- [
- """ case %s: {
- delete reinterpret_cast<%sChild*>(gChildActor);
- return;
- }
-"""
- % (t, t)
- for t in unittests + extras
- ]
- )
-
- child_init_cases = "\n".join(
- [
- """ case %s: {
- %sChild** child =
- reinterpret_cast<%sChild**>(&gChildActor);
- *child = new %sChild();
- (*child)->Open(transport, parentPid, worker);
- return;
- }
-"""
- % (t, t, t, t)
- for t in unittests + extras
- ]
- )
-
- templatefile = open(template, "r", encoding="utf-8")
- sys.stdout.write(
- string.Template(templatefile.read()).substitute(
- INCLUDES=includes,
- ENUM_VALUES=enum_values,
- LAST_ENUM=last_enum,
- STRING_TO_ENUMS=string_to_enums,
- ENUM_TO_STRINGS=enum_to_strings,
- PARENT_DELETE_CASES=parent_delete_cases,
- PARENT_ENABLED_CASES_PROC=parent_enabled_cases_proc,
- PARENT_MAIN_CASES_PROC=parent_main_cases_proc,
- PARENT_ENABLED_CASES_THREAD=parent_enabled_cases_thread,
- PARENT_MAIN_CASES_THREAD=parent_main_cases_thread,
- CHILD_DELETE_CASES=child_delete_cases,
- CHILD_INIT_CASES=child_init_cases,
- )
- )
- templatefile.close()
-
-
-if __name__ == "__main__":
- main(sys.argv)
diff --git a/ipc/ipdl/test/cxx/moz.build b/ipc/ipdl/test/cxx/moz.build
deleted file mode 100644
index 196dc09add..0000000000
--- a/ipc/ipdl/test/cxx/moz.build
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ["app"]
-
-EXPORTS.mozilla._ipdltest += [
- "IPDLUnitTestProcessChild.h",
- "IPDLUnitTests.h",
- "IPDLUnitTestTypes.h",
- "IPDLUnitTestUtils.h",
- "TestOffMainThreadPainting.h",
-]
-
-SOURCES += [
- "TestOffMainThreadPainting.cpp",
-]
-
-SOURCES += [
- "!IPDLUnitTests.cpp",
- "IPDLUnitTestProcessChild.cpp",
- "IPDLUnitTestSubprocess.cpp",
-]
-
-IPDL_SOURCES += [
- "PTestIndirectProtocolParam.ipdlh",
- "PTestIndirectProtocolParamFirst.ipdl",
- "PTestIndirectProtocolParamManage.ipdl",
- "PTestIndirectProtocolParamSecond.ipdl",
- "PTestPaintThread.ipdl",
- "PTestPriority.ipdl",
-]
-
-include("/ipc/chromium/chromium-config.mozbuild")
-
-FINAL_LIBRARY = "xul"
diff --git a/ipc/ipdl/test/gtest/PTestUniquePtrIPC.ipdl b/ipc/ipdl/test/gtest/PTestUniquePtrIPC.ipdl
index b55d8f19d1..2ef3d9cb59 100644
--- a/ipc/ipdl/test/gtest/PTestUniquePtrIPC.ipdl
+++ b/ipc/ipdl/test/gtest/PTestUniquePtrIPC.ipdl
@@ -1,15 +1,25 @@
+using std::string from "string";
+
+// std::string is an arbitrary simple type declared inside a namespace,
+// to test that that will work when used in a UniquePtr inside a union.
+
namespace mozilla {
namespace _ipdltest {
struct DummyStruct {
- int x;
+ string x;
+};
+
+union DummyUnion {
+ UniquePtr<string>;
+ int;
};
[ChildProc=any, ChildImpl=virtual, ParentImpl=virtual]
protocol PTestUniquePtrIPC {
child:
- async TestMessage(UniquePtr<int> a1, UniquePtr<DummyStruct> a2,
- DummyStruct a3, UniquePtr<int> a4);
+ async TestMessage(UniquePtr<string> a1, UniquePtr<DummyStruct> a2,
+ DummyStruct a3, UniquePtr<string> a4, DummyUnion a5);
async TestSendReference(UniquePtr<DummyStruct> a);
};
diff --git a/ipc/ipdl/test/gtest/TestHangs.cpp b/ipc/ipdl/test/gtest/TestHangs.cpp
index ddc4a0c7d0..56f28c8afa 100644
--- a/ipc/ipdl/test/gtest/TestHangs.cpp
+++ b/ipc/ipdl/test/gtest/TestHangs.cpp
@@ -25,8 +25,7 @@ enum class HangMode : uint32_t {
/// The synchronous call should time out.
Hang,
/// The synchronous call should time out but the response should still be
- /// received
- /// (racing with the reply timeout logic).
+ /// received (racing with the reply timeout logic).
HangButReceive,
/// The synchronous call should time out but the response should still be
/// received because the child indicates that processing should continue after
@@ -50,8 +49,10 @@ class TestHangsChild : public PTestHangsChild {
this->hangMode = (HangMode)hangMode;
auto result = SendHang(hangMode, timeout->CloneHandle());
+ // Only the `Hang` mode should actually fail.
if (this->hangMode == HangMode::Hang) {
- // Only the `Hang` mode should actually fail.
+ // See description in parent.
+ timeout->Signal();
EXPECT_FALSE(result);
} else {
EXPECT_TRUE(result);
@@ -102,6 +103,13 @@ class TestHangsParent : public PTestHangsParent {
// Wait to ensure the child process has called
// ShouldContinueFromReplyTimeout().
timeout->Wait();
+
+ if (hangMode == (uint32_t)HangMode::Hang) {
+ // Wait to ensure the child process has returned from `SendHang()`,
+ // otherwise the reply message can race with the processing after
+ // ShouldContinueFromReplyTimeout().
+ timeout->Wait();
+ }
}
return IPC_OK();
}
diff --git a/ipc/ipdl/test/gtest/TestUniquePtrIPC.cpp b/ipc/ipdl/test/gtest/TestUniquePtrIPC.cpp
index 52ca322f8e..b3c68b99b4 100644
--- a/ipc/ipdl/test/gtest/TestUniquePtrIPC.cpp
+++ b/ipc/ipdl/test/gtest/TestUniquePtrIPC.cpp
@@ -26,18 +26,20 @@ class TestUniquePtrIPCParent : public PTestUniquePtrIPCParent {
class TestUniquePtrIPCChild : public PTestUniquePtrIPCChild {
NS_INLINE_DECL_REFCOUNTING(TestUniquePtrIPCChild, override)
private:
- IPCResult RecvTestMessage(const UniquePtr<int>& aA1,
+ IPCResult RecvTestMessage(const UniquePtr<std::string>& aA1,
const UniquePtr<DummyStruct>& aA2,
const DummyStruct& aA3,
- const UniquePtr<int>& aA4) final override {
+ const UniquePtr<std::string>& aA4,
+ const DummyUnion& aA5) final override {
EXPECT_TRUE(aA1) << "TestMessage received NULL aA1";
EXPECT_TRUE(aA2) << "TestMessage received NULL aA2";
EXPECT_FALSE(aA4)
<< "TestMessage received non-NULL when expecting NULL aA4";
- EXPECT_EQ(*aA1, 1);
- EXPECT_EQ(aA2->x(), 2);
- EXPECT_EQ(aA3.x(), 3);
+ EXPECT_EQ(*aA1, std::string("unique"));
+ EXPECT_EQ(aA2->x(), std::string("uniqueStruct"));
+ EXPECT_EQ(aA3.x(), std::string("struct"));
+ EXPECT_EQ(*aA5.get_string(), std::string("union"));
return IPC_OK();
}
@@ -45,7 +47,7 @@ class TestUniquePtrIPCChild : public PTestUniquePtrIPCChild {
IPCResult RecvTestSendReference(
const UniquePtr<DummyStruct>& aA) final override {
EXPECT_TRUE(aA) << "TestSendReference received NULL item in child";
- EXPECT_EQ(aA->x(), 1);
+ EXPECT_EQ(aA->x(), std::string("reference"));
Close();
return IPC_OK();
@@ -55,12 +57,13 @@ class TestUniquePtrIPCChild : public PTestUniquePtrIPCChild {
};
IPDL_TEST(TestUniquePtrIPC) {
- UniquePtr<int> a1 = MakeUnique<int>(1);
- UniquePtr<DummyStruct> a2 = MakeUnique<DummyStruct>(2);
- DummyStruct a3(3);
- UniquePtr<int> a4;
+ UniquePtr<std::string> a1 = MakeUnique<std::string>("unique");
+ UniquePtr<DummyStruct> a2 = MakeUnique<DummyStruct>("uniqueStruct");
+ DummyStruct a3("struct");
+ UniquePtr<std::string> a4;
+ DummyUnion a5(MakeUnique<std::string>("union"));
- EXPECT_TRUE(mActor->SendTestMessage(a1, a2, a3, a4));
+ EXPECT_TRUE(mActor->SendTestMessage(a1, a2, a3, a4, a5));
EXPECT_TRUE(a1)
<< "IPC arguments are passed by const reference and shouldn't be moved";
@@ -70,7 +73,7 @@ IPDL_TEST(TestUniquePtrIPC) {
EXPECT_FALSE(a4) << "somehow turned null ptr into non-null by sending it";
// Pass UniquePtr by reference
- UniquePtr<DummyStruct> b = MakeUnique<DummyStruct>(1);
+ UniquePtr<DummyStruct> b = MakeUnique<DummyStruct>("reference");
EXPECT_TRUE(mActor->SendTestSendReference(b));
EXPECT_TRUE(b)
diff --git a/ipc/ipdl/test/ipdl/error/IntrAsyncManagee.ipdl b/ipc/ipdl/test/ipdl/error/IntrAsyncManagee.ipdl
deleted file mode 100644
index 527c007ec4..0000000000
--- a/ipc/ipdl/test/ipdl/error/IntrAsyncManagee.ipdl
+++ /dev/null
@@ -1,9 +0,0 @@
-//error: protocol `IntrAsyncManagee' requires more powerful send semantics than its manager `IntrAsyncManager' provides
-
-include protocol IntrAsyncManager;
-
-intr protocol IntrAsyncManagee {
- manager IntrAsyncManager;
-child:
- async __delete__();
-};
diff --git a/ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl b/ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl
deleted file mode 100644
index dc5768df28..0000000000
--- a/ipc/ipdl/test/ipdl/error/IntrAsyncManager.ipdl
+++ /dev/null
@@ -1,10 +0,0 @@
-//error: protocol `IntrAsyncManagee' requires more powerful send semantics than its manager `IntrAsyncManager' provides
-
-include protocol IntrAsyncManagee;
-
-[ChildProc=any]
-async protocol IntrAsyncManager {
- manages IntrAsyncManagee;
-parent:
- async IntrAsyncManagee();
-};
diff --git a/ipc/ipdl/test/ipdl/error/IntrSyncManagee.ipdl b/ipc/ipdl/test/ipdl/error/IntrSyncManagee.ipdl
deleted file mode 100644
index d0b1462e86..0000000000
--- a/ipc/ipdl/test/ipdl/error/IntrSyncManagee.ipdl
+++ /dev/null
@@ -1,9 +0,0 @@
-//error: protocol `IntrSyncManagee' requires more powerful send semantics than its manager `IntrSyncManager' provides
-
-include protocol IntrSyncManager;
-
-intr protocol IntrSyncManagee {
- manager IntrSyncManager;
-child:
- async __delete__();
-};
diff --git a/ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl b/ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl
deleted file mode 100644
index f8e762093c..0000000000
--- a/ipc/ipdl/test/ipdl/error/IntrSyncManager.ipdl
+++ /dev/null
@@ -1,10 +0,0 @@
-//error: protocol `IntrSyncManagee' requires more powerful send semantics than its manager `IntrSyncManager' provides
-
-include protocol IntrSyncManagee;
-
-[ChildProc=any]
-sync protocol IntrSyncManager {
- manages IntrSyncManagee;
-parent:
- async IntrSyncManagee();
-};
diff --git a/ipc/ipdl/test/ipdl/error/PIntrNested.ipdl b/ipc/ipdl/test/ipdl/error/PIntrNested.ipdl
deleted file mode 100644
index c487bcd49d..0000000000
--- a/ipc/ipdl/test/ipdl/error/PIntrNested.ipdl
+++ /dev/null
@@ -1,7 +0,0 @@
-//error: intr message `Msg' cannot specify [Nested]
-
-[ChildProc=any]
-intr protocol PIntrNested {
-child:
- [Nested=inside_sync, LegacyIntr] intr Msg();
-};
diff --git a/ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl b/ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl
deleted file mode 100644
index dd95a7c002..0000000000
--- a/ipc/ipdl/test/ipdl/error/PIntrNestedProtocol.ipdl
+++ /dev/null
@@ -1,7 +0,0 @@
-//error: intr protocol `PIntrNestedProtocol' cannot specify [NestedUpTo]
-
-[NestedUpTo=inside_sync, ChildProc=any]
-intr protocol PIntrNestedProtocol {
-child:
- [LegacyIntr] intr Msg();
-};
diff --git a/ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl b/ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl
deleted file mode 100644
index c8bf75e9a3..0000000000
--- a/ipc/ipdl/test/ipdl/error/PIntrPriority.ipdl
+++ /dev/null
@@ -1,7 +0,0 @@
-//error: intr message `Msg' cannot specify [Priority]
-
-[ChildProc=any]
-intr protocol PIntrPriority {
-child:
- [Priority=vsync, LegacyIntr] intr Msg();
-};
diff --git a/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl b/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl
index b196050c48..8a80689ec0 100644
--- a/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl
+++ b/ipc/ipdl/test/ipdl/error/PNoTaintWithoutTainted.ipdl
@@ -1,7 +1,7 @@
//error: argument typename `int' of message `foo' has a NoTaint attribute, but the message lacks the Tainted attribute
[ChildProc=any]
-intr protocol PNoTaintWithoutTainted {
+sync protocol PNoTaintWithoutTainted {
child:
async foo([NoTaint=passback] int id);
};
diff --git a/ipc/ipdl/test/ipdl/error/compressCtor.ipdl b/ipc/ipdl/test/ipdl/error/compressCtor.ipdl
index 93c300333d..a5e0e4062b 100644
--- a/ipc/ipdl/test/ipdl/error/compressCtor.ipdl
+++ b/ipc/ipdl/test/ipdl/error/compressCtor.ipdl
@@ -4,7 +4,7 @@
include protocol compressCtorManagee;
[ChildProc=any]
-intr protocol compressCtor {
+sync protocol compressCtor {
manages compressCtorManagee;
parent:
diff --git a/ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl b/ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl
index 52ec2cc1cd..cf867ce54b 100644
--- a/ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl
+++ b/ipc/ipdl/test/ipdl/error/compressCtorManagee.ipdl
@@ -3,7 +3,7 @@
include protocol compressCtor;
-intr protocol compressCtorManagee {
+sync protocol compressCtorManagee {
manager compressCtor;
child:
diff --git a/ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl b/ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl
deleted file mode 100644
index e56cfc5d8c..0000000000
--- a/ipc/ipdl/test/ipdl/error/intrMessageCompress.ipdl
+++ /dev/null
@@ -1,10 +0,0 @@
-//error: message `foo' in protocol `intrMessageCompress' requests compression but is not async
-//error: message `bar' in protocol `intrMessageCompress' requests compression but is not async
-
-[ChildProc=any]
-intr protocol intrMessageCompress {
-parent:
- [Compress, LegacyIntr] intr foo();
-child:
- [Compress, LegacyIntr] intr bar();
-};
diff --git a/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl b/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl
index 8ce7c0be47..8cc0fdb72d 100644
--- a/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl
+++ b/ipc/ipdl/test/ipdl/error/syncParentToChild.ipdl
@@ -1,7 +1,7 @@
//error: sync parent-to-child messages are verboten (here, message `Msg' in protocol `syncParentToChild')
[ChildProc=any]
-intr protocol syncParentToChild {
+sync protocol syncParentToChild {
// can't declare sync parent-to-child messages
child: sync Msg();
diff --git a/ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl b/ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl
deleted file mode 100644
index 7dad5e68ef..0000000000
--- a/ipc/ipdl/test/ipdl/error/tooWeakIntrAsync.ipdl
+++ /dev/null
@@ -1,10 +0,0 @@
-//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakIntrAsync' provides
-
-[ChildProc=any]
-protocol tooWeakIntrAsync {
-
- // it's an error to declare an async protocol with an intr message
-
-parent: [LegacyIntr] intr Msg();
-
-};
diff --git a/ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl b/ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl
deleted file mode 100644
index a56e884e73..0000000000
--- a/ipc/ipdl/test/ipdl/error/tooWeakIntrSync.ipdl
+++ /dev/null
@@ -1,9 +0,0 @@
-//error: message `Msg' requires more powerful send semantics than its protocol `tooWeakIntrSync' provides
-
-[ChildProc=any]
-sync protocol tooWeakIntrSync {
-
- // it's an error to declare a sync protocol with an interrupt message
-parent:
- [LegacyIntr] intr Msg();
-};
diff --git a/ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl b/ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl
deleted file mode 100644
index 7ce415aba0..0000000000
--- a/ipc/ipdl/test/ipdl/error/unknownIntrMessage.ipdl
+++ /dev/null
@@ -1,7 +0,0 @@
-//error: Unknown sync IPC message unknownIntrMessage::Msg
-
-[ChildProc=any]
-intr protocol unknownIntrMessage {
-parent:
- [LegacyIntr] intr Msg();
-};
diff --git a/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl b/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl
index deb10fb7ac..e6565c6264 100644
--- a/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl
+++ b/ipc/ipdl/test/ipdl/ok/PMessageTainted.ipdl
@@ -1,5 +1,5 @@
[ChildProc=any]
-intr protocol PMessageTainted {
+sync protocol PMessageTainted {
child:
[Tainted] async foo();
};
diff --git a/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl b/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl
index 8db2c8b742..25fbae1f92 100644
--- a/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl
+++ b/ipc/ipdl/test/ipdl/ok/PMessageTaintedWithPassback.ipdl
@@ -1,5 +1,5 @@
[ChildProc=any]
-intr protocol PMessageTaintedWithPassback {
+sync protocol PMessageTaintedWithPassback {
child:
[Tainted] async foo([NoTaint=passback] int id);
};
diff --git a/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl b/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl
index a0ceac937f..d51878b872 100644
--- a/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl
+++ b/ipc/ipdl/test/ipdl/ok/Pbytebuf.ipdl
@@ -4,11 +4,9 @@ union Foo {
};
[ChildProc=any]
-intr protocol Pbytebuf {
+sync protocol Pbytebuf {
parent:
async Msg(ByteBuf s, Foo f);
sync SyncMsg(ByteBuf s, Foo f)
returns (ByteBuf t, Foo g);
- [LegacyIntr] intr InterruptMsg(ByteBuf s, Foo f)
- returns (ByteBuf t, Foo g);
};
diff --git a/ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl b/ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl
deleted file mode 100644
index 4b663327e6..0000000000
--- a/ipc/ipdl/test/ipdl/ok/PintrProtocol.ipdl
+++ /dev/null
@@ -1,14 +0,0 @@
-[ChildProc=any]
-intr protocol PintrProtocol {
-
- // sanity check of Interrupt protocols
-child:
- async AsyncMsg();
-
-parent:
- sync SyncMsg(int i) returns (int r);
-
-both:
- [LegacyIntr] intr InterruptMsg(int x) returns (int y);
-
-};
diff --git a/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl b/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl
index 7e14c888dd..0ec6476299 100644
--- a/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl
+++ b/ipc/ipdl/test/ipdl/ok/PmessageCompress.ipdl
@@ -1,5 +1,5 @@
[ChildProc=any]
-intr protocol PmessageCompress {
+sync protocol PmessageCompress {
child:
[Compress] async foo();
[Compress=all] async bar();
diff --git a/ipc/ipdl/test/ipdl/ok/Pplugin.ipdl b/ipc/ipdl/test/ipdl/ok/Pplugin.ipdl
deleted file mode 100644
index f7d9352a08..0000000000
--- a/ipc/ipdl/test/ipdl/ok/Pplugin.ipdl
+++ /dev/null
@@ -1,6 +0,0 @@
-[ChildProc=any]
-intr protocol Pplugin {
-child:
- async __delete__();
-
-};
diff --git a/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl b/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl
index a46e777d8c..2779a2437f 100644
--- a/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl
+++ b/ipc/ipdl/test/ipdl/ok/Pshmem.ipdl
@@ -4,11 +4,9 @@ union Foo {
};
[ChildProc=any]
-intr protocol Pshmem {
+sync protocol Pshmem {
parent:
async Msg(Shmem s, Foo f);
sync SyncMsg(Shmem s, Foo f)
returns (Shmem t, Foo g);
- [LegacyIntr] intr InterruptMsg(Shmem s, Foo f)
- returns (Shmem t, Foo g);
};
diff --git a/ipc/ipdl/test/ipdl/sync-messages.ini b/ipc/ipdl/test/ipdl/sync-messages.ini
index 82af605d01..afd0ff3d5d 100644
--- a/ipc/ipdl/test/ipdl/sync-messages.ini
+++ b/ipc/ipdl/test/ipdl/sync-messages.ini
@@ -10,30 +10,16 @@ description = test only
description = test only
[Punion_Comparable::Msg]
description = test only
-[PintrProtocol::SyncMsg]
-description = test only
-[PintrProtocol::InterruptMsg]
-description = test only
[Pshmem::SyncMsg]
description = test only
-[Pshmem::InterruptMsg]
-description = test only
[Pbytebuf::SyncMsg]
description = test only
-[Pbytebuf::InterruptMsg]
-description = test only
[PsyncProtocol::SyncMsg]
description = test only
-[PintrMessageCompress::foo]
-description = test only
-[PintrMessageCompress::bar]
-description = test only
[PsyncMessageCompress::foo]
description = test only
[PsyncParentToChild::Msg]
description = test only
-[PtooWeakIntrSync::Msg]
-description = test only
[PtooWeakSyncAsync::Msg]
description = test only
[PundeclReturnType::Msg]