Skip to content

Commit 2db6e49

Browse files
HeikoKlarefedejeanne
authored andcommitted
Execute browser tests for Edge #671
Browser tests were only executed for the default configuration of a system's browser using the SWT.NONE flag. Other configurations, such as using the Edge browser in Windows, were not tested. A parameterization has been added to allow other configurations to be tested. This change adds Edge to the test configurations executed for the browser. This allows to detect regressions when performing future changes to the Edge browser. Fixes #671
1 parent 37b22fb commit 2db6e49

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import org.eclipse.swt.widgets.Shell;
8282
import org.eclipse.swt.widgets.Text;
8383
import org.junit.Before;
84+
import org.junit.BeforeClass;
8485
import org.junit.FixMethodOrder;
8586
import org.junit.Rule;
8687
import org.junit.Test;
@@ -145,13 +146,10 @@ private void testLogAppend(String msg) {
145146
@Parameters(name = "browser flags: {0}")
146147
public static Collection<Object[]> browserFlagsToTest() {
147148
List<Object[]> browserFlags = new ArrayList<>();
149+
browserFlags.add(new Object[] {SWT.NONE});
148150
if (SwtTestUtil.isWindows) {
149-
// NOTE: This is currently disabled due to test issues in the CI
150-
// Execute Edge tests first, because IE starts some OS timer that conflicts with Edge event handling
151-
// browserFlags.add(0, new Object[] {SWT.EDGE});
151+
// Execute IE tests after Edge, because IE starts some OS timer that conflicts with Edge event handling
152152
browserFlags.add(new Object[] {SWT.IE});
153-
} else {
154-
browserFlags.add(new Object[] {SWT.NONE});
155153
}
156154
return browserFlags;
157155
}
@@ -160,6 +158,16 @@ public Test_org_eclipse_swt_browser_Browser(int swtBrowserSettings) {
160158
this.swtBrowserSettings = swtBrowserSettings;
161159
}
162160

161+
@BeforeClass
162+
public static void setupEdgeEnvironment() {
163+
// initialize Edge environment before any test runs to isolate environment setup
164+
if (SwtTestUtil.isWindows) {
165+
Shell shell = new Shell();
166+
new Browser(shell, SWT.EDGE);
167+
shell.dispose();
168+
}
169+
}
170+
163171
@Override
164172
@Before
165173
public void setUp() {
@@ -234,6 +242,16 @@ protected void afterDispose(Display display) {
234242
printThreadsInfo();
235243
}
236244
}
245+
if (isEdge) {
246+
// wait for and process pending events to properly cleanup Edge browser resources
247+
do {
248+
processUiEvents();
249+
try {
250+
Thread.sleep(100);
251+
} catch (InterruptedException e) {
252+
}
253+
} while (Display.getCurrent().readAndDispatch());
254+
}
237255
if (SwtTestUtil.isGTK) {
238256
int descriptorDiff = reportOpenedDescriptors();
239257
if(descriptorDiff > 0) {

0 commit comments

Comments
 (0)