Bug 1414176: make data channel readyState checks spec compliant r=jib

MozReview-Commit-ID: 8VYTsK2edLE

--HG--
extra : rebase_source : c845272bf8357647212a6a6a43e06464ea798cb0
This commit is contained in:
Nils Ohlmeier [:drno] 2018-02-16 23:28:10 -08:00
Родитель f4384d768c
Коммит 209544512d
2 изменённых файлов: 11 добавлений и 17 удалений

Просмотреть файл

@ -25,7 +25,6 @@ var commandsCreateDataChannel = [
function PC_LOCAL_CREATE_DATA_CHANNEL(test) {
var channel = test.pcLocal.createDataChannel({});
is(channel.binaryType, "blob", channel + " is of binary type 'blob'");
is(channel.readyState, "connecting", channel + " is in state: 'connecting'");
is(test.pcLocal.signalingState, STABLE,
"Create datachannel does not change signaling state");
@ -68,13 +67,8 @@ var commandsCheckDataChannel = [
},
function CREATE_SECOND_DATA_CHANNEL(test) {
return test.createDataChannel({ }).then(result => {
var sourceChannel = result.local;
var targetChannel = result.remote;
is(sourceChannel.readyState, "open", sourceChannel + " is in state: 'open'");
is(targetChannel.readyState, "open", targetChannel + " is in state: 'open'");
is(targetChannel.binaryType, "blob", targetChannel + " is of binary type 'blob'");
return test.createDataChannel({}).then(result => {
is(result.remote.binaryType, "blob", "remote data channel is of binary type 'blob'");
});
},
@ -130,8 +124,6 @@ var commandsCheckDataChannel = [
return test.createDataChannel(options).then(result => {
var sourceChannel2 = result.local;
var targetChannel2 = result.remote;
is(sourceChannel2.readyState, "open", sourceChannel2 + " is in state: 'open'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
is(targetChannel2.binaryType, "blob", targetChannel2 + " is of binary type 'blob'");
@ -179,12 +171,7 @@ var commandsCheckDataChannel = [
maxPacketLifeTime: 10
};
return test.createDataChannel(options).then(result => {
var sourceChannel3 = result.local;
var targetChannel3 = result.remote;
is(sourceChannel3.readyState, "open", sourceChannel3 + " is in state: 'open'");
is(targetChannel3.readyState, "open", targetChannel3 + " is in state: 'open'");
is(targetChannel3.binaryType, "blob", targetChannel3 + " is of binary type 'blob'");
is(result.remote.binaryType, "blob", "remote data channel is of binary type 'blob'");
});
},

Просмотреть файл

@ -272,7 +272,7 @@ PeerConnectionTest.prototype.send = function(data, options) {
PeerConnectionTest.prototype.createDataChannel = function(options) {
var remotePromise;
if (!options.negotiated) {
this.pcRemote.expectDataChannel();
this.pcRemote.expectDataChannel("pcRemote expected data channel");
remotePromise = this.pcRemote.nextDataChannel;
}
@ -1098,6 +1098,7 @@ PeerConnectionWrapper.prototype = {
this.nextDataChannel = new Promise(resolve => {
this.ondatachannel = e => {
ok(e.channel, message);
is(e.channel.readyState, "connecting", "data channel in 'connecting after 'ondatachannel''");
resolve(e.channel);
};
});
@ -1118,6 +1119,12 @@ PeerConnectionWrapper.prototype = {
this.expectNegotiationNeeded();
}
var channel = this._pc.createDataChannel(label, options);
if (!this.dataChannels.length) {
is(channel.readyState, "connecting", "initial readyState is 'connecting'");
} else {
// TODO: Bug 1441723 Update firefox to spec.
is(channel.readyState, "open", "subsequent readyState is 'open'");
}
var wrapper = new DataChannelWrapper(channel, this);
this.dataChannels.push(wrapper);
return wrapper;