summaryrefslogtreecommitdiff
path: root/js/test/Ice/acm/Client.js
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2017-09-14 13:38:10 +0200
committerBenoit Foucher <benoit@zeroc.com>2017-09-14 13:38:10 +0200
commitc471b7bb2abd153e6e5f9d395ab8ac524b704384 (patch)
treebdf5c832abda99a0b4273ac924c76618fc560594 /js/test/Ice/acm/Client.js
parentRemove -Wstrict-prototypes compiler option, not valid with C++ (diff)
downloadice-c471b7bb2abd153e6e5f9d395ab8ac524b704384.tar.bz2
ice-c471b7bb2abd153e6e5f9d395ab8ac524b704384.tar.xz
ice-c471b7bb2abd153e6e5f9d395ab8ac524b704384.zip
Added test for Ice::Connection setHeartbeatCallback/setCloseCallback (ICE-8012)
Diffstat (limited to 'js/test/Ice/acm/Client.js')
-rw-r--r--js/test/Ice/acm/Client.js40
1 files changed, 31 insertions, 9 deletions
diff --git a/js/test/Ice/acm/Client.js b/js/test/Ice/acm/Client.js
index 535ce23d718..d4b65e1e518 100644
--- a/js/test/Ice/acm/Client.js
+++ b/js/test/Ice/acm/Client.js
@@ -441,27 +441,49 @@
runTestCase(adapter, proxy)
{
- var acm = new Ice.ACM();
- acm = proxy.ice_getCachedConnection().getACM();
+ var con = proxy.ice_getCachedConnection();
+
+ var acm;
+ acm = con.getACM();
test(acm.timeout === 15);
test(acm.close === Ice.ACMClose.CloseOnIdleForceful);
test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatOff);
- proxy.ice_getCachedConnection().setACM(undefined, undefined, undefined);
- acm = proxy.ice_getCachedConnection().getACM();
+ con.setACM(undefined, undefined, undefined);
+ acm = con.getACM();
test(acm.timeout === 15);
test(acm.close === Ice.ACMClose.CloseOnIdleForceful);
test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatOff);
- proxy.ice_getCachedConnection().setACM(1,
- Ice.ACMClose.CloseOnInvocationAndIdle,
- Ice.ACMHeartbeat.HeartbeatAlways);
- acm = proxy.ice_getCachedConnection().getACM();
+ con.setACM(1, Ice.ACMClose.CloseOnInvocationAndIdle, Ice.ACMHeartbeat.HeartbeatAlways);
+ acm = con.getACM();
test(acm.timeout === 1);
test(acm.close === Ice.ACMClose.CloseOnInvocationAndIdle);
test(acm.heartbeat === Ice.ACMHeartbeat.HeartbeatAlways);
- return proxy.startHeartbeatCount().then(() => proxy.waitForHeartbeatCount(2));
+ var p = new Ice.Promise();
+ return proxy.startHeartbeatCount()
+ .then(() => proxy.waitForHeartbeatCount(2))
+ .then(() => {
+ con.setCloseCallback(c => p.resolve());
+ con.close(Ice.ConnectionClose.Gracefully);
+ return p;
+ }).then(() => {
+ try
+ {
+ con.throwException();
+ test(false);
+ }
+ catch(ex)
+ {
+ }
+
+ p = new Ice.Promise();
+ con.setCloseCallback(c => p.resolve());
+ return p;
+ }).then(() => {
+ con.setHeartbeatCallback(c => test(false));
+ });
}
}