Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
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/. */
6 #ifndef mozilla__ipdltest_IPDLUnitTests_h
7 #define mozilla__ipdltest_IPDLUnitTests_h 1
9 #include "base/message_loop.h"
10 #include "base/process.h"
11 #include "chrome/common/ipc_channel.h"
13 #include "nsIAppShell.h"
15 #include "nsCOMPtr.h"
16 #include "nsDebug.h"
17 #include "nsServiceManagerUtils.h" // do_GetService()
18 #include "nsWidgetsCID.h" // NS_APPSHELL_CID
19 #include "nsXULAppAPI.h"
22 #define MOZ_IPDL_TESTFAIL_LABEL "TEST-UNEXPECTED-FAIL"
23 #define MOZ_IPDL_TESTPASS_LABEL "TEST-PASS"
24 #define MOZ_IPDL_TESTINFO_LABEL "TEST-INFO"
27 namespace mozilla {
28 namespace _ipdltest {
30 //-----------------------------------------------------------------------------
31 // both processes
32 const char* const IPDLUnitTestName();
34 // NB: these are named like the similar functions in
35 // xpcom/test/TestHarness.h. The names should nominally be kept in
36 // sync.
38 inline void fail(const char* fmt, ...)
39 {
40 va_list ap;
42 fprintf(stderr, MOZ_IPDL_TESTFAIL_LABEL " | %s | ", IPDLUnitTestName());
44 va_start(ap, fmt);
45 vfprintf(stderr, fmt, ap);
46 va_end(ap);
48 fputc('\n', stderr);
50 NS_RUNTIMEABORT("failed test");
51 }
53 inline void passed(const char* fmt, ...)
54 {
55 va_list ap;
57 printf(MOZ_IPDL_TESTPASS_LABEL " | %s | ", IPDLUnitTestName());
59 va_start(ap, fmt);
60 vprintf(fmt, ap);
61 va_end(ap);
63 fputc('\n', stdout);
64 }
66 //-----------------------------------------------------------------------------
67 // parent process only
69 class IPDLUnitTestSubprocess;
71 extern void* gParentActor;
72 extern IPDLUnitTestSubprocess* gSubprocess;
74 void IPDLUnitTestMain(void* aData);
76 void QuitParent();
78 //-----------------------------------------------------------------------------
79 // child process only
81 extern void* gChildActor;
83 void IPDLUnitTestChildInit(IPC::Channel* transport,
84 base::ProcessHandle parent,
85 MessageLoop* worker);
87 void QuitChild();
89 } // namespace _ipdltest
90 } // namespace mozilla
93 #endif // ifndef mozilla__ipdltest_IPDLUnitTests_h