зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1205219 - [Presentation WebAPI] Support terminate semantics. Part 2 - Tests. r=smaug
This commit is contained in:
Родитель
fb882d073c
Коммит
b4479e705d
|
@ -42,12 +42,12 @@ function testSessionAvailable() {
|
|||
session = aSession;
|
||||
|
||||
ok(session.id, "Session ID should be set: " + session.id);
|
||||
is(session.state, "disconnected", "Session state at receiver side should be disconnected by default.");
|
||||
is(session.state, "closed", "Session state at receiver side should be closed by default.");
|
||||
aResolve();
|
||||
},
|
||||
function(aError) {
|
||||
ok(false, "Error occurred when getting the session: " + aError);
|
||||
teardown();
|
||||
finish();
|
||||
aReject();
|
||||
}
|
||||
);
|
||||
|
@ -81,7 +81,7 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testCloseSession() {
|
||||
function testTerminateSession() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
session.onstatechange = function() {
|
||||
session.onstatechange = null;
|
||||
|
@ -89,14 +89,14 @@ function testCloseSession() {
|
|||
aResolve();
|
||||
};
|
||||
|
||||
session.close();
|
||||
session.terminate();
|
||||
});
|
||||
}
|
||||
|
||||
testSessionAvailable().
|
||||
then(testSessionReady).
|
||||
then(testIncomingMessage).
|
||||
then(testCloseSession).
|
||||
then(testTerminateSession).
|
||||
then(finish);
|
||||
|
||||
</script>
|
||||
|
|
|
@ -42,12 +42,12 @@ function testSessionAvailable() {
|
|||
session = aSession;
|
||||
|
||||
ok(session.id, "Session ID should be set: " + session.id);
|
||||
is(session.state, "disconnected", "Session state at receiver side should be disconnected by default.");
|
||||
is(session.state, "closed", "Session state at receiver side should be closed by default.");
|
||||
aResolve();
|
||||
},
|
||||
function(aError) {
|
||||
ok(false, "Error occurred when getting the session: " + aError);
|
||||
teardown();
|
||||
finish();
|
||||
aReject();
|
||||
}
|
||||
);
|
||||
|
@ -81,7 +81,7 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testCloseSession() {
|
||||
function testTerminateSession() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
session.onstatechange = function() {
|
||||
session.onstatechange = null;
|
||||
|
@ -89,14 +89,14 @@ function testCloseSession() {
|
|||
aResolve();
|
||||
};
|
||||
|
||||
session.close();
|
||||
session.terminate();
|
||||
});
|
||||
}
|
||||
|
||||
testSessionAvailable().
|
||||
then(testSessionReady).
|
||||
then(testIncomingMessage).
|
||||
then(testCloseSession).
|
||||
then(testTerminateSession).
|
||||
then(finish);
|
||||
|
||||
</script>
|
||||
|
|
|
@ -42,12 +42,12 @@ function testSessionAvailable() {
|
|||
session = aSession;
|
||||
|
||||
ok(session.id, "Session ID should be set: " + session.id);
|
||||
is(session.state, "disconnected", "Session state at receiver side should be disconnected by default.");
|
||||
is(session.state, "closed", "Session state at receiver side should be closed by default.");
|
||||
aResolve();
|
||||
},
|
||||
function(aError) {
|
||||
ok(false, "Error occurred when getting the session: " + aError);
|
||||
teardown();
|
||||
finish();
|
||||
aReject();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -148,7 +148,7 @@ function testIncomingMessage() {
|
|||
});
|
||||
}
|
||||
|
||||
function testCloseSession() {
|
||||
function testTerminateSession() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
gScript.addMessageListener('data-transport-closed', function dataTransportClosedHandler(aReason) {
|
||||
gScript.removeMessageListener('data-transport-closed', dataTransportClosedHandler);
|
||||
|
@ -161,7 +161,7 @@ function testCloseSession() {
|
|||
aResolve();
|
||||
};
|
||||
|
||||
session.close();
|
||||
session.terminate();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ function runTests() {
|
|||
then(testStartSession).
|
||||
then(testSend).
|
||||
then(testIncomingMessage).
|
||||
then(testCloseSession).
|
||||
then(testTerminateSession).
|
||||
then(teardown);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ function testStartSession() {
|
|||
});
|
||||
}
|
||||
|
||||
function testCloseSession() {
|
||||
function testTerminateSession() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
gScript.addMessageListener('data-transport-closed', function dataTransportClosedHandler(aReason) {
|
||||
gScript.removeMessageListener('data-transport-closed', dataTransportClosedHandler);
|
||||
|
@ -110,7 +110,7 @@ function testCloseSession() {
|
|||
aResolve();
|
||||
};
|
||||
|
||||
session.close();
|
||||
session.terminate();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ function runTests() {
|
|||
|
||||
testSetup().
|
||||
then(testStartSession).
|
||||
then(testCloseSession).
|
||||
then(testTerminateSession).
|
||||
then(teardown);
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ function testSessionDisconnection() {
|
|||
|
||||
session.onstatechange = function() {
|
||||
session.onstatechange = null;
|
||||
is(session.state, "disconnected", "Session should be disconnected.");
|
||||
is(session.state, "closed", "Session should be closed.");
|
||||
aResolve();
|
||||
};
|
||||
|
||||
|
@ -121,18 +121,6 @@ function testSessionDisconnection() {
|
|||
});
|
||||
}
|
||||
|
||||
function testCloseSession() {
|
||||
return new Promise(function(aResolve, aReject) {
|
||||
session.onstatechange = function() {
|
||||
session.onstatechange = null;
|
||||
is(session.state, "terminated", "Session should be terminated.");
|
||||
aResolve();
|
||||
};
|
||||
|
||||
session.close();
|
||||
});
|
||||
}
|
||||
|
||||
function teardown() {
|
||||
gScript.addMessageListener('teardown-complete', function teardownCompleteHandler() {
|
||||
gScript.removeMessageListener('teardown-complete', teardownCompleteHandler);
|
||||
|
@ -149,7 +137,6 @@ function runTests() {
|
|||
testSetup().
|
||||
then(testStartSession).
|
||||
then(testSessionDisconnection).
|
||||
then(testCloseSession).
|
||||
then(teardown);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче