Update web-platform-tests to revision be959408023fe02cf79abe70f6018598a7004a88

This commit is contained in:
WPT Sync Bot 2018-06-11 21:57:51 -04:00
parent a76777b115
commit 761c8bc2a9
171 changed files with 2434 additions and 907 deletions

View file

@ -168,36 +168,6 @@ function generateAnswer(offer) {
.then(() => pc.createAnswer());
}
// Wait for peer connection to fire onsignalingstatechange
// event, compare and make sure the new state is the same
// as expected state. It accepts an RTCPeerConnection object
// and an array of expected state changes. The test passes
// if all expected state change events have been fired, and
// fail if the new state is different from the expected state.
//
// Note that the promise is never resolved if no change
// event is fired. To avoid confusion with the main test
// getting timed out, this is done in parallel as a separate
// test
function test_state_change_event(parentTest, pc, expectedStates) {
return async_test(t => {
pc.onsignalingstatechange = t.step_func(() => {
if(expectedStates.length === 0) {
return;
}
const newState = pc.signalingState;
const expectedState = expectedStates.shift();
assert_equals(newState, expectedState, 'New signaling state is different from expected.');
if(expectedStates.length === 0) {
t.done();
}
});
}, `Test onsignalingstatechange event for ${parentTest.name}`);
}
// Run a test function that return a promise that should
// never be resolved. For lack of better options,
// we wait for a time out and pass the test if the
@ -418,16 +388,19 @@ function getUserMediaTracksAndStreams(count, type = 'audio') {
});
}
// Creates an offer for the caller, set it as the caller's local description and
// then sets the callee's remote description to the offer. Returns the Promise
// of the setRemoteDescription call.
function performOffer(caller, callee) {
let sessionDescription;
return caller.createOffer()
.then(offer => {
sessionDescription = offer;
return caller.setLocalDescription(offer);
}).then(() => callee.setRemoteDescription(sessionDescription));
async function exchangeOffer(caller, callee) {
const offer = await caller.createOffer();
await caller.setLocalDescription(offer);
return callee.setRemoteDescription(offer);
}
async function exchangeAnswer(caller, callee) {
const answer = await callee.createAnswer();
await callee.setLocalDescription(answer);
return caller.setRemoteDescription(answer);
}
async function exchangeOfferAnswer(caller, callee) {
await exchangeOffer(caller, callee);
return exchangeAnswer(caller, callee);
}
@ -445,3 +418,13 @@ class Resolver {
this.reject = promiseReject;
}
}
function addEventListenerPromise(t, target, type, listener) {
return new Promise((resolve, reject) => {
target.addEventListener(type, t.step_func(e => {
if (listener != undefined)
e = listener(e);
resolve(e);
}));
});
}