Skip to content

Commit 8afbe01

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 8afbe01

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,9 @@ private <T> void waitForFutureToFinish(CompletableFuture<T> future) {
465465
private static void processNextOSMessage() {
466466
Display display = Display.getCurrent();
467467
MSG msg = new MSG();
468-
while (!OS.PeekMessage (msg, 0, 0, 0, OS.PM_NOREMOVE)) {
469-
display.sleep();
468+
if (OS.PeekMessage (msg, 0, 0, 0, OS.PM_NOREMOVE)) {
469+
display.readAndDispatch();
470470
}
471-
display.readAndDispatch();
472471
}
473472

474473
static ICoreWebView2CookieManager getCookieManager() {

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

+1-1
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)