Bug 199200 Make Networking Tests XP friendly by using the eventqueueservice
r=darin
This commit is contained in:
@@ -268,24 +268,9 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Enter the message pump to allow the URL load to proceed.
|
// Enter the message pump to allow the URL load to proceed.
|
||||||
while ( gKeepRunning ) {
|
while ( gKeepRunning ) {
|
||||||
#ifdef WIN32
|
PLEvent *gEvent;
|
||||||
MSG msg;
|
gEventQ->WaitForEvent(&gEvent);
|
||||||
|
gEventQ->HandleEvent(gEvent);
|
||||||
if (GetMessage(&msg, NULL, 0, 0)) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
} else {
|
|
||||||
gKeepRunning = 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef XP_MAC
|
|
||||||
/* Mac stuff is missing here! */
|
|
||||||
#else
|
|
||||||
PLEvent *gEvent;
|
|
||||||
rv = gEventQ->GetEvent(&gEvent);
|
|
||||||
rv = gEventQ->HandleEvent(gEvent);
|
|
||||||
#endif /* XP_UNIX */
|
|
||||||
#endif /* !WIN32 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ShutdownXPCOM(nsnull);
|
NS_ShutdownXPCOM(nsnull);
|
||||||
|
|||||||
@@ -344,27 +344,9 @@ main(int argc, char* argv[])
|
|||||||
|
|
||||||
// Enter the message pump
|
// Enter the message pump
|
||||||
while ( gKeepRunning ) {
|
while ( gKeepRunning ) {
|
||||||
#ifdef WIN32
|
|
||||||
MSG msg;
|
|
||||||
if (GetMessage(&msg, NULL, 0, 0)) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gKeepRunning = FALSE;
|
|
||||||
#elif XP_MAC
|
|
||||||
/* Mac stuff is missing here! */
|
|
||||||
#elif XP_OS2
|
|
||||||
QMSG qmsg;
|
|
||||||
if (WinGetMsg(0, &qmsg, 0, 0, 0))
|
|
||||||
WinDispatchMsg(0, &qmsg);
|
|
||||||
else
|
|
||||||
gKeepRunning = FALSE;
|
|
||||||
#else
|
|
||||||
PLEvent *gEvent;
|
PLEvent *gEvent;
|
||||||
rv = gEventQ->WaitForEvent(&gEvent);
|
gEventQ->WaitForEvent(&gEvent);
|
||||||
rv = gEventQ->HandleEvent(gEvent);
|
gEventQ->HandleEvent(gEvent);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRTime endTime;
|
PRTime endTime;
|
||||||
|
|||||||
@@ -645,24 +645,9 @@ main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
// Enter the message pump to allow the URL load to proceed.
|
// Enter the message pump to allow the URL load to proceed.
|
||||||
while ( gKeepRunning ) {
|
while ( gKeepRunning ) {
|
||||||
#ifdef WIN32
|
|
||||||
MSG msg;
|
|
||||||
|
|
||||||
if (GetMessage(&msg, NULL, 0, 0)) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
} else {
|
|
||||||
gKeepRunning = 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef XP_MAC
|
|
||||||
/* Mac stuff is missing here! */
|
|
||||||
#else
|
|
||||||
PLEvent *gEvent;
|
PLEvent *gEvent;
|
||||||
rv = gEventQ->WaitForEvent(&gEvent);
|
gEventQ->WaitForEvent(&gEvent);
|
||||||
rv = gEventQ->HandleEvent(gEvent);
|
gEventQ->HandleEvent(gEvent);
|
||||||
#endif /* XP_UNIX */
|
|
||||||
#endif /* !WIN32 */
|
|
||||||
}
|
}
|
||||||
} // this scopes the nsCOMPtrs
|
} // this scopes the nsCOMPtrs
|
||||||
// no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
|
// no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
|
||||||
|
|||||||
@@ -343,27 +343,9 @@ main(int argc, char* argv[])
|
|||||||
|
|
||||||
// Enter the message pump to allow the URL load to proceed.
|
// Enter the message pump to allow the URL load to proceed.
|
||||||
while ( gKeepRunning ) {
|
while ( gKeepRunning ) {
|
||||||
#ifdef WIN32
|
|
||||||
MSG msg;
|
|
||||||
if (GetMessage(&msg, NULL, 0, 0)) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gKeepRunning = FALSE;
|
|
||||||
#elif XP_MAC
|
|
||||||
/* Mac stuff is missing here! */
|
|
||||||
#elif XP_OS2
|
|
||||||
QMSG qmsg;
|
|
||||||
if (WinGetMsg(0, &qmsg, 0, 0, 0))
|
|
||||||
WinDispatchMsg(0, &qmsg);
|
|
||||||
else
|
|
||||||
gKeepRunning = FALSE;
|
|
||||||
#else
|
|
||||||
PLEvent *gEvent;
|
PLEvent *gEvent;
|
||||||
rv = gEventQ->WaitForEvent(&gEvent);
|
gEventQ->WaitForEvent(&gEvent);
|
||||||
rv = gEventQ->HandleEvent(gEvent);
|
gEventQ->HandleEvent(gEvent);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -183,31 +183,9 @@ main(int argc, char* argv[])
|
|||||||
|
|
||||||
// Enter the message pump to allow the URL load to proceed.
|
// Enter the message pump to allow the URL load to proceed.
|
||||||
while ( gKeepRunning ) {
|
while ( gKeepRunning ) {
|
||||||
#ifdef WIN32
|
|
||||||
MSG msg;
|
|
||||||
|
|
||||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef XP_MAC
|
|
||||||
/* Mac stuff is missing here! */
|
|
||||||
#else
|
|
||||||
#ifdef XP_OS2
|
|
||||||
QMSG qmsg;
|
|
||||||
|
|
||||||
if (WinGetMsg(0, &qmsg, 0, 0, 0))
|
|
||||||
WinDispatchMsg(0, &qmsg);
|
|
||||||
else
|
|
||||||
gKeepRunning = FALSE;
|
|
||||||
#else
|
|
||||||
PLEvent *gEvent;
|
PLEvent *gEvent;
|
||||||
rv = eventQ->GetEvent(&gEvent);
|
eventQ->WaitForEvent(&gEvent);
|
||||||
rv = eventQ->HandleEvent(gEvent);
|
eventQ->HandleEvent(gEvent);
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // this scopes the nsCOMPtrs
|
} // this scopes the nsCOMPtrs
|
||||||
|
|||||||
@@ -190,31 +190,16 @@ main(int argc, char* argv[])
|
|||||||
listener = new InputTestConsumer;
|
listener = new InputTestConsumer;
|
||||||
if (!listener) {
|
if (!listener) {
|
||||||
NS_ERROR("Failed to create a new stream listener!");
|
NS_ERROR("Failed to create a new stream listener!");
|
||||||
return -1;;
|
return -1;
|
||||||
}
|
}
|
||||||
NS_ADDREF(listener);
|
NS_ADDREF(listener);
|
||||||
|
|
||||||
channel->AsyncOpen(listener, nsnull);
|
channel->AsyncOpen(listener, nsnull);
|
||||||
|
|
||||||
while ( gKeepRunning ) {
|
while ( gKeepRunning ) {
|
||||||
#ifdef WIN32
|
|
||||||
MSG msg;
|
|
||||||
|
|
||||||
if (GetMessage(&msg, NULL, 0, 0)) {
|
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
} else {
|
|
||||||
gKeepRunning = 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#ifdef XP_MAC
|
|
||||||
/* Mac stuff is missing here! */
|
|
||||||
#else
|
|
||||||
PLEvent *gEvent;
|
PLEvent *gEvent;
|
||||||
rv = gEventQ->WaitForEvent(&gEvent);
|
gEventQ->WaitForEvent(&gEvent);
|
||||||
rv = gEventQ->HandleEvent(gEvent);
|
gEventQ->HandleEvent(gEvent);
|
||||||
#endif /* XP_UNIX */
|
|
||||||
#endif /* !WIN32 */
|
|
||||||
}
|
}
|
||||||
} // this scopes the nsCOMPtrs
|
} // this scopes the nsCOMPtrs
|
||||||
// no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
|
// no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
|
||||||
|
|||||||
Reference in New Issue
Block a user