File tree Expand file tree Collapse file tree
src/main/java/com/openfin/desktop/demo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,6 +203,37 @@ public void canStopAndRestartOpenFinDesktopConnection() throws Exception {
203203 //teardownDesktopConnection() will be caled from teardown()
204204 }
205205
206+ @ Test
207+ public void throwingExceptionFromOpenFinThreadRecoversCleanly () throws Exception {
208+
209+ Application application = openWindow (nextTestUuid (), "http://www.google.com" );
210+ WindowBounds bounds1 = getWindowBounds (application .getWindow ());
211+
212+ //throw an exception from the OpenFin event thread
213+ final int delta = 10 ;
214+ application .getWindow ().moveBy (delta , delta , new AckListener () {
215+ @ Override
216+ public void onSuccess (Ack ack ) {
217+ throw new RuntimeException ("thrown intentionally - OpenFin should recover from this" );
218+ }
219+ @ Override
220+ public void onError (Ack ack ) {
221+ fail ("could not open a window to run test: " + ack .getReason ());
222+ }
223+ });
224+
225+ try {
226+ WindowBounds bounds2 = getWindowBounds (application .getWindow ());
227+ assertEquals ("window was not moved" , new Integer (bounds1 .getLeft () + delta ), bounds2 .getLeft ());
228+ } catch (Throwable t ) {
229+ fail ("OpenFin did not respond after an exception was thrown, caused by: " + t .getMessage ());
230+ t .printStackTrace ();
231+ }
232+ application .close ();
233+ }
234+
235+
236+
206237 @ Test
207238 public void canOpenAndCloseMultipleWindowsWithDifferentUUIDS () throws Exception {
208239 Application application1 = openWindow (nextTestUuid (), "http://www.google.com" );
You can’t perform that action at this time.
0 commit comments