--- a/modules/plugin/test/testplugin/nptest_gtk2.cpp
+++ b/modules/plugin/test/testplugin/nptest_gtk2.cpp
@@ -664,24 +664,21 @@ CrasherThread(void* data)
}
bool
pluginCrashInNestedLoop(InstanceData* instanceData)
{
// wait at least long enough for nested loop detector task to be pending ...
sleep(1);
- // Run the nested loop detector by processing all events that are waiting.
- bool found_event = false;
- while (g_main_context_iteration(NULL, FALSE)) {
- found_event = true;
- }
- if (!found_event) {
+ // Run the nested loop detector. Other events are not expected.
+ if (!g_main_context_iteration(NULL, TRUE)) {
g_warning("DetectNestedEventLoop did not fire");
return true; // trigger a test failure
+
}
// wait at least long enough for the "process browser events" task to be
// pending ...
sleep(1);
// we'll be crashing soon, note that fact now to avoid messing with
// timing too much
@@ -689,24 +686,20 @@ pluginCrashInNestedLoop(InstanceData* in
// schedule the crasher thread ...
pthread_t crasherThread;
if (0 != pthread_create(&crasherThread, NULL, CrasherThread, NULL)) {
g_warning("Failed to create thread");
return true; // trigger a test failure
}
- // .. and hope it crashes at about the same time as the "process browser
- // events" task (that should run in this loop) is being processed in the
- // parent.
- found_event = false;
- while (g_main_context_iteration(NULL, FALSE)) {
- found_event = true;
- }
- if (found_event) {
+ // .. and hope the time it takes to spawn means that it crashes at about the
+ // same time as the "process browser events" task that should run next is
+ // being processed in the parent. Other events are not expected.
+ if (g_main_context_iteration(NULL, TRUE)) {
g_warning("Should have crashed in ProcessBrowserEvents");
} else {
g_warning("ProcessBrowserEvents did not fire");
}
// if we get here without crashing, then we'll trigger a test failure
return true;
}