Skip to content

Commit 862ee7b

Browse files
committed
Browser tests: reduce timeout for instantiation to reasonable value
The timeout for browser instantiation in the browser tests has been increased to avoid flaky tests. However, browser instantiation taking more than 10 seconds (the previous timeout value) is an indicator for something being wrong with the instantiation. There is no reason why instantiation may take that long during test execution but the same issue should never arise in productive use, thus such a case should be captured by tests and, if necessary, be fixed productively. In order to do so, this change reduces the test timeout value again to a more reasonable value. Related to #1676
1 parent 9aa7973 commit 862ee7b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/Edge.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ private static void processNextOSMessage() {
466466
Display display = Display.getCurrent();
467467
MSG msg = new MSG();
468468
while (!OS.PeekMessage (msg, 0, 0, 0, OS.PM_NOREMOVE)) {
469+
display.timerExec(100, () -> {});
469470
display.sleep();
470471
}
471472
display.readAndDispatch();
@@ -631,6 +632,7 @@ private IUnknown createControllerInitializationCallback(int previousAttempts) {
631632
}
632633
break;
633634
}
635+
browser.getDisplay().wake();
634636
return COM.S_OK;
635637
});
636638
}

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ private int reportOpenedDescriptors() {
296296
}
297297

298298
private Browser createBrowser(Shell s, int flags) {
299-
long maximumBrowserCreationMilliseconds = 90_000;
299+
long maximumBrowserCreationMilliseconds = 5_000;
300300
long createStartTime = System.currentTimeMillis();
301301
Browser b = new Browser(s, flags);
302302
// Wait for asynchronous initialization via getting URL

0 commit comments

Comments
 (0)