Skip to content

Commit 1ca1ab3

Browse files
committed
Disable browser tests for Edge that are incompatible with WebView #671
Browser tests are currently not executed for the Edge browser on Windows. Some of the existing tests are not working for Edge, as they make assumptions that are incompatible with WebView API (such as executing operations on the browser from within browser callback). In order to prepare the tests to be executed for Edge as well, this change disables the incompatible tests when being executed for Edge. Contributes to #671
1 parent 2374dcf commit 1ca1ab3

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import static org.junit.Assert.assertNotNull;
2323
import static org.junit.Assert.assertNull;
2424
import static org.junit.Assert.assertSame;
25+
import static org.junit.Assert.assertThrows;
2526
import static org.junit.Assert.assertTrue;
2627
import static org.junit.Assert.fail;
2728
import static org.junit.Assume.assumeFalse;
@@ -258,14 +259,13 @@ private Browser createBrowser(Shell s, int flags) {
258259
* Test that if Browser is constructed with the parent being "null", Browser throws an exception.
259260
*/
260261
@Override
261-
@Test(expected = IllegalArgumentException.class)
262262
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
263263
Browser browser = createBrowser(shell, SWT.NONE);
264264
browser.dispose();
265265
browser = createBrowser(shell, SWT.BORDER);
266266
// System.out.println("Test_org_eclipse_swt_browser_Browser#test_Constructor*#getBrowserType(): " + browser.getBrowserType());
267267
browser.dispose();
268-
browser = createBrowser(null, SWT.NONE); // Should throw.
268+
assertThrows(IllegalArgumentException.class, () -> createBrowser(null, SWT.NONE));
269269
}
270270

271271
/**
@@ -529,6 +529,8 @@ public void test_LocationListener_changing() {
529529
}
530530
@Test
531531
public void test_LocationListener_changed() {
532+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
533+
532534
AtomicBoolean changedFired = new AtomicBoolean(false);
533535
browser.addLocationListener(changedAdapter(e -> changedFired.set(true)));
534536
shell.open();
@@ -538,6 +540,8 @@ public void test_LocationListener_changed() {
538540
}
539541
@Test
540542
public void test_LocationListener_changingAndOnlyThenChanged() {
543+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
544+
541545
// Test proper order of events.
542546
// Check that 'changed' is only fired after 'changing' has fired at least once.
543547
AtomicBoolean changingFired = new AtomicBoolean(false);
@@ -581,6 +585,8 @@ else if (!changingFired.get())
581585

582586
@Test
583587
public void test_LocationListener_then_ProgressListener() {
588+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
589+
584590
AtomicBoolean locationChanged = new AtomicBoolean(false);
585591
AtomicBoolean progressChanged = new AtomicBoolean(false);
586592
AtomicBoolean progressChangedAfterLocationChanged = new AtomicBoolean(false);
@@ -674,6 +680,8 @@ public void changed(LocationEvent event) {
674680
@Test
675681
/** Ensue that only one changed and one completed event are fired for url changes */
676682
public void test_LocationListener_ProgressListener_noExtraEvents() {
683+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
684+
677685
AtomicInteger changedCount = new AtomicInteger(0);
678686
AtomicInteger completedCount = new AtomicInteger(0);
679687

@@ -780,6 +788,8 @@ public void test_OpenWindowListener_open_ChildPopup() {
780788
/** Validate event order : Child's visibility should come before progress completed event */
781789
@Test
782790
public void test_OpenWindow_Progress_Listener_ValidateEventOrder() {
791+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
792+
783793
AtomicBoolean windowOpenFired = new AtomicBoolean(false);
784794
AtomicBoolean childCompleted = new AtomicBoolean(false);
785795
AtomicBoolean visibilityShowed = new AtomicBoolean(false);
@@ -1259,6 +1269,8 @@ public void completed(ProgressEvent event) {
12591269
*/
12601270
@Test
12611271
public void test_VisibilityWindowListener_eventSize() {
1272+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
1273+
12621274
shell.setSize(200,300);
12631275
AtomicBoolean childCompleted = new AtomicBoolean(false);
12641276
AtomicReference<Point> result = new AtomicReference<>(new Point(0,0));
@@ -1448,6 +1460,8 @@ public void completed(ProgressEvent event) {
14481460
*/
14491461
@Test
14501462
public void test_LocationListener_evaluateInCallback() {
1463+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
1464+
14511465
AtomicBoolean changingFinished = new AtomicBoolean(false);
14521466
AtomicBoolean changedFinished = new AtomicBoolean(false);
14531467
browser.addLocationListener(new LocationListener() {
@@ -1496,6 +1510,8 @@ public void changed(LocationEvent event) {
14961510
/** Verify that evaluation works inside an OpenWindowListener */
14971511
@Test
14981512
public void test_OpenWindowListener_evaluateInCallback() {
1513+
assumeFalse("behavior is not (yet) supported by Edge browser", isEdge);
1514+
14991515
AtomicBoolean eventFired = new AtomicBoolean(false);
15001516
browser.addOpenWindowListener(event -> {
15011517
browser.evaluate("SWTopenListener = true");

0 commit comments

Comments
 (0)