Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326

This commit is contained in:
Josh Matthews 2017-10-12 09:25:50 -04:00
parent 462c272380
commit 1f531f66ea
5377 changed files with 174916 additions and 84369 deletions

View file

@ -61,7 +61,7 @@ function assert_is_session_description(sessionDesc) {
}
assert_not_equals(sessionDesc, undefined,
'Expect session description to be defined, but got undefined');
'Expect session description to be defined');
assert_true(typeof(sessionDesc) === 'object',
'Expect sessionDescription to be either a RTCSessionDescription or an object');
@ -69,7 +69,7 @@ function assert_is_session_description(sessionDesc) {
assert_true(typeof(sessionDesc.type) === 'string',
'Expect sessionDescription.type to be a string');
assert_true(typeof(sessionDesc.type) === 'string',
assert_true(typeof(sessionDesc.sdp) === 'string',
'Expect sessionDescription.sdp to be a string');
}
@ -107,21 +107,27 @@ function assert_session_desc_not_equals(sessionDesc1, sessionDesc2) {
// object with any audio, video, data media lines present
function generateOffer(options={}) {
const {
audio=false,
video=false,
data=false
audio = false,
video = false,
data = false,
pc,
} = options;
const pc = new RTCPeerConnection();
if(data) {
if (data) {
pc.createDataChannel('test');
}
return pc.createOffer({
offerToReceiveAudio: audio,
offerToReceiveVideo: video
}).then(offer => {
const setup = {};
if (audio) {
setup.offerToReceiveAudio = true;
}
if (video) {
setup.offerToReceiveVideo = true;
}
return pc.createOffer(setup).then(offer => {
// Guard here to ensure that the generated offer really
// contain the number of media lines we want
const { sdp } = offer;
@ -251,10 +257,11 @@ function doSignalingHandshake(localPc, remotePc) {
// It does the heavy lifting of performing signaling handshake,
// ICE candidate exchange, and waiting for data channel at two
// end points to open.
function createDataChannelPair() {
const pc1 = new RTCPeerConnection();
const pc2 = new RTCPeerConnection();
const channel1 = pc1.createDataChannel('test');
function createDataChannelPair(
pc1=new RTCPeerConnection(),
pc2=new RTCPeerConnection())
{
const channel1 = pc1.createDataChannel('');
exchangeIceCandidates(pc1, pc2);
@ -278,7 +285,7 @@ function createDataChannelPair() {
}
function onDataChannel(event) {
channel2 = event.channel
channel2 = event.channel;
channel2.addEventListener('error', reject);
const { readyState } = channel2;
@ -360,7 +367,7 @@ function assert_equals_array_buffer(buffer1, buffer2) {
function generateMediaStreamTrack(kind) {
const pc = new RTCPeerConnection();
assert_own_property(pc, 'addTransceiver',
assert_idl_attribute(pc, 'addTransceiver',
'Expect pc to have addTransceiver() method');
const transceiver = pc.addTransceiver(kind);
@ -372,3 +379,18 @@ function generateMediaStreamTrack(kind) {
return track;
}
// Obtain a MediaStreamTrack of kind using getUserMedia.
// Return Promise of pair of track and associated mediaStream.
// Assumes that there is at least one available device
// to generate the track.
function getTrackFromUserMedia(kind) {
return navigator.mediaDevices.getUserMedia({ [kind]: true })
.then(mediaStream => {
const tracks = mediaStream.getTracks();
assert_greater_than(tracks.length, 0,
`Expect getUserMedia to return at least one track of kind ${kind}`);
const [ track ] = tracks;
return [track, mediaStream];
});
}