JBR-4456: fixed HandleJSQueryTest

first invocation of dispatch(WindowEvent.WINDOW_CLOSING) calls System.exit() internally (because of setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE))
This commit is contained in:
Artem Bochkarev
2022-06-20 14:06:44 +07:00
committed by jbrbot
parent 3bce2ed61c
commit ee1506fd2f

View File

@@ -42,11 +42,11 @@ public class HandleJSQueryTest {
}
System.out.println("Test PASSED");
} finally {
firstBrowser.getBrowser().dispose();
secondBrowser.getBrowser().dispose();
System.out.println("Close all windows");
SwingUtilities.invokeAndWait(() -> firstBrowser.dispatchEvent(new WindowEvent(firstBrowser, WindowEvent.WINDOW_CLOSING)));
SwingUtilities.invokeAndWait(() -> secondBrowser.dispatchEvent(new WindowEvent(secondBrowser, WindowEvent.WINDOW_CLOSING)));
System.out.println("Dispose CefApp");
JBCefApp.getInstance().getCefApp().dispose();
SwingUtilities.invokeAndWait(firstBrowser::dispose);
SwingUtilities.invokeAndWait(secondBrowser::dispose);
}
}
}