diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-07-14 13:12:48 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-07-14 13:12:48 +0200 |
commit | a2711c0199c752682f2fe9c04883dccd7ac9ac8a (patch) | |
tree | 87e72aa8d60805ebe684aae07ee57348eb622f34 | |
parent | Updated Gradle version for Android to 4.0.1 (diff) | |
download | ice-a2711c0199c752682f2fe9c04883dccd7ac9ac8a.tar.bz2 ice-a2711c0199c752682f2fe9c04883dccd7ac9ac8a.tar.xz ice-a2711c0199c752682f2fe9c04883dccd7ac9ac8a.zip |
Fixed JS Ice/ami test to work with latest Safari preview versions
-rw-r--r-- | js/test/Ice/ami/Client.js | 102 |
1 files changed, 63 insertions, 39 deletions
diff --git a/js/test/Ice/ami/Client.js b/js/test/Ice/ami/Client.js index 5f3a2decfb7..71b66ce2f86 100644 --- a/js/test/Ice/ami/Client.js +++ b/js/test/Ice/ami/Client.js @@ -205,7 +205,6 @@ out.write("testing AsyncResult operations... "); var indirect = Test.TestIntfPrx.uncheckedCast(p.ice_adapterId("dummy")); - return indirect.op().catch(ex => test(ex instanceof Ice.NoEndpointException) ).then(() => testController.holdAdapter() ).then(() => @@ -213,29 +212,40 @@ var r1 = p.op(); var r2 = null; var seq = new Uint8Array(100000); + loop = () => { + r2 = p.opWithPayload(seq); + if(r2.sentSynchronously()) + { + return Ice.Promise.delay(0).then(loop); + } + else + { + return Ice.Promise.resolve(); + } + }; + return loop().then(() => { + test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() || + !r1.sentSynchronously() && !r1.isCompleted()); - while((r2 = p.opWithPayload(seq)).sentSynchronously()); - test(r1.sentSynchronously() && r1.isSent() && !r1.isCompleted() || - !r1.sentSynchronously() && !r1.isCompleted()); - - test(!r2.sentSynchronously() && !r2.isCompleted()); + test(!r2.sentSynchronously() && !r2.isCompleted()); - testController.resumeAdapter(); + testController.resumeAdapter(); - test(r1.operation === "op"); - test(r2.operation === "opWithPayload"); + test(r1.operation === "op"); + test(r2.operation === "opWithPayload"); - return r1.then(() => - { - test(r1.isSent()); - test(r1.isCompleted()); - return r2; - } - ).then(() => - { - test(r2.isSent()); - test(r2.isCompleted()); - }); + return r1.then(() => + { + test(r1.isSent()); + test(r1.isCompleted()); + return r2; + } + ).then(() => + { + test(r2.isSent()); + test(r2.isCompleted()); + }); + }); } ).then(() => { @@ -287,29 +297,43 @@ ).then(() => { var seq = new Uint8Array(new Array(100000)); - while((r = p.opWithPayload(seq)).sentSynchronously()); - test(!r.isSent()); + var r = null; + loop = () => { + r = p.opWithPayload(seq); + if(r.sentSynchronously()) + { + return Ice.Promise.delay(0).then(loop); + } + else + { + return Ice.Promise.resolve(); + } + }; + return loop().then(() => { - var r1 = p.ice_ping(); - r1.then( - () => test(false), - (ex) => test(ex instanceof Ice.InvocationCanceledException)); + test(!r.isSent()); - var r2 = p.ice_id(); - r2.then( - () => test(false), - (ex) => test(ex instanceof Ice.InvocationCanceledException)); + var r1 = p.ice_ping(); + r1.then( + () => test(false), + (ex) => test(ex instanceof Ice.InvocationCanceledException)); - r1.cancel(); - r2.cancel(); + var r2 = p.ice_id(); + r2.then( + () => test(false), + (ex) => test(ex instanceof Ice.InvocationCanceledException)); - return testController.resumeAdapter() - .then(() => p.ice_ping()) - .then(() => - { - test(!r1.isSent() && r1.isCompleted()); - test(!r2.isSent() && r2.isCompleted()); - }); + r1.cancel(); + r2.cancel(); + + return testController.resumeAdapter() + .then(() => p.ice_ping()) + .then(() => + { + test(!r1.isSent() && r1.isCompleted()); + test(!r2.isSent() && r2.isCompleted()); + }); + }); } ).then(() => testController.holdAdapter() ).then(() => |