Skip to content

Commit 2e0a9d4

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 422f742 commit 2e0a9d4

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

.github/workflows/maven.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ jobs:
2828
matrix:
2929
java: [ '21' ]
3030
config:
31-
- { name: Linux, os: ubuntu-latest, native: gtk.linux.x86_64 }
3231
- { name: Windows, os: windows-latest, native: win32.win32.x86_64 }
33-
- { name: MacOS x86, os: macos-13, native: cocoa.macosx.x86_64 }
34-
- { name: MacOS ARM, os: macos-latest, native: cocoa.macosx.aarch64 }
3532
name: Verify ${{ matrix.config.name }} with Java-${{ matrix.java }}
3633
runs-on: ${{ matrix.config.os }}
3734
steps:

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,7 @@ private static void processOSMessagesUntil(Supplier<Boolean> condition, Display
463463
// The timer call also wakes up the display to avoid being stuck in display.sleep()
464464
display.timerExec((int) MAXIMUM_OPERATION_TIME.toMillis(), () -> timeoutOccurred.set(true));
465465
while (!display.isDisposed() && !condition.get() && !timeoutOccurred.get()) {
466-
if (OS.PeekMessage(msg, 0, 0, 0, OS.PM_NOREMOVE)) {
467-
display.readAndDispatch();
468-
} else {
466+
if (!display.readAndDispatch()) {
469467
display.sleep();
470468
}
471469
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515

1616

1717
import org.eclipse.test.TracingSuite;
18-
import org.eclipse.test.TracingSuite.TracingOptions;
1918
import org.junit.runner.JUnitCore;
2019
import org.junit.runner.RunWith;
2120
import org.junit.runners.Suite;
2221

2322
@RunWith(TracingSuite.class)
24-
@TracingOptions(stackDumpTimeoutSeconds = 60)
2523
@Suite.SuiteClasses({
2624
Test_org_eclipse_swt_browser_Browser.class,
2725
})

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
public class Test_org_eclipse_swt_browser_Browser extends Test_org_eclipse_swt_widgets_Composite {
104104

105105
// TODO Reduce to reasonable value
106-
private static Duration MAXIMUM_BROWSER_CREATION_TIME = Duration.ofSeconds(90);
106+
private static Duration MAXIMUM_BROWSER_CREATION_TIME = Duration.ofSeconds(15);
107107

108108
static {
109109
try {
@@ -165,10 +165,11 @@ public Test_org_eclipse_swt_browser_Browser(int swtBrowserSettings) {
165165

166166
@BeforeClass
167167
public static void setupEdgeEnvironment() {
168+
System.out.println("Setting up Edge environment");
168169
// initialize Edge environment before any test runs to isolate environment setup
169170
if (SwtTestUtil.isWindows) {
170171
Shell shell = new Shell();
171-
new Browser(shell, SWT.EDGE);
172+
new Browser(shell, SWT.None).getUrl();
172173
shell.dispose();
173174
}
174175
}

tests/org.eclipse.swt.tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<packaging>eclipse-test-plugin</packaging>
2626
<properties>
2727
<tycho.testArgLine></tycho.testArgLine>
28-
<test>AllTests</test>
28+
<test>AllBrowserTests</test>
2929
</properties>
3030
<build>
3131
<plugins>

0 commit comments

Comments
 (0)