--- a/dom/media/tests/mochitest/dataChannel.js
+++ b/dom/media/tests/mochitest/dataChannel.js
@@ -14,17 +14,17 @@ function getBlobContent(blob) {
// Listen for 'onloadend' which will always be called after a success or failure
reader.onloadend = event => resolve(event.target.result);
reader.readAsText(blob);
});
}
var commandsCreateDataChannel = [
function PC_REMOTE_EXPECT_DATA_CHANNEL(test) {
- test.pcRemote.expectDataChannel();
+ test.pcRemote.expectDataChannel("PC_REMOTE: expected initial data channel");
},
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,
@@ -168,24 +168,25 @@ var commandsCheckDataChannel = [
}
];
var commandsCheckLargeXfer = [
function SEND_BIG_BUFFER(test) {
var size = 512*1024; // SCTP internal buffer is 256K, so we'll have ~256K queued
var buffer = new ArrayBuffer(size);
// note: type received is always blob for binary data
- var options = {};
- options.bufferedAmountLowThreshold = 64*1024;
+ var options = {
+ sourceChannel: test.pcRemote.dataChannels[0],
+ targetChannel: test.pcLocal.dataChannels[0],
+ bufferedAmountLowThreshold: 64*1024
+ };
return test.send(buffer, options).then(result => {
ok(result.data instanceof Blob, "Received data is of instance Blob");
is(result.data.size, size, "Received data has the correct size.");
});
},
];
function addInitialDataChannel(chain) {
chain.insertBefore('PC_LOCAL_CREATE_OFFER', commandsCreateDataChannel);
- chain.insertBefore('PC_LOCAL_WAIT_FOR_MEDIA_FLOW', commandsWaitForDataChannel);
- chain.removeAfter('PC_REMOTE_CHECK_ICE_CONNECTIONS');
- chain.append(commandsCheckLargeXfer);
+ chain.insertAfter('PC_REMOTE_WAIT_FOR_ICE_CONNECTED', commandsWaitForDataChannel);
chain.append(commandsCheckDataChannel);
}
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -2,16 +2,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var Cc = SpecialPowers.Cc;
var Ci = SpecialPowers.Ci;
+const isAndroid = !!navigator.userAgent.includes("Android");
+const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
+
+
// Specifies whether we are using fake streams to run this automation
var FAKE_ENABLED = true;
var TEST_AUDIO_FREQ = 1000;
try {
var audioDevice = SpecialPowers.getCharPref('media.audio_loopback_dev');
var videoDevice = SpecialPowers.getCharPref('media.video_loopback_dev');
dump('TEST DEVICES: Using media devices:\n');
dump('audio: ' + audioDevice + '\nvideo: ' + videoDevice + '\n');
@@ -321,17 +325,16 @@ function setupEnvironment() {
['media.navigator.streams.fake', FAKE_ENABLED],
['media.getusermedia.screensharing.enabled', true],
['media.getusermedia.screensharing.allowed_domains', "mochi.test"],
['media.getusermedia.audiocapture.enabled', true],
['media.recorder.audio_node.enabled', true]
]
};
- const isAndroid = !!navigator.userAgent.includes("Android");
if (isAndroid) {
defaultMochitestPrefs.set.push(
["media.navigator.video.default_width", 320],
["media.navigator.video.default_height", 240],
["media.navigator.video.max_fr", 10],
["media.autoplay.enabled", true]
);
@@ -364,19 +367,24 @@ function run_test(is_initiator,timeout)
s.onload = () => setTestOptions(options);
document.head.appendChild(s);
}
function runTestWhenReady(testFunc) {
setupEnvironment();
return testConfigured.then(options => testFunc(options))
.catch(e => {
- ok(false, 'Error executing test: ' + e +
- ((typeof e.stack === 'string') ?
- (' ' + e.stack.split('\n').join(' ... ')) : ''));
+ if (e) {
+ ok(false, 'Error execution test: ' + e +
+ ((typeof e.stack === 'string') ?
+ (' ' + e.stack.split('\n').join(' ... ')) : ''));
+ } else {
+ ok(false, 'Caught exception without error object;' +
+ ' don\'t use Promise.reject() without a new Error("some reason")');
+ }
SimpleTest.finish();
});
}
/**
* Checks that the media stream tracks have the expected amount of tracks
* with the correct kind and id based on the type and constraints given.
@@ -727,20 +735,26 @@ CommandChain.prototype = {
throw new Error('registered non-function' + next);
}
return prev.then(() => {
info('Run step ' + (i + 1) + ': ' + next.name);
return Promise.race([ next(this._framework), rejectOnUnexpectedEvent ]);
});
}, Promise.resolve())
- .catch(e =>
- ok(false, 'Error in test execution: ' + e +
- ((typeof e.stack === 'string') ?
- (' ' + e.stack.split('\n').join(' ... ')) : '')));
+ .catch(e => {
+ if (e) {
+ ok(false, 'Error in test execution: ' + e +
+ ((typeof e.stack === 'string') ?
+ (' ' + e.stack.split('\n').join(' ... ')) : ''));
+ } else {
+ ok(false, 'Caught exception without error object;' +
+ ' don\'t use Promise.reject() without a new Error("some reason")');
+ }
+ });
},
/**
* Add new commands to the end of the chain
*/
append: function(commands) {
this.commands = this.commands.concat(commands);
},
@@ -887,17 +901,17 @@ AudioStreamHelper.prototype = {
return this.checkAudio(stream, analyser, array => array[freq] > 200);
},
checkAudioNotFlowing: function(stream) {
var analyser = new AudioStreamAnalyser(this._context, stream);
var freq = analyser.binIndexForFrequency(TEST_AUDIO_FREQ);
return this.checkAudio(stream, analyser, array => array[freq] < 50);
}
-}
+};
function VideoStreamHelper() {
this._helper = new CaptureStreamTestHelper2D(50,50);
this._canvas = this._helper.createAndAppendElement('canvas', 'source_canvas');
// Make sure this is initted
this._helper.drawColor(this._canvas, this._helper.green);
this._stream = this._canvas.captureStream(10);
}
@@ -939,32 +953,17 @@ VideoStreamHelper.prototype = {
},
verifyNoFrames: function(canvas) {
return this.waitForFrames(canvas).then(
() => ok(false, "Color should not change"),
() => ok(true, "Color should not change")
);
}
-}
-
-
-function IsMacOSX10_6orOlder() {
- if (navigator.platform.indexOf("Mac") !== 0) {
- return false;
- }
-
- var version = Cc["@mozilla.org/system-info;1"]
- .getService(Ci.nsIPropertyBag2)
- .getProperty("version");
- // the next line is correct: Mac OS 10.6 corresponds to Darwin version 10.x !
- // Mac OS 10.7 is Darwin version 11.x. the |version| string we've got here
- // is the Darwin version.
- return (parseFloat(version) < 11.0);
-}
+};
(function(){
var el = document.createElement("link");
el.rel = "stylesheet";
el.type = "text/css";
el.href= "/tests/SimpleTest/test.css";
document.head.appendChild(el);
}());
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -23,20 +23,37 @@ const signalingStateTransitions = {
"stable": ["have-local-offer", "have-remote-offer", "closed"],
"have-local-offer": ["have-remote-pranswer", "stable", "closed", "have-local-offer"],
"have-remote-pranswer": ["stable", "closed", "have-remote-pranswer"],
"have-remote-offer": ["have-local-pranswer", "stable", "closed", "have-remote-offer"],
"have-local-pranswer": ["stable", "closed", "have-local-pranswer"],
"closed": []
}
-var makeDefaultCommands = () => {
- return [].concat(commandsPeerConnectionInitial,
- commandsGetUserMedia,
- commandsPeerConnectionOfferAnswer);
+
+var optionsToCmds = options => {
+ var cmds = [];
+ if (options.enableVerifyMedia) {
+ cmds = cmds.concat(commandsPeerConnectionVerifyMediaFlowing);
+ }
+ if (options.enableStatsChecks) {
+ cmds = cmds.concat(commandsPeerConnectionStatsChecks);
+ }
+ if (options.enableIceChecks) {
+ cmds = cmds.concat(commandsPeerConnectionIceChecks);
+ }
+ return cmds;
+};
+
+var makeDefaultCommands = options => {
+ var cmds = [].concat(commandsPeerConnectionInitial,
+ commandsGetUserMedia,
+ commandsPeerConnectionOfferAnswer);
+ cmds = cmds.concat(optionsToCmds(options));
+ return cmds;
};
/**
* This class handles tests for peer connections.
*
* @constructor
* @param {object} [options={}]
* Optional options for the peer connection test
@@ -47,28 +64,29 @@ var makeDefaultCommands = () => {
* @param {bool} [options.is_remote=true]
* true if this test should run the tests for the "remote" side.
* @param {object} [options.config_local=undefined]
* Configuration for the local peer connection instance
* @param {object} [options.config_remote=undefined]
* Configuration for the remote peer connection instance. If not defined
* the configuration from the local instance will be used
*/
-function PeerConnectionTest(options) {
+function PeerConnectionTest(options = {}) {
// If no options are specified make it an empty object
- options = options || { };
- options.commands = options.commands || makeDefaultCommands();
+ options.commands = options.commands || makeDefaultCommands(options);
options.is_local = "is_local" in options ? options.is_local : true;
options.is_remote = "is_remote" in options ? options.is_remote : true;
options.h264 = "h264" in options ? options.h264 : false;
options.bundle = "bundle" in options ? options.bundle : true;
options.rtcpmux = "rtcpmux" in options ? options.rtcpmux : true;
options.opus = "opus" in options ? options.opus : true;
+ options.logging = "logging" in options ? options.logging : false;
+
if (iceServersArray.length) {
if (!options.turn_disabled_local) {
options.config_local = options.config_local || {}
options.config_local.iceServers = iceServersArray;
}
if (!options.turn_disabled_remote) {
options.config_remote = options.config_remote || {}
options.config_remote.iceServers = iceServersArray;
@@ -118,16 +136,34 @@ function timerGuard(p, time, message) {
return Promise.race([
p,
wait(time).then(() => {
throw new Error('timeout after ' + (time / 1000) + 's: ' + message);
})
]);
}
+PeerConnectionTest.prototype.addRenegotiation = function(pre, post) {
+ this.chain.append(pre);
+ this.chain.append(commandsPeerConnectionOfferAnswer);
+ this.chain.append(optionsToCmds(this.testOptions));
+ if (post) {
+ this.chain.append(post);
+ }
+};
+
+PeerConnectionTest.prototype.addRenegotiationAnswerer = function(pre, post) {
+ this.chain.append(function SWAP_PC_LOCAL_PC_REMOTE(test) {
+ var temp = test.pcLocal;
+ test.pcLocal = test.pcRemote;
+ test.pcRemote = temp;
+ });
+ this.addRenegotiation(pre, post);
+};
+
/**
* Closes the peer connection if it is active
*/
PeerConnectionTest.prototype.closePC = function() {
info("Closing peer connections");
var closeIt = pc => {
if (!pc || pc.signalingState === "closed") {
@@ -248,19 +284,19 @@ PeerConnectionTest.prototype.send = func
bufferlow_fired = false;
source.onbufferedamountlow = function() {
bufferlow_fired = true;
};
}
return new Promise(resolve => {
// Register event handler for the target channel
- target.onmessage = e => {
- ok(bufferlow_fired, "bufferedamountlow event fired");
- resolve({ channel: target, data: e.data });
+ target.onmessage = e => {
+ ok(bufferlow_fired, "bufferedamountlow event fired");
+ resolve({ channel: target, data: e.data });
};
source.send(data);
});
};
/**
* Create a data channel
@@ -468,25 +504,34 @@ PeerConnectionTest.prototype.run = funct
this.updateChainSteps();
var finished = () => {
if (window.SimpleTest) {
networkTestFinished();
} else {
finish();
}
};
+ if (this.testOptions.logging) {
+ SimpleTest.requestCompleteLog();
+ }
return this.chain.execute()
.then(() => this.close())
- .catch(e =>
- ok(false, 'Error in test execution: ' + e +
- ((typeof e.stack === 'string') ?
- (' ' + e.stack.split('\n').join(' ... ')) : '')))
+ .catch(e => {
+ if (e) {
+ ok(false, 'Error in test execution: ' + e +
+ ((typeof e.stack === 'string') ?
+ (' ' + e.stack.split('\n').join(' ... ')) : ''))
+ } else {
+ ok(false, 'Caught exception without error object;' +
+ ' don\'t use Promise.reject() without a new Error("some reason")');
+ }
+ })
.then(() => finished())
.catch(e =>
- ok(false, "Error in finished()"));
+ ok(false, "Error " + e + " in finished()"));
};
/**
* Routes ice candidates from one PCW to the other PCW
*/
PeerConnectionTest.prototype.iceCandidateHandler = function(caller, candidate) {
info("Received: " + JSON.stringify(candidate) + " from " + caller);
@@ -1028,17 +1073,17 @@ PeerConnectionWrapper.prototype = {
* Create a new data channel instance
*
* @param {Object} options
* Options which get forwarded to nsIPeerConnection.createDataChannel
* @returns {DataChannelWrapper} The created data channel
*/
createDataChannel : function(options) {
var label = 'channel_' + this.dataChannels.length;
- info(this + ": Create data channel '" + label);
+ info(this + ": Create data channel '" + label + "'");
if (!this.dataChannels.length) {
this.expectNegotiationNeeded();
}
var channel = this._pc.createDataChannel(label, options);
var wrapper = new DataChannelWrapper(channel, this);
this.dataChannels.push(wrapper);
return wrapper;
@@ -1524,18 +1569,16 @@ PeerConnectionWrapper.prototype = {
/**
* Checks that we are getting the media streams we expect.
*
* @param {object} stats
* The stats to check from this PeerConnectionWrapper
*/
checkStats : function(stats, twoMachines) {
- const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
-
// Use spec way of enumerating stats
var counters = {};
for (let [key, res] of stats) {
// validate stats
ok(res.id == key, "Coherent stats id");
var nowish = Date.now() + 1000; // TODO: clock drift observed
var minimum = this.whenCreated - 1000; // on Windows XP (Bug 979649)
if (isWinXP) {
--- a/dom/media/tests/mochitest/templates.js
+++ b/dom/media/tests/mochitest/templates.js
@@ -383,45 +383,27 @@ var commandsPeerConnectionOfferAnswer =
},
function PC_REMOTE_WAIT_FOR_ICE_CONNECTED(test) {
return test.pcRemote.waitForIceConnected()
.then(() => {
info(test.pcRemote + ": ICE connection state log: " + test.pcRemote.iceConnectionLog);
});
},
+];
+var commandsPeerConnectionIceChecks = [
function PC_LOCAL_VERIFY_ICE_GATHERING(test) {
return waitForAnIceCandidate(test.pcLocal);
},
function PC_REMOTE_VERIFY_ICE_GATHERING(test) {
return waitForAnIceCandidate(test.pcRemote);
},
- function PC_LOCAL_WAIT_FOR_MEDIA_FLOW(test) {
- return test.pcLocal.waitForMediaFlow();
- },
-
- function PC_REMOTE_WAIT_FOR_MEDIA_FLOW(test) {
- return test.pcRemote.waitForMediaFlow();
- },
-
- function PC_LOCAL_CHECK_STATS(test) {
- return test.pcLocal.getStats().then(stats => {
- test.pcLocal.checkStats(stats, test.testOptions.steeplechase);
- });
- },
-
- function PC_REMOTE_CHECK_STATS(test) {
- return test.pcRemote.getStats().then(stats => {
- test.pcRemote.checkStats(stats, test.testOptions.steeplechase);
- });
- },
-
function PC_LOCAL_CHECK_ICE_CONNECTION_TYPE(test) {
return test.pcLocal.getStats().then(stats => {
test.pcLocal.checkStatsIceConnectionType(stats,
test.testOptions.expectedLocalCandidateType);
});
},
function PC_REMOTE_CHECK_ICE_CONNECTION_TYPE(test) {
@@ -444,82 +426,93 @@ var commandsPeerConnectionOfferAnswer =
return test.pcRemote.getStats().then(stats => {
test.pcRemote.checkStatsIceConnections(stats,
test._offer_constraints,
test._offer_options,
test.testOptions);
});
},
- function PC_LOCAL_CHECK_MSID(test) {
- return test.pcLocal.checkMsids();
- },
- function PC_REMOTE_CHECK_MSID(test) {
- return test.pcRemote.checkMsids();
- },
-
- function PC_LOCAL_CHECK_TRACK_STATS(test) {
- return checkAllTrackStats(test.pcLocal);
- },
- function PC_REMOTE_CHECK_TRACK_STATS(test) {
- return checkAllTrackStats(test.pcRemote);
- },
function PC_LOCAL_VERIFY_SDP_AFTER_END_OF_TRICKLE(test) {
if (test.pcLocal.endOfTrickleSdp) {
/* In case the endOfTrickleSdp promise is resolved already it will win the
* race because it gets evaluated first. But if endOfTrickleSdp is still
* pending the rejection will win the race. */
return Promise.race([
test.pcLocal.endOfTrickleSdp,
Promise.reject("No SDP")
])
.then(sdp => sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcLocal.label),
() => info("pcLocal: Gathering is not complete yet, skipping post-gathering SDP check"));
}
},
+
function PC_REMOTE_VERIFY_SDP_AFTER_END_OF_TRICKLE(test) {
if (test.pcRemote.endOfTrickleSdp) {
/* In case the endOfTrickleSdp promise is resolved already it will win the
* race because it gets evaluated first. But if endOfTrickleSdp is still
* pending the rejection will win the race. */
return Promise.race([
test.pcRemote.endOfTrickleSdp,
Promise.reject("No SDP")
])
.then(sdp => sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcRemote.label),
() => info("pcRemote: Gathering is not complete yet, skipping post-gathering SDP check"));
}
- }
+ },
+];
+
+var commandsPeerConnectionVerifyMediaFlowing = [
+ function PC_LOCAL_WAIT_FOR_MEDIA_FLOW(test) {
+ return test.pcLocal.waitForMediaFlow();
+ },
+
+ function PC_REMOTE_WAIT_FOR_MEDIA_FLOW(test) {
+ return test.pcRemote.waitForMediaFlow();
+ },
+];
+
+var commandsPeerConnectionStatsChecks = [
+ function PC_LOCAL_CHECK_STATS(test) {
+ return test.pcLocal.getStats().then(stats => {
+ test.pcLocal.checkStats(stats, test.testOptions.steeplechase);
+ });
+ },
+
+ function PC_REMOTE_CHECK_STATS(test) {
+ return test.pcRemote.getStats().then(stats => {
+ test.pcRemote.checkStats(stats, test.testOptions.steeplechase);
+ });
+ },
+
+ function PC_LOCAL_CHECK_MSID(test) {
+ return test.pcLocal.checkMsids();
+ },
+
+ function PC_REMOTE_CHECK_MSID(test) {
+ return test.pcRemote.checkMsids();
+ },
+
+ function PC_LOCAL_CHECK_TRACK_STATS(test) {
+ return checkAllTrackStats(test.pcLocal);
+ },
+
+ function PC_REMOTE_CHECK_TRACK_STATS(test) {
+ return checkAllTrackStats(test.pcRemote);
+ },
];
function PC_LOCAL_REMOVE_ALL_BUT_H264_FROM_OFFER(test) {
isnot(test.originalOffer.sdp.search("H264/90000"), -1, "H.264 should be present in the SDP offer");
test.originalOffer.sdp = sdputils.removeCodec(sdputils.removeCodec(sdputils.removeCodec(
- test.originalOffer.sdp, 120), 121, 97));
+ test.originalOffer.sdp, 120), 121, 97));
info("Updated H264 only offer: " + JSON.stringify(test.originalOffer));
};
function PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER(test) {
test.originalOffer.sdp = sdputils.removeBundle(test.originalOffer.sdp);
info("Updated no bundle offer: " + JSON.stringify(test.originalOffer));
};
function PC_LOCAL_REMOVE_RTCPMUX_FROM_OFFER(test) {
test.originalOffer.sdp = sdputils.removeRtcpMux(test.originalOffer.sdp);
info("Updated no RTCP-Mux offer: " + JSON.stringify(test.originalOffer));
};
-
-var addRenegotiation = (chain, commands, checks) => {
- chain.append(commands);
- chain.append(commandsPeerConnectionOfferAnswer);
- if (checks) {
- chain.append(checks);
- }
-};
-
-var addRenegotiationAnswerer = (chain, commands, checks) => {
- chain.append(function SWAP_PC_LOCAL_PC_REMOTE(test) {
- var temp = test.pcLocal;
- test.pcLocal = test.pcRemote;
- test.pcRemote = temp;
- });
- addRenegotiation(chain, commands, checks);
-};
--- a/dom/media/tests/mochitest/test_dataChannel_basicAudio.html
+++ b/dom/media/tests/mochitest/test_dataChannel_basicAudio.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796895",
title: "Basic data channel audio connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_dataChannel_basicAudioVideo.html
+++ b/dom/media/tests/mochitest/test_dataChannel_basicAudioVideo.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796891",
title: "Basic data channel audio/video connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.run();
});
</script>
--- a/dom/media/tests/mochitest/test_dataChannel_basicAudioVideoCombined.html
+++ b/dom/media/tests/mochitest/test_dataChannel_basicAudioVideoCombined.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796891",
title: "Basic data channel audio/video connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
test.setMediaConstraints([{audio: true, video: true}],
[{audio: true, video: true}]);
test.run();
});
</script>
--- a/dom/media/tests/mochitest/test_dataChannel_basicAudioVideoNoBundle.html
+++ b/dom/media/tests/mochitest/test_dataChannel_basicAudioVideoNoBundle.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1016476",
title: "Basic data channel audio/video connection without bundle"
});
var test;
-runNetworkTest(function (options) {
- options = options || { };
+runNetworkTest(function(options = {}) {
options.bundle = false;
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.run();
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_dataChannel_basicDataOnly.html
+++ b/dom/media/tests/mochitest/test_dataChannel_basicDataOnly.html
@@ -7,18 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796894",
title: "Basic datachannel only connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
+ test.chain.append(commandsCheckLargeXfer);
test.run();
});
</script>
</pre>
</body>
</html>
--- a/dom/media/tests/mochitest/test_dataChannel_basicVideo.html
+++ b/dom/media/tests/mochitest/test_dataChannel_basicVideo.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796889",
title: "Basic data channel video connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
test.setMediaConstraints([{video: true}], [{video: true}]);
test.run();
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_dataChannel_bug1013809.html
+++ b/dom/media/tests/mochitest/test_dataChannel_bug1013809.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796895",
title: "Basic data channel audio connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
addInitialDataChannel(test.chain);
var sld = test.chain.remove("PC_REMOTE_SET_LOCAL_DESCRIPTION");
test.chain.insertAfter("PC_LOCAL_SET_REMOTE_DESCRIPTION", sld);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
--- a/dom/media/tests/mochitest/test_dataChannel_noOffer.html
+++ b/dom/media/tests/mochitest/test_dataChannel_noOffer.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "856319",
title: "Don't offer m=application unless createDataChannel is called first"
});
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
var pc = new RTCPeerConnection();
// necessary to circumvent bug 864109
var options = { offerToReceiveAudio: true };
pc.createOffer(options).then(offer => {
ok(!offer.sdp.includes("m=application"),
"m=application is not contained in the SDP");
--- a/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicScreenshare.html
@@ -13,19 +13,18 @@
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
/**
* Run a test to verify that we can complete a start and stop media playback
* cycle for a screenshare LocalMediaStream on a video HTMLMediaElement.
*/
runTest(function () {
- const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
- if (IsMacOSX10_6orOlder() || isWinXP) {
- ok(true, "Screensharing disabled for OSX10.6 and WinXP");
+ if (isWinXP) {
+ ok(true, "Screensharing disabled for WinXP");
return;
}
var testVideo = createMediaElement('video', 'testVideo');
var constraints = {
video: {
mozMediaSource: "screen",
mediaSource: "screen"
--- a/dom/media/tests/mochitest/test_getUserMedia_basicTabshare.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicTabshare.html
@@ -12,19 +12,18 @@
});
/**
* Run a test to verify that we can complete a start and stop media playback
* cycle for a tabshare LocalMediaStream on a video HTMLMediaElement.
*
* Additionally, exercise applyConstraints code for tabshare viewport offset.
*/
runTest(function () {
- const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
- if (IsMacOSX10_6orOlder() || isWinXP) {
- ok(true, "Screensharing disabled for OSX10.6 and WinXP");
+ if (isWinXP) {
+ ok(true, "Screensharing disabled for WinXP");
return;
}
var testVideo = createMediaElement('video', 'testVideo');
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
return Promise.resolve()
.then(() => pushPrefs(["media.getusermedia.browser.enabled", true]))
.then(() => getUserMedia({
--- a/dom/media/tests/mochitest/test_getUserMedia_basicWindowshare.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_basicWindowshare.html
@@ -10,19 +10,18 @@
title: "getUserMedia Basic Windowshare Test",
bug: "1038926"
});
/**
* Run a test to verify that we can complete a start and stop media playback
* cycle for an screenshare LocalMediaStream on a video HTMLMediaElement.
*/
runTest(function () {
- const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
- if (IsMacOSX10_6orOlder() || isWinXP) {
- ok(true, "Screensharing disabled for OSX10.6 and WinXP");
+ if (isWinXP) {
+ ok(true, "Screensharing disabled for WinXP");
return;
}
var testVideo = createMediaElement('video', 'testVideo');
var constraints = {
video: {
mozMediaSource: "window",
mediaSource: "window"
},
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_audio.html
@@ -1,13 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
- <script type="application/javascript" src="head.js"></script>
</head>
<body>
<pre id="test">
<script>
createHTML({
bug: "1259788",
title: "Test CaptureStream audio content on HTMLMediaElement playing a gUM MediaStream",
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_tracks.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_tracks.html
@@ -1,13 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
- <script type="application/javascript" src="head.js"></script>
</head>
<body>
<pre id="test">
<script>
createHTML({
bug: "1259788",
title: "Test CaptureStream track output on HTMLMediaElement playing a gUM MediaStream",
--- a/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_video.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_mediaElementCapture_video.html
@@ -1,14 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
- <script type="application/javascript" src="head.js"></script>
</head>
<body>
<pre id="test">
<script>
createHTML({
bug: "1259788",
title: "Test CaptureStream video content on HTMLMediaElement playing a gUM MediaStream",
--- a/dom/media/tests/mochitest/test_getUserMedia_scarySources.html
+++ b/dom/media/tests/mochitest/test_getUserMedia_scarySources.html
@@ -28,19 +28,18 @@ let getDevices = async constraints => {
let devices = await new Promise((resolve, reject) =>
window.navigator.mozGetUserMediaDevices({}, resolve, reject,
innerWindowID, callID));
return devices.map(d => d.QueryInterface(Ci.nsIMediaDevice));
};
runTest(async () => {
try {
- const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
- if (IsMacOSX10_6orOlder() || isWinXP) {
- ok(true, "Screensharing disabled for OSX10.6 and WinXP");
+ if (isWinXP) {
+ ok(true, "Screensharing disabled for WinXP");
return;
}
await pushPrefs(["media.navigator.permission.disabled", true],
["media.navigator.permission.fake", true],
["media.navigator.permission.force", true]);
let devices = await getDevices({video: { mediaSource: "window" }});
ok(devices.length, "Found one or more windows.");
--- a/dom/media/tests/mochitest/test_ondevicechange.html
+++ b/dom/media/tests/mochitest/test_ondevicechange.html
@@ -36,17 +36,16 @@ function OnDeviceChangeEventNotReceived(
wait(RESPONSE_WAIT_TIME_MS)
]);
}
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
var videoTracks;
-SimpleTest.requestCompleteLog();
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("Fake devicechange event is fired periodically, \
so we need to wait a while to make sure the event is fired or not as we expect.");
var videoTracks;
function wait(time, message) {
return new Promise(r => setTimeout(() => r(message), time));
--- a/dom/media/tests/mochitest/test_peerConnection_addAudioTrackToExistingVideoStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addAudioTrackToExistingVideoStream.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1246310",
title: "Renegotiation: add audio track to existing video-only stream",
});
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest(options);
test.chain.replace("PC_LOCAL_GUM",
[
function PC_LOCAL_GUM_ATTACH_VIDEO_ONLY(test) {
var localConstraints = {audio: true, video: true};
test.setMediaConstraints([{video: true}], []);
return getUserMedia(localConstraints)
.then(s => test.originalGumStream = s)
@@ -25,17 +25,17 @@
.then(() => is(test.originalGumStream.getVideoTracks().length, 1,
"Should have 1 video track"))
.then(() => test.pcLocal.attachLocalTrack(
test.originalGumStream.getVideoTracks()[0],
test.originalGumStream));
},
]
);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ATTACH_SECOND_TRACK_AUDIO(test) {
test.setMediaConstraints([{audio: true, video: true}], []);
return test.pcLocal.attachLocalTrack(
test.originalGumStream.getAudioTracks()[0],
test.originalGumStream);
},
],
--- a/dom/media/tests/mochitest/test_peerConnection_addDataChannel.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addDataChannel.html
@@ -7,24 +7,23 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: add DataChannel"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
- commandsCreateDataChannel,
- commandsCheckDataChannel);
+ test.addRenegotiation(commandsCreateDataChannel,
+ commandsCheckDataChannel);
- // Insert before the second PC_LOCAL_WAIT_FOR_MEDIA_FLOW
- test.chain.insertBefore('PC_LOCAL_WAIT_FOR_MEDIA_FLOW',
+ // Insert after the second PC_REMOTE_WAIT_FOR_ICE_CONNECTED
+ test.chain.insertAfter('PC_REMOTE_WAIT_FOR_ICE_CONNECTED',
commandsWaitForDataChannel,
false,
1);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
--- a/dom/media/tests/mochitest/test_peerConnection_addDataChannelNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addDataChannelNoBundle.html
@@ -7,35 +7,35 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: add DataChannel"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.bundle = false;
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
commandsCreateDataChannel.concat(
[
function PC_LOCAL_EXPECT_ICE_CHECKING(test) {
test.pcLocal.expectIceChecking();
},
function PC_REMOTE_EXPECT_ICE_CHECKING(test) {
test.pcRemote.expectIceChecking();
},
]
),
commandsCheckDataChannel);
- // Insert before the second PC_LOCAL_WAIT_FOR_MEDIA_FLOW
- test.chain.insertBefore('PC_LOCAL_WAIT_FOR_MEDIA_FLOW',
+ // Insert after the second PC_REMOTE_WAIT_FOR_ICE_CONNECTED
+ test.chain.insertAfter('PC_REMOTE_WAIT_FOR_ICE_CONNECTED',
commandsWaitForDataChannel,
false,
1);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
--- a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1087551",
title: "addIceCandidate behavior (local and remote) including invalid data"
});
var test;
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_GET_ANSWER");
test.chain.insertAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION", [
function PC_LOCAL_ADD_CANDIDATE_EARLY(test) {
var candidate = {
candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
--- a/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: add second audio stream"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{audio: true}, {audio: true}],
[{audio: true}]);
return test.pcLocal.getAllUserMedia([{audio: true}]);
},
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStreamNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStreamNoBundle.html
@@ -7,21 +7,21 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: add second audio stream, no bundle"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.bundle = false;
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{audio: true}, {audio: true}],
[{audio: true}]);
// Since this is a NoBundle variant, adding a track will cause us to
// go back to checking.
test.pcLocal.expectIceChecking();
return test.pcLocal.getAllUserMedia([{audio: true}]);
--- a/dom/media/tests/mochitest/test_peerConnection_addSecondVideoStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addSecondVideoStream.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: add second video stream"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{video: true}, {video: true}],
[{video: true}]);
return test.pcLocal.getAllUserMedia([{video: true}]);
},
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_addSecondVideoStreamNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addSecondVideoStreamNoBundle.html
@@ -7,21 +7,20 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: add second video stream, no bundle"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.bundle = false;
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{video: true}, {video: true}],
[{video: true}]);
// Since this is a NoBundle variant, adding a track will cause us to
// go back to checking.
test.pcLocal.expectIceChecking();
return test.pcLocal.getAllUserMedia([{video: true}]);
--- a/dom/media/tests/mochitest/test_peerConnection_addtrack_removetrack_events.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addtrack_removetrack_events.html
@@ -8,20 +8,20 @@
<script type="application/javascript">
"use strict";
createHTML({
title: "MediaStream's 'addtrack' and 'removetrack' events with gUM",
bug: "1208328"
});
-runNetworkTest(function (options) {
+runNetworkTest(function(options = {}) {
let test = new PeerConnectionTest(options);
let eventsPromise;
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_SWAP_VIDEO_TRACKS(test) {
return getUserMedia({video: true}).then(stream => {
const localStream = test.pcLocal._pc.getLocalStreams()[0];
ok(localStream, "Should have local stream");
const remoteStream = test.pcRemote._pc.getRemoteStreams()[0];
ok(remoteStream, "Should have remote stream");
--- a/dom/media/tests/mochitest/test_peerConnection_answererAddSecondAudioStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_answererAddSecondAudioStream.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: answerer adds second audio stream"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiationAnswerer(test.chain,
+ test.addRenegotiationAnswerer(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{audio: true}, {audio: true}],
[{audio: true}]);
return test.pcLocal.getAllUserMedia([{audio: true}]);
},
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_audioRenegotiationInactiveAnswer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_audioRenegotiationInactiveAnswer.html
@@ -8,47 +8,44 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1213773",
title: "Renegotiation: answerer uses a=inactive for audio"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
var helper = new AudioStreamHelper();
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}], []);
test.chain.append([
function PC_REMOTE_CHECK_AUDIO_FLOWING() {
return helper.checkAudioFlowing(test.pcRemote._pc.getRemoteStreams()[0]);
}
]);
- addRenegotiation(test.chain, []);
+ test.addRenegotiation([]);
test.chain.insertAfter("PC_LOCAL_GET_ANSWER", [
function PC_LOCAL_REWRITE_REMOTE_SDP_INACTIVE(test) {
test._remote_answer.sdp =
sdputils.setAllMsectionsInactive(test._remote_answer.sdp);
}
], false, 1);
test.chain.append([
function PC_REMOTE_CHECK_AUDIO_NOT_FLOWING() {
return helper.checkAudioNotFlowing(test.pcRemote._pc.getRemoteStreams()[0]);
}
]);
- test.chain.remove("PC_REMOTE_CHECK_STATS", 1);
- test.chain.remove("PC_LOCAL_CHECK_STATS", 1);
-
- addRenegotiation(test.chain, []);
+ test.addRenegotiation([]);
test.chain.append([
function PC_REMOTE_CHECK_AUDIO_FLOWING_2() {
return helper.checkAudioFlowing(test.pcRemote._pc.getRemoteStreams()[0]);
}
]);
test.run();
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudio.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796892",
title: "Basic audio-only peer connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
// pc.js uses video elements by default, we want to test audio elements here
test.pcLocal.audioElementsOnly = true;
test.run();
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioDynamicPtMissingRtpmap.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioDynamicPtMissingRtpmap.html
@@ -7,18 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1246011",
title: "Offer with dynamic PT but missing rtpmap"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
// we want Opus to get selected and 101 to be ignored
options.opus = true;
test = new PeerConnectionTest(options);
test.chain.insertBefore("PC_REMOTE_GET_OFFER", [
function PC_LOCAL_REDUCE_MLINE_REMOVE_RTPMAPS(test) {
test.originalOffer.sdp =
sdputils.reduceAudioMLineToDynamicPtAndOpus(test.originalOffer.sdp);
test.originalOffer.sdp =
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioNATRelay.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioNATRelay.html
@@ -8,25 +8,24 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1231975",
title: "Basic audio-only peer connection with port dependent NAT"
});
var test;
- runNetworkTest(options => {
+ runNetworkTest(function(options = {}) {
SpecialPowers.pushPrefEnv(
{
'set': [
['media.peerconnection.nat_simulator.filtering_type', 'PORT_DEPENDENT'],
['media.peerconnection.nat_simulator.mapping_type', 'PORT_DEPENDENT']
]
}, function (options) {
- options = options || {};
options.expectedLocalCandidateType = "serverreflexive";
options.expectedRemoteCandidateType = "relayed";
// If both have TURN, it is a toss-up which one will end up using a
// relay.
options.turn_disabled_local = true;
test = new PeerConnectionTest(options);
// Make sure we don't end up choosing the wrong thing due to delays in
// trickle. Once we are willing to accept trickle after ICE success, we
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioNATRelayTCP.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioNATRelayTCP.html
@@ -7,26 +7,25 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1231975",
title: "Basic audio-only peer connection with port dependent NAT that blocks UDP"
});
var test;
- runNetworkTest(options => {
+ runNetworkTest(function(options = {}) {
SpecialPowers.pushPrefEnv(
{
'set': [
['media.peerconnection.nat_simulator.filtering_type', 'PORT_DEPENDENT'],
['media.peerconnection.nat_simulator.mapping_type', 'PORT_DEPENDENT'],
['media.peerconnection.nat_simulator.block_udp', true]
]
}, function (options) {
- options = options || {};
options.expectedLocalCandidateType = "relayed-tcp";
options.expectedRemoteCandidateType = "relayed-tcp";
// No reason to wait for gathering to complete like the other NAT tests,
// since relayed-tcp is the only thing that can work.
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
})
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioNATSrflx.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioNATSrflx.html
@@ -8,25 +8,24 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1231975",
title: "Basic audio-only peer connection with endpoint independent NAT"
});
var test;
- runNetworkTest(options => {
+ runNetworkTest(function(options = {}) {
SpecialPowers.pushPrefEnv(
{
'set': [
['media.peerconnection.nat_simulator.filtering_type', 'ENDPOINT_INDEPENDENT'],
['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT']
]
}, function (options) {
- options = options || {};
options.expectedLocalCandidateType = "serverreflexive";
options.expectedRemoteCandidateType = "serverreflexive";
test = new PeerConnectionTest(options);
// Make sure we don't end up choosing the wrong thing due to delays in
// trickle. Once we are willing to accept trickle after ICE success, we
// can maybe wait a bit to allow things to stabilize.
// TODO(bug 1238249)
makeOffererNonTrickle(test.chain);
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioPcmaPcmuOnly.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioPcmaPcmuOnly.html
@@ -7,18 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1221837",
title: "Only offer PCMA and PMCU in mline (no rtpmaps)"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.opus = false;
test = new PeerConnectionTest(options);
test.chain.insertBefore("PC_REMOTE_GET_OFFER", [
function PC_LOCAL_REDUCE_MLINE_REMOVE_RTPMAPS(test) {
test.originalOffer.sdp =
sdputils.reduceAudioMLineToPcmuPcma(test.originalOffer.sdp);
test.originalOffer.sdp =
sdputils.removeAllRtpMaps(test.originalOffer.sdp);
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioRequireEOC.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioRequireEOC.html
@@ -7,17 +7,18 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1167443",
title: "Basic audio-only peer connection which waits for end-of-candidates"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
test.chain.replace("PC_LOCAL_VERIFY_SDP_AFTER_END_OF_TRICKLE", [
function PC_LOCAL_REQUIRE_SDP_AFTER_END_OF_TRICKLE(test) {
return test.pcLocal.endOfTrickleSdp.then(sdp =>
sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcLocal.label));
}
]);
test.chain.replace("PC_REMOTE_VERIFY_SDP_AFTER_END_OF_TRICKLE", [
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
@@ -7,17 +7,21 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796890",
title: "Basic audio/video (separate) peer connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
+ // one test needs to volunteer to execute all checks
+ options.enableVerifyMedia = true;
+ options.enableStatsChecks = true;
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796890",
title: "Basic audio/video (combined) peer connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true, video: true}],
[{audio: true, video: true}]);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundle.html
@@ -6,18 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1016476",
title: "Basic audio/video peer connection with no Bundle"
});
- runNetworkTest(options => {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.bundle = false;
var test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.run();
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundleNoRtcpMux.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundleNoRtcpMux.html
@@ -7,20 +7,20 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1167443",
title: "Basic audio & video call with disabled bundle and disbaled RTCP-Mux"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.bundle = false;
options.rtcpmux = false;
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
test.chain.replace("PC_LOCAL_VERIFY_SDP_AFTER_END_OF_TRICKLE", [
function PC_LOCAL_REQUIRE_SDP_AFTER_END_OF_TRICKLE(test) {
return test.pcLocal.endOfTrickleSdp .then(sdp =>
sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcLocal.label));
}
]);
test.chain.replace("PC_REMOTE_VERIFY_SDP_AFTER_END_OF_TRICKLE", [
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoRtcpMux.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoRtcpMux.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1167443",
title: "Basic audio & video call with disabled RTCP-Mux"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.rtcpmux = false;
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
test.chain.replace("PC_LOCAL_VERIFY_SDP_AFTER_END_OF_TRICKLE", [
function PC_LOCAL_REQUIRE_SDP_AFTER_END_OF_TRICKLE(test) {
return test.pcLocal.endOfTrickleSdp .then(sdp =>
sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcLocal.label));
}
]);
test.chain.replace("PC_REMOTE_VERIFY_SDP_AFTER_END_OF_TRICKLE", [
--- a/dom/media/tests/mochitest/test_peerConnection_basicH264Video.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicH264Video.html
@@ -7,18 +7,17 @@
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "1040346",
title: "Basic H.264 GMP video-only peer connection"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.h264 = true;
test = new PeerConnectionTest(options);
test.setMediaConstraints([{video: true}], [{video: true}]);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_basicScreenshare.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicScreenshare.html
@@ -7,20 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1039666",
title: "Basic screenshare-only peer connection"
});
var test;
- runNetworkTest(function (options) {
- const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
- if (IsMacOSX10_6orOlder() || isWinXP) {
- ok(true, "Screensharing disabled for OSX10.6 and WinXP");
+ runNetworkTest(function(options = {}) {
+ if (isWinXP) {
+ ok(true, "Screensharing disabled for WinXP");
SimpleTest.finish();
return;
}
test = new PeerConnectionTest(options);
var constraints = {
video: {
mozMediaSource: "screen",
mediaSource: "screen"
--- a/dom/media/tests/mochitest/test_peerConnection_basicVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicVideo.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "796888",
title: "Basic video-only peer connection"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{video: true}], [{video: true}]);
test.run();
});
</script>
</pre>
</body>
</html>
--- a/dom/media/tests/mochitest/test_peerConnection_basicWindowshare.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicWindowshare.html
@@ -7,20 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1038926",
title: "Basic windowshare-only peer connection"
});
var test;
- runNetworkTest(function (options) {
- const isWinXP = navigator.userAgent.indexOf("Windows NT 5.1") != -1;
- if (IsMacOSX10_6orOlder() || isWinXP) {
- ok(true, "Screensharing disabled for OSX10.6 and WinXP");
+ runNetworkTest(function(options = {}) {
+ if (isWinXP) {
+ ok(true, "Screensharing disabled for WinXP");
SimpleTest.finish();
return;
}
test = new PeerConnectionTest(options);
var constraints = {
video: {
mozMediaSource: "window",
mediaSource: "window"
--- a/dom/media/tests/mochitest/test_peerConnection_bug1013809.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug1013809.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1013809",
title: "Audio-only peer connection with swapped setLocal and setRemote steps"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
var sld = test.chain.remove("PC_REMOTE_SET_LOCAL_DESCRIPTION");
test.chain.insertAfter("PC_LOCAL_SET_REMOTE_DESCRIPTION", sld);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_peerConnection_bug1042791.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug1042791.html
@@ -7,18 +7,17 @@
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "1040346",
title: "Basic H.264 GMP video-only peer connection"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.h264 = true;
test = new PeerConnectionTest(options);
test.setMediaConstraints([{video: true}], [{video: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
test.chain.append([
function PC_LOCAL_VERIFY_H264_OFFER(test) {
ok(!test.pcLocal._latest_offer.sdp.toLowerCase().includes("profile-level-id=0x42e0"),
--- a/dom/media/tests/mochitest/test_peerConnection_bug1064223.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug1064223.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1064223",
title: "CreateOffer fails without streams or modern RTCOfferOptions"
});
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
var pc = new mozRTCPeerConnection();
var options = { mandatory: { OfferToReceiveVideo: true } }; // obsolete
pc.createOffer(options).then(() => ok(false, "createOffer must fail"),
e => is(e.name, "InternalError",
"createOffer must fail"))
.catch(e => ok(false, e.message))
.then(() => {
--- a/dom/media/tests/mochitest/test_peerConnection_bug1227781.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug1227781.html
@@ -9,17 +9,17 @@
createHTML({
bug: "1227781",
title: "Test with invalid TURN server"
});
var turnConfig = { iceServers: [{"username":"mozilla","credential"
:"mozilla","url":"turn:test@10.0.0.1"}] };
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
var exception = false;
try {
pc = new RTCPeerConnection(turnConfig);
} catch (e) {
info(e);
exception = true;
}
--- a/dom/media/tests/mochitest/test_peerConnection_bug822674.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug822674.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "822674",
title: "RTCPeerConnection isn't a true javascript object as it should be"
});
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
var pc = new RTCPeerConnection();
pc.thereIsNeverGoingToBeAPropertyWithThisNameOnThisInterface = 1;
is(pc.thereIsNeverGoingToBeAPropertyWithThisNameOnThisInterface, 1,
"Can set expandos on an RTCPeerConnection");
pc = null;
networkTestFinished();
--- a/dom/media/tests/mochitest/test_peerConnection_bug825703.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug825703.html
@@ -34,17 +34,17 @@ var makePC = (config, expected_error) =>
var toComparable = o =>
(typeof o != 'object' || !o)? o : Object.keys(o).sort().reduce((co, key) => {
co[key] = toComparable(o[key]);
return co;
}, {});
// This is a test of the iceServers parsing code + readable errors
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var exception = null;
try {
new RTCPeerConnection().close();
} catch (e) {
exception = e;
}
ok(!exception, "RTCPeerConnection() succeeds");
--- a/dom/media/tests/mochitest/test_peerConnection_bug827843.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug827843.html
@@ -53,17 +53,17 @@ var steps = [
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(() => {
+runNetworkTest(function(options = {}) {
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.append(steps);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_bug834153.html
+++ b/dom/media/tests/mochitest/test_peerConnection_bug834153.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "834153",
title: "Queue CreateAnswer in PeerConnection.js"
});
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
var pc1 = new RTCPeerConnection();
var pc2 = new RTCPeerConnection();
pc1.createOffer({ offerToReceiveAudio: true }).then(offer => {
// The whole point of this test is not to wait for the
// setRemoteDescription call to succesfully complete, so we
// don't wait for it to succeed.
pc2.setRemoteDescription(offer);
--- a/dom/media/tests/mochitest/test_peerConnection_callbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_callbacks.html
@@ -53,17 +53,17 @@ pc2.onicecandidate = e => {
var v1, v2;
var delivered = new Promise(resolve => {
pc2.onaddstream = e => {
v2.mozSrcObject = e.stream;
resolve(e.stream);
};
});
-runNetworkTest(function() {
+runNetworkTest(function(options = {}) {
v1 = createMediaElement('video', 'v1');
v2 = createMediaElement('video', 'v2');
var canPlayThrough = new Promise(resolve => v2.canplaythrough = resolve);
is(v2.currentTime, 0, "v2.currentTime is zero at outset");
// not testing legacy gUM here
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => pc1.addStream(v1.mozSrcObject = stream))
--- a/dom/media/tests/mochitest/test_peerConnection_captureStream_canvas_2d.html
+++ b/dom/media/tests/mochitest/test_peerConnection_captureStream_canvas_2d.html
@@ -8,17 +8,17 @@
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "1032848",
title: "Canvas(2D)::CaptureStream as video-only input to peerconnection",
visible: true
});
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
var mediaElement;
var h = new CaptureStreamTestHelper2D();
var canvas = document.createElement('canvas');
var stream;
canvas.id = 'source_canvas';
canvas.width = canvas.height = 10;
document.getElementById('content').appendChild(canvas);
--- a/dom/media/tests/mochitest/test_peerConnection_captureStream_canvas_webgl.html
+++ b/dom/media/tests/mochitest/test_peerConnection_captureStream_canvas_webgl.html
@@ -19,17 +19,17 @@
void main() { gl_FragColor = uColor; }
</script>
<script type="application/javascript;version=1.8">
createHTML({
bug: "1032848",
title: "Canvas(WebGL)::CaptureStream as video-only input to peerconnection"
});
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
var vremote;
var h = new CaptureStreamTestHelperWebGL();
var canvas = document.createElement('canvas');
canvas.id = 'source_canvas';
canvas.width = canvas.height = 10;
canvas.style.display = 'none';
document.getElementById('content').appendChild(canvas);
@@ -47,17 +47,17 @@ runNetworkTest(() => {
test.setMediaConstraints([{video: true}], []);
test.chain.replace("PC_LOCAL_GUM", [
function WEBGL_SETUP(test) {
var program = WebGLUtil.createProgramByIds(gl, 'v-shader', 'f-shader');
if (!program) {
ok(false, "Program should link");
- return Promise.reject();
+ return Promise.reject(new Error("Failed to link WebGL program"));
}
gl.useProgram(program);
var uColorLocation = gl.getUniformLocation(program, "uColor");
h.setFragmentColorLocation(uColorLocation);
var squareBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, squareBuffer);
--- a/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html
@@ -45,17 +45,17 @@ function startTest(media, token) {
new Promise((resolve, reject) => {
video.onloadedmetadata = resolve;
video.onerror = () => reject(video.error);
})
.then(() => {
video.onerror = () => ok(false, media.name + " failed in playback (code=" +
video.error.code + "). Stream should be OK. " +
"Continuing test.");
- return runNetworkTest(() => {
+ return runNetworkTest(function(options = {}) {
var stream = video.mozCaptureStream();
test = new PeerConnectionTest({ config_local: { label_suffix: media.name },
config_remote: { label_suffix: media.name } });
test.setOfferOptions({ offerToReceiveVideo: false,
offerToReceiveAudio: false });
var hasVideo = stream.getVideoTracks().length > 0;
var hasAudio = stream.getAudioTracks().length > 0;
test.setMediaConstraints([{ video: hasVideo, audio: hasAudio }], []);
--- a/dom/media/tests/mochitest/test_peerConnection_certificates.html
+++ b/dom/media/tests/mochitest/test_peerConnection_certificates.html
@@ -93,17 +93,17 @@
.then(retrieved => {
db.close();
return retrieved;
});
});
}
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
var expiredCert;
return Promise.resolve()
.then(() => RTCPeerConnection.generateCertificate({
name: "ECDSA",
namedCurve: "P-256",
expires: 1 // smallest possible expiration window
}))
.then(cert => {
--- a/dom/media/tests/mochitest/test_peerConnection_close.html
+++ b/dom/media/tests/mochitest/test_peerConnection_close.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "991877",
title: "Basic RTCPeerConnection.close() tests"
});
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
var pc = new RTCPeerConnection();
var exception = null;
var eTimeout = null;
// everything should be in initial state
is(pc.signalingState, "stable", "Initial signalingState is 'stable'");
is(pc.iceConnectionState, "new", "Initial iceConnectionState is 'new'");
is(pc.iceGatheringState, "new", "Initial iceGatheringState is 'new'");
--- a/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html
+++ b/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html
@@ -56,17 +56,17 @@ function PC_REMOTE_WAIT_FOR_ICE_CHECKING
test.pcRemote.iceChecking = new Promise(r => resolveIceChecking = r);
test.pcRemote.ice_connection_callbacks.checkIceStatus = () => {
if (test.pcRemote._pc.iceConnectionState === "checking") {
resolveIceChecking();
}
}
}
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.replace("PC_LOCAL_SETUP_ICE_HANDLER", PC_LOCAL_SETUP_NULL_ICE_HANDLER);
test.chain.replace("PC_REMOTE_SETUP_ICE_HANDLER", PC_REMOTE_SETUP_NULL_ICE_HANDLER);
test.chain.insertAfter("PC_REMOTE_SETUP_NULL_ICE_HANDLER", PC_LOCAL_WAIT_FOR_ICE_CHECKING);
test.chain.insertAfter("PC_LOCAL_WAIT_FOR_ICE_CHECKING", PC_REMOTE_WAIT_FOR_ICE_CHECKING);
test.chain.removeAfter("PC_LOCAL_SET_REMOTE_DESCRIPTION");
test.chain.append([PC_REMOTE_ADD_FAKE_ICE_CANDIDATE, PC_LOCAL_ADD_FAKE_ICE_CANDIDATE,
--- a/dom/media/tests/mochitest/test_peerConnection_constructedStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_constructedStream.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "1271669",
title: "Test that pc.addTrack() accepts any MediaStream",
visible: true
});
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
var constructedStream;
var dummyStream = new MediaStream();
var dummyStreamTracks = [];
test.setMediaConstraints([ {audio: true, video: true}
, {audio: true}
, {video: true}
--- a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
@@ -38,17 +38,17 @@
return pc.setRemoteDescription({ sdp: "Who?", type: "offer" })
.then(generateErrorCallback("setRemoteDescription with nonsense SDP should fail"),
validateReason);
};
// No test for createOffer errors -- there's nothing we can do at this
// level to evoke an error in createOffer.
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
testCreateAnswerError()
.then(testSetLocalDescriptionError)
.then(testSetRemoteDescriptionError)
.catch(reason => ok(false, "unexpected error: " + reason))
.then(networkTestFinished);
});
</script>
--- a/dom/media/tests/mochitest/test_peerConnection_forwarding_basicAudioVideoCombined.html
+++ b/dom/media/tests/mochitest/test_peerConnection_forwarding_basicAudioVideoCombined.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "931903",
title: "Forwarding a stream from a combined audio/video peerconnection to another"
});
-runNetworkTest(function() {
+runNetworkTest(function(options = {}) {
var gumTest = new PeerConnectionTest();
var forwardingOptions = { config_local: { label_suffix: "forwarded" },
config_remote: { label_suffix: "forwarded" } };
var forwardingTest = new PeerConnectionTest(forwardingOptions);
gumTest.setMediaConstraints([{audio: true, video: true}], []);
forwardingTest.setMediaConstraints([{audio: true, video: true}], []);
@@ -24,17 +24,16 @@ runNetworkTest(function() {
function PC_FORWARDING_CAPTUREVIDEO(test) {
var streams = gumTest.pcRemote._pc.getRemoteStreams();
is(streams.length, 1, "One stream to forward");
is(streams[0].getTracks().length, 2, "Forwarded stream has 2 tracks");
forwardingTest.pcLocal.attachLocalStream(streams[0]);
return Promise.resolve();
}
]);
- gumTest.chain.removeAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW");
gumTest.chain.execute()
.then(() => forwardingTest.chain.execute())
.then(() => gumTest.close())
.then(() => forwardingTest.close())
.then(() => networkTestFinished());
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_peerConnection_iceFailure.html
+++ b/dom/media/tests/mochitest/test_peerConnection_iceFailure.html
@@ -53,17 +53,17 @@ function PC_REMOTE_WAIT_FOR_ICE_FAILED(t
test.pcRemote.iceFailed = new Promise(r => resolveIceFailed = r);
test.pcRemote.ice_connection_callbacks.checkIceStatus = () => {
if (test.pcRemote._pc.iceConnectionState === "failed") {
resolveIceFailed();
}
}
}
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
SpecialPowers.pushPrefEnv({
'set': [
['media.peerconnection.ice.stun_client_maximum_transmits', 3],
['media.peerconnection.ice.trickle_grace_period', 3000],
]
}, function() {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
--- a/dom/media/tests/mochitest/test_peerConnection_insertDTMF.html
+++ b/dom/media/tests/mochitest/test_peerConnection_insertDTMF.html
@@ -47,22 +47,22 @@ function insertdtmftest(pc) {
sender.dtmf.insertDTMF("AAA");
} catch (ex) {
threw = true;
is(ex.code, DOMException.INVALID_STATE_ERR, "Expected InvalidStateError");
}
ok(threw, "Expected exception");
}
-runNetworkTest(() => {
- test = new PeerConnectionTest();
+runNetworkTest(function(options = {}) {
+ options.enableVerifyMedia = true;
+ test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
- test.chain.removeAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW");
- // Test sender dtmf.
+ // Test sender dtmf
test.chain.append([
function PC_LOCAL_INSERT_DTMF(test) {
// We want to call removeTrack
test.pcLocal.expectNegotiationNeeded();
return insertdtmftest(test.pcLocal._pc);
}
]);
--- a/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "952145",
title: "Rollback local reoffer"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain, [
+ test.addRenegotiation([
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{audio: true}, {audio: true}],
[{audio: true}]);
return test.pcLocal.getAllUserMedia([{audio: true}]);
},
function PC_REMOTE_SETUP_ICE_HANDLER(test) {
test.pcRemote.setupIceCandidateHandler(test);
--- a/dom/media/tests/mochitest/test_peerConnection_localRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_localRollback.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "952145",
title: "Rollback local offer"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.insertBefore('PC_LOCAL_CREATE_OFFER', [
function PC_REMOTE_CREATE_AND_SET_OFFER(test) {
return test.createOffer(test.pcRemote).then(offer => {
return test.setLocalDescription(test.pcRemote, offer, HAVE_LOCAL_OFFER);
});
},
--- a/dom/media/tests/mochitest/test_peerConnection_multiple_captureStream_canvas_2d.html
+++ b/dom/media/tests/mochitest/test_peerConnection_multiple_captureStream_canvas_2d.html
@@ -11,17 +11,17 @@ createHTML({
bug: "1166832",
title: "Canvas(2D)::Multiple CaptureStream as video-only input to peerconnection",
visible: true
});
/**
* Test to verify using multiple capture streams concurrently.
*/
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
var h = new CaptureStreamTestHelper2D(50, 50);
var vremote1;
var stream1;
var canvas1 = h.createAndAppendElement('canvas', 'source_canvas1');
var vremote2;
--- a/dom/media/tests/mochitest/test_peerConnection_noTrickleAnswer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_noTrickleAnswer.html
@@ -8,17 +8,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1060102",
title: "Basic audio only SDP answer without trickle ICE"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
makeAnswererNonTrickle(test.chain);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_noTrickleOffer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_noTrickleOffer.html
@@ -8,17 +8,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1060102",
title: "Basic audio only SDP offer without trickle ICE"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
makeOffererNonTrickle(test.chain);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_noTrickleOfferAnswer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_noTrickleOfferAnswer.html
@@ -8,17 +8,18 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1060102",
title: "Basic audio only SDP offer and answer without trickle ICE"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
+ options.enableIceChecks = true;
test = new PeerConnectionTest(options);
makeOffererNonTrickle(test.chain);
makeAnswererNonTrickle(test.chain);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();
});
</script>
</pre>
--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "850275",
title: "Simple offer media constraint test with audio"
});
- runNetworkTest(function() {
+ runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([], [{audio: true}]);
test.setOfferOptions({ offerToReceiveAudio: true });
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "850275",
title: "Simple offer media constraint test with video"
});
- runNetworkTest(function() {
+ runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([], [{video: true}]);
test.setOfferOptions({ offerToReceiveVideo: true });
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "850275",
title: "Simple offer media constraint test with video/audio"
});
- runNetworkTest(function() {
+ runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([], [{audio: true, video: true}]);
test.setOfferOptions({ offerToReceiveVideo: true, offerToReceiveAudio: true });
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_promiseSendOnly.html
+++ b/dom/media/tests/mochitest/test_peerConnection_promiseSendOnly.html
@@ -29,17 +29,17 @@
// Test RTCTrackEvent required args here.
mustThrowWith("RTCTrackEvent wo/required args",
"TypeError", () => new RTCTrackEvent("track", {}));
v2.srcObject = e.streams[0];
resolve();
}
});
- runNetworkTest(function() {
+ runNetworkTest(function(options = {}) {
v1 = createMediaElement('video', 'v1');
v2 = createMediaElement('video', 'v2');
var canPlayThrough = new Promise(resolve => v2.canplaythrough = e => resolve());
is(v2.currentTime, 0, "v2.currentTime is zero at outset");
navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => (v1.srcObject = stream).getTracks().forEach(t => pc1.addTrack(t, stream)))
--- a/dom/media/tests/mochitest/test_peerConnection_relayOnly.html
+++ b/dom/media/tests/mochitest/test_peerConnection_relayOnly.html
@@ -26,20 +26,17 @@ function PC_BOTH_WAIT_FOR_ICE_FAILED(tes
isFail(() => waitForIceConnected(test, test.pcRemote), "ICE failed", "Remote ICE")
])
.then(() => ok(true, "ICE on both sides must fail."));
}
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
var test;
-runNetworkTest(options =>
- pushPrefs(['media.peerconnection.ice.stun_client_maximum_transmits', 3],
- ['media.peerconnection.ice.trickle_grace_period', 5000]).then(() => {
- options = options || {};
+runNetworkTest(function(options = {}) {
options.config_local = options.config_local || {};
var servers = options.config_local.iceServers || [];
// remove any turn servers
options.config_local.iceServers = servers.filter(server =>
server.urls.every(u => !u.toLowerCase().startsWith('turn')));
// Here's the setting we're testing. Comment out and this test should fail:
options.config_local.iceTransportPolicy = "relay";
@@ -47,15 +44,18 @@ runNetworkTest(options =>
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.chain.remove("PC_LOCAL_SETUP_ICE_LOGGER"); // Needed to suppress failing
test.chain.remove("PC_REMOTE_SETUP_ICE_LOGGER"); // on ICE-failure.
test.chain.insertAfter("PC_LOCAL_SETUP_ICE_HANDLER", PC_LOCAL_NO_CANDIDATES);
test.chain.replace("PC_LOCAL_WAIT_FOR_ICE_CONNECTED", PC_BOTH_WAIT_FOR_ICE_FAILED);
test.chain.removeAfter("PC_BOTH_WAIT_FOR_ICE_FAILED");
- test.run();
+
+ return pushPrefs(['media.peerconnection.ice.stun_client_maximum_transmits', 3],
+ ['media.peerconnection.ice.trickle_grace_period', 5000])
+ .then(() => test.run());
}));
</script>
</pre>
</body>
</html>
--- a/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "952145",
title: "Rollback remote reoffer"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{audio: true}, {audio: true}],
[{audio: true}]);
return test.pcLocal.getAllUserMedia([{audio: true}]);
},
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "952145",
title: "Rollback remote offer"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter('PC_REMOTE_CHECK_CAN_TRICKLE_SYNC');
test.chain.append([
function PC_REMOTE_ROLLBACK(test) {
// We still haven't negotiated the tracks
test.pcRemote.expectNegotiationNeeded();
return test.setRemoteDescription(test.pcRemote, { type: "rollback" },
--- a/dom/media/tests/mochitest/test_peerConnection_removeAudioTrack.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeAudioTrack.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: remove audio track"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_REMOVE_AUDIO_TRACK(test) {
test.setOfferOptions({ offerToReceiveAudio: true });
return test.pcLocal.removeSender(0);
},
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrack.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrack.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: remove then add audio track"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_REMOVE_AUDIO_TRACK(test) {
return test.pcLocal.removeSender(0);
},
function PC_LOCAL_ADD_AUDIO_TRACK(test) {
// The new track's pipeline will start with a packet count of
// 0, but the remote side will keep its old pipeline and packet
// count.
--- a/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrackNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeThenAddAudioTrackNoBundle.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: remove then add audio track"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_REMOVE_AUDIO_TRACK(test) {
// The new track's pipeline will start with a packet count of
// 0, but the remote side will keep its old pipeline and packet
// count.
test.pcLocal.disableRtpCountChecking = true;
return test.pcLocal.removeSender(0);
},
--- a/dom/media/tests/mochitest/test_peerConnection_removeThenAddVideoTrack.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeThenAddVideoTrack.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: remove then add video track"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_REMOVE_AUDIO_TRACK(test) {
// The new track's pipeline will start with a packet count of
// 0, but the remote side will keep its old pipeline and packet
// count.
test.pcLocal.disableRtpCountChecking = true;
return test.pcLocal.removeSender(0);
},
--- a/dom/media/tests/mochitest/test_peerConnection_removeThenAddVideoTrackNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeThenAddVideoTrackNoBundle.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: remove then add video track, no bundle"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_REMOVE_AUDIO_TRACK(test) {
// The new track's pipeline will start with a packet count of
// 0, but the remote side will keep its old pipeline and packet
// count.
test.pcLocal.disableRtpCountChecking = true;
return test.pcLocal.removeSender(0);
},
--- a/dom/media/tests/mochitest/test_peerConnection_removeVideoTrack.html
+++ b/dom/media/tests/mochitest/test_peerConnection_removeVideoTrack.html
@@ -7,19 +7,19 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: remove video track"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_REMOVE_VIDEO_TRACK(test) {
test.setOfferOptions({ offerToReceiveVideo: true });
test.setMediaConstraints([], [{video: true}]);
return test.pcLocal.removeSender(0);
},
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_renderAfterRenegotiation.html
+++ b/dom/media/tests/mochitest/test_peerConnection_renderAfterRenegotiation.html
@@ -30,17 +30,17 @@
// Test RTCTrackEvent required args here.
mustThrowWith("RTCTrackEvent wo/required args",
"TypeError", () => new RTCTrackEvent("track", {}));
v2.srcObject = e.streams[0];
resolve();
}
});
- runNetworkTest(function() {
+ runNetworkTest(function(options = {}) {
var h = new CaptureStreamTestHelper2D();
var canvas = document.createElement('canvas');
canvas.id = 'source_canvas';
canvas.width = canvas.height = 10;
document.getElementById('content').appendChild(canvas);
v2 = createMediaElement('video', 'v2');
is(v2.currentTime, 0, "v2.currentTime is zero at outset");
--- a/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html
+++ b/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html
@@ -59,21 +59,20 @@
"track exists among pc's local streams");
return sender.replaceTrack(audiotrack)
.then(() => ok(false, "replacing with different kind should fail"),
e => is(e.name, "IncompatibleMediaStreamTrackError",
"replacing with different kind should fail"));
});
}
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest();
test.audioCtx = new AudioContext();
test.setMediaConstraints([{video: true, audio: true}], [{video: true}]);
- test.chain.removeAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW");
// Test replaceTrack on pcRemote separately since it's video only.
test.chain.append([
function PC_REMOTE_VIDEOONLY_REPLACE_VIDEOTRACK(test) {
return replacetest(test.pcRemote);
},
function PC_LOCAL_NEW_VIDEOTRACK_WAIT_FOR_MEDIA_FLOW(test) {
return test.pcLocal.waitForMediaFlow();
--- a/dom/media/tests/mochitest/test_peerConnection_replaceVideoThenRenegotiate.html
+++ b/dom/media/tests/mochitest/test_peerConnection_replaceVideoThenRenegotiate.html
@@ -7,20 +7,20 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1017888",
title: "Renegotiation: replaceTrack followed by adding a second video stream"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{video:true}], [{video:true}]);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_REPLACE_VIDEO_TRACK_THEN_ADD_SECOND_STREAM(test) {
var oldstream = test.pcLocal._pc.getLocalStreams()[0];
var oldtrack = oldstream.getVideoTracks()[0];
var sender = test.pcLocal._pc.getSenders()[0];
return navigator.mediaDevices.getUserMedia({video:true})
.then(newstream => {
var newtrack = newstream.getVideoTracks()[0];
--- a/dom/media/tests/mochitest/test_peerConnection_restartIce.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIce.html
@@ -7,20 +7,20 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "906986",
title: "Renegotiation: restart ice"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
// causes a full, normal ice restart
function PC_LOCAL_SET_OFFER_OPTION(test) {
test.setOfferOptions({ iceRestart: true });
},
function PC_LOCAL_EXPECT_ICE_CHECKING(test) {
test.pcLocal.expectIceChecking();
},
--- a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html
@@ -7,20 +7,20 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "906986",
title: "Renegotiation: restart ice, local and remote rollback"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
// causes a full, normal ice restart
function PC_LOCAL_SET_OFFER_OPTION(test) {
test.setOfferOptions({ iceRestart: true });
}
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html
@@ -7,20 +7,20 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "906986",
title: "Renegotiation: restart ice, local rollback"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
// causes a full, normal ice restart
function PC_LOCAL_SET_OFFER_OPTION(test) {
test.setOfferOptions({ iceRestart: true });
},
// causes an ice restart and then rolls it back
// (does not result in sending an offer)
function PC_LOCAL_SETUP_ICE_HANDLER(test) {
--- a/dom/media/tests/mochitest/test_peerConnection_restartIceNoBundle.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIceNoBundle.html
@@ -7,22 +7,21 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "906986",
title: "Renegotiation: restart ice, no bundle"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.bundle = false;
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
// causes a full, normal ice restart
function PC_LOCAL_SET_OFFER_OPTION(test) {
test.setOfferOptions({ iceRestart: true });
},
function PC_LOCAL_EXPECT_ICE_CHECKING(test) {
test.pcLocal.expectIceChecking();
},
--- a/dom/media/tests/mochitest/test_peerConnection_restartIceNoBundleNoRtcpMux.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIceNoBundleNoRtcpMux.html
@@ -7,23 +7,22 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "906986",
title: "Renegotiation: restart ice, no bundle and disabled RTCP-Mux"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.bundle = false;
options.rtcpmux = false;
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
// causes a full, normal ice restart
function PC_LOCAL_SET_OFFER_OPTION(test) {
test.setOfferOptions({ iceRestart: true });
},
function PC_LOCAL_EXPECT_ICE_CHECKING(test) {
test.pcLocal.expectIceChecking();
},
--- a/dom/media/tests/mochitest/test_peerConnection_restartIceNoRtcpMux.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIceNoRtcpMux.html
@@ -7,22 +7,21 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "906986",
title: "Renegotiation: restart ice, with disabled RTCP-Mux"
});
var test;
- runNetworkTest(function (options) {
- options = options || { };
+ runNetworkTest(function(options = {}) {
options.rtcpmux = false;
test = new PeerConnectionTest(options);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
// causes a full, normal ice restart
function PC_LOCAL_SET_OFFER_OPTION(test) {
test.setOfferOptions({ iceRestart: true });
},
function PC_LOCAL_EXPECT_ICE_CHECKING(test) {
test.pcLocal.expectIceChecking();
},
--- a/dom/media/tests/mochitest/test_peerConnection_scaleResolution.html
+++ b/dom/media/tests/mochitest/test_peerConnection_scaleResolution.html
@@ -72,14 +72,14 @@
.then(() => {
stream.getTracks().forEach(track => track.stop());
v1.srcObject = v2.srcObject = null;
})
})
.catch(generateErrorCallback());
}
- runNetworkTest(() => testScale("VP8").then(() => testScale("H264"))
+ runNetworkTest(function(options = {}) testScale("VP8").then(() => testScale("H264"))
.then(networkTestFinished));
</script>
</pre>
</body>
</html>
--- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "784519",
title: "setLocalDescription (answer) in 'have-local-offer'"
});
-runNetworkTest(function () {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
test.chain.append([
function PC_LOCAL_SET_LOCAL_ANSWER(test) {
test.pcLocal._latest_offer.type = "answer";
return test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer)
--- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html
+++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "784519",
title: "setLocalDescription (answer) in 'stable'"
});
-runNetworkTest(function () {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
test.chain.append([
function PC_LOCAL_SET_LOCAL_ANSWER(test) {
test.pcLocal._latest_offer.type = "answer";
return test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer)
--- a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "784519",
title: "setLocalDescription (offer) in 'have-remote-offer'"
});
-runNetworkTest(function () {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION");
test.chain.append([
function PC_REMOTE_SET_LOCAL_OFFER(test) {
test.pcRemote.setLocalDescriptionAndFail(test.pcLocal._latest_offer)
.then(err => {
--- a/dom/media/tests/mochitest/test_peerConnection_setParameters.html
+++ b/dom/media/tests/mochitest/test_peerConnection_setParameters.html
@@ -55,21 +55,20 @@ function parameterstest(pc) {
[{ encodings: [{ rid: "foo", maxBitrate: 40000 },
{ rid: "bar", maxBitrate: 10000 },
{ rid: "bar", maxBitrate: 20000 }] }, "TypeError", "Duplicate rid"],
[{}]
].reduce((p, args) => p.then(() => testParameters.apply(this, args)),
Promise.resolve());
}
-runNetworkTest(() => {
-
- test = new PeerConnectionTest();
+runNetworkTest(function(options = {}) {
+ options.enableVerifyMedia = true;
+ test = new PeerConnectionTest(options);
test.setMediaConstraints([{video: true}], [{video: true}]);
- test.chain.removeAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW");
// Test sender parameters.
test.chain.append([
function PC_LOCAL_SET_PARAMETERS(test) {
return parameterstest(test.pcLocal._pc);
}
]);
--- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "784519",
title: "setRemoteDescription (answer) in 'have-remote-offer'"
});
-runNetworkTest(function () {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION");
test.chain.append([
function PC_REMOTE_SET_REMOTE_ANSWER(test) {
test.pcLocal._latest_offer.type = "answer";
test.pcRemote._pc.setRemoteDescription(test.pcLocal._latest_offer)
--- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html
+++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "784519",
title: "setRemoteDescription (answer) in 'stable'"
});
-runNetworkTest(function () {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
test.chain.append([
function PC_LOCAL_SET_REMOTE_ANSWER(test) {
test.pcLocal._latest_offer.type = "answer";
test.pcLocal._pc.setRemoteDescription(test.pcLocal._latest_offer)
--- a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "784519",
title: "setRemoteDescription (offer) in 'have-local-offer'"
});
-runNetworkTest(function () {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
test.chain.append([
function PC_LOCAL_SET_REMOTE_OFFER(test) {
test.pcLocal._pc.setRemoteDescription(test.pcLocal._latest_offer)
.then(generateErrorCallback('setRemoteDescription should fail'),
--- a/dom/media/tests/mochitest/test_peerConnection_simulcastOffer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_simulcastOffer.html
@@ -1,139 +1,138 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1231507",
title: "Basic video-only peer connection with Simulcast offer",
visible: true
});
- var test;
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
function selectRecvSsrc(pc, index) {
var receivers = pc._pc.getReceivers();
is(receivers.length, 1, "We have exactly one RTP receiver");
var receiver = receivers[0];
SpecialPowers.wrap(pc._pc).mozSelectSsrc(receiver, index);
}
- runNetworkTest(() =>
- pushPrefs(['media.peerconnection.simulcast', true],
- ['media.peerconnection.video.min_bitrate_estimate', 100*1000]).then(() => {
- SimpleTest.requestCompleteLog();
- var helper;
+ runNetworkTest((options = {}) => {
+ var helper;
- test = new PeerConnectionTest({bundle: false});
- test.setMediaConstraints([{video: true}], []);
+ options.bundle = false;
+ options.enableVerifyMedia = true;
+ var test = new PeerConnectionTest(options);
+ test.setMediaConstraints([{video: true}], []);
- test.chain.replace("PC_LOCAL_GUM", [
- function PC_LOCAL_CANVAS_CAPTURESTREAM(test) {
- helper = new VideoStreamHelper();
- test.pcLocal.attachLocalStream(helper.stream());
- }
- ]);
+ test.chain.replace("PC_LOCAL_GUM", [
+ function PC_LOCAL_CANVAS_CAPTURESTREAM(test) {
+ helper = new VideoStreamHelper();
+ test.pcLocal.attachLocalStream(helper.stream());
+ }
+ ]);
- test.chain.insertBefore('PC_LOCAL_CREATE_OFFER', [
- function PC_LOCAL_SET_RIDS(test) {
- var senders = test.pcLocal._pc.getSenders();
- is(senders.length, 1, "We have exactly one RTP sender");
- var sender = senders[0];
- ok(sender.track, "Sender has a track");
+ test.chain.insertBefore('PC_LOCAL_CREATE_OFFER', [
+ function PC_LOCAL_SET_RIDS(test) {
+ var senders = test.pcLocal._pc.getSenders();
+ is(senders.length, 1, "We have exactly one RTP sender");
+ var sender = senders[0];
+ ok(sender.track, "Sender has a track");
- return sender.setParameters({
- encodings: [{ rid: "foo", maxBitrate: 40000 },
- { rid: "bar", maxBitrate: 40000, scaleResolutionDownBy: 2 }]
- });
- }
- ]);
+ return sender.setParameters({
+ encodings: [{ rid: "foo", maxBitrate: 40000 },
+ { rid: "bar", maxBitrate: 40000, scaleResolutionDownBy: 2 }]
+ });
+ }
+ ]);
- test.chain.insertAfter('PC_LOCAL_GET_ANSWER', [
- function PC_LOCAL_ADD_RIDS_TO_ANSWER(test) {
- test._remote_answer.sdp = sdputils.transferSimulcastProperties(
- test.originalOffer.sdp, test._remote_answer.sdp);
- info("Answer with RIDs: " + JSON.stringify(test._remote_answer));
- ok(test._remote_answer.sdp.match(/a=simulcast:/), "Modified answer has simulcast");
- ok(test._remote_answer.sdp.match(/a=rid:/), "Modified answer has rid");
- }
- ]);
+ test.chain.insertAfter('PC_LOCAL_GET_ANSWER', [
+ function PC_LOCAL_ADD_RIDS_TO_ANSWER(test) {
+ test._remote_answer.sdp = sdputils.transferSimulcastProperties(
+ test.originalOffer.sdp, test._remote_answer.sdp);
+ info("Answer with RIDs: " + JSON.stringify(test._remote_answer));
+ ok(test._remote_answer.sdp.match(/a=simulcast:/), "Modified answer has simulcast");
+ ok(test._remote_answer.sdp.match(/a=rid:/), "Modified answer has rid");
+ }
+ ]);
- test.chain.insertAfter('PC_REMOTE_WAIT_FOR_MEDIA_FLOW',[
- function PC_REMOTE_SET_RTP_FIRST_RID(test) {
- // Cause pcRemote to filter out everything but the first SSRC. This
- // lets only one of the simulcast streams through.
- selectRecvSsrc(test.pcRemote, 0);
- }
- ]);
+ test.chain.insertAfter('PC_REMOTE_WAIT_FOR_MEDIA_FLOW',[
+ function PC_REMOTE_SET_RTP_FIRST_RID(test) {
+ // Cause pcRemote to filter out everything but the first SSRC. This
+ // lets only one of the simulcast streams through.
+ selectRecvSsrc(test.pcRemote, 0);
+ }
+ ]);
- test.chain.append([
- function PC_REMOTE_WAIT_FOR_FRAMES() {
- var vremote = test.pcRemote.remoteMediaElements[0];
- ok(vremote, "Should have remote video element for pcRemote");
- return helper.waitForFrames(vremote);
- },
- function PC_REMOTE_CHECK_SIZE_1() {
- var vlocal = test.pcLocal.localMediaElements[0];
- var vremote = test.pcRemote.remoteMediaElements[0];
- ok(vlocal, "Should have local video element for pcLocal");
- ok(vremote, "Should have remote video element for pcRemote");
- ok(vlocal.videoWidth > 0, "source width is positive");
- ok(vlocal.videoHeight > 0, "source height is positive");
- is(vremote.videoWidth, vlocal.videoWidth, "sink is same width as source");
- is(vremote.videoHeight, vlocal.videoHeight, "sink is same height as source");
- },
- function PC_REMOTE_SET_RTP_SECOND_RID(test) {
- // Now, cause pcRemote to filter out everything but the second SSRC.
- // This lets only the other simulcast stream through.
- selectRecvSsrc(test.pcRemote, 1);
- },
- function PC_REMOTE_WAIT_FOR_SECOND_MEDIA_FLOW(test) {
- return test.pcRemote.waitForMediaFlow();
- },
- function PC_REMOTE_WAIT_FOR_FRAMES_2() {
- var vremote = test.pcRemote.remoteMediaElements[0];
- ok(vremote, "Should have remote video element for pcRemote");
- return helper.waitForFrames(vremote);
- },
- // For some reason, even though we're getting a 25x25 stream, sometimes
- // the resolution isn't updated on the video element on the first frame.
- function PC_REMOTE_WAIT_FOR_FRAMES_3() {
- var vremote = test.pcRemote.remoteMediaElements[0];
- ok(vremote, "Should have remote video element for pcRemote");
- return helper.waitForFrames(vremote);
- },
- function PC_REMOTE_CHECK_SIZE_2() {
- var vlocal = test.pcLocal.localMediaElements[0];
- var vremote = test.pcRemote.remoteMediaElements[0];
- ok(vlocal, "Should have local video element for pcLocal");
- ok(vremote, "Should have remote video element for pcRemote");
- ok(vlocal.videoWidth > 0, "source width is positive");
- ok(vlocal.videoHeight > 0, "source height is positive");
- is(vremote.videoWidth, vlocal.videoWidth / 2, "sink is 1/2 width of source");
- is(vremote.videoHeight, vlocal.videoHeight / 2, "sink is 1/2 height of source");
- },
- function PC_REMOTE_SET_RTP_NONEXISTENT_RID(test) {
- // Now, cause pcRemote to filter out everything, just to make sure
- // selectRecvSsrc is working.
- selectRecvSsrc(test.pcRemote, 2);
- },
- function PC_REMOTE_ENSURE_NO_FRAMES() {
- var vremote = test.pcRemote.remoteMediaElements[0];
- ok(vremote, "Should have remote video element for pcRemote");
- return helper.verifyNoFrames(vremote);
- },
- ]);
+ test.chain.append([
+ function PC_REMOTE_WAIT_FOR_FRAMES() {
+ var vremote = test.pcRemote.remoteMediaElements[0];
+ ok(vremote, "Should have remote video element for pcRemote");
+ return helper.waitForFrames(vremote);
+ },
+ function PC_REMOTE_CHECK_SIZE_1() {
+ var vlocal = test.pcLocal.localMediaElements[0];
+ var vremote = test.pcRemote.remoteMediaElements[0];
+ ok(vlocal, "Should have local video element for pcLocal");
+ ok(vremote, "Should have remote video element for pcRemote");
+ ok(vlocal.videoWidth > 0, "source width is positive");
+ ok(vlocal.videoHeight > 0, "source height is positive");
+ is(vremote.videoWidth, vlocal.videoWidth, "sink is same width as source");
+ is(vremote.videoHeight, vlocal.videoHeight, "sink is same height as source");
+ },
+ function PC_REMOTE_SET_RTP_SECOND_RID(test) {
+ // Now, cause pcRemote to filter out everything but the second SSRC.
+ // This lets only the other simulcast stream through.
+ selectRecvSsrc(test.pcRemote, 1);
+ },
+ function PC_REMOTE_WAIT_FOR_SECOND_MEDIA_FLOW(test) {
+ return test.pcRemote.waitForMediaFlow();
+ },
+ function PC_REMOTE_WAIT_FOR_FRAMES_2() {
+ var vremote = test.pcRemote.remoteMediaElements[0];
+ ok(vremote, "Should have remote video element for pcRemote");
+ return helper.waitForFrames(vremote);
+ },
+ // For some reason, even though we're getting a 25x25 stream, sometimes
+ // the resolution isn't updated on the video element on the first frame.
+ function PC_REMOTE_WAIT_FOR_FRAMES_3() {
+ var vremote = test.pcRemote.remoteMediaElements[0];
+ ok(vremote, "Should have remote video element for pcRemote");
+ return helper.waitForFrames(vremote);
+ },
+ function PC_REMOTE_CHECK_SIZE_2() {
+ var vlocal = test.pcLocal.localMediaElements[0];
+ var vremote = test.pcRemote.remoteMediaElements[0];
+ ok(vlocal, "Should have local video element for pcLocal");
+ ok(vremote, "Should have remote video element for pcRemote");
+ ok(vlocal.videoWidth > 0, "source width is positive");
+ ok(vlocal.videoHeight > 0, "source height is positive");
+ is(vremote.videoWidth, vlocal.videoWidth / 2, "sink is 1/2 width of source");
+ is(vremote.videoHeight, vlocal.videoHeight / 2, "sink is 1/2 height of source");
+ },
+ function PC_REMOTE_SET_RTP_NONEXISTENT_RID(test) {
+ // Now, cause pcRemote to filter out everything, just to make sure
+ // selectRecvSsrc is working.
+ selectRecvSsrc(test.pcRemote, 2);
+ },
+ function PC_REMOTE_ENSURE_NO_FRAMES() {
+ var vremote = test.pcRemote.remoteMediaElements[0];
+ ok(vremote, "Should have remote video element for pcRemote");
+ return helper.verifyNoFrames(vremote);
+ },
+ ]);
- return test.run();
- })
- .catch(e => ok(false, "unexpected failure: " + e)));
+ return pushPrefs(['media.peerconnection.simulcast', true],
+ ['media.peerconnection.video.min_bitrate_estimate', 100*1000])
+ .then(() => test.run());
+ });
</script>
</pre>
</body>
</html>
--- a/dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html
+++ b/dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html
@@ -31,17 +31,17 @@ function PC_REMOTE_SET_LOCAL_DESCRIPTION
}
function PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC(test) {
test.pcLocal.onsignalingstatechange = function() {};
test.pcLocal._pc.setRemoteDescription(test._remote_answer,
test.pcLocal.releaseIceCandidates,
generateErrorCallback("pcLocal._pc.setRemoteDescription() sync failed"));
}
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{video: true}], [{video: true}]);
test.chain.replace("PC_LOCAL_SET_LOCAL_DESCRIPTION", PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC);
test.chain.replace("PC_REMOTE_SET_REMOTE_DESCRIPTION", PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC);
test.chain.remove("PC_REMOTE_CHECK_CAN_TRICKLE_SYNC");
test.chain.replace("PC_REMOTE_SET_LOCAL_DESCRIPTION", PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC);
test.chain.replace("PC_LOCAL_SET_REMOTE_DESCRIPTION", PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC);
test.chain.remove("PC_LOCAL_CHECK_CAN_TRICKLE_SYNC");
--- a/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_throwInCallbacks.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "857765",
title: "Throw in PeerConnection callbacks"
});
-runNetworkTest(function () {
+runNetworkTest(function(options = {}) {
function finish() {
window.onerror = oldOnError;
is(error_count, 7, "Seven expected errors verified.");
networkTestFinished();
}
function getFail() {
return err => {
--- a/dom/media/tests/mochitest/test_peerConnection_toJSON.html
+++ b/dom/media/tests/mochitest/test_peerConnection_toJSON.html
@@ -6,17 +6,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "928304",
title: "test toJSON() on RTCSessionDescription and RTCIceCandidate"
});
- runNetworkTest(function () {
+ runNetworkTest(function(options = {}) {
/** Test for Bug 872377 **/
var rtcSession = new RTCSessionDescription({ sdp: "Picklechips!",
type: "offer" });
var jsonCopy = JSON.parse(JSON.stringify(rtcSession));
for (key in rtcSession) {
if (typeof(rtcSession[key]) == "function") continue;
is(rtcSession[key], jsonCopy[key], "key " + key + " should match.");
--- a/dom/media/tests/mochitest/test_peerConnection_trackDisabling.html
+++ b/dom/media/tests/mochitest/test_peerConnection_trackDisabling.html
@@ -7,17 +7,17 @@
<body>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "1219711",
title: "Disabling locally should be reflected remotely"
});
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
// Always use fake tracks since we depend on video to be somewhat green and
// audio to have a large 1000Hz component (or 440Hz if using fake devices).
test.setMediaConstraints([{audio: true, video: true, fake: true}], []);
test.chain.append([
function CHECK_ASSUMPTIONS() {
is(test.pcLocal.localMediaElements.length, 2,
--- a/dom/media/tests/mochitest/test_peerConnection_trackDisabling_clones.html
+++ b/dom/media/tests/mochitest/test_peerConnection_trackDisabling_clones.html
@@ -7,17 +7,17 @@
<body>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
bug: "1219711",
title: "Disabling locally should be reflected remotely, individually for clones"
});
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
var originalStream;
var localVideoOriginal;
// Always use fake tracks since we depend on audio to have a large 1000Hz
// component.
test.setMediaConstraints([{audio: true, video: true, fake: true}], []);
--- a/dom/media/tests/mochitest/test_peerConnection_twoAudioStreams.html
+++ b/dom/media/tests/mochitest/test_peerConnection_twoAudioStreams.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1091242",
title: "Multistream: Two audio streams"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}, {audio: true}],
[{audio: true}, {audio: true}]);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_twoAudioTracksInOneStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_twoAudioTracksInOneStream.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1145407",
title: "Multistream: Two audio tracks in one stream"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.chain.insertAfter("PC_REMOTE_GET_OFFER", [
function PC_REMOTE_OVERRIDE_STREAM_IDS_IN_OFFER(test) {
test._local_offer.sdp = test._local_offer.sdp.replace(
/a=msid:[^\s]*/g,
"a=msid:foo");
},
function PC_REMOTE_OVERRIDE_EXPECTED_STREAM_IDS(test) {
--- a/dom/media/tests/mochitest/test_peerConnection_twoAudioVideoStreams.html
+++ b/dom/media/tests/mochitest/test_peerConnection_twoAudioVideoStreams.html
@@ -8,17 +8,17 @@
<script type="application/javascript">
createHTML({
bug: "1091242",
title: "Multistream: Two audio streams, two video streams"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true}, {video: true}, {audio: true},
{video: true}],
[{audio: true}, {video: true}, {audio: true},
{video: true}]);
test.run();
});
</script>
--- a/dom/media/tests/mochitest/test_peerConnection_twoAudioVideoStreamsCombined.html
+++ b/dom/media/tests/mochitest/test_peerConnection_twoAudioVideoStreamsCombined.html
@@ -8,17 +8,17 @@
<script type="application/javascript">
createHTML({
bug: "1091242",
title: "Multistream: Two audio/video streams"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{audio: true, video: true},
{audio: true, video: true}],
[{audio: true, video: true},
{audio: true, video: true}]);
test.run();
});
</script>
--- a/dom/media/tests/mochitest/test_peerConnection_twoVideoStreams.html
+++ b/dom/media/tests/mochitest/test_peerConnection_twoVideoStreams.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1091242",
title: "Multistream: Two video streams"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.setMediaConstraints([{video: true}, {video: true}],
[{video: true}, {video: true}]);
test.run();
});
</script>
</pre>
</body>
--- a/dom/media/tests/mochitest/test_peerConnection_twoVideoTracksInOneStream.html
+++ b/dom/media/tests/mochitest/test_peerConnection_twoVideoTracksInOneStream.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1145407",
title: "Multistream: Two video tracks in offerer stream"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
test.chain.insertAfter("PC_REMOTE_GET_OFFER", [
function PC_REMOTE_OVERRIDE_STREAM_IDS_IN_OFFER(test) {
test._local_offer.sdp = test._local_offer.sdp.replace(
/a=msid:[^\s]*/g,
"a=msid:foo");
},
function PC_REMOTE_OVERRIDE_EXPECTED_STREAM_IDS(test) {
--- a/dom/media/tests/mochitest/test_peerConnection_verifyAudioAfterRenegotiation.html
+++ b/dom/media/tests/mochitest/test_peerConnection_verifyAudioAfterRenegotiation.html
@@ -7,17 +7,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1166832",
title: "Renegotiation: verify audio after renegotiation"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
test = new PeerConnectionTest(options);
var helper = new AudioStreamHelper();
test.chain.append([
function CHECK_ASSUMPTIONS() {
is(test.pcLocal.localMediaElements.length, 1,
"pcLocal should have one media element");
is(test.pcRemote.remoteMediaElements.length, 1,
@@ -38,17 +38,17 @@
.then(() => info("Checking local audio disabled"))
.then(() => helper.checkAudioNotFlowing(test.pcLocal._pc.getLocalStreams()[0]))
.then(() => info("Checking remote audio disabled"))
.then(() => helper.checkAudioNotFlowing(test.pcRemote._pc.getRemoteStreams()[0]))
}
]);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
test.setMediaConstraints([{audio: true}],
[]);
return test.pcLocal.getAllUserMedia([{audio: true}]);
},
]
);
--- a/dom/media/tests/mochitest/test_peerConnection_verifyVideoAfterRenegotiation.html
+++ b/dom/media/tests/mochitest/test_peerConnection_verifyVideoAfterRenegotiation.html
@@ -7,17 +7,17 @@
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1166832",
title: "Renegotiation: verify video after renegotiation"
});
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
var h1 = new CaptureStreamTestHelper2D(50, 50);
var canvas1 = h1.createAndAppendElement('canvas', 'source_canvas1');
var stream1;
var vremote1;
var h2 = new CaptureStreamTestHelper2D(50, 50);
@@ -53,17 +53,17 @@ runNetworkTest(() => {
h1.drawColor(canvas1, h1.red);
},
function WAIT_FOR_REMOTE_RED() {
return h1.waitForPixelColor(vremote1, h1.red, 128,
"pcRemote's remote should become red");
}
]);
- addRenegotiation(test.chain,
+ test.addRenegotiation(
[
function PC_LOCAL_ADD_SECOND_STREAM(test) {
canvas2 = h2.createAndAppendElement('canvas', 'source_canvas2');
h2.drawColor(canvas2, h2.blue);
stream2 = canvas2.captureStream(0);
// can't use test.pcLocal.getAllUserMedia([{video: true}]);
// because it doesn't let us substitute the capture stream
--- a/dom/media/tests/mochitest/test_peerConnection_videoRenegotiationInactiveAnswer.html
+++ b/dom/media/tests/mochitest/test_peerConnection_videoRenegotiationInactiveAnswer.html
@@ -9,17 +9,17 @@
<pre id="test">
<script type="application/javascript">
createHTML({
bug: "1213773",
title: "Renegotiation: answerer uses a=inactive for video"
});
var test;
- runNetworkTest(function (options) {
+ runNetworkTest(function(options = {}) {
var helper;
test = new PeerConnectionTest(options);
test.chain.replace("PC_LOCAL_GUM", [
function PC_LOCAL_CANVAS_CAPTURESTREAM(test) {
helper = new VideoStreamHelper();
test.pcLocal.attachLocalStream(helper.stream());
@@ -29,37 +29,34 @@
test.chain.append([
function PC_REMOTE_WAIT_FOR_FRAMES() {
var vremote = test.pcRemote.remoteMediaElements[0];
ok(vremote, "Should have remote video element for pcRemote");
return helper.waitForFrames(vremote);
}
]);
- addRenegotiation(test.chain, []);
+ test.addRenegotiation([]);
test.chain.insertAfter("PC_LOCAL_GET_ANSWER", [
function PC_LOCAL_REWRITE_REMOTE_SDP_INACTIVE(test) {
test._remote_answer.sdp =
sdputils.setAllMsectionsInactive(test._remote_answer.sdp);
}
], false, 1);
test.chain.append([
function PC_REMOTE_ENSURE_NO_FRAMES() {
var vremote = test.pcRemote.remoteMediaElements[0];
ok(vremote, "Should have remote video element for pcRemote");
return helper.verifyNoFrames(vremote);
},
]);
- test.chain.remove("PC_REMOTE_CHECK_STATS", 1);
- test.chain.remove("PC_LOCAL_CHECK_STATS", 1);
-
- addRenegotiation(test.chain, []);
+ test.addRenegotiation([]);
test.chain.append([
function PC_REMOTE_WAIT_FOR_FRAMES_2() {
var vremote = test.pcRemote.remoteMediaElements[0];
ok(vremote, "Should have remote video element for pcRemote");
return helper.waitForFrames(vremote);
}
]);
--- a/dom/media/tests/mochitest/test_peerConnection_webAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_webAudio.html
@@ -10,17 +10,17 @@ createHTML({
bug: "1081819",
title: "WebAudio on both input and output side of peerconnection"
});
// This tests WebAudio (a 700Hz OscillatorNode) as input to a PeerConnection.
// It also tests that a PeerConnection works as input to WebAudio as the remote
// stream is connected to an AnalyserNode and compared to the source node.
-runNetworkTest(function() {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.audioContext = new AudioContext();
test.setMediaConstraints([{audio: true}], []);
test.chain.replace("PC_LOCAL_GUM", [
function PC_LOCAL_WEBAUDIO_SOURCE(test) {
var oscillator = test.audioContext.createOscillator();
oscillator.type = 'sine';
oscillator.frequency.value = 700;
--- a/dom/media/tests/mochitest/test_selftest.html
+++ b/dom/media/tests/mochitest/test_selftest.html
@@ -17,17 +17,17 @@ var catcher = func => {
try {
func();
return null;
} catch (e) {
return e.message;
}
};
-runNetworkTest(() => {
+runNetworkTest(function(options = {}) {
var test = new PeerConnectionTest();
test.setMediaConstraints([{video: true}], [{video: true}]);
is(catcher(() => test.chain.replace("PC_LOCAL_SET_LOCAL_DESCRIPTION", TEST)),
null, "test.chain.replace works");
is(catcher(() => test.chain.replace("FOO", TEST)),
"Unknown test: FOO", "test.chain.replace catches typos");
networkTestFinished();
});