Backed out 11 changesets (bug 1119593) for zmedia failures on a CLOSED TREE

Backed out changeset 6a3067465821 (bug 1119593)
Backed out changeset 7a2f5bf9e656 (bug 1119593)
Backed out changeset 544d8d52bbaf (bug 1119593)
Backed out changeset 3e61d3076385 (bug 1119593)
Backed out changeset 8b17ccc1d9c6 (bug 1119593)
Backed out changeset 8c9ee98fcce6 (bug 1119593)
Backed out changeset cc930e78d1b5 (bug 1119593)
Backed out changeset 2198a2cd71a1 (bug 1119593)
Backed out changeset 49e681140796 (bug 1119593)
Backed out changeset 288e9b7efccc (bug 1119593)
Backed out changeset 33b1f11c8784 (bug 1119593)
This commit is contained in:
Wes Kocher 2015-01-21 18:17:22 -08:00
parent 99e5446dba
commit 9ce614d9c8
88 changed files with 4057 additions and 2430 deletions

View File

@ -52,15 +52,23 @@ var common_tests = [
*/
function testConstraints(tests) {
function testgum(prev, test) {
return prev.then(() => navigator.mediaDevices.getUserMedia(test.constraints))
.then(() => is(null, test.error, test.message),
reason => is(reason.name, test.error, test.message + ": " + reason.message));
function testgum(p, test) {
return p.then(function() {
return navigator.mediaDevices.getUserMedia(test.constraints);
})
.then(function() {
is(null, test.error, test.message);
}, function(reason) {
is(reason.name, test.error, test.message + ": " + reason.message);
});
}
tests.reduce(testgum, Promise.resolve())
.catch(reason => {
ok(false, "Unexpected failure: " + reason.message);
})
.then(SimpleTest.finish);
var p = new Promise(function(resolve) { resolve(); });
tests.forEach(function(test) {
p = testgum(p, test);
});
p.catch(function(reason) {
ok(false, "Unexpected failure: " + reason.message);
})
.then(SimpleTest.finish);
}

View File

@ -2,169 +2,229 @@
* 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/. */
/**
* Returns the contents of a blob as text
*
* @param {Blob} blob
The blob to retrieve the contents from
*/
function getBlobContent(blob) {
return new Promise(resolve => {
var reader = new FileReader();
// Listen for 'onloadend' which will always be called after a success or failure
reader.onloadend = event => resolve(event.target.result);
reader.readAsText(blob);
});
}
function addInitialDataChannel(chain) {
chain.insertBefore('PC_LOCAL_CREATE_OFFER', [
function PC_REMOTE_EXPECT_DATA_CHANNEL(test) {
test.pcRemote.expectDataChannel();
},
['PC_LOCAL_CREATE_DATA_CHANNEL',
function (test) {
var channel = test.pcLocal.createDataChannel({});
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(channel.binaryType, "blob", channel + " is of binary type 'blob'");
is(channel.readyState, "connecting", channel + " is in state: 'connecting'");
is(test.pcLocal.signalingState, STABLE,
"Create datachannel does not change signaling state");
}
is(test.pcLocal.signalingState, STABLE,
"Create datachannel does not change signaling state");
test.next();
}
]
]);
chain.insertAfter('PC_REMOTE_CREATE_ANSWER', [
[
'PC_LOCAL_SETUP_DATA_CHANNEL_CALLBACK',
function (test) {
test.waitForInitialDataChannel(test.pcLocal, function () {
ok(true, test.pcLocal + " dataChannels[0] switched to 'open'");
},
// At this point a timeout failure will be of no value
null);
test.next();
}
],
[
'PC_REMOTE_SETUP_DATA_CHANNEL_CALLBACK',
function (test) {
test.waitForInitialDataChannel(test.pcRemote, function () {
ok(true, test.pcRemote + " dataChannels[0] switched to 'open'");
},
// At this point a timeout failure will be of no value
null);
test.next();
}
]
]);
chain.insertBefore('PC_LOCAL_CHECK_MEDIA_TRACKS', [
function PC_LOCAL_VERIFY_DATA_CHANNEL_STATE(test) {
return test.pcLocal.dataChannels[0].opened;
},
function PC_REMOTE_VERIFY_DATA_CHANNEL_STATE(test) {
return test.pcRemote.nextDataChannel.then(channel => channel.opened);
}
[
'PC_LOCAL_VERIFY_DATA_CHANNEL_STATE',
function (test) {
test.waitForInitialDataChannel(test.pcLocal, function() {
test.next();
}, function() {
ok(false, test.pcLocal + " initial dataChannels[0] failed to switch to 'open'");
//TODO: use stopAndExit() once bug 1019323 has landed
unexpectedEventAndFinish(this, 'timeout')
// to prevent test framework timeouts
test.next();
});
}
],
[
'PC_REMOTE_VERIFY_DATA_CHANNEL_STATE',
function (test) {
test.waitForInitialDataChannel(test.pcRemote, function() {
test.next();
}, function() {
ok(false, test.pcRemote + " initial dataChannels[0] failed to switch to 'open'");
//TODO: use stopAndExit() once bug 1019323 has landed
unexpectedEventAndFinish(this, 'timeout');
// to prevent test framework timeouts
test.next();
});
}
]
]);
chain.removeAfter('PC_REMOTE_CHECK_ICE_CONNECTIONS');
chain.append([
function SEND_MESSAGE(test) {
var message = "Lorem ipsum dolor sit amet";
[
'SEND_MESSAGE',
function (test) {
var message = "Lorem ipsum dolor sit amet";
return test.send(message).then(result => {
is(result.data, message, "Message correctly transmitted from pcLocal to pcRemote.");
});
},
test.send(message, function (channel, data) {
is(data, message, "Message correctly transmitted from pcLocal to pcRemote.");
function SEND_BLOB(test) {
var contents = ["At vero eos et accusam et justo duo dolores et ea rebum."];
var blob = new Blob(contents, { "type" : "text/plain" });
test.next();
});
}
],
[
'SEND_BLOB',
function (test) {
var contents = ["At vero eos et accusam et justo duo dolores et ea rebum."];
var blob = new Blob(contents, { "type" : "text/plain" });
return test.send(blob).then(result => {
ok(result.data instanceof Blob, "Received data is of instance Blob");
is(result.data.size, blob.size, "Received data has the correct size.");
test.send(blob, function (channel, data) {
ok(data instanceof Blob, "Received data is of instance Blob");
is(data.size, blob.size, "Received data has the correct size.");
return getBlobContent(result.data);
}).then(recv_contents =>
is(recv_contents, contents, "Received data has the correct content."));
},
getBlobContent(data, function (recv_contents) {
is(recv_contents, contents, "Received data has the correct content.");
function CREATE_SECOND_DATA_CHANNEL(test) {
return test.createDataChannel({ }).then(result => {
var sourceChannel = result.local;
var targetChannel = result.remote;
is(sourceChannel.readyState, "open", sourceChannel + " is in state: 'open'");
is(targetChannel.readyState, "open", targetChannel + " is in state: 'open'");
test.next();
});
});
}
],
[
'CREATE_SECOND_DATA_CHANNEL',
function (test) {
test.createDataChannel({ }, function (sourceChannel, targetChannel) {
is(sourceChannel.readyState, "open", sourceChannel + " is in state: 'open'");
is(targetChannel.readyState, "open", targetChannel + " is in state: 'open'");
is(targetChannel.binaryType, "blob", targetChannel + " is of binary type 'blob'");
});
},
is(targetChannel.binaryType, "blob", targetChannel + " is of binary type 'blob'");
is(targetChannel.readyState, "open", targetChannel + " is in state: 'open'");
function SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL(test) {
var channels = test.pcRemote.dataChannels;
var message = "I am the Omega";
test.next();
});
}
],
[
'SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL',
function (test) {
var channels = test.pcRemote.dataChannels;
var message = "Lorem ipsum dolor sit amet";
return test.send(message).then(result => {
is(channels.indexOf(result.channel), channels.length - 1, "Last channel used");
is(result.data, message, "Received message has the correct content.");
});
},
test.send(message, function (channel, data) {
is(channels.indexOf(channel), channels.length - 1, "Last channel used");
is(data, message, "Received message has the correct content.");
test.next();
});
}
],
[
'SEND_MESSAGE_THROUGH_FIRST_CHANNEL',
function (test) {
var message = "Message through 1st channel";
var options = {
sourceChannel: test.pcLocal.dataChannels[0],
targetChannel: test.pcRemote.dataChannels[0]
};
function SEND_MESSAGE_THROUGH_FIRST_CHANNEL(test) {
var message = "Message through 1st channel";
var options = {
sourceChannel: test.pcLocal.dataChannels[0],
targetChannel: test.pcRemote.dataChannels[0]
};
test.send(message, function (channel, data) {
is(test.pcRemote.dataChannels.indexOf(channel), 0, "1st channel used");
is(data, message, "Received message has the correct content.");
return test.send(message, options).then(result => {
is(test.pcRemote.dataChannels.indexOf(result.channel), 0, "1st channel used");
is(result.data, message, "Received message has the correct content.");
});
},
test.next();
}, options);
}
],
[
'SEND_MESSAGE_BACK_THROUGH_FIRST_CHANNEL',
function (test) {
var message = "Return a message also through 1st channel";
var options = {
sourceChannel: test.pcRemote.dataChannels[0],
targetChannel: test.pcLocal.dataChannels[0]
};
test.send(message, function (channel, data) {
is(test.pcLocal.dataChannels.indexOf(channel), 0, "1st channel used");
is(data, message, "Return message has the correct content.");
function SEND_MESSAGE_BACK_THROUGH_FIRST_CHANNEL(test) {
var message = "Return a message also through 1st channel";
var options = {
sourceChannel: test.pcRemote.dataChannels[0],
targetChannel: test.pcLocal.dataChannels[0]
};
test.next();
}, options);
}
],
[
'CREATE_NEGOTIATED_DATA_CHANNEL',
function (test) {
var options = {negotiated:true, id: 5, protocol:"foo/bar", ordered:false,
maxRetransmits:500};
test.createDataChannel(options, function (sourceChannel2, targetChannel2) {
is(sourceChannel2.readyState, "open", sourceChannel2 + " is in state: 'open'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
return test.send(message, options).then(result => {
is(test.pcLocal.dataChannels.indexOf(result.channel), 0, "1st channel used");
is(result.data, message, "Return message has the correct content.");
});
},
is(targetChannel2.binaryType, "blob", targetChannel2 + " is of binary type 'blob'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
function CREATE_NEGOTIATED_DATA_CHANNEL(test) {
var options = {
negotiated:true,
id: 5,
protocol: "foo/bar",
ordered: false,
maxRetransmits: 500
};
return test.createDataChannel(options).then(result => {
var sourceChannel2 = result.local;
var targetChannel2 = result.remote;
is(sourceChannel2.readyState, "open", sourceChannel2 + " is in state: 'open'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
is(targetChannel2.binaryType, "blob", targetChannel2 + " is of binary type 'blob'");
is(sourceChannel2.id, options.id, sourceChannel2 + " id is:" + sourceChannel2.id);
var reliable = !options.ordered ? false : (options.maxRetransmits || options.maxRetransmitTime);
is(sourceChannel2.protocol, options.protocol, sourceChannel2 + " protocol is:" + sourceChannel2.protocol);
is(sourceChannel2.reliable, reliable, sourceChannel2 + " reliable is:" + sourceChannel2.reliable);
/*
These aren't exposed by IDL yet
if (options.id != undefined) {
is(sourceChannel2.id, options.id, sourceChannel2 + " id is:" + sourceChannel2.id);
}
else {
options.id = sourceChannel2.id;
}
var reliable = !options.ordered ? false : (options.maxRetransmits || options.maxRetransmitTime);
is(sourceChannel2.protocol, options.protocol, sourceChannel2 + " protocol is:" + sourceChannel2.protocol);
is(sourceChannel2.reliable, reliable, sourceChannel2 + " reliable is:" + sourceChannel2.reliable);
/*
These aren't exposed by IDL yet
is(sourceChannel2.ordered, options.ordered, sourceChannel2 + " ordered is:" + sourceChannel2.ordered);
is(sourceChannel2.maxRetransmits, options.maxRetransmits, sourceChannel2 + " maxRetransmits is:" +
sourceChannel2.maxRetransmits);
sourceChannel2.maxRetransmits);
is(sourceChannel2.maxRetransmitTime, options.maxRetransmitTime, sourceChannel2 + " maxRetransmitTime is:" +
sourceChannel2.maxRetransmitTime);
*/
sourceChannel2.maxRetransmitTime);
*/
is(targetChannel2.id, options.id, targetChannel2 + " id is:" + targetChannel2.id);
is(targetChannel2.protocol, options.protocol, targetChannel2 + " protocol is:" + targetChannel2.protocol);
is(targetChannel2.reliable, reliable, targetChannel2 + " reliable is:" + targetChannel2.reliable);
/*
These aren't exposed by IDL yet
is(targetChannel2.ordered, options.ordered, targetChannel2 + " ordered is:" + targetChannel2.ordered);
is(targetChannel2.id, options.id, targetChannel2 + " id is:" + targetChannel2.id);
is(targetChannel2.protocol, options.protocol, targetChannel2 + " protocol is:" + targetChannel2.protocol);
is(targetChannel2.reliable, reliable, targetChannel2 + " reliable is:" + targetChannel2.reliable);
/*
These aren't exposed by IDL yet
is(targetChannel2.ordered, options.ordered, targetChannel2 + " ordered is:" + targetChannel2.ordered);
is(targetChannel2.maxRetransmits, options.maxRetransmits, targetChannel2 + " maxRetransmits is:" +
targetChannel2.maxRetransmits);
targetChannel2.maxRetransmits);
is(targetChannel2.maxRetransmitTime, options.maxRetransmitTime, targetChannel2 + " maxRetransmitTime is:" +
targetChannel2.maxRetransmitTime);
*/
});
},
targetChannel2.maxRetransmitTime);
*/
function SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL2(test) {
var channels = test.pcRemote.dataChannels;
var message = "I am the walrus; Goo goo g'joob";
test.next();
});
}
],
[
'SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL2',
function (test) {
var channels = test.pcRemote.dataChannels;
var message = "Lorem ipsum dolor sit amet";
return test.send(message).then(result => {
is(channels.indexOf(result.channel), channels.length - 1, "Last channel used");
is(result.data, message, "Received message has the correct content.");
});
}
test.send(message, function (channel, data) {
is(channels.indexOf(channel), channels.length - 1, "Last channel used");
is(data, message, "Received message has the correct content.");
test.next();
});
}
]
]);
}

View File

@ -2,10 +2,9 @@
* 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;
var Cr = SpecialPowers.Cr;
// Specifies whether we are using fake streams to run this automation
var FAKE_ENABLED = true;
@ -33,7 +32,7 @@ try {
* @param {boolean} [meta.visible=false]
* Visibility of the media elements
*/
function realCreateHTML(meta) {
function createHTML(meta) {
var test = document.getElementById('test');
// Create the head content
@ -47,13 +46,13 @@ function realCreateHTML(meta) {
// Create the body content
var anchor = document.createElement('a');
anchor.textContent = meta.title;
anchor.setAttribute('target', '_blank');
if (meta.bug) {
anchor.setAttribute('href', 'https://bugzilla.mozilla.org/show_bug.cgi?id=' + meta.bug);
} else {
anchor.setAttribute('target', '_blank');
}
anchor.textContent = meta.title;
document.body.insertBefore(anchor, test);
var display = document.createElement('p');
@ -82,16 +81,14 @@ function createMediaElement(type, label) {
var element = document.getElementById(id);
// Sanity check that we haven't created the element already
if (element) {
if (element)
return element;
}
element = document.createElement(type === 'audio' ? 'audio' : 'video');
element.setAttribute('id', id);
element.setAttribute('height', 100);
element.setAttribute('width', 150);
element.setAttribute('controls', 'controls');
element.setAttribute('autoplay', 'autoplay');
document.getElementById('content').appendChild(element);
return element;
@ -104,32 +101,35 @@ function createMediaElement(type, label) {
*
* @param {Dictionary} constraints
* The constraints for this mozGetUserMedia callback
* @param {Function} onSuccess
* The success callback if the stream is successfully retrieved
* @param {Function} onError
* The error callback if the stream fails to be retrieved
*/
function getUserMedia(constraints) {
function getUserMedia(constraints, onSuccess, onError) {
if (!("fake" in constraints) && FAKE_ENABLED) {
constraints["fake"] = FAKE_ENABLED;
}
info("Call getUserMedia for " + JSON.stringify(constraints));
return navigator.mediaDevices.getUserMedia(constraints);
navigator.mozGetUserMedia(constraints, onSuccess, onError);
}
// These are the promises we use to track that the prerequisites for the test
// are in place before running it. Users of this file need to ensure that they
// also provide a promise called `scriptsReady` as well.
var setTestOptions;
var testConfigured = new Promise(r => setTestOptions = r);
function setupEnvironment() {
if (!window.SimpleTest) {
return Promise.resolve();
}
// Running as a Mochitest.
SimpleTest.requestFlakyTimeout("WebRTC inherently depends on timeouts");
window.finish = () => SimpleTest.finish();
SpecialPowers.pushPrefEnv({
'set': [
/**
* Setup any Mochitest for WebRTC by enabling the preference for
* peer connections. As by bug 797979 it will also enable mozGetUserMedia()
* and disable the mozGetUserMedia() permission checking.
*
* @param {Function} aCallback
* Test method to execute after initialization
*/
function runTest(aCallback) {
if (window.SimpleTest) {
// Running as a Mochitest.
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("WebRTC inherently depends on timeouts");
SpecialPowers.pushPrefEnv({'set': [
['dom.messageChannel.enabled', true],
['media.peerconnection.enabled', true],
['media.peerconnection.identity.enabled', true],
@ -137,39 +137,29 @@ function setupEnvironment() {
['media.peerconnection.default_iceservers', '[]'],
['media.navigator.permission.disabled', true],
['media.getusermedia.screensharing.enabled', true],
['media.getusermedia.screensharing.allowed_domains', "mochi.test"]
]
}, setTestOptions);
['media.getusermedia.screensharing.allowed_domains', "mochi.test"]]
}, function () {
try {
aCallback();
}
catch (err) {
generateErrorCallback()(err);
}
});
} else {
// Steeplechase, let it call the callback.
window.run_test = function(is_initiator) {
var options = {is_local: is_initiator,
is_remote: !is_initiator};
aCallback(options);
};
// Also load the steeplechase test code.
var s = document.createElement("script");
s.src = "/test.js";
document.head.appendChild(s);
}
}
// This is called by steeplechase; which provides the test configuration options
// directly to the test through this function. If we're not on steeplechase,
// the test is configured directly and immediately.
function run_test(is_initiator) {
var options = { is_local: is_initiator,
is_remote: !is_initiator };
// Also load the steeplechase test code.
var s = document.createElement("script");
s.src = "/test.js";
s.onload = () => setTestOptions(options);
document.head.appendChild(s);
}
function runTestWhenReady(testFunc) {
setupEnvironment();
return Promise.all([scriptsReady, testConfigured]).then(() => {
try {
return testConfigured.then(options => testFunc(options));
} catch (e) {
ok(false, 'Error executing test: ' + e +
((typeof e.stack === 'string') ?
(' ' + e.stack.split('\n').join(' ... ')) : ''));
}
});
}
/**
* 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.
@ -181,10 +171,10 @@ function runTestWhenReady(testFunc) {
* tracks being checked
*/
function checkMediaStreamTracksByType(constraints, type, mediaStreamTracks) {
if (constraints[type]) {
if(constraints[type]) {
is(mediaStreamTracks.length, 1, 'One ' + type + ' track shall be present');
if (mediaStreamTracks.length) {
if(mediaStreamTracks.length) {
is(mediaStreamTracks[0].kind, type, 'Track kind should be ' + type);
ok(mediaStreamTracks[0].id, 'Track id should be defined');
}
@ -208,27 +198,29 @@ function checkMediaStreamTracks(constraints, mediaStream) {
mediaStream.getVideoTracks());
}
/*** Utility methods */
/**
* Utility methods
*/
/** The dreadful setTimeout, use sparingly */
function wait(time) {
return new Promise(r => setTimeout(r, time));
/**
* Returns the contents of a blob as text
*
* @param {Blob} blob
The blob to retrieve the contents from
* @param {Function} onSuccess
Callback with the blobs content as parameter
*/
function getBlobContent(blob, onSuccess) {
var reader = new FileReader();
// Listen for 'onloadend' which will always be called after a success or failure
reader.onloadend = function (event) {
onSuccess(event.target.result);
};
reader.readAsText(blob);
}
/** The even more dreadful setInterval, use even more sparingly */
function waitUntil(func, time) {
return new Promise(resolve => {
var interval = setInterval(() => {
if (func()) {
clearInterval(interval);
resolve();
}
}, time || 200);
});
}
/*** Test control flow methods */
/**
* Generates a callback function fired only under unexpected circumstances
* while running the tests. The generated function kills off the test as well
@ -246,7 +238,7 @@ function generateErrorCallback(message) {
* @param {object} aObj
* The object fired back from the callback
*/
return aObj => {
return function (aObj) {
if (aObj) {
if (aObj.name && aObj.message) {
ok(false, "Unexpected callback for '" + aObj.name +
@ -260,15 +252,10 @@ function generateErrorCallback(message) {
ok(false, "Unexpected callback with message = '" + message +
"' at: " + JSON.stringify(stack));
}
throw new Error("Unexpected callback");
SimpleTest.finish();
}
}
var unexpectedEventArrived;
var rejectOnUnexpectedEvent = new Promise((x, reject) => {
unexpectedEventArrived = reject;
});
/**
* Generates a callback function fired only for unexpected events happening.
*
@ -277,211 +264,29 @@ var rejectOnUnexpectedEvent = new Promise((x, reject) => {
* @param {String} eventName
Name of the unexpected event
*/
function unexpectedEvent(message, eventName) {
function unexpectedEventAndFinish(message, eventName) {
var stack = new Error().stack.split("\n");
stack.shift(); // Don't include this instantiation frame
return e => {
var details = "Unexpected event '" + eventName + "' fired with message = '" +
message + "' at: " + JSON.stringify(stack);
ok(false, details);
unexpectedEventArrived(new Error(details));
return function () {
ok(false, "Unexpected event '" + eventName + "' fired with message = '" +
message + "' at: " + JSON.stringify(stack));
SimpleTest.finish();
}
}
/**
* Implements the one-shot event pattern used throughout. Each of the 'onxxx'
* attributes on the wrappers can be set with a custom handler. Prior to the
* handler being set, if the event fires, it causes the test execution to halt.
* That handler is used exactly once, after which the original, error-generating
* handler is re-installed. Thus, each event handler is used at most once.
*
* @param {object} wrapper
* The wrapper on which the psuedo-handler is installed
* @param {object} obj
* The real source of events
* @param {string} event
* The name of the event
*/
function createOneShotEventWrapper(wrapper, obj, event) {
var onx = 'on' + event;
var unexpected = unexpectedEvent(wrapper, event);
wrapper[onx] = unexpected;
obj[onx] = e => {
info(wrapper + ': "on' + event + '" event fired');
e.wrapper = wrapper;
wrapper[onx](e);
wrapper[onx] = unexpected;
};
}
/**
* This class executes a series of functions in a continuous sequence.
* Promise-bearing functions are executed after the previous promise completes.
*
* @constructor
* @param {object} framework
* A back reference to the framework which makes use of the class. It is
* passed to each command callback.
* @param {function[]} commandList
* Commands to set during initialization
*/
function CommandChain(framework, commandList) {
this._framework = framework;
this.commands = commandList || [ ];
}
CommandChain.prototype = {
/**
* Start the command chain. This returns a promise that always resolves
* cleanly (this catches errors and fails the test case).
*/
execute: function () {
return this.commands.reduce((prev, next, i) => {
if (typeof next !== 'function' || !next.name) {
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(' ... ')) : '')));
},
/**
* Add new commands to the end of the chain
*/
append: function(commands) {
this.commands = this.commands.concat(commands);
},
/**
* Returns the index of the specified command in the chain.
*/
indexOf: function(functionOrName) {
if (typeof functionOrName === 'string') {
return this.commands.findIndex(f => f.name === functionOrName);
}
return this.commands.indexOf(functionOrName);
},
/**
* Inserts the new commands after the specified command.
*/
insertAfter: function(functionOrName, commands) {
this._insertHelper(functionOrName, commands, 1);
},
/**
* Inserts the new commands before the specified command.
*/
insertBefore: function(functionOrName, commands) {
this._insertHelper(functionOrName, commands, 0);
},
_insertHelper: function(functionOrName, commands, delta) {
var index = this.indexOf(functionOrName);
if (index >= 0) {
this.commands = [].concat(
this.commands.slice(0, index + delta),
commands,
this.commands.slice(index + delta));
}
},
/**
* Removes the specified command, returns what was removed.
*/
remove: function(functionOrName) {
var index = this.indexOf(functionOrName);
if (index >= 0) {
return this.commands.splice(index, 1);
}
return [];
},
/**
* Removes all commands after the specified one, returns what was removed.
*/
removeAfter: function(functionOrName) {
var index = this.indexOf(functionOrName);
if (index >= 0) {
return this.commands.splice(index + 1);
}
return [];
},
/**
* Removes all commands before the specified one, returns what was removed.
*/
removeBefore: function(functionOrName) {
var index = this.indexOf(functionOrName);
if (index >= 0) {
return this.commands.splice(0, index);
}
return [];
},
/**
* Replaces a single command, returns what was removed.
*/
replace: function(functionOrName, commands) {
this.insertBefore(functionOrName, commands);
return this.remove(functionOrName);
},
/**
* Replaces all commands after the specified one, returns what was removed.
*/
replaceAfter: function(functionOrName, commands) {
var oldCommands = this.removeAfter(functionOrName);
this.append(commands);
return oldCommands;
},
/**
* Replaces all commands before the specified one, returns what was removed.
*/
replaceBefore: function(functionOrName, commands) {
var oldCommands = this.removeBefore(functionOrName);
this.insertBefore(functionOrName, commands);
return oldCommands;
},
/**
* Remove all commands whose name match the specified regex.
*/
filterOut: function (id_match) {
this.commands = this.commands.filter(c => !id_match.test(c.name));
}
};
function IsMacOSX10_6orOlder() {
if (navigator.platform.indexOf("Mac") !== 0) {
return false;
}
var is106orOlder = 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);
if (navigator.platform.indexOf("Mac") == 0) {
var version = Cc["@mozilla.org/system-info;1"]
.getService(SpecialPowers.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.
is106orOlder = (parseFloat(version) < 11.0);
}
return is106orOlder;
}
(function(){
var el = document.createElement("link");
el.rel = "stylesheet";
el.type = "text/css";
el.href= "/tests/SimpleTest/test.css";
document.head.appendChild(el);
}());

View File

@ -1,7 +1,7 @@
(function(g) {
'use strict';
g.trapIdentityEvents = target => {
g.trapIdentityEvents = function(target) {
var state = {};
var identityEvents = ['idpassertionerror', 'idpvalidationerror',
'identityresult', 'peeridentity'];

View File

@ -1,15 +1,17 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript">var scriptRelativePath = "../";</script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="../head.js"></script>
<script type="application/javascript" src="../pc.js"></script>
<script type="application/javascript" src="../templates.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "getIdentityAssertion Tests",
bug: "942367"
title: "getIdentityAssertion Tests"
});
function checkIdentity(assertion, identity) {
@ -26,80 +28,85 @@ function theTest() {
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter('PC_REMOTE_CHECK_INITIAL_SIGNALINGSTATE');
test.chain.append([
function GET_IDENTITY_ASSERTION_FAILS_WITHOUT_PROVIDER(test) {
return new Promise(resolve => {
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(e, "getIdentityAssertion must fail without provider");
resolve();
};
test.pcLocal._pc.getIdentityAssertion();
});
[
"GET_IDENTITY_ASSERTION_FAILS_WITHOUT_PROVIDER",
function(test) {
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(e, "getIdentityAssertion must fail without provider");
test.next();
};
test.pcLocal._pc.getIdentityAssertion();
},
function GET_IDENTITY_ASSERTION_FIRES_EVENTUALLY_AND_SUBSEQUENTLY(test) {
return new Promise(resolve => {
var fired = 0;
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html');
test.pcLocal._pc.onidentityresult = function(e) {
fired++;
if (fired == 1) {
ok(true, "identityresult fired");
checkIdentity(e.assertion, 'someone@example.com');
} else if (fired == 2) {
ok(true, "identityresult fired 2x");
checkIdentity(e.assertion, 'someone@example.com');
resolve();
}
};
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(false, "error event fired");
resolve();
};
test.pcLocal._pc.getIdentityAssertion();
test.pcLocal._pc.getIdentityAssertion();
});
},
function GET_IDENTITY_ASSERTION_FAILS(test) {
return new Promise(resolve => {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error');
test.pcLocal._pc.onidentityresult = function(e) {
ok(false, "Should not get an identity result");
resolve();
};
test.pcLocal._pc.onidpassertionerror = function(err) {
ok(err, "Got error event from getIdentityAssertion");
resolve();
};
test.pcLocal._pc.getIdentityAssertion();
});
},
function GET_IDENTITY_ASSERTION_IDP_NOT_READY(test) {
return new Promise(resolve => {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error:ready');
test.pcLocal._pc.onidentityresult = function(e) {
ok(false, "Should not get an identity result");
resolve();
};
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(e, "Got error callback from getIdentityAssertion");
resolve();
};
test.pcLocal._pc.getIdentityAssertion();
});
},
function GET_IDENTITY_ASSERTION_WITH_SPECIFIC_NAME(test) {
return new Promise(resolve => {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html', 'user@example.com');
test.pcLocal._pc.onidentityresult = function(e) {
checkIdentity(e.assertion, 'user@example.com');
resolve();
};
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(false, "Got error callback from getIdentityAssertion");
resolve();
};
test.pcLocal._pc.getIdentityAssertion();
});
],
[
"GET_IDENTITY_ASSERTION_FIRES_EVENTUALLY_AND_SUBSEQUENTLY",
function(test) {
var fired = 0;
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html');
test.pcLocal._pc.onidentityresult = function(e) {
fired++;
if (fired == 1) {
ok(true, "identityresult fired");
checkIdentity(e.assertion, 'someone@example.com');
} else if (fired == 2) {
ok(true, "identityresult fired 2x");
checkIdentity(e.assertion, 'someone@example.com');
test.next();
}
};
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(false, "error event fired");
test.next();
};
test.pcLocal._pc.getIdentityAssertion();
test.pcLocal._pc.getIdentityAssertion();
}
],
[
"GET_IDENTITY_ASSERTION_FAILS",
function(test) {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error');
test.pcLocal._pc.onidentityresult = function(e) {
ok(false, "Should not get an identity result");
test.next();
};
test.pcLocal._pc.onidpassertionerror = function(err) {
ok(err, "Got error event from getIdentityAssertion");
test.next();
};
test.pcLocal._pc.getIdentityAssertion();
}
],
[
"GET_IDENTITY_ASSERTION_IDP_NOT_READY",
function(test) {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error:ready');
test.pcLocal._pc.onidentityresult = function(e) {
ok(false, "Should not get an identity result");
test.next();
};
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(e, "Got error callback from getIdentityAssertion");
test.next();
};
test.pcLocal._pc.getIdentityAssertion();
}
],
[
"GET_IDENTITY_ASSERTION_WITH_SPECIFIC_NAME",
function(test) {
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html', 'user@example.com');
test.pcLocal._pc.onidentityresult = function(e) {
checkIdentity(e.assertion, 'user@example.com');
test.next();
};
test.pcLocal._pc.onidpassertionerror = function(e) {
ok(false, "Got error callback from getIdentityAssertion");
test.next();
};
test.pcLocal._pc.getIdentityAssertion();
}
]
]);
test.run();
}

View File

@ -1,16 +1,21 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript">var scriptRelativePath = "../";</script>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="../head.js"></script>
<script type="application/javascript" src="../pc.js"></script>
<script type="application/javascript" src="../templates.js"></script>
<script type="application/javascript" src="../blacksilence.js"></script>
<script type="application/javascript" src="../turnConfig.js"></script>
</head>
<body>
<div id="display"></div>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "setIdentityProvider leads to peerIdentity and assertions in SDP",
bug: "942367"
title: "setIdentityProvider leads to peerIdentity and assertions in SDP"
});
var test;
@ -43,8 +48,9 @@ function theTest() {
test.setIdentityProvider(test.pcLocal, 'test1.example.com', 'idp.html');
test.setIdentityProvider(test.pcRemote, 'test2.example.com', 'idp.html');
test.chain.append([
function PEER_IDENTITY_IS_SET_CORRECTLY(test) {
[
"PEER_IDENTITY_IS_SET_CORRECTLY",
function(test) {
// no need to wait to check identity in this case,
// setRemoteDescription should wait for the IdP to complete
function checkIdentity(pc, pfx, idp, name) {
@ -54,15 +60,26 @@ function theTest() {
checkIdentity(test.pcLocal._pc, "local: ", "test2.example.com", "someone");
checkIdentity(test.pcRemote._pc, "remote: ", "test1.example.com", "someone");
},
function REMOTE_STREAMS_ARE_RESTRICTED(test) {
var remoteStream = test.pcLocal._pc.getRemoteStreams()[0];
return Promise.all([
new Promise(done => audioIsSilence(true, remoteStream, done)),
new Promise(done => videoIsBlack(true, remoteStream, done))
]);
test.next();
}
],
[
"REMOTE_STREAMS_ARE_RESTRICTED",
function(test) {
var remoteStream = test.pcLocal._pc.getRemoteStreams()[0];
var oneDone = false;
function done() {
if (!oneDone) {
oneDone = true;
return;
}
test.next();
}
audioIsSilence(true, remoteStream, done);
videoIsBlack(true, remoteStream, done);
}
],
]);
test.run();
}

View File

@ -1,16 +1,19 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript">var scriptRelativePath = "../";</script>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="../head.js"></script>
<script type="application/javascript" src="../pc.js"></script>
<script type="application/javascript" src="../templates.js"></script>
<script type="application/javascript" src="identityevent.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "setIdentityProvider leads to peerIdentity and assertions in SDP",
bug: "942367"
title: "setIdentityProvider leads to peerIdentity and assertions in SDP"
});
var test;
@ -24,71 +27,88 @@ function theTest() {
var remoteEvents = trapIdentityEvents(test.pcRemote._pc);
test.chain.append([
function PEER_IDENTITY_IS_SET_CORRECTLY(test) {
[
"PEER_IDENTITY_IS_SET_CORRECTLY",
function(test) {
var outstanding = 0;
// we have to wait for the identity result in order to get the actual
// identity information, since the call will complete before the identity
// provider has a chance to finish verifying... that's OK, but it makes
// testing more difficult
function checkOrSetupCheck(pc, prefix, idp, name) {
function checkOrSetupCheck(pc, pfx, idp, name) {
function checkIdentity() {
ok(pc.peerIdentity, prefix + "peerIdentity is set");
is(pc.peerIdentity.idp, idp, prefix + "IdP is correct");
is(pc.peerIdentity.name, name + "@" + idp, prefix + "identity is correct");
ok(pc.peerIdentity, pfx + "peerIdentity is set");
is(pc.peerIdentity.idp, idp, pfx + "IdP is correct");
is(pc.peerIdentity.name, name + "@" + idp, pfx + "identity is correct");
}
if (pc.peerIdentity) {
info(prefix + "peerIdentity already set");
info(pfx + "peerIdentity already set");
checkIdentity();
return Promise.resolve();
}
return new Promise(resolve => {
info(prefix + "setting onpeeridentity handler");
pc.onpeeridentity = e => {
} else {
++outstanding;
info(pfx + "setting onpeeridentity handler");
pc.onpeeridentity = function checkIdentityEvent(e) {
info(pfx + "checking peerIdentity");
checkIdentity();
resolve();
--outstanding;
if (outstanding <= 0) {
test.next();
}
};
});
}
}
return Promise.all([
checkOrSetupCheck(test.pcLocal._pc, "local: ", "test2.example.com", "someone"),
checkOrSetupCheck(test.pcRemote._pc, "remote: ", "test1.example.com", "someone")
]);
},
function CHECK_IDENTITY_EVENTS(test) {
checkOrSetupCheck(test.pcLocal._pc, "local: ", "test2.example.com", "someone");
checkOrSetupCheck(test.pcRemote._pc, "remote: ", "test1.example.com", "someone");
if (outstanding <= 0) {
test.next();
}
}
],
[
"CHECK_IDENTITY_EVENTS",
function(test) {
ok(!localEvents.idpassertionerror , "No assertion generation errors on local");
ok(!remoteEvents.idpassertionerror, "No assertion generation errors on remote");
ok(!localEvents.idpvalidationerror, "No assertion validation errors on local");
ok(!remoteEvents.idpvalidationerror, "No assertion validation errors on remote");
ok( !remoteEvents.idpvalidationerror, "No assertion validation errors on remote");
ok(localEvents.identityresult, "local acquired identity assertions");
ok(remoteEvents.identityresult, "remote acquired identity assertions");
ok(localEvents.peeridentity, "local got peer identity");
ok(remoteEvents.peeridentity, "remote got peer identity");
},
function OFFERS_AND_ANSWERS_INCLUDE_IDENTITY(test) {
test.next();
}
],
[
"OFFERS_AND_ANSWERS_INCLUDE_IDENTITY",
function(test) {
ok(test.originalOffer.sdp.contains("a=identity"), "a=identity is in the offer SDP");
ok(test.originalAnswer.sdp.contains("a=identity"), "a=identity is in the answer SDP");
},
function DESCRIPTIONS_CONTAIN_IDENTITY(test) {
ok(test.pcLocal.localDescription.sdp.contains("a=identity"),
"a=identity is in the local copy of the offer");
ok(test.pcRemote.localDescription.sdp.contains("a=identity"),
"a=identity is in the remote copy of the offer");
ok(test.pcLocal.remoteDescription.sdp.contains("a=identity"),
"a=identity is in the local copy of the answer");
ok(test.pcRemote.remoteDescription.sdp.contains("a=identity"),
"a=identity is in the remote copy of the answer");
test.next();
}
],
[
"DESCRIPTIONS_CONTAIN_IDENTITY",
function(test) {
ok(test.pcLocal.localDescription.sdp.contains("a=identity"),
"a=identity is in the local copy of the offer");
ok(test.pcRemote.localDescription.sdp.contains("a=identity"),
"a=identity is in the remote copy of the offer");
ok(test.pcLocal.remoteDescription.sdp.contains("a=identity"),
"a=identity is in the local copy of the answer");
ok(test.pcRemote.remoteDescription.sdp.contains("a=identity"),
"a=identity is in the remote copy of the answer");
test.next();
}
]
]);
test.run();
}
runNetworkTest(theTest);
</script>
</pre>
</body>

View File

@ -1,20 +1,23 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript">var scriptRelativePath = "../";</script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="../head.js"></script>
<script type="application/javascript" src="../pc.js"></script>
<script type="application/javascript" src="../templates.js"></script>
<script type="application/javascript" src="identityevent.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "Identity Provider returning errors is handled correctly",
bug: "942367"
title: "Identity Provider returning errors is handled correctly"
});
var test;
runNetworkTest(function () {
var test = new PeerConnectionTest();
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
// first example generates an error
test.setIdentityProvider(test.pcLocal, 'example.com', 'idp.html#error', 'nobody');
@ -25,45 +28,53 @@ runNetworkTest(function () {
var remoteEvents = trapIdentityEvents(test.pcRemote._pc);
test.chain.append([
function CHECK_IDENTITY_EVENTS(test) {
function checkEvents() {
ok(localEvents.idpassertionerror, 'local assertion generation should fail (idpassertionerror)');
is(localEvents.idpassertionerror.idp, 'example.com', 'event IdP is correct');
is(localEvents.idpassertionerror.protocol, 'idp.html#error', 'event IdP protocol is #error');
ok(!remoteEvents.idpassertionerror, 'remote assertion generation should succeed (idpassertionerror)');
ok(!localEvents.identityresult, 'local assertion generation should fail (identityresult)');
ok(remoteEvents.identityresult, 'remote assertion generation should succeed (identityresult)');
[
'CHECK_IDENTITY_EVENTS',
function(test) {
function checkEvents() {
ok(localEvents.idpassertionerror, 'local assertion generation should fail (idpassertionerror)');
is(localEvents.idpassertionerror.idp, 'example.com', 'event IdP is correct');
is(localEvents.idpassertionerror.protocol, 'idp.html#error', 'event IdP protocol is #error');
ok(!remoteEvents.idpassertionerror, 'remote assertion generation should succeed (idpassertionerror)');
ok(!localEvents.identityresult, 'local assertion generation should fail (identityresult)');
ok(remoteEvents.identityresult, 'remote assertion generation should succeed (identityresult)');
ok(!localEvents.peeridentity, 'no peer identity event for local peer');
ok(!remoteEvents.peeridentity, 'no peer identity event for remote peer');
ok(localEvents.idpvalidationerror, 'local fails to validate');
is(localEvents.idpvalidationerror.idp, 'example.com', 'event IdP is correct');
is(localEvents.idpvalidationerror.protocol, 'idp.html#bad', 'event IdP protocol is #bad');
ok(!remoteEvents.idpvalidationerror, 'remote doesn\'t even see an assertion');
ok(!localEvents.peeridentity, 'no peer identity event for local peer');
ok(!remoteEvents.peeridentity, 'no peer identity event for remote peer');
ok(localEvents.idpvalidationerror, 'local fails to validate');
is(localEvents.idpvalidationerror.idp, 'example.com', 'event IdP is correct');
is(localEvents.idpvalidationerror.protocol, 'idp.html#bad', 'event IdP protocol is #bad');
ok(!remoteEvents.idpvalidationerror, 'remote doesn\'t even see an assertion');
test.next();
}
// we actually have to wait on this because IdP validation happens asynchronously
if (localEvents.idpvalidationerror) {
checkEvents();
} else {
// have to let the other event handler have a chance to record success
// before we run the checks that rely on that recording
test.pcLocal._pc.onidpvalidationerror = setTimeout.bind(window, checkEvents, 1);
}
}
// we actually have to wait on this because IdP validation happens asynchronously
if (localEvents.idpvalidationerror) {
checkEvents();
return Promise.resolve();
],
[
'PEER_IDENTITY_IS_EMPTY',
function(test) {
ok(!test.pcLocal._pc.peerIdentity, 'local peerIdentity is not set');
ok(!test.pcRemote._pc.peerIdentity, 'remote peerIdentity is not set');
test.next();
}
// have to let the other event handler have a chance to record success
// before we run the checks that rely on that recording
return new Promise(resolve => {
test.pcLocal._pc.onidpvalidationerror = resolve;
}).then(checkEvents);
},
function PEER_IDENTITY_IS_EMPTY(test) {
ok(!test.pcLocal._pc.peerIdentity, 'local peerIdentity is not set');
ok(!test.pcRemote._pc.peerIdentity, 'remote peerIdentity is not set');
},
function ONLY_REMOTE_SDP_INCLUDES_IDENTITY_ASSERTION(test) {
ok(!test.originalOffer.sdp.contains('a=identity'), 'a=identity not contained in the offer SDP');
ok(test.originalAnswer.sdp.contains('a=identity'), 'a=identity is contained in the answer SDP');
}
],
[
'ONLY_REMOTE_SDP_INCLUDES_IDENTITY_ASSERTION',
function(test) {
ok(!test.originalOffer.sdp.contains('a=identity'), 'a=identity not contained in the offer SDP');
ok(test.originalAnswer.sdp.contains('a=identity'), 'a=identity is contained in the answer SDP');
test.next();
}
]
]);
test.run();
});

View File

@ -37,9 +37,13 @@ MediaStreamPlayback.prototype = {
* @param {Function} onError the error callback if the media playback
* start and stop cycle fails
*/
playMedia : function(isResume) {
return this.startMedia(isResume)
.then(() => this.stopMediaElement());
playMedia : function MSP_playMedia(isResume, onSuccess, onError) {
var self = this;
this.startMedia(isResume, function() {
self.stopMediaElement();
onSuccess();
}, onError);
},
/**
@ -47,8 +51,13 @@ MediaStreamPlayback.prototype = {
*
* @param {Boolean} isResume specifies if the media element playback
* is being resumed from a previous run
* @param {Function} onSuccess the success function call back
* if media starts correctly
* @param {Function} onError the error function call back
* if media fails to start
*/
startMedia : function(isResume) {
startMedia : function MSP_startMedia(isResume, onSuccess, onError) {
var self = this;
var canPlayThroughFired = false;
// If we're initially running this media, check that the time is zero
@ -57,84 +66,89 @@ MediaStreamPlayback.prototype = {
"Before starting the media element, currentTime = 0");
}
return new Promise((resolve, reject) => {
/**
* Callback fired when the canplaythrough event is fired. We only
* run the logic of this function once, as this event can fire
* multiple times while a HTMLMediaStream is playing content from
* a real-time MediaStream.
*/
var canPlayThroughCallback = () => {
// Disable the canplaythrough event listener to prevent multiple calls
canPlayThroughFired = true;
this.mediaElement.removeEventListener('canplaythrough',
canPlayThroughCallback, false);
/**
* Callback fired when the canplaythrough event is fired. We only
* run the logic of this function once, as this event can fire
* multiple times while a HTMLMediaStream is playing content from
* a real-time MediaStream.
*/
var canPlayThroughCallback = function() {
// Disable the canplaythrough event listener to prevent multiple calls
canPlayThroughFired = true;
self.mediaElement.removeEventListener('canplaythrough',
canPlayThroughCallback, false);
is(this.mediaElement.paused, false,
"Media element should be playing");
is(this.mediaElement.duration, Number.POSITIVE_INFINITY,
"Duration should be infinity");
is(self.mediaElement.paused, false,
"Media element should be playing");
is(self.mediaElement.duration, Number.POSITIVE_INFINITY,
"Duration should be infinity");
// When the media element is playing with a real-time stream, we
// constantly switch between having data to play vs. queuing up data,
// so we can only check that the ready state is one of those two values
ok(this.mediaElement.readyState === HTMLMediaElement.HAVE_ENOUGH_DATA ||
this.mediaElement.readyState === HTMLMediaElement.HAVE_CURRENT_DATA,
"Ready state shall be HAVE_ENOUGH_DATA or HAVE_CURRENT_DATA");
// When the media element is playing with a real-time stream, we
// constantly switch between having data to play vs. queuing up data,
// so we can only check that the ready state is one of those two values
ok(self.mediaElement.readyState === HTMLMediaElement.HAVE_ENOUGH_DATA ||
self.mediaElement.readyState === HTMLMediaElement.HAVE_CURRENT_DATA,
"Ready state shall be HAVE_ENOUGH_DATA or HAVE_CURRENT_DATA");
is(this.mediaElement.seekable.length, 0,
"Seekable length shall be zero");
is(this.mediaElement.buffered.length, 0,
"Buffered length shall be zero");
is(self.mediaElement.seekable.length, 0,
"Seekable length shall be zero");
is(self.mediaElement.buffered.length, 0,
"Buffered length shall be zero");
is(this.mediaElement.seeking, false,
"MediaElement is not seekable with MediaStream");
ok(isNaN(this.mediaElement.startOffsetTime),
"Start offset time shall not be a number");
is(this.mediaElement.loop, false, "Loop shall be false");
is(this.mediaElement.preload, "", "Preload should not exist");
is(this.mediaElement.src, "", "No src should be defined");
is(this.mediaElement.currentSrc, "",
"Current src should still be an empty string");
is(self.mediaElement.seeking, false,
"MediaElement is not seekable with MediaStream");
ok(isNaN(self.mediaElement.startOffsetTime),
"Start offset time shall not be a number");
is(self.mediaElement.loop, false, "Loop shall be false");
is(self.mediaElement.preload, "", "Preload should not exist");
is(self.mediaElement.src, "", "No src should be defined");
is(self.mediaElement.currentSrc, "",
"Current src should still be an empty string");
var timeUpdateCallback = () => {
if (this.mediaStream.currentTime > 0 &&
this.mediaElement.currentTime > 0) {
this.mediaElement.removeEventListener('timeupdate',
timeUpdateCallback, false);
resolve();
}
};
var timeUpdateFired = false;
// When timeupdate fires, we validate time has passed and move
// onto the success condition
this.mediaElement.addEventListener('timeupdate', timeUpdateCallback,
false);
// If timeupdate doesn't fire in enough time, we fail the test
setTimeout(() => {
this.mediaElement.removeEventListener('timeupdate',
timeUpdateCallback, false);
reject(new Error("timeUpdate event never fired"));
}, TIMEUPDATE_TIMEOUT_LENGTH);
var timeUpdateCallback = function() {
if (self.mediaStream.currentTime > 0 &&
self.mediaElement.currentTime > 0) {
timeUpdateFired = true;
self.mediaElement.removeEventListener('timeupdate',
timeUpdateCallback, false);
onSuccess();
}
};
// Adds a listener intended to be fired when playback is available
// without further buffering.
this.mediaElement.addEventListener('canplaythrough', canPlayThroughCallback,
false);
// When timeupdate fires, we validate time has passed and move
// onto the success condition
self.mediaElement.addEventListener('timeupdate', timeUpdateCallback,
false);
// Hooks up the media stream to the media element and starts playing it
this.mediaElement.mozSrcObject = this.mediaStream;
this.mediaElement.play();
// If timeupdate doesn't fire in enough time, we fail the test
setTimeout(function() {
if (!timeUpdateFired) {
self.mediaElement.removeEventListener('timeupdate',
timeUpdateCallback, false);
onError("timeUpdate event never fired");
}
}, TIMEUPDATE_TIMEOUT_LENGTH);
};
// If canplaythrough doesn't fire in enough time, we fail the test
setTimeout(() => {
this.mediaElement.removeEventListener('canplaythrough',
canPlayThroughCallback, false);
reject(new Error("canplaythrough event never fired"));
}, CANPLAYTHROUGH_TIMEOUT_LENGTH);
});
// Adds a listener intended to be fired when playback is available
// without further buffering.
this.mediaElement.addEventListener('canplaythrough', canPlayThroughCallback,
false);
// Hooks up the media stream to the media element and starts playing it
this.mediaElement.mozSrcObject = this.mediaStream;
this.mediaElement.play();
// If canplaythrough doesn't fire in enough time, we fail the test
setTimeout(function() {
if (!canPlayThroughFired) {
self.mediaElement.removeEventListener('canplaythrough',
canPlayThroughCallback, false);
onError("canplaythrough event never fired");
}
}, CANPLAYTHROUGH_TIMEOUT_LENGTH);
},
/**
@ -143,7 +157,7 @@ MediaStreamPlayback.prototype = {
* Precondition: The media stream and element should both be actively
* being played.
*/
stopMediaElement : function() {
stopMediaElement : function MSP_stopMediaElement() {
this.mediaElement.pause();
this.mediaElement.mozSrcObject = null;
}
@ -172,12 +186,23 @@ LocalMediaStreamPlayback.prototype = Object.create(MediaStreamPlayback.prototype
*
* @param {Boolean} isResume specifies if this media element is being resumed
* from a previous run
* @param {Function} onSuccess the success callback if the media element
* successfully fires ended on a stop() call
* on the stream
* @param {Function} onError the error callback if the media element fails
* to fire an ended callback on a stop() call
* on the stream
*/
playMediaWithStreamStop : {
value: function(isResume) {
return this.startMedia(isResume)
.then(() => this.stopStreamInMediaPlayback())
.then(() => this.stopMediaElement());
value: function (isResume, onSuccess, onError) {
var self = this;
this.startMedia(isResume, function() {
self.stopStreamInMediaPlayback(function() {
self.stopMediaElement();
onSuccess();
}, onError);
}, onError);
}
},
@ -188,49 +213,37 @@ LocalMediaStreamPlayback.prototype = Object.create(MediaStreamPlayback.prototype
* Precondition: The media stream and element should both be actively
* being played.
*
* @param {Function} onSuccess the success callback if the media element
* fires an ended event from stop() being called
* @param {Function} onError the error callback if the media element
* fails to fire an ended event from stop() being
* called
*/
stopStreamInMediaPlayback : {
value: function () {
return new Promise((resolve, reject) => {
/**
* Callback fired when the ended event fires when stop() is called on the
* stream.
*/
var endedCallback = () => {
this.mediaElement.removeEventListener('ended', endedCallback, false);
ok(true, "ended event successfully fired");
resolve();
};
value: function (onSuccess, onError) {
var endedFired = false;
var self = this;
this.mediaElement.addEventListener('ended', endedCallback, false);
this.mediaStream.stop();
/**
* Callback fired when the ended event fires when stop() is called on the
* stream.
*/
var endedCallback = function() {
endedFired = true;
self.mediaElement.removeEventListener('ended', endedCallback, false);
ok(true, "ended event successfully fired");
onSuccess();
};
// If ended doesn't fire in enough time, then we fail the test
setTimeout(() => {
reject(new Error("ended event never fired"));
}, ENDED_TIMEOUT_LENGTH);
});
this.mediaElement.addEventListener('ended', endedCallback, false);
this.mediaStream.stop();
// If ended doesn't fire in enough time, then we fail the test
setTimeout(function() {
if (!endedFired) {
onError("ended event never fired");
}
}, ENDED_TIMEOUT_LENGTH);
}
}
});
// haxx to prevent SimpleTest from failing at window.onload
function addLoadEvent() {}
var scriptsReady = Promise.all([
"/tests/SimpleTest/SimpleTest.js",
"head.js"
].map(script => {
var el = document.createElement("script");
el.src = script;
document.head.appendChild(el);
return new Promise(r => el.onload = r);
}));
function createHTML(options) {
return scriptsReady.then(() => realCreateHTML(options));
}
function runTest(f) {
return scriptsReady.then(() => runTestWhenReady(f));
}

View File

@ -6,7 +6,6 @@ support-files =
constraints.js
dataChannel.js
mediaStreamPlayback.js
network.js
nonTrickleIce.js
pc.js
templates.js
@ -45,7 +44,6 @@ skip-if = toolkit == 'gonk' || toolkit == 'android' # Bug 907352, backwards-comp
[test_getUserMedia_constraints_mobile.html]
skip-if = toolkit != 'gonk' && toolkit != 'android' # Bug 907352, backwards-compatible behavior on mobile only
[test_getUserMedia_exceptions.html]
[test_getUserMedia_callbacks.html]
[test_getUserMedia_gumWithinGum.html]
[test_getUserMedia_playAudioTwice.html]
[test_getUserMedia_playVideoAudioTwice.html]
@ -114,8 +112,6 @@ skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabl
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_promiseSendOnly.html]
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_callbacks.html]
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_replaceTrack.html]
skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_syncSetDescription.html]

View File

@ -1,121 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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";
/**
* Query function for determining if any IP address is available for
* generating SDP.
*
* @return false if required additional network setup.
*/
function isNetworkReady() {
// for gonk platform
if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) {
var listService = SpecialPowers.Cc["@mozilla.org/network/interface-list-service;1"]
.getService(SpecialPowers.Ci.nsINetworkInterfaceListService);
var itfList = listService.getDataInterfaceList(
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_MMS_INTERFACES |
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_SUPL_INTERFACES |
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_IMS_INTERFACES |
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_DUN_INTERFACES);
var num = itfList.getNumberOfInterface();
for (var i = 0; i < num; i++) {
var ips = {};
var prefixLengths = {};
var length = itfList.getInterface(i).getAddresses(ips, prefixLengths);
for (var j = 0; j < length; j++) {
var ip = ips.value[j];
// skip IPv6 address until bug 797262 is implemented
if (ip.indexOf(":") < 0) {
safeInfo("Network interface is ready with address: " + ip);
return true;
}
}
}
// ip address is not available
safeInfo("Network interface is not ready, required additional network setup");
return false;
}
safeInfo("Network setup is not required");
return true;
}
/**
* Network setup utils for Gonk
*
* @return {object} providing functions for setup/teardown data connection
*/
function getNetworkUtils() {
var url = SimpleTest.getTestFileURL("NetworkPreparationChromeScript.js");
var script = SpecialPowers.loadChromeScript(url);
var utils = {
/**
* Utility for setting up data connection.
*
* @param aCallback callback after data connection is ready.
*/
prepareNetwork: function() {
return new Promise(resolve => {
script.addMessageListener('network-ready', () => {
info("Network interface is ready");
resolve();
});
info("Setting up network interface");
script.sendAsyncMessage("prepare-network", true);
});
},
/**
* Utility for tearing down data connection.
*
* @param aCallback callback after data connection is closed.
*/
tearDownNetwork: function() {
if (!isNetworkReady()) {
info("No network to tear down");
return Promise.resolve();
}
return new Promise(resolve => {
script.addMessageListener('network-disabled', message => {
info("Network interface torn down");
script.destroy();
resolve();
});
info("Tearing down network interface");
script.sendAsyncMessage("network-cleanup", true);
});
}
};
return utils;
}
/**
* Setup network on Gonk if needed and execute test once network is up
*
*/
function startNetworkAndTest() {
if (isNetworkReady()) {
return Promise.resolve();
}
var utils = getNetworkUtils();
// Trigger network setup to obtain IP address before creating any PeerConnection.
return utils.prepareNetwork();
}
/**
* A wrapper around SimpleTest.finish() to handle B2G network teardown
*/
function networkTestFinished() {
var p;
if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) {
var utils = getNetworkUtils();
p = utils.tearDownNetwork();
} else {
p = Promise.resolve();
}
return p.then(() => finish());
}

View File

@ -4,57 +4,127 @@
function makeOffererNonTrickle(chain) {
chain.replace('PC_LOCAL_SETUP_ICE_HANDLER', [
function PC_LOCAL_SETUP_NOTRICKLE_ICE_HANDLER(test) {
// We need to install this callback before calling setLocalDescription
// otherwise we might miss callbacks
test.pcLocal.setupIceCandidateHandler(test, () => {});
// We ignore ICE candidates because we want the full offer
}
['PC_LOCAL_SETUP_NOTRICKLE_ICE_HANDLER',
function (test) {
test.pcLocalWaitingForEndOfTrickleIce = false;
// We need to install this callback before calling setLocalDescription
// otherwise we might miss callbacks
test.pcLocal.setupIceCandidateHandler(test, function () {
// We ignore ICE candidates because we want the full offer
} , function (label) {
if (test.pcLocalWaitingForEndOfTrickleIce) {
// This callback is needed for slow environments where ICE
// trickling has not finished before the other side needs the
// full SDP. In this case, this call to test.next() will complete
// the PC_REMOTE_WAIT_FOR_OFFER step (see below).
info("Looks like we were still waiting for Trickle to finish");
// TODO replace this with a Promise
test.next();
}
});
// We can't wait for trickle to finish here as it will only start once
// we have called setLocalDescription in the next step
test.next();
}
]
]);
chain.replace('PC_REMOTE_GET_OFFER', [
function PC_REMOTE_GET_FULL_OFFER(test) {
return test.pcLocal.endOfTrickleIce.then(() => {
['PC_REMOTE_WAIT_FOR_OFFER',
function (test) {
if (test.pcLocal.endOfTrickleIce) {
info("Trickle ICE finished already");
test.next();
} else {
info("Waiting for trickle ICE to finish");
test.pcLocalWaitingForEndOfTrickleIce = true;
// In this case we rely on the callback from
// PC_LOCAL_SETUP_NOTRICKLE_ICE_HANDLER above to proceed to the next
// step once trickle is finished.
}
}
],
['PC_REMOTE_GET_FULL_OFFER',
function (test) {
test._local_offer = test.pcLocal.localDescription;
test._offer_constraints = test.pcLocal.constraints;
test._offer_options = test.pcLocal.offerOptions;
});
}
test.next();
}
]
]);
chain.insertAfter('PC_REMOTE_SANE_REMOTE_SDP', [
function PC_REMOTE_REQUIRE_REMOTE_SDP_CANDIDATES(test) {
info("test.pcLocal.localDescription.sdp: " + JSON.stringify(test.pcLocal.localDescription.sdp));
info("test._local_offer.sdp" + JSON.stringify(test._local_offer.sdp));
ok(!test.localRequiresTrickleIce, "Local does NOT require trickle");
ok(test._local_offer.sdp.contains("a=candidate"), "offer has ICE candidates")
ok(test._local_offer.sdp.contains("a=end-of-candidates"), "offer has end-of-candidates");
}
['PC_REMOTE_REQUIRE_REMOTE_SDP_CANDIDATES',
function (test) {
info("test.pcLocal.localDescription.sdp: " + JSON.stringify(test.pcLocal.localDescription.sdp));
info("test._local_offer.sdp" + JSON.stringify(test._local_offer.sdp));
ok(!test.localRequiresTrickleIce, "Local does NOT require trickle");
ok(test._local_offer.sdp.contains("a=candidate"), "offer has ICE candidates")
// TODO check for a=end-of-candidates once implemented
test.next();
}
]
]);
}
function makeAnswererNonTrickle(chain) {
chain.replace('PC_REMOTE_SETUP_ICE_HANDLER', [
function PC_REMOTE_SETUP_NOTRICKLE_ICE_HANDLER(test) {
// We need to install this callback before calling setLocalDescription
// otherwise we might miss callbacks
test.pcRemote.setupIceCandidateHandler(test, () => {});
// We ignore ICE candidates because we want the full offer
}
['PC_REMOTE_SETUP_NOTRICKLE_ICE_HANDLER',
function (test) {
test.pcRemoteWaitingForEndOfTrickleIce = false;
// We need to install this callback before calling setLocalDescription
// otherwise we might miss callbacks
test.pcRemote.setupIceCandidateHandler(test, function () {
// We ignore ICE candidates because we want the full answer
}, function (label) {
if (test.pcRemoteWaitingForEndOfTrickleIce) {
// This callback is needed for slow environments where ICE
// trickling has not finished before the other side needs the
// full SDP. In this case this callback will call the step after
// PC_LOCAL_WAIT_FOR_ANSWER
info("Looks like we were still waiting for Trickle to finish");
// TODO replace this with a Promise
test.next();
}
});
// We can't wait for trickle to finish here as it will only start once
// we have called setLocalDescription in the next step
test.next();
}
]
]);
chain.replace('PC_LOCAL_GET_ANSWER', [
function PC_LOCAL_GET_FULL_ANSWER(test) {
return test.pcRemote.endOfTrickleIce.then(() => {
['PC_LOCAL_WAIT_FOR_ANSWER',
function (test) {
if (test.pcRemote.endOfTrickleIce) {
info("Trickle ICE finished already");
test.next();
} else {
info("Waiting for trickle ICE to finish");
test.pcRemoteWaitingForEndOfTrickleIce = true;
// In this case we rely on the callback from
// PC_REMOTE_SETUP_NOTRICKLE_ICE_HANDLER above to proceed to the next
// step once trickle is finished.
}
}
],
['PC_LOCAL_GET_FULL_ANSWER',
function (test) {
test._remote_answer = test.pcRemote.localDescription;
test._answer_constraints = test.pcRemote.constraints;
});
}
test.next();
}
]
]);
chain.insertAfter('PC_LOCAL_SANE_REMOTE_SDP', [
function PC_LOCAL_REQUIRE_REMOTE_SDP_CANDIDATES(test) {
info("test.pcRemote.localDescription.sdp: " + JSON.stringify(test.pcRemote.localDescription.sdp));
info("test._remote_answer.sdp" + JSON.stringify(test._remote_answer.sdp));
ok(!test.remoteRequiresTrickleIce, "Remote does NOT require trickle");
ok(test._remote_answer.sdp.contains("a=candidate"), "answer has ICE candidates")
ok(test._remote_answer.sdp.contains("a=end-of-candidates"), "answer has end-of-candidates");
}
['PC_LOCAL_REQUIRE_REMOTE_SDP_CANDIDATES',
function (test) {
info("test.pcRemote.localDescription.sdp: " + JSON.stringify(test.pcRemote.localDescription.sdp));
info("test._remote_answer.sdp" + JSON.stringify(test._remote_answer.sdp));
ok(!test.remoteRequiresTrickleIce, "Remote does NOT require trickle");
ok(test._remote_answer.sdp.contains("a=candidate"), "answer has ICE candidates")
// TODO check for a=end-of-candidates once implemented
test.next();
}
]
]);
}

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
support-files =
head.js
mediaStreamPlayback.js
network.js
pc.js
templates.js
turnConfig.js

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="dataChannel.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="dataChannel.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="dataChannel.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="dataChannel.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,22 +17,27 @@
title: "Basic data channel audio/video connection without bundle"
});
var test;
runNetworkTest(function () {
test = new PeerConnectionTest();
addInitialDataChannel(test.chain);
test.chain.insertAfter("PC_LOCAL_CREATE_OFFER", [
function PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER(test) {
// Just replace a=group:BUNDLE with something that will be ignored.
test.originalOffer.sdp = test.originalOffer.sdp.replace(
"a=group:BUNDLE",
"a=foo:");
}
]);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.run();
});
var test;
runNetworkTest(function () {
test = new PeerConnectionTest();
addInitialDataChannel(test.chain);
test.chain.insertAfter("PC_LOCAL_CREATE_OFFER",
[[
'PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER',
function (test) {
// Just replace a=group:BUNDLE with something that will be ignored.
test.originalOffer.sdp = test.originalOffer.sdp.replace(
"a=group:BUNDLE",
"a=foo:");
test.next();
}
]]
);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.run();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="dataChannel.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="dataChannel.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="dataChannel.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,6 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>

View File

@ -1,26 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=781534
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Basic Audio Test</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Audio Test</a>
<p id="display"></p>
<div id="content" style="display: none">
<audio id="testAudio"></audio>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "getUserMedia Basic Audio Test", bug: "781534" });
/**
* Run a test to verify that we can complete a start and stop media playback
* cycle for an audio LocalMediaStream on an audio HTMLMediaElement.
*/
runTest(function () {
var testAudio = createMediaElement('audio', 'testAudio');
var testAudio = document.getElementById('testAudio');
var constraints = {audio: true};
getUserMedia(constraints).then(aStream => {
getUserMedia(constraints, function (aStream) {
checkMediaStreamTracks(constraints, aStream);
var playback = new LocalMediaStreamPlayback(testAudio, aStream);
return playback.playMedia(false);
}).then(() => SimpleTest.finish(), generateErrorCallback());
playback.playMedia(false, function () {
aStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,15 +1,24 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=983504
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Basic Screenshare Test</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=983504">mozGetUserMedia Basic Screenshare Test</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "getUserMedia Basic Screenshare Test",
bug: "983504"
});
/**
* Run a test to verify that we can complete a start and stop media playback
* cycle for an screenshare LocalMediaStream on a video HTMLMediaElement.
@ -21,7 +30,7 @@
SimpleTest.finish();
return;
}
var testVideo = createMediaElement('video', 'testVideo');
var testVideo = document.getElementById('testVideo');
var constraints = {
video: {
mozMediaSource: "screen",
@ -30,12 +39,16 @@
fake: false
};
getUserMedia(constraints).then(aStream => {
getUserMedia(constraints, function (aStream) {
checkMediaStreamTracks(constraints, aStream);
var playback = new LocalMediaStreamPlayback(testVideo, aStream);
return playback.playMediaWithStreamStop(false);
}).then(() => SimpleTest.finish(), generateErrorCallback());
playback.playMediaWithStreamStop(false, function () {
aStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
});

View File

@ -1,29 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=781534
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Basic Video Test</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Video Test</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "getUserMedia Basic Video Test",
bug: "781534"
});
/**
* Run a test to verify that we can complete a start and stop media playback
* cycle for an video LocalMediaStream on a video HTMLMediaElement.
*/
runTest(function () {
var testVideo = createMediaElement('video', 'testVideo');
var testVideo = document.getElementById('testVideo');
var constraints = {video: true};
getUserMedia(constraints).then(aStream => {
getUserMedia(constraints, function (aStream) {
checkMediaStreamTracks(constraints, aStream);
var playback = new LocalMediaStreamPlayback(testVideo, aStream);
return playback.playMedia(false);
}).then(() => SimpleTest.finish(), generateErrorCallback());
playback.playMedia(false, function () {
aStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,29 +1,42 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=781534
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Basic Video & Audio Test</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=781534">mozGetUserMedia Basic Video & Audio Test</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideoAudio"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "getUserMedia Basic Video & Audio Test",
bug: "781534"
});
/**
* Run a test to verify that we can complete a start and stop media playback
* cycle for a video and audio LocalMediaStream on a video HTMLMediaElement.
*/
runTest(function () {
var testVideoAudio = createMediaElement('video', 'testVideoAudio');
var testVideoAudio = document.getElementById('testVideoAudio');
var constraints = {video: true, audio: true};
getUserMedia(constraints).then(aStream => {
getUserMedia(constraints, function (aStream) {
checkMediaStreamTracks(constraints, aStream);
var playback = new LocalMediaStreamPlayback(testVideoAudio, aStream);
return playback.playMedia(false);
}).then(() => SimpleTest.finish(), generateErrorCallback());
playback.playMedia(false, function () {
aStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,15 +1,24 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=983504
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Basic Windowshare Test</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1038926">mozGetUserMedia Basic Windowshare Test</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({
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.
@ -21,7 +30,7 @@
SimpleTest.finish();
return;
}
var testVideo = createMediaElement('video', 'testVideo');
var testVideo = document.getElementById('testVideo');
var constraints = {
video: {
mozMediaSource: "window",
@ -30,12 +39,16 @@
fake: false
};
getUserMedia(constraints).then(aStream => {
getUserMedia(constraints, function (aStream) {
checkMediaStreamTracks(constraints, aStream);
var playback = new LocalMediaStreamPlayback(testVideo, aStream);
return playback.playMediaWithStreamStop(false);
}).then(() => SimpleTest.finish(), generateErrorCallback());
playback.playMediaWithStreamStop(false, function () {
aStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
});

View File

@ -1,33 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "navigator.mozGetUserMedia Callback Test",
bug: "1119593"
});
/**
* Check that the old fashioned callback-based function works.
*/
runTest(function () {
var testAudio = createMediaElement('audio', 'testAudio');
var constraints = {audio: true};
SimpleTest.waitForExplicitFinish();
navigator.mozGetUserMedia(constraints, aStream => {
checkMediaStreamTracks(constraints, aStream);
var playback = new LocalMediaStreamPlayback(testAudio, aStream);
return playback.playMedia(false)
.then(() => SimpleTest.finish(), generateErrorCallback());
}, generateErrorCallback());
});
</script>
</pre>
</body>
</html>

View File

@ -1,13 +1,24 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=882145
-->
<head>
<script src="mediaStreamPlayback.js"></script>
<script src="constraints.js"></script>
<meta charset="utf-8">
<title>Test mozGetUserMedia Constraints</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="constraints.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882145">Test mozGetUserMedia Constraints (desktop)</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "Test getUserMedia constraints (desktop)", bug: "882145" });
/**
See constraints.js for testConstraints() and common_tests.
TODO(jib): Merge desktop and mobile version of these tests again (Bug 997365)

View File

@ -1,13 +1,24 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=882145
-->
<head>
<script src="mediaStreamPlayback.js"></script>
<script src="constraints.js"></script>
<meta charset="utf-8">
<title>Test mozGetUserMedia Constraints</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="constraints.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882145">Test mozGetUserMedia Constraints (mobile)</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "Test getUserMedia constraints (mobile)", bug: "882145" });
/**
See constraints.js for testConstraints() and common_tests.
TODO(jib): Merge desktop and mobile version of these tests again (Bug 997365)

View File

@ -1,12 +1,23 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=795367
-->
<head>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<meta charset="utf-8">
<title>Test mozGetUserMedia Exceptions</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=795367">Test mozGetUserMedia Exceptions</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "Test mozGetUserMedia Exceptions", bug: "795367" });
/**
These tests verify that the appropriate exception is thrown when incorrect
values are provided to the immediate mozGetUserMedia call.

View File

@ -1,37 +1,53 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia gum within gum</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia gum within gum</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
<audio id="testAudio"></audio>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({title: "getUserMedia within getUserMedia", bug: "822109" });
/**
* Run a test that we can complete a playback cycle for a video,
* then upon completion, do a playback cycle with audio, such that
* the audio gum call happens within the video gum call.
*/
runTest(function () {
getUserMedia({video: true})
.then(videoStream => {
var testVideo = createMediaElement('video', 'testVideo');
var videoPlayback = new LocalMediaStreamPlayback(testVideo,
videoStream);
getUserMedia({video: true}, function(videoStream) {
var testVideo = document.getElementById('testVideo');
var videoStreamPlayback = new LocalMediaStreamPlayback(testVideo,
videoStream);
return videoPlayback.playMedia(false)
.then(() => getUserMedia({audio: true}))
.then(audioStream => {
var testAudio = createMediaElement('audio', 'testAudio');
var audioPlayback = new LocalMediaStreamPlayback(testAudio,
audioStream);
videoStreamPlayback.playMedia(false, function() {
getUserMedia({audio: true}, function(audioStream) {
var testAudio = document.getElementById('testAudio');
var audioStreamPlayback = new LocalMediaStreamPlayback(testAudio,
audioStream);
return audioPlayback.playMedia(false)
.then(() => audioStream.stop());
})
.then(() => videoStream.stop());
})
.then(() => SimpleTest.finish(), generateErrorCallback());
audioStreamPlayback.playMedia(false, function() {
audioStream.stop();
videoStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,13 +1,24 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=942367
-->
<head>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<meta charset="utf-8">
<title>Test mozGetUserMedia peerIdentity Constraint</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="blacksilence.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=942367">Test mozGetUserMedia peerIdentity Constraint</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "Test getUserMedia peerIdentity Constraint", bug: "942367" });
function theTest() {
function testPeerIdentityConstraint(withConstraint, done) {
var config = { audio: true, video: true, fake: true };

View File

@ -1,25 +1,45 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Play Audio Twice</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Play Audio Twice</a>
<p id="display"></p>
<div id="content" style="display: none">
<audio id="testAudio"></audio>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({title: "getUserMedia Play Audio Twice", bug: "822109" });
/**
* Run a test that we can complete an audio playback cycle twice in a row.
*/
runTest(function () {
getUserMedia({audio: true}).then(audioStream => {
var testAudio = createMediaElement('audio', 'testAudio');
var playback = new LocalMediaStreamPlayback(testAudio, audioStream);
getUserMedia({audio: true}, function(audioStream) {
var testAudio = document.getElementById('testAudio');
var audioStreamPlayback = new LocalMediaStreamPlayback(testAudio,
audioStream);
return playback.playMedia(false)
.then(() => playback.playMedia(true))
.then(() => audioStream.stop());
}).then(() => SimpleTest.finish(), generateErrorCallback());
audioStreamPlayback.playMedia(false, function() {
audioStreamPlayback.playMedia(true, function() {
audioStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>
</pre>
</body>

View File

@ -1,24 +1,42 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Play Video and Audio Twice</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Play Video and Audio Twice</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({title: "getUserMedia Play Video and Audio Twice", bug: "822109" });
/**
* Run a test that we can complete a video playback cycle twice in a row.
*/
runTest(function () {
getUserMedia({video: true, audio: true}).then(stream => {
var testVideo = createMediaElement('video', 'testVideo');
var playback = new LocalMediaStreamPlayback(testVideo, stream);
getUserMedia({video: true, audio: true}, function(stream) {
var testVideo = document.getElementById('testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
return playback.playMedia(false)
.then(() => playback.playMedia(true))
.then(() => stream.stop());
}).then(() => SimpleTest.finish(), generateErrorCallback());
streamPlayback.playMedia(false, function() {
streamPlayback.playMedia(true, function() {
stream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,24 +1,43 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Play Video Twice</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Play Video Twice</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "getUserMedia Play Video Twice", bug: "822109" });
/**
* Run a test that we can complete a video playback cycle twice in a row.
*/
runTest(function () {
getUserMedia({video: true}).then(stream => {
var testVideo = createMediaElement('video', 'testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
getUserMedia({video: true}, function(videoStream) {
var testVideo = document.getElementById('testVideo');
var videoStreamPlayback = new LocalMediaStreamPlayback(testVideo,
videoStream);
return streamPlayback.playMedia(false)
.then(() => streamPlayback.playMedia(true))
.then(() => stream.stop());
}).then(() => SimpleTest.finish(), generateErrorCallback());
videoStreamPlayback.playMedia(false, function() {
videoStreamPlayback.playMedia(true, function() {
videoStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,25 +1,36 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Stop Audio Stream</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Stop Audio Stream</a>
<p id="display"></p>
<div id="content" style="display: none">
<audio id="testAudio"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "getUserMedia Stop Audio Stream", bug: "822109" });
/**
* Run a test to verify that we can start an audio stream in a media element,
* call stop() on the stream, and successfully get an ended event fired.
*/
runTest(function () {
getUserMedia({audio: true})
.then(stream => {
var testAudio = createMediaElement('audio', 'testAudio');
var streamPlayback = new LocalMediaStreamPlayback(testAudio, stream);
getUserMedia({audio: true}, function(stream) {
var testAudio = document.getElementById('testAudio');
var audioStreamPlayback = new LocalMediaStreamPlayback(testAudio, stream);
return streamPlayback.playMediaWithStreamStop(false);
})
.then(() => SimpleTest.finish(), generateErrorCallback());
audioStreamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,33 +1,48 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Stop Audio Stream With Followup Audio</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Stop Audio Stream With Followup Audio</a>
<p id="display"></p>
<div id="content" style="display: none">
<audio id="testAudio"></audio>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "getUserMedia Stop Audio Stream With Followup Audio", bug: "822109" });
/**
* Run a test to verify that I can complete an audio gum playback in a media
* element, stop the stream, and then complete another audio gum playback
* in a media element.
*/
runTest(function () {
getUserMedia({audio: true})
.then(firstStream => {
var testAudio = createMediaElement('audio', 'testAudio');
var streamPlayback = new LocalMediaStreamPlayback(testAudio, firstStream);
getUserMedia({audio: true}, function(firstStream) {
var testAudio = document.getElementById('testAudio');
var streamPlayback = new LocalMediaStreamPlayback(testAudio, firstStream);
return streamPlayback.playMediaWithStreamStop(false)
.then(() => getUserMedia({audio: true}))
.then(secondStream => {
streamPlayback.mediaStream = secondStream;
streamPlayback.playMediaWithStreamStop(false, function() {
getUserMedia({audio: true}, function(secondStream) {
streamPlayback.mediaStream = secondStream;
return streamPlayback.playMedia(false)
.then(() => secondStream.stop());
});
})
.then(() => SimpleTest.finish(), generateErrorCallback());
streamPlayback.playMedia(false, function() {
secondStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,26 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Stop Video Audio Stream</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Stop Video Audio Stream</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "getUserMedia Stop Video Audio Stream", bug: "822109" });
/**
* Run a test to verify that we can start a video+audio stream in a
* media element, call stop() on the stream, and successfully get an
* ended event fired.
*/
runTest(function () {
getUserMedia({video: true, audio: true})
.then(stream => {
var testVideo = createMediaElement('video', 'testVideo');
var playback = new LocalMediaStreamPlayback(testVideo, stream);
getUserMedia({video: true, audio: true}, function(stream) {
var testVideo = document.getElementById('testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
return playback.playMediaWithStreamStop(false);
})
.then(() => SimpleTest.finish(), generateErrorCallback());
streamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,36 +1,48 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Stop Video+Audio Stream With Followup Video+Audio</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Stop Video+Audio Stream With Followup Video+Audio</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({
title: "getUserMedia Stop Video+Audio Stream With Followup Video+Audio",
bug: "822109"
});
/**
* Run a test to verify that I can complete an video+audio gum playback in a
* media element, stop the stream, and then complete another video+audio gum
* playback in a media element.
*/
runTest(function () {
getUserMedia({video: true, audio: true})
.then(stream => {
var testVideo = createMediaElement('video', 'testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
getUserMedia({video: true, audio: true}, function(firstStream) {
var testVideo = document.getElementById('testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo, firstStream);
return streamPlayback.playMediaWithStreamStop(false)
.then(() => getUserMedia({video: true, audio: true}))
.then(secondStream => {
streamPlayback.mediaStream = secondStream;
streamPlayback.playMediaWithStreamStop(false, function() {
getUserMedia({video: true, audio: true}, function(secondStream) {
streamPlayback.mediaStream = secondStream;
return streamPlayback.playMedia(false)
.then(() => secondStream.stop());
});
})
.then(() => SimpleTest.finish(), generateErrorCallback());
streamPlayback.playMedia(false, function() {
secondStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,26 +1,36 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<meta charset="utf-8">
<title>mozGetUserMedia Stop Video Stream</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Stop Video Stream</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "getUserMedia Stop Video Stream", bug: "822109" });
/**
* Run a test to verify that we can start a video stream in a
* media element, call stop() on the stream, and successfully get an
* ended event fired.
* Run a test to verify that we can start a video stream in a media element,
* call stop() on the stream, and successfully get an ended event fired.
*/
runTest(function () {
getUserMedia({video: true})
.then(stream => {
var testVideo = createMediaElement('video', 'testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
getUserMedia({video: true}, function(stream) {
var testVideo = document.getElementById('testVideo');
var videoStreamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
return streamPlayback.playMediaWithStreamStop(false);
})
.then(() => SimpleTest.finish(), generateErrorCallback());
videoStreamPlayback.playMediaWithStreamStop(false, SimpleTest.finish,
generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,33 +1,49 @@
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=822109
-->
<head>
<script src="mediaStreamPlayback.js"></script>
<meta charset="utf-8">
<title>mozGetUserMedia Stop Video Stream With Followup Video</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=822109">mozGetUserMedia Stop Video Stream With Followup Video</a>
<p id="display"></p>
<div id="content" style="display: none">
<video id="testVideo"></video>
</div>
<pre id="test">
<script type="application/javascript">
createHTML({ title: "getUserMedia Stop Video Stream With Followup Video", bug: "822109" });
/**
* Run a test to verify that I can complete an video gum playback in a
* media element, stop the stream, and then complete another video gum
* playback in a media element.
* Run a test to verify that I can complete an audio gum playback in a media
* element, stop the stream, and then complete another audio gum playback
* in a media element.
*/
runTest(function () {
getUserMedia({video: true})
.then(stream => {
var testVideo = createMediaElement('video', 'testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);
getUserMedia({video: true}, function(firstStream) {
var testVideo = document.getElementById('testVideo');
var streamPlayback = new LocalMediaStreamPlayback(testVideo,
firstStream);
return streamPlayback.playMediaWithStreamStop(false)
.then(() => getUserMedia({video: true}))
.then(secondStream => {
streamPlayback.mediaStream = secondStream;
streamPlayback.playMediaWithStreamStop(false, function() {
getUserMedia({video: true}, function(secondStream) {
streamPlayback.mediaStream = secondStream;
return streamPlayback.playMedia(false)
.then(() => secondStream.stop());
});
})
.then(() => SimpleTest.finish(), generateErrorCallback());
streamPlayback.playMedia(false, function() {
secondStream.stop();
SimpleTest.finish();
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
}, generateErrorCallback());
});
</script>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -17,18 +23,20 @@
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
test.chain.append([
function PC_LOCAL_ADD_CANDIDATE(test) {
var candidate = new mozRTCIceCandidate(
{candidate:"1 1 UDP 2130706431 192.168.2.1 50005 typ host",
sdpMLineIndex: 1});
return test.pcLocal._pc.addIceCandidate(candidate).then(
generateErrorCallback("addIceCandidate should have failed."),
err => {
test.chain.append([[
"PC_LOCAL_ADD_CANDIDATE",
function (test) {
test.pcLocal.addIceCandidateAndFail(
new mozRTCIceCandidate(
{candidate:"1 1 UDP 2130706431 192.168.2.1 50005 typ host",
sdpMLineIndex: 1}),
function(err) {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
});
}
]);
test.next();
} );
}
]]);
test.run();
});
</script>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -15,40 +21,77 @@
runNetworkTest(function (options) {
test = new PeerConnectionTest(options);
test.chain.append([
function PC_LOCAL_SETUP_NEGOTIATION_CALLBACK(test) {
[
'PC_LOCAL_SETUP_NEGOTIATION_CALLBACK',
function (test) {
test.pcLocal.onNegotiationneededFired = false;
test.pcLocal._pc.onnegotiationneeded = anEvent => {
test.pcLocal._pc.onnegotiationneeded = function (anEvent) {
info("pcLocal.onnegotiationneeded fired");
test.pcLocal.onNegotiationneededFired = true;
};
},
function PC_LOCAL_ADD_SECOND_STREAM(test) {
return test.pcLocal.getAllUserMedia([{audio: true}]);
},
function PC_LOCAL_CREATE_NEW_OFFER(test) {
ok(test.pcLocal.onNegotiationneededFired, "onnegotiationneeded");
return test.createOffer(test.pcLocal).then(offer => {
test._new_offer = offer;
});
},
function PC_LOCAL_SET_NEW_LOCAL_DESCRIPTION(test) {
return test.setLocalDescription(test.pcLocal, test._new_offer, HAVE_LOCAL_OFFER);
},
function PC_REMOTE_SET_NEW_REMOTE_DESCRIPTION(test) {
return test.setRemoteDescription(test.pcRemote, test._new_offer, HAVE_REMOTE_OFFER);
},
function PC_REMOTE_CREATE_NEW_ANSWER(test) {
return test.createAnswer(test.pcRemote).then(answer => {
test._new_answer = answer;
});
},
function PC_REMOTE_SET_NEW_LOCAL_DESCRIPTION(test) {
return test.setLocalDescription(test.pcRemote, test._new_answer, STABLE);
},
function PC_LOCAL_SET_NEW_REMOTE_DESCRIPTION(test) {
return test.setRemoteDescription(test.pcLocal, test._new_answer, STABLE);
test.next();
}
// TODO(bug 1093835): figure out how to verify if media flows through the new stream
],
[
'PC_LOCAL_ADD_SECOND_STREAM',
function (test) {
test.pcLocal.getAllUserMedia([{audio: true}], function () {
test.next();
});
}
],
[
'PC_LOCAL_CREATE_NEW_OFFER',
function (test) {
ok(test.pcLocal.onNegotiationneededFired, "onnegotiationneeded");
test.createOffer(test.pcLocal, function (offer) {
test._new_offer = offer;
test.next();
});
}
],
[
'PC_LOCAL_SET_NEW_LOCAL_DESCRIPTION',
function (test) {
test.setLocalDescription(test.pcLocal, test._new_offer, HAVE_LOCAL_OFFER, function () {
test.next();
});
}
],
[
'PC_REMOTE_SET_NEW_REMOTE_DESCRIPTION',
function (test) {
test.setRemoteDescription(test.pcRemote, test._new_offer, HAVE_REMOTE_OFFER, function () {
test.next();
});
}
],
[
'PC_REMOTE_CREATE_NEW_ANSWER',
function (test) {
test.createAnswer(test.pcRemote, function (answer) {
test._new_answer = answer;
test.next();
});
}
],
[
'PC_REMOTE_SET_NEW_LOCAL_DESCRIPTION',
function (test) {
test.setLocalDescription(test.pcRemote, test._new_answer, STABLE, function () {
test.next();
});
}
],
[
'PC_LOCAL_SET_NEW_REMOTE_DESCRIPTION',
function (test) {
test.setRemoteDescription(test.pcLocal, test._new_answer, STABLE, function () {
test.next();
});
}
]
// TODO(bug 1093835): figure out how to verify if media flows through the new stream
]);
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.run();

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -6,8 +6,14 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="long.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -19,7 +25,7 @@
});
var test;
runNetworkTest(function (options) {
runTest(function (options) {
options = options || {};
options.commands = commandsPeerConnection.slice(0);
options.commands.push(generateIntervalCommand(verifyConnectionStatus,
@ -35,3 +41,4 @@
</pre>
</body>
</html>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,19 +17,22 @@
title: "Basic audio/video peer connection with no Bundle"
});
runNetworkTest(options => {
var test = new PeerConnectionTest(options);
test.chain.insertAfter(
'PC_LOCAL_CREATE_OFFER',
[
function PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER(test) {
test.originalOffer.sdp = test.originalOffer.sdp.replace(
/a=group:BUNDLE .*\r\n/g,
""
);
info("Updated no bundle offer: " + JSON.stringify(test.originalOffer));
}
]);
SimpleTest.requestFlakyTimeout("WebRTC is full of inherent timeouts");
var test;
runNetworkTest(function (options) {
test = new PeerConnectionTest(options);
test.chain.insertAfter('PC_LOCAL_CREATE_OFFER',
[['PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER',
function (test) {
test.originalOffer.sdp = test.originalOffer.sdp.replace(
/a=group:BUNDLE .*\r\n/g,
""
);
info("Updated no bundle offer: " + JSON.stringify(test.originalOffer));
test.next();
}
]]);
test.setMediaConstraints([{audio: true}, {video: true}],
[{audio: true}, {video: true}]);
test.run();

View File

@ -6,8 +6,14 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="long.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -6,8 +6,14 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="long.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -19,14 +25,16 @@
test.setMediaConstraints([{video: true}], [{video: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
test.chain.append([
function PC_LOCAL_VERIFY_H264_OFFER(test) {
test.chain.append([[
"PC_LOCAL_VERIFY_H264_OFFER",
function (test) {
ok(!test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=0x42e0"),
"H264 offer does not contain profile-level-id=0x42e0");
"H264 offer does not contain profile-level-id=0x42e0");
ok(test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=42e0"),
"H264 offer contains profile-level-id=42e0");
"H264 offer contains profile-level-id=42e0");
test.next();
}
]);
]]);
test.run();
});

View File

@ -1,6 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>

View File

@ -1,6 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
@ -11,69 +14,69 @@
title: "RTCConfiguration valid/invalid permutations"
});
var makePC = (config, expected_error) => {
var exception;
try {
new mozRTCPeerConnection(config).close();
} catch (e) {
exception = e;
}
is((exception? exception.name : "success"), expected_error || "success",
"mozRTCPeerConnection(" + JSON.stringify(config) + ")");
};
// This is a test of the iceServers parsing code + readable errors
runNetworkTest(() => {
var exception = null;
try {
new mozRTCPeerConnection().close();
} catch (e) {
exception = e;
}
ok(!exception, "mozRTCPeerConnection() succeeds");
exception = null;
makePC();
makePC(1, "TypeError");
makePC({});
makePC({ iceServers: [] });
makePC({ iceServers: [{ urls:"" }] }, "SyntaxError");
makePC({ iceServers: [
{ urls:"stun:127.0.0.1" },
{ urls:"stun:localhost", foo:"" },
{ urls: ["stun:127.0.0.1", "stun:localhost"] },
{ urls:"stuns:localhost", foo:"" },
{ urls:"turn:[::1]:3478", username:"p", credential:"p" },
{ urls:"turn:localhost:3478?transport=udp", username:"p", credential:"p" },
{ urls: ["turn:[::1]:3478", "turn:localhost"], username:"p", credential:"p" },
{ urls:"turns:localhost:3478?transport=udp", username:"p", credential:"p" },
{ url:"stun:localhost", foo:"" },
{ url:"turn:localhost", username:"p", credential:"p" }
]});
makePC({ iceServers: [{ urls: ["stun:127.0.0.1", ""] }] }, "SyntaxError");
makePC({ iceServers: [{ urls:"turns:localhost:3478", username:"p" }] }, "InvalidAccessError");
makePC({ iceServers: [{ url:"turns:localhost:3478", credential:"p" }] }, "InvalidAccessError");
makePC({ iceServers: [{ urls:"http:0.0.0.0" }] }, "SyntaxError");
try {
new mozRTCPeerConnection({ iceServers: [{ url:"http:0.0.0.0" }] }).close();
} catch (e) {
ok(e.message.indexOf("http") > 0,
"mozRTCPeerConnection() constructor has readable exceptions");
makePC = (config, expected_error) => {
var exception;
try {
new mozRTCPeerConnection(config).close();
} catch (e) {
exception = e;
}
is((exception? exception.name : "success"), expected_error || "success",
"mozRTCPeerConnection(" + JSON.stringify(config) + ")");
}
networkTestFinished();
});
// This is a test of the iceServers parsing code + readable errors
runNetworkTest(function () {
var exception = null;
try {
new mozRTCPeerConnection().close();
} catch (e) {
exception = e;
}
ok(!exception, "mozRTCPeerConnection() succeeds");
exception = null;
makePC();
makePC(1, "TypeError");
makePC({});
makePC({ iceServers: [] });
makePC({ iceServers: [{ urls:"" }] }, "SyntaxError");
makePC({ iceServers: [
{ urls:"stun:127.0.0.1" },
{ urls:"stun:localhost", foo:"" },
{ urls: ["stun:127.0.0.1", "stun:localhost"] },
{ urls:"stuns:localhost", foo:"" },
{ urls:"turn:[::1]:3478", username:"p", credential:"p" },
{ urls:"turn:localhost:3478?transport=udp", username:"p", credential:"p" },
{ urls: ["turn:[::1]:3478", "turn:localhost"], username:"p", credential:"p" },
{ urls:"turns:localhost:3478?transport=udp", username:"p", credential:"p" },
{ url:"stun:localhost", foo:"" },
{ url:"turn:localhost", username:"p", credential:"p" }
]});
makePC({ iceServers: [{ urls: ["stun:127.0.0.1", ""] }] }, "SyntaxError");
makePC({ iceServers: [{ urls:"turns:localhost:3478", username:"p" }] }, "InvalidAccessError");
makePC({ iceServers: [{ url:"turns:localhost:3478", credential:"p" }] }, "InvalidAccessError");
makePC({ iceServers: [{ urls:"http:0.0.0.0" }] }, "SyntaxError");
try {
new mozRTCPeerConnection({ iceServers: [{ url:"http:0.0.0.0" }] }).close();
} catch (e) {
ok(e.message.indexOf("http") > 0,
"mozRTCPeerConnection() constructor has readable exceptions");
}
networkTestFinished();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,59 +16,56 @@
title: "Ensure that localDescription and remoteDescription are null after close"
});
var steps = [
function CHECK_SDP_ON_CLOSED_PC(test) {
var description;
var exception = null;
var steps = [
[
"CHECK_SDP_ON_CLOSED_PC",
function (test) {
var description;
var exception = null;
// handle the event which the close() triggers
var localClosed = new Promise(resolve => {
test.pcLocal.onsignalingstatechange = e => {
is(e.target.signalingState, "closed",
"Received expected onsignalingstatechange event on 'closed'");
resolve();
// handle the event which the close() triggers
test.pcLocal.onsignalingstatechange = function (e) {
is(e.target.signalingState, "closed",
"Received expected onsignalingstatechange event on 'closed'");
}
test.pcLocal.close();
try { description = test.pcLocal.localDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access localDescription of pcLocal after close throws exception");
exception = null;
try { description = test.pcLocal.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcLocal after close throws exception");
exception = null;
// handle the event which the close() triggers
test.pcRemote.onsignalingstatechange = function (e) {
is(e.target.signalingState, "closed",
"Received expected onsignalingstatechange event on 'closed'");
}
test.pcRemote.close();
try { description = test.pcRemote.localDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access localDescription of pcRemote after close throws exception");
exception = null;
try { description = test.pcRemote.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcRemote after close throws exception");
test.next();
}
});
]
];
test.pcLocal.close();
try { description = test.pcLocal.localDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access localDescription of pcLocal after close throws exception");
exception = null;
try { description = test.pcLocal.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcLocal after close throws exception");
exception = null;
// handle the event which the close() triggers
var remoteClosed = new Promise(resolve => {
test.pcRemote.onsignalingstatechange = e => {
is(e.target.signalingState, "closed",
"Received expected onsignalingstatechange event on 'closed'");
resolve();
}
});
test.pcRemote.close();
try { description = test.pcRemote.localDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access localDescription of pcRemote after close throws exception");
exception = null;
try { description = test.pcRemote.remoteDescription; } catch (e) { exception = e; }
ok(exception, "Attempt to access remoteDescription of pcRemote after close throws exception");
return Promise.all([localClosed, remoteClosed]);
}
];
var test;
runNetworkTest(() => {
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.append(steps);
test.run();
});
var test;
runNetworkTest(function () {
test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.append(steps);
test.run();
});
</script>
</pre>
</body>

View File

@ -1,6 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>

View File

@ -1,92 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
title: "PeerConnection using callback functions",
bug: "1119593",
visible: true
});
// This still aggressively uses promises, but it is testing that the callback functions
// are properly in place.
// wrapper that turns a callback-based function call into a promise
function pcall(o, f, beforeArg) {
return new Promise((resolve, reject) => {
var args = [resolve, reject];
if (typeof beforeArg !== 'undefined') {
args.unshift(beforeArg);
}
info('Calling ' + f.name);
f.apply(o, args);
});
}
var pc1 = new mozRTCPeerConnection();
var pc2 = new mozRTCPeerConnection();
var pc2_haveRemoteOffer = new Promise(resolve => {
pc2.onsignalingstatechange =
e => (e.target.signalingState == "have-remote-offer") && resolve();
});
var pc1_stable = new Promise(resolve => {
pc1.onsignalingstatechange =
e => (e.target.signalingState == "stable") && resolve();
});
pc1.onicecandidate = e => {
pc2_haveRemoteOffer
.then(() => !e.candidate || pcall(pc2, pc2.addIceCandidate, e.candidate))
.catch(generateErrorCallback());
};
pc2.onicecandidate = e => {
pc1_stable
.then(() => !e.candidate || pcall(pc1, pc1.addIceCandidate, e.candidate))
.catch(generateErrorCallback());
};
var v1, v2;
var delivered = new Promise(resolve => {
pc2.onaddstream = e => {
v2.mozSrcObject = e.stream;
resolve(e.stream);
};
});
runNetworkTest(function() {
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({ fake: true, video: true, audio: true })
.then(stream => pc1.addStream(v1.mozSrcObject = stream))
.then(() => pcall(pc1, pc1.createOffer))
.then(offer => pcall(pc1, pc1.setLocalDescription, offer))
.then(() => pcall(pc2, pc2.setRemoteDescription, pc1.localDescription))
.then(() => pcall(pc2, pc2.createAnswer))
.then(answer => pcall(pc2, pc2.setLocalDescription, answer))
.then(() => pcall(pc1, pc1.setRemoteDescription, pc2.localDescription))
.then(() => delivered)
// .then(() => canPlayThrough) // why doesn't this fire?
.then(() => waitUntil(() => v2.currentTime > 0 && v2.mozSrcObject.currentTime > 0))
.then(() => ok(v2.currentTime > 0, "v2.currentTime is moving (" + v2.currentTime + ")"))
.then(() => ok(true, "Connected."))
.then(() => pcall(pc1, pc1.getStats, null))
.then(stats => ok(Object.keys(stats).length > 0, "pc1 has stats"))
.then(() => pcall(pc2, pc2.getStats, null))
.then(stats => ok(Object.keys(stats).length > 0, "pc2 has stats"))
.then(() => { v1.pause(); v2.pause(); })
.catch(reason => ok(false, "unexpected failure: " + reason))
.then(networkTestFinished);
});
</script>
</pre>
</body>
</html>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<video id="v1" src="../../test/vp9cake.webm" height="120" width="160" autoplay muted></video>
@ -13,32 +19,36 @@
visible: true
});
var metadataLoaded = new Promise(resolve => {
if (v1.readyState < v1.HAVE_METADATA) {
v1.onloadedmetadata = resolve;
} else {
resolve();
}
});
runNetworkTest(function() {
var test = new PeerConnectionTest();
test.setOfferOptions({ offerToReceiveVideo: false,
offerToReceiveAudio: false });
test.chain.insertAfter("PC_LOCAL_GUM", [
function PC_LOCAL_CAPTUREVIDEO(test) {
return metadataLoaded
.then(() => {
var stream = v1.mozCaptureStreamUntilEnded();
is(stream.getTracks().length, 2, "Captured stream has 2 tracks");
stream.getTracks().forEach(tr => test.pcLocal._pc.addTrack(tr, stream));
test.pcLocal.constraints = [{ video: true, audio:true }]; // fool tests
});
var metadataLoaded = new Promise(resolve => {
if (v1.readyState < v1.HAVE_METADATA) {
v1.onloadedmetadata = e => resolve();
return;
}
]);
test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
test.run();
});
resolve();
});
runNetworkTest(function() {
var test = new PeerConnectionTest();
test.setOfferOptions({ offerToReceiveVideo: false,
offerToReceiveAudio: false });
test.chain.insertAfter("PC_LOCAL_GUM", [["PC_LOCAL_CAPTUREVIDEO", function (test) {
metadataLoaded
.then(function() {
var stream = v1.mozCaptureStreamUntilEnded();
is(stream.getTracks().length, 2, "Captured stream has 2 tracks");
stream.getTracks().forEach(tr => test.pcLocal._pc.addTrack(tr, stream));
test.pcLocal.constraints = [{ video: true, audio:true }]; // fool tests
test.next();
})
.catch(function(reason) {
ok(false, "unexpected failure: " + reason);
SimpleTest.finish();
});
}
]]);
test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
test.run();
});
</script>
</pre>
</body>

View File

@ -1,6 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>

View File

@ -1,6 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>

View File

@ -1,8 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="nonTrickleIce.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,8 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="nonTrickleIce.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,8 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="nonTrickleIce.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,9 +1,14 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<video id="v1" controls="controls" height="120" width="160" autoplay></video>
<video id="v2" controls="controls" height="120" width="160" autoplay></video><br>
<pre id="test">
<script type="application/javascript;version=1.8">
createHTML({
@ -12,6 +17,10 @@
visible: true
});
var waituntil = func => new Promise(resolve => {
var inter = setInterval(() => func() && resolve(clearInterval(inter)), 200);
});
var pc1 = new mozRTCPeerConnection();
var pc2 = new mozRTCPeerConnection();
@ -25,15 +34,11 @@
pc2.onicecandidate = e => pc1_stable.then(() => !e.candidate ||
pc1.addIceCandidate(e.candidate)).catch(generateErrorCallback());
var v1, v2;
var delivered = new Promise(resolve =>
pc2.onaddstream = e => resolve(v2.mozSrcObject = e.stream));
var canPlayThrough = new Promise(resolve => v2.canplaythrough = e => resolve());
runNetworkTest(function() {
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({ fake: true, video: true, audio: true })
@ -46,7 +51,7 @@
.then(() => pc1.setRemoteDescription(pc2.localDescription))
.then(() => delivered)
// .then(() => canPlayThrough) // why doesn't this fire?
.then(() => waitUntil(() => v2.currentTime > 0 && v2.mozSrcObject.currentTime > 0))
.then(() => waituntil(() => v2.currentTime > 0 && v2.mozSrcObject.currentTime > 0))
.then(() => ok(v2.currentTime > 0, "v2.currentTime is moving (" + v2.currentTime + ")"))
.then(() => ok(true, "Connected."))
.catch(reason => ok(false, "unexpected failure: " + reason))

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -25,23 +31,27 @@
test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
var flowtest = test.chain.remove("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT");
test.chain.append(flowtest);
test.chain.append([
function PC_LOCAL_REPLACE_VIDEOTRACK(test) {
test.chain.append([["PC_LOCAL_REPLACE_VIDEOTRACK",
function (test) {
var stream = test.pcLocal._pc.getLocalStreams()[0];
var track = stream.getVideoTracks()[0];
var sender = test.pcLocal._pc.getSenders().find(isSenderOfTrack, track);
ok(sender, "track has a sender");
var newtrack;
return navigator.mediaDevices.getUserMedia({video:true, fake: true})
.then(newStream => {
newtrack = newStream.getVideoTracks()[0];
return sender.replaceTrack(newtrack);
})
.then(() => {
is(sender.track, newtrack, "sender.track has been replaced");
});
navigator.mediaDevices.getUserMedia({video:true, fake: true})
.then(function(newStream) {
newtrack = newStream.getVideoTracks()[0];
return sender.replaceTrack(newtrack);
})
.then(function() {
is(sender.track, newtrack, "sender.track has been replaced");
})
.catch(function(reason) {
ok(false, "unexpected error = " + reason.message);
})
.then(test.next.bind(test));
}
]);
]]);
test.chain.append(flowtest);
test.run();

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,23 +17,26 @@
title: "setLocalDescription (answer) in 'have-local-offer'"
});
runNetworkTest(function () {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
var test;
runNetworkTest(function () {
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)
.then(err => {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
});
}
]);
test.chain.append([[
"PC_LOCAL_SET_LOCAL_ANSWER",
function (test) {
test.pcLocal._latest_offer.type="answer";
test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer,
function(err) {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
test.next();
} );
}
]]);
test.run();
});
test.run();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,23 +17,26 @@
title: "setLocalDescription (answer) in 'stable'"
});
runNetworkTest(function () {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
var test;
runNetworkTest(function () {
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)
.then(err => {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
});
}
]);
test.chain.append([[
"PC_LOCAL_SET_LOCAL_ANSWER",
function (test) {
test.pcLocal._latest_offer.type="answer";
test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer,
function(err) {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
test.next();
} );
}
]]);
test.run();
});
test.run();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,22 +17,25 @@
title: "setLocalDescription (offer) in 'have-remote-offer'"
});
runNetworkTest(function () {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION");
var test;
runNetworkTest(function () {
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 => {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
});
}
]);
test.chain.append([[
"PC_REMOTE_SET_LOCAL_OFFER",
function (test) {
test.pcRemote.setLocalDescriptionAndFail(test.pcLocal._latest_offer,
function(err) {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
test.next();
} );
}
]]);
test.run();
});
test.run();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,23 +17,26 @@
title: "setRemoteDescription (answer) in 'have-remote-offer'"
});
runNetworkTest(function () {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION");
var test;
runNetworkTest(function () {
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)
.then(generateErrorCallback('setRemoteDescription should fail'),
err =>
is(err.name, "InvalidStateError", "Error is InvalidStateError"));
}
]);
test.chain.append([[
"PC_REMOTE_SET_REMOTE_ANSWER",
function (test) {
test.pcLocal._latest_offer.type="answer";
test.pcRemote.setRemoteDescriptionAndFail(test.pcLocal._latest_offer,
function(err) {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
test.next();
} );
}
]]);
test.run();
});
test.run();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,23 +17,26 @@
title: "setRemoteDescription (answer) in 'stable'"
});
runNetworkTest(function () {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_CREATE_OFFER");
var test;
runNetworkTest(function () {
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)
.then(generateErrorCallback('setRemoteDescription should fail'),
err =>
is(err.name, "InvalidStateError", "Error is InvalidStateError"));
}
]);
test.chain.append([[
"PC_LOCAL_SET_REMOTE_ANSWER",
function (test) {
test.pcLocal._latest_offer.type="answer";
test.pcLocal.setRemoteDescriptionAndFail(test.pcLocal._latest_offer,
function(err) {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
test.next();
} );
}
]]);
test.run();
});
test.run();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -11,22 +17,25 @@
title: "setRemoteDescription (offer) in 'have-local-offer'"
});
runNetworkTest(function () {
var test = new PeerConnectionTest();
test.setMediaConstraints([{audio: true}], [{audio: true}]);
test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION");
var test;
runNetworkTest(function () {
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'),
err =>
is(err.name, "InvalidStateError", "Error is InvalidStateError"));
}
]);
test.chain.append([[
"PC_LOCAL_SET_REMOTE_OFFER",
function (test) {
test.pcLocal.setRemoteDescriptionAndFail(test.pcLocal._latest_offer,
function(err) {
is(err.name, "InvalidStateError", "Error is InvalidStateError");
test.next();
} );
}
]]);
test.run();
});
test.run();
});
</script>
</pre>
</body>

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">
@ -12,40 +18,62 @@
visible: true
});
// Test setDescription without callbacks, which many webrtc examples still do
// Test setDescription without callbacks, which many webrtc examples still do
function PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC(test) {
test.pcLocal.onsignalingstatechange = function() {};
test.pcLocal._pc.setLocalDescription(test.originalOffer);
}
var pc1_local =
[[
'PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC',
function (test) {
test.pcLocal.onsignalingstatechange = function() {};
test.pcLocal.setLocalDescription(test.originalOffer);
test.next();
}
]];
function PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC(test) {
test.pcRemote.onsignalingstatechange = function() {};
test.pcRemote._pc.setRemoteDescription(test._local_offer);
}
function PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC(test) {
test.pcRemote.onsignalingstatechange = function() {};
test.pcRemote._pc.setLocalDescription(test.originalAnswer);
}
function PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC(test) {
test.pcLocal.onsignalingstatechange = function() {};
test.pcLocal._pc.setRemoteDescription(test._remote_answer);
}
var pc2_remote =
[[
'PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC',
function (test) {
test.pcRemote.onsignalingstatechange = function() {};
test.pcRemote.setRemoteDescription(test._local_offer);
test.next();
}
]];
runNetworkTest(() => {
var replace = (test, name, command) => {
test.chain.insertAfter(name, command);
test.chain.remove(name);
}
var pc2_local =
[[
'PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC',
function (test) {
test.pcRemote.onsignalingstatechange = function() {};
test.pcRemote.setLocalDescription(test.originalAnswer);
test.next();
}
]];
var test = new PeerConnectionTest();
test.setMediaConstraints([{video: true}], [{video: true}]);
test.chain.replace(test, "PC_LOCAL_SET_LOCAL_DESCRIPTION", PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC);
test.chain.replace(test, "PC_REMOTE_SET_REMOTE_DESCRIPTION", PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC);
test.chain.replace(test, "PC_REMOTE_SET_LOCAL_DESCRIPTION", PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC);
test.chain.replace(test, "PC_LOCAL_SET_REMOTE_DESCRIPTION", PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC);
test.run();
});
var pc1_remote =
[[
'PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC',
function (test) {
test.pcLocal.onsignalingstatechange = function() {};
test.pcLocal.setRemoteDescription(test._remote_answer);
test.next();
}
]];
runNetworkTest(function () {
function replace(test, name, command) {
test.chain.insertAfter(name, command);
test.chain.remove(name);
}
var test = new PeerConnectionTest();
test.setMediaConstraints([{video: true}], [{video: true}]);
replace(test, "PC_LOCAL_SET_LOCAL_DESCRIPTION", pc1_local);
replace(test, "PC_REMOTE_SET_REMOTE_DESCRIPTION", pc2_remote);
replace(test, "PC_REMOTE_SET_LOCAL_DESCRIPTION", pc2_local);
replace(test, "PC_LOCAL_SET_REMOTE_DESCRIPTION", pc1_remote);
test.run();
});
</script>
</pre>
</body>

View File

@ -1,6 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
@ -11,23 +15,9 @@
title: "Throw in PeerConnection callbacks"
});
runNetworkTest(function () {
function finish() {
window.onerror = oldOnError;
is(error_count, 7, "Seven expected errors verified.");
networkTestFinished();
}
function getFail() {
return err => {
window.onerror = oldOnError;
generateErrorCallback()(err);
};
}
let error_count = 0;
let oldOnError = window.onerror;
window.onerror = (errorMsg, url, lineNumber) => {
window.onerror = function (errorMsg, url, lineNumber) {
if (errorMsg.indexOf("Expected") == -1) {
getFail()(errorMsg);
}
@ -41,21 +31,27 @@ runNetworkTest(function () {
}
let pc0, pc1, pc2;
// Test failure callbacks (limited to 1 for now)
pc0 = new mozRTCPeerConnection();
pc0.createOffer(getFail(), function(err) {
pc1 = new mozRTCPeerConnection();
pc2 = new mozRTCPeerConnection();
// Test success callbacks (happy path)
navigator.mozGetUserMedia({video:true, fake: true}, function(video1) {
pc1.addStream(video1);
pc1.createOffer(function(offer) {
pc1.setLocalDescription(offer, function() {
pc2.setRemoteDescription(offer, function() {
pc2.createAnswer(function(answer) {
pc2.setLocalDescription(answer, function() {
pc1.setRemoteDescription(answer, function() {
runNetworkTest(function () {
error_count = 0;
// Test failure callbacks (limited to 1 for now)
pc0 = new mozRTCPeerConnection();
pc0.createOffer(getFail(), function(err) {
pc1 = new mozRTCPeerConnection();
pc2 = new mozRTCPeerConnection();
// Test success callbacks (happy path)
navigator.mozGetUserMedia({video:true, fake: true}, function(video1) {
pc1.addStream(video1);
pc1.createOffer(function(offer) {
pc1.setLocalDescription(offer, function() {
pc2.setRemoteDescription(offer, function() {
pc2.createAnswer(function(answer) {
pc2.setLocalDescription(answer, function() {
pc1.setRemoteDescription(answer, function() {
throw new Error("Expected");
}, getFail());
throw new Error("Expected");
}, getFail());
throw new Error("Expected");
@ -66,13 +62,23 @@ runNetworkTest(function () {
}, getFail());
throw new Error("Expected");
}, getFail());
throw new Error("Expected");
}, getFail());
}, getFail());
throw new Error("Expected");
throw new Error("Expected");
});
});
});
function finish() {
window.onerror = oldOnError;
is(error_count, 7, "Seven expected errors verified.");
networkTestFinished();
}
function getFail() {
return function (err) {
window.onerror = oldOnError;
generateErrorCallback()(err);
};
}
</script>
</pre>
</body>

View File

@ -1,6 +1,14 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=872377
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 872377 and Bug 928304</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
@ -21,9 +29,9 @@
if (typeof(rtcSession[key]) == "function") continue;
is(rtcSession[key], jsonCopy[key], "key " + key + " should match.");
}
/** Test for Bug 928304 **/
var rtcIceCandidate = new mozRTCIceCandidate({ candidate: "dummy",
sdpMid: "test",
sdpMLineIndex: 3 });

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,7 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="mediaStreamPlayback.js"></script>
<script type="application/javascript" src="pc.js"></script>
<script type="application/javascript" src="templates.js"></script>
<script type="application/javascript" src="turnConfig.js"></script>
</head>
<body>
<pre id="test">

View File

@ -1,22 +1,24 @@
<!DOCTYPE HTML>
<html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="network.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
if ("nsINetworkInterfaceListService" in SpecialPowers.Ci) {
getNetworkUtils().tearDownNetwork()
.then(() =>
ok(true, 'Successfully teared down network interface'),
() =>
ok(true, 'Network interface was in down state already'))
.then(() => SimpleTest.finish());
var utils = getNetworkUtils();
utils.tearDownNetwork(function() {
ok(true, 'Successfully teared down network interface');
SimpleTest.finish();
}, function() {
ok(true, 'Network interface was in down state already');
SimpleTest.finish();
});
} else {
ok(true, 'No need to cleanup network interface');
SimpleTest.finish();