Skip to content

Commit 03715fb

Browse files
author
Wenjun Che
committed
ADAP-44: create junit tests
1 parent 5144b74 commit 03715fb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
759 Bytes
Binary file not shown.

src/main/java/com/openfin/desktop/demo/OpenFinWindowTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ public void onOutgoingMessage(String message) {
106106
private static void teardownDesktopConnection() throws Exception {
107107
printf("teardownDesktopConnection");
108108
new System(desktopConnection).exit();
109+
// OpenFin update: wait for websocket to be disconnected so re-launch of OpenFin Runtime will work
109110
openFinDisconnectedLatch.await(20, TimeUnit.SECONDS);
110111
assertFalse(desktopConnection.isConnected());
111112
printf("desktop connection closed");
@@ -235,6 +236,7 @@ public void windowMoves() throws Exception {
235236

236237
//set the initial position of the window and check
237238
CountDownLatch moveLatch = new CountDownLatch(1);
239+
// OpenFin update: need to pass AckListener to make sure moveTo operations is completed before checking bounds
238240
application.getWindow().moveTo(10, 20, new AckListener() {
239241
@Override
240242
public void onSuccess(Ack ack) {
@@ -252,7 +254,18 @@ public void onError(Ack ack) {
252254
Thread.sleep(SLEEP_FOR_HUMAN_OBSERVATION);
253255

254256
//move the window and check again
255-
application.getWindow().moveTo(100, 200);
257+
// OpenFin update: need to pass AckListener to make sure moveTo operations is completed before checking bounds
258+
CountDownLatch moveLatch2 = new CountDownLatch(1);
259+
application.getWindow().moveTo(100, 200, new AckListener() {
260+
@Override
261+
public void onSuccess(Ack ack) {
262+
moveLatch2.countDown();
263+
}
264+
@Override
265+
public void onError(Ack ack) {
266+
}
267+
});
268+
moveLatch2.await(5, TimeUnit.SECONDS);
256269
WindowBounds movedBounds = getWindowBounds(application.getWindow());
257270
printf("moved bounds top:%s left:%s", movedBounds.getTop(), movedBounds.getLeft());
258271

0 commit comments

Comments
 (0)