Bug 1119593 - Update PeerConnection tests, r=drno,jib

--HG--
extra : rebase_source : 1ee4d19bdc88bfc7a5bbe782a1fe9e04f4179bcb
This commit is contained in:
Martin Thomson 2015-01-21 14:34:13 -08:00
parent 710f4a1030
commit 4c33305998
15 changed files with 261 additions and 341 deletions

View File

@ -23,20 +23,18 @@
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
test.chain.append([[ test.chain.append([
"PC_LOCAL_ADD_CANDIDATE", function PC_LOCAL_ADD_CANDIDATE(test) {
function (test) { var candidate = new mozRTCIceCandidate(
test.pcLocal.addIceCandidateAndFail( {candidate:"1 1 UDP 2130706431 192.168.2.1 50005 typ host",
new mozRTCIceCandidate( sdpMLineIndex: 1});
{candidate:"1 1 UDP 2130706431 192.168.2.1 50005 typ host", return test.pcLocal._pc.addIceCandidate(candidate).then(
sdpMLineIndex: 1}), generateErrorCallback("addIceCandidate should have failed."),
function(err) { err => {
is(err.name, "InvalidStateError", "Error is InvalidStateError"); is(err.name, "InvalidStateError", "Error is InvalidStateError");
test.next(); });
} ); }
} ]);
]]);
test.run(); test.run();
}); });
</script> </script>

View File

