Confirmed users
699
edits
Line 228: | Line 228: | ||
Now re-open <code>xpcom/build/nsXULAppAPI.h</code> and add the declaration | Now re-open <code>xpcom/build/nsXULAppAPI.h</code> and add the declaration | ||
XRE_API(int, | XRE_API(int, | ||
XRE_RunIPCTestHarness, (int aArgc, | |||
char* aArgv[])) | |||
Re-open <code>toolkit/xre/nsEmbedFunctions.cpp</code>. See that | Re-open <code>toolkit/xre/nsEmbedFunctions.cpp</code>. See that | ||
Line 242: | Line 242: | ||
static void | static void | ||
IPCTestHarnessMain(TestProcessParent* subprocess) | |||
{ | { | ||
TestParent parent; | TestParent parent; | ||
Line 251: | Line 251: | ||
static void | static void | ||
IPCTestHarnessLaunchSubprocess(TestProcessParent* subprocess, | |||
MessageLoop* mainLoop) | |||
{ | { | ||
NS_ASSERTION(subprocess->Launch(), "can't launch subprocess"); | NS_ASSERTION(subprocess->Launch(), "can't launch subprocess"); | ||
mainLoop->PostTask(FROM_HERE, | mainLoop->PostTask(FROM_HERE, | ||
NewRunnableFunction( | NewRunnableFunction(IPCTestHarnessMain, subprocess)); | ||
} | } | ||
static void | static void | ||
IPCTestHarnessPostLaunchSubprocessTask(void* data) | |||
{ | { | ||
TestProcessParent* subprocess = new TestProcessParent(); | TestProcessParent* subprocess = new TestProcessParent(); | ||
Line 266: | Line 266: | ||
BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO); | BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO); | ||
ioLoop->PostTask(FROM_HERE, | ioLoop->PostTask(FROM_HERE, | ||
NewRunnableFunction( | NewRunnableFunction(IPCTestHarnessLaunchSubprocess, | ||
subprocess, | subprocess, | ||
MessageLoop::current())); | MessageLoop::current())); | ||
Line 272: | Line 272: | ||
int | int | ||
XRE_RunIPCTestHarness(int aArgc, char* aArgv[]) | |||
{ | { | ||
nsresult rv = | nsresult rv = | ||
XRE_InitParentProcess( | XRE_InitParentProcess( | ||
aArgc, aArgv, | aArgc, aArgv, IPCTestHarnessPostLaunchSubprocessTask, NULL); | ||
NS_ENSURE_SUCCESS(rv, 1); | NS_ENSURE_SUCCESS(rv, 1); | ||
return 0; | return 0; |