summaryrefslogtreecommitdiff
path: root/js/test/Ice/acm/Client.js
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-11-29 11:35:51 +0100
committerBenoit Foucher <benoit@zeroc.com>2016-11-29 11:35:51 +0100
commitf27e2b4d7a565a05c599b6ec0cbb5e9a525d8665 (patch)
treec171e5d6101b6fcaf821ffa080f08c46744d9b37 /js/test/Ice/acm/Client.js
parentCSharp test updates (diff)
downloadice-f27e2b4d7a565a05c599b6ec0cbb5e9a525d8665.tar.bz2
ice-f27e2b4d7a565a05c599b6ec0cbb5e9a525d8665.tar.xz
ice-f27e2b4d7a565a05c599b6ec0cbb5e9a525d8665.zip
Fixed ObjC ami test failure, JS ACM test failures, Windows Python 3 script failures
Diffstat (limited to 'js/test/Ice/acm/Client.js')
-rw-r--r--js/test/Ice/acm/Client.js47
1 files changed, 32 insertions, 15 deletions
diff --git a/js/test/Ice/acm/Client.js b/js/test/Ice/acm/Client.js
index 6c3b74e89cb..2c36927ce5f 100644
--- a/js/test/Ice/acm/Client.js
+++ b/js/test/Ice/acm/Client.js
@@ -28,17 +28,17 @@
this._messages = [];
this._out = out;
}
-
+
print(msg)
{
this._messages.push(msg);
}
-
+
trace(category, message)
{
this._messages.push("[" + category + "] " + message);
}
-
+
warning(message)
{
this._messages.push("warning: " + message);
@@ -140,9 +140,9 @@
return prx.ice_getConnection().then(con =>
{
con.setCloseCallback(connection => this._closed = true);
-
+
con.setHeartbeatCallback(connection => ++this._heartbeat);
-
+
return this.runTestCase(this._adapter, prx);
}).catch(ex =>
{
@@ -151,6 +151,22 @@
});
}
+ waitForClosed()
+ {
+ if(!this._closed)
+ {
+ var now = Date.now();
+ return Ice.Promise.delay(1000).then(() => {
+ if(Data.now() - now > 1000)
+ {
+ test(false);
+ }
+ return Promise.resolve();
+ })
+ }
+ return Promise.resolve();
+ }
+
runTestCase(adapter, proxy)
{
test(false); // Abstract
@@ -180,7 +196,7 @@
runTestCase(adapter, proxy)
{
- return proxy.sleep(2).then(() =>
+ return proxy.sleep(2).then(() =>
{
test(this._heartbeat >= 2);
});
@@ -202,9 +218,9 @@
// fail.
return proxy.sleepAndHold(10).then(
() => test(false),
- ex => test(this._closed))
- .then(() => adapter.activate())
- .then(() => proxy.interruptSleep());
+ ex => adapter.activate())
+ .then(() => proxy.interruptSleep())
+ .then(() => this.waitForClosed());
}
}
@@ -225,10 +241,11 @@
() => test(false),
ex =>
{
- test(this._heartbeat === 0);
- test(this._closed);
return proxy.interruptSleep();
- });
+ }).then(() => this.waitForClosed())
+ .then(() => {
+ test(this._heartbeat === 0);
+ });
}
}
@@ -263,7 +280,7 @@
runTestCase(adapter, proxy)
{
- return Ice.Promise.delay(2000).then(() =>
+ return Ice.Promise.delay(2000).then(() => this.waitForClosed()).then(() =>
{
test(this._heartbeat === 0);
test(this._closed);
@@ -310,7 +327,7 @@
test(this._heartbeat === 0);
test(!this._closed); // Not closed yet because of graceful close.
return adapter.activate();
- }).delay(500).then(() => test(this._closed)); // Connection should be closed this time.
+ }).delay(500).then(() => this.waitForClosed()); // Connection should be closed this time.
}
}
@@ -324,7 +341,7 @@
runTestCase(adapter, proxy)
{
- return adapter.hold().delay(1500).then(
+ return adapter.hold().delay(1500).then(() => this.waitForClosed()).then(
() =>
{
test(this._heartbeat === 0);