@ -21,77 +21,40 @@
runNetworkTest(function (options) { runNetworkTest(function (options) {
test = new PeerConnectionTest(options); test = new PeerConnectionTest(options);
test.chain.append([ test.chain.append([
[ function PC_LOCAL_SETUP_NEGOTIATION_CALLBACK(test) {
'PC_LOCAL_SETUP_NEGOTIATION_CALLBACK',
function (test) {
test.pcLocal.onNegotiationneededFired = false; test.pcLocal.onNegotiationneededFired = false;
test.pcLocal._pc.onnegotiationneeded = function (anEvent) { test.pcLocal._pc.onnegotiationneeded = anEvent => {
info("pcLocal.onnegotiationneeded fired"); info("pcLocal.onnegotiationneeded fired");
test.pcLocal.onNegotiationneededFired = true; test.pcLocal.onNegotiationneededFired = true;
}; };
test.next(); },
} function PC_LOCAL_ADD_SECOND_STREAM(test) {
], return test.pcLocal.getAllUserMedia([{audio: true}]);
[ },
'PC_LOCAL_ADD_SECOND_STREAM', function PC_LOCAL_CREATE_NEW_OFFER(test) {
function (test) {
test.pcLocal.getAllUserMedia([{audio: true}], function () {
test.next();
});
}
],
[
'PC_LOCAL_CREATE_NEW_OFFER',
function (test) {
ok(test.pcLocal.onNegotiationneededFired, "onnegotiationneeded"); ok(test.pcLocal.onNegotiationneededFired, "onnegotiationneeded");
test.createOffer(test.pcLocal, function (offer) { return test.createOffer(test.pcLocal).then(offer => {
test._new_offer = offer; test._new_offer = offer;
test.next();
}); });
} },
], function PC_LOCAL_SET_NEW_LOCAL_DESCRIPTION(test) {
[ return test.setLocalDescription(test.pcLocal, test._new_offer, HAVE_LOCAL_OFFER);
'PC_LOCAL_SET_NEW_LOCAL_DESCRIPTION', },
function (test) { function PC_REMOTE_SET_NEW_REMOTE_DESCRIPTION(test) {
test.setLocalDescription(test.pcLocal, test._new_offer, HAVE_LOCAL_OFFER, function () { return test.setRemoteDescription(test.pcRemote, test._new_offer, HAVE_REMOTE_OFFER);
test.next(); },
}); function PC_REMOTE_CREATE_NEW_ANSWER(test) {
} return test.createAnswer(test.pcRemote).then(answer => {
],
[
'PC_REMOTE_SET_NEW_REMOTE_DESCRIPTION',
function (test) {
test.setRemoteDescription(test.pcRemote, test._new_offer, HAVE_REMOTE_OFFER, function () {
test.next();
});
}
],
[
'PC_REMOTE_CREATE_NEW_ANSWER',
function (test) {
test.createAnswer(test.pcRemote, function (answer) {
test._new_answer = answer; test._new_answer = answer;
test.next();
}); });
},
function PC_REMOTE_SET_NEW_LOCAL_DESCRIPTION(test) {
return test.setLocalDescription(test.pcRemote, test._new_answer, STABLE);
},
function PC_LOCAL_SET_NEW_REMOTE_DESCRIPTION(test) {
return test.setRemoteDescription(test.pcLocal, test._new_answer, STABLE);
} }
], // TODO(bug 1093835): figure out how to verify if media flows through the new stream
[
'PC_REMOTE_SET_NEW_LOCAL_DESCRIPTION',
function (test) {
test.setLocalDescription(test.pcRemote, test._new_answer, STABLE, function () {
test.next();
});
}
],
[
'PC_LOCAL_SET_NEW_REMOTE_DESCRIPTION',
function (test) {
test.setRemoteDescription(test.pcLocal, test._new_answer, STABLE, function () {
test.next();
});
}
]
// TODO(bug 1093835): figure out how to verify if media flows through the new stream
]); ]);
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run(); test.run();

View File

@ -22,17 +22,17 @@
var test; var test;
runNetworkTest(function (options) { runNetworkTest(function (options) {
test = new PeerConnectionTest(options); test = new PeerConnectionTest(options);
test.chain.insertAfter('PC_LOCAL_CREATE_OFFER', test.chain.insertAfter(
[['PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER', 'PC_LOCAL_CREATE_OFFER',
function (test) { [
test.originalOffer.sdp = test.originalOffer.sdp.replace( function PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER(test) {
/a=group:BUNDLE .*\r\n/g, test.originalOffer.sdp = test.originalOffer.sdp.replace(
"" /a=group:BUNDLE .*\r\n/g,
); ""
info("Updated no bundle offer: " + JSON.stringify(test.originalOffer)); );
test.next(); info("Updated no bundle offer: " + JSON.stringify(test.originalOffer));
} }
]]); ]);
test.setMediaConstraints([{audio: true}, {video: true}], test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]); [{audio: true}, {video: true}]);
test.run(); test.run();

View File

@ -25,16 +25,14 @@
test.setMediaConstraints([{video: true}], [{video: true}]); test.setMediaConstraints([{video: true}], [{video: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
test.chain.append([[ test.chain.append([
"PC_LOCAL_VERIFY_H264_OFFER", function PC_LOCAL_VERIFY_H264_OFFER(test) {
function (test) {
ok(!test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=0x42e0"), ok(!test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=0x42e0"),
"H264 offer does not contain profile-level-id=0x42e0"); "H264 offer does not contain profile-level-id=0x42e0");
ok(test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=42e0"), ok(test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=42e0"),
"H264 offer contains profile-level-id=42e0"); "H264 offer contains profile-level-id=42e0");
test.next();
} }
]]); ]);
test.run(); test.run();
}); });

View File

@ -16,56 +16,59 @@
title: "Ensure that localDescription and remoteDescription are null after close" title: "Ensure that localDescription and remoteDescription are null after close"
}); });
var steps = [ var steps = [
[ function CHECK_SDP_ON_CLOSED_PC(test) {
"CHECK_SDP_ON_CLOSED_PC", var description;
function (test) { var exception = null;
var description;
var exception = null;
// handle the event which the close() triggers // handle the event which the close() triggers
test.pcLocal.onsignalingstatechange = function (e) { var localClosed = new Promise(resolve => {
is(e.target.signalingState, "closed", test.pcLocal.onsignalingstatechange = e => {
"Received expected onsignalingstatechange event on 'closed'"); is(e.target.signalingState, "closed",
} "Received expected onsignalingstatechange event on 'closed'");
resolve();
test.pcLocal.close();
try { description = test.pcLocal.localDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access localDescription of pcLocal after close throws exception");
exception = null;
try { description = test.pcLocal.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcLocal after close throws exception");
exception = null;
// handle the event which the close() triggers
test.pcRemote.onsignalingstatechange = function (e) {
is(e.target.signalingState, "closed",
"Received expected onsignalingstatechange event on 'closed'");
}
test.pcRemote.close();
try { description = test.pcRemote.localDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access localDescription of pcRemote after close throws exception");
exception = null;
try { description = test.pcRemote.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcRemote after close throws exception");
test.next();
} }
] });
];
var test; test.pcLocal.close();
runNetworkTest(function () {
test = new PeerConnectionTest(); try { description = test.pcLocal.localDescription; } catch (e) { exception = e; }
test.setMediaConstraints([{audio: true}], [{audio: true}]); ok(exception, "Attempt to access localDescription of pcLocal after close throws exception");
test.chain.append(steps); exception = null;
test.run();
}); try { description = test.pcLocal.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcLocal after close throws exception");
exception = null;
// handle the event which the close() triggers
var remoteClosed = new Promise(resolve => {
test.pcRemote.onsignalingstatechange = e => {
is(e.target.signalingState, "closed",
"Received expected onsignalingstatechange event on 'closed'");
resolve();
}
});
test.pcRemote.close();
try { description = test.pcRemote.localDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access localDescription of pcRemote after close throws exception");
exception = null;
try { description = test.pcRemote.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcRemote after close throws exception");
return Promise.all([localClosed, remoteClosed]);
}
];
var test;
runNetworkTest(() => {
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.append(steps);
test.run();
});
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -19,36 +19,32 @@
visible: true visible: true
}); });
var metadataLoaded = new Promise(resolve => { var metadataLoaded = new Promise(resolve => {
if (v1.readyState < v1.HAVE_METADATA) { if (v1.readyState < v1.HAVE_METADATA) {
v1.onloadedmetadata = e => resolve(); v1.onloadedmetadata = resolve;
return; } else {
}
resolve(); resolve();
}); }
});
runNetworkTest(function() { runNetworkTest(function() {
var test = new PeerConnectionTest(); var test = new PeerConnectionTest();
test.setOfferOptions({ offerToReceiveVideo: false, test.setOfferOptions({ offerToReceiveVideo: false,
offerToReceiveAudio: false }); offerToReceiveAudio: false });
test.chain.insertAfter("PC_LOCAL_GUM", [["PC_LOCAL_CAPTUREVIDEO", function (test) { test.chain.insertAfter("PC_LOCAL_GUM", [
metadataLoaded function PC_LOCAL_CAPTUREVIDEO(test) {
.then(function() { return metadataLoaded
var stream = v1.mozCaptureStreamUntilEnded(); .then(() => {
is(stream.getTracks().length, 2, "Captured stream has 2 tracks"); var stream = v1.mozCaptureStreamUntilEnded();
stream.getTracks().forEach(tr => test.pcLocal._pc.addTrack(tr, stream)); is(stream.getTracks().length, 2, "Captured stream has 2 tracks");
test.pcLocal.constraints = [{ video: true, audio:true }]; // fool tests stream.getTracks().forEach(tr => test.pcLocal._pc.addTrack(tr, stream));
test.next(); test.pcLocal.constraints = [{ video: true, audio:true }]; // fool tests
}) });
.catch(function(reason) {
ok(false, "unexpected failure: " + reason);
SimpleTest.finish();
});
} }
]]); ]);
test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT"); test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
test.run(); test.run();
}); });
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -31,27 +31,23 @@
test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT"); test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
var flowtest = test.chain.remove("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT"); var flowtest = test.chain.remove("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
test.chain.append(flowtest); test.chain.append(flowtest);
test.chain.append([["PC_LOCAL_REPLACE_VIDEOTRACK", test.chain.append([
function (test) { function PC_LOCAL_REPLACE_VIDEOTRACK(test) {
var stream = test.pcLocal._pc.getLocalStreams()[0]; var stream = test.pcLocal._pc.getLocalStreams()[0];
var track = stream.getVideoTracks()[0]; var track = stream.getVideoTracks()[0];
var sender = test.pcLocal._pc.getSenders().find(isSenderOfTrack, track); var sender = test.pcLocal._pc.getSenders().find(isSenderOfTrack, track);
ok(sender, "track has a sender"); ok(sender, "track has a sender");
var newtrack; var newtrack;
navigator.mediaDevices.getUserMedia({video:true, fake: true}) return navigator.mediaDevices.getUserMedia({video:true, fake: true})
.then(function(newStream) { .then(newStream => {
newtrack = newStream.getVideoTracks()[0]; newtrack = newStream.getVideoTracks()[0];
return sender.replaceTrack(newtrack); return sender.replaceTrack(newtrack);
}) })
.then(function() { .then(() => {
is(sender.track, newtrack, "sender.track has been replaced"); is(sender.track, newtrack, "sender.track has been replaced");
}) });
.catch(function(reason) {
ok(false, "unexpected error = " + reason.message);
})
.then(test.next.bind(test));
} }
]]); ]);
test.chain.append(flowtest); test.chain.append(flowtest);
test.run(); test.run();

View File

@ -17,26 +17,24 @@
title: "setLocalDescription (answer) in 'have-local-offer'" title: "setLocalDescription (answer) in 'have-local-offer'"
}); });
var test; var test;
runNetworkTest(function () { runNetworkTest(function () {
test = new PeerConnectionTest(); test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
test.chain.append([[ test.chain.append([
"PC_LOCAL_SET_LOCAL_ANSWER", function PC_LOCAL_SET_LOCAL_ANSWER(test) {
function (test) { test.pcLocal._latest_offer.type = "answer";
test.pcLocal._latest_offer.type="answer"; return test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer)
test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer, .then(err => {
function(err) { is(err.name, "InvalidStateError", "Error is InvalidStateError");
is(err.name, "InvalidStateError", "Error is InvalidStateError"); });
test.next(); }
} ); ]);
}
]]);
test.run(); test.run();
}); });
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -17,26 +17,24 @@
title: "setLocalDescription (answer) in 'stable'" title: "setLocalDescription (answer) in 'stable'"
}); });
var test; var test;
runNetworkTest(function () { runNetworkTest(function () {
test = new PeerConnectionTest(); test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
test.chain.append([[ test.chain.append([
"PC_LOCAL_SET_LOCAL_ANSWER", function PC_LOCAL_SET_LOCAL_ANSWER(test) {
function (test) { test.pcLocal._latest_offer.type = "answer";
test.pcLocal._latest_offer.type="answer"; return test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer)
test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer, .then(err => {
function(err) { is(err.name, "InvalidStateError", "Error is InvalidStateError");
is(err.name, "InvalidStateError", "Error is InvalidStateError"); });
test.next(); }
} ); ]);
}
]]);
test.run(); test.run();
}); });
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -17,25 +17,23 @@
title: "setLocalDescription (offer) in 'have-remote-offer'" title: "setLocalDescription (offer) in 'have-remote-offer'"
}); });
var test; var test;
runNetworkTest(function () { runNetworkTest(function () {
test = new PeerConnectionTest(); test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION"); test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION");
test.chain.append([[ test.chain.append([
"PC_REMOTE_SET_LOCAL_OFFER", function PC_REMOTE_SET_LOCAL_OFFER(test) {
function (test) { test.pcRemote.setLocalDescriptionAndFail(test.pcLocal._latest_offer)
test.pcRemote.setLocalDescriptionAndFail(test.pcLocal._latest_offer, .then(err => {
function(err) { is(err.name, "InvalidStateError", "Error is InvalidStateError");
is(err.name, "InvalidStateError", "Error is InvalidStateError"); });
test.next(); }
} ); ]);
}
]]);
test.run(); test.run();
}); });
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -17,26 +17,24 @@
title: "setRemoteDescription (answer) in 'have-remote-offer'" title: "setRemoteDescription (answer) in 'have-remote-offer'"
}); });
var test; var test;
runNetworkTest(function () { runNetworkTest(function () {
test = new PeerConnectionTest(); test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION"); test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION");
test.chain.append([[ test.chain.append([
"PC_REMOTE_SET_REMOTE_ANSWER", function PC_REMOTE_SET_REMOTE_ANSWER(test) {
function (test) { test.pcLocal._latest_offer.type = "answer";
test.pcLocal._latest_offer.type="answer"; test.pcRemote._pc.setRemoteDescription(test.pcLocal._latest_offer)
test.pcRemote.setRemoteDescriptionAndFail(test.pcLocal._latest_offer, .then(generateErrorCallback('setRemoteDescription should fail'),
function(err) { err =>
is(err.name, "InvalidStateError", "Error is InvalidStateError"); is(err.name, "InvalidStateError", "Error is InvalidStateError"));
test.next(); }
} ); ]);
}
]]);
test.run(); test.run();
}); });
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -17,26 +17,24 @@
title: "setRemoteDescription (answer) in 'stable'" title: "setRemoteDescription (answer) in 'stable'"
}); });
var test; var test;
runNetworkTest(function () { runNetworkTest(function () {
test = new PeerConnectionTest(); test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
test.chain.append([[ test.chain.append([
"PC_LOCAL_SET_REMOTE_ANSWER", function PC_LOCAL_SET_REMOTE_ANSWER(test) {
function (test) { test.pcLocal._latest_offer.type = "answer";
test.pcLocal._latest_offer.type="answer"; test.pcLocal._pc.setRemoteDescription(test.pcLocal._latest_offer)
test.pcLocal.setRemoteDescriptionAndFail(test.pcLocal._latest_offer, .then(generateErrorCallback('setRemoteDescription should fail'),
function(err) { err =>
is(err.name, "InvalidStateError", "Error is InvalidStateError"); is(err.name, "InvalidStateError", "Error is InvalidStateError"));
test.next(); }
} ); ]);
}
]]);
test.run(); test.run();
}); });
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -17,25 +17,23 @@
title: "setRemoteDescription (offer) in 'have-local-offer'" title: "setRemoteDescription (offer) in 'have-local-offer'"
}); });
var test; var test;
runNetworkTest(function () { runNetworkTest(function () {
test = new PeerConnectionTest(); test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]); test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
test.chain.append([[ test.chain.append([
"PC_LOCAL_SET_REMOTE_OFFER", function PC_LOCAL_SET_REMOTE_OFFER(test) {
function (test) { test.pcLocal._pc.setRemoteDescription(test.pcLocal._latest_offer)
test.pcLocal.setRemoteDescriptionAndFail(test.pcLocal._latest_offer, .then(generateErrorCallback('setRemoteDescription should fail'),
function(err) { err =>
is(err.name, "InvalidStateError", "Error is InvalidStateError"); is(err.name, "InvalidStateError", "Error is InvalidStateError"));
test.next(); }
} ); ]);
}
]]);
test.run(); test.run();
}); });
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -18,62 +18,40 @@
visible: true visible: true
}); });
// Test setDescription without callbacks, which many webrtc examples still do // Test setDescription without callbacks, which many webrtc examples still do
var pc1_local = function PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC(test) {
[[ test.pcLocal.onsignalingstatechange = function() {};
'PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC', test.pcLocal._pc.setLocalDescription(test.originalOffer);
function (test) { }
test.pcLocal.onsignalingstatechange = function() {};
test.pcLocal.setLocalDescription(test.originalOffer);
test.next();
}
]];
var pc2_remote = function PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC(test) {
[[ test.pcRemote.onsignalingstatechange = function() {};
'PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC', test.pcRemote._pc.setRemoteDescription(test._local_offer);
function (test) { }
test.pcRemote.onsignalingstatechange = function() {}; function PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC(test) {
test.pcRemote.setRemoteDescription(test._local_offer); test.pcRemote.onsignalingstatechange = function() {};
test.next(); test.pcRemote._pc.setLocalDescription(test.originalAnswer);
} }
]]; function PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC(test) {
test.pcLocal.onsignalingstatechange = function() {};
test.pcLocal._pc.setRemoteDescription(test._remote_answer);
}
var pc2_local = runNetworkTest(() => {
[[ var replace = (test, name, command) => {
'PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC', test.chain.insertAfter(name, command);
function (test) { test.chain.remove(name);
test.pcRemote.onsignalingstatechange = function() {}; }
test.pcRemote.setLocalDescription(test.originalAnswer);
test.next();
}
]];
var pc1_remote = var test = new PeerConnectionTest();
[[ test.setMediaConstraints([{video: true}], [{video: true}]);
'PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC', test.chain.replace(test, "PC_LOCAL_SET_LOCAL_DESCRIPTION", PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC);
function (test) { test.chain.replace(test, "PC_REMOTE_SET_REMOTE_DESCRIPTION", PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC);
test.pcLocal.onsignalingstatechange = function() {}; test.chain.replace(test, "PC_REMOTE_SET_LOCAL_DESCRIPTION", PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC);
test.pcLocal.setRemoteDescription(test._remote_answer); test.chain.replace(test, "PC_LOCAL_SET_REMOTE_DESCRIPTION", PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC);
test.next(); test.run();
} });
]];
runNetworkTest(function () {
function replace(test, name, command) {
test.chain.insertAfter(name, command);
test.chain.remove(name);
}
var test = new PeerConnectionTest();
test.setMediaConstraints([{video: true}], [{video: true}]);
replace(test, "PC_LOCAL_SET_LOCAL_DESCRIPTION", pc1_local);
replace(test, "PC_REMOTE_SET_REMOTE_DESCRIPTION", pc2_remote);
replace(test, "PC_REMOTE_SET_LOCAL_DESCRIPTION", pc2_local);
replace(test, "PC_LOCAL_SET_REMOTE_DESCRIPTION", pc1_remote);
test.run();
});
</script> </script>
</pre> </pre>
</body> </body>

View File

@ -29,9 +29,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=872377
if (typeof(rtcSession[key]) == "function") continue; if (typeof(rtcSession[key]) == "function") continue;
is(rtcSession[key], jsonCopy[key], "key " + key + " should match."); is(rtcSession[key], jsonCopy[key], "key " + key + " should match.");
} }
/** Test for Bug 928304 **/ /** Test for Bug 928304 **/
var rtcIceCandidate = new mozRTCIceCandidate({ candidate: "dummy", var rtcIceCandidate = new mozRTCIceCandidate({ candidate: "dummy",
sdpMid: "test", sdpMid: "test",
sdpMLineIndex: 3 }); sdpMLineIndex: 3 });