Bug 1604858 [wpt PR 20845] - Fail when calling createOffer in the wrong signaling state, a=testonly

Automatic update from web-platform-tests
Fail when calling createOffer in the wrong signaling state (#20845)

* Fail when calling createOffer in the wrong signaling state

close #16188 per https://github.com/w3c/webrtc-pc/issues/2145

--

wpt-commits: 841671e2b4e2bba13b76a805723c4cfb4560dbe9
wpt-pr: 20845
This commit is contained in:
Dominique Hazael-Massieux 2020-01-15 11:50:50 +00:00 committed by moz-wptsync-bot
parent 4fd11e7446
commit b930c1a43b

View File

@ -49,7 +49,7 @@
return generateVideoReceiveOnlyOffer(pc)
.then(offer =>
pc.setLocalDescription(offer)
pc.setLocalDescription(offer)
.then(() => {
assert_equals(pc.signalingState, 'have-local-offer');
assert_session_desc_similar(pc.localDescription, offer);
@ -93,6 +93,26 @@
});
}, 'When media stream is added when createOffer() is running in parallel, the result offer should contain the new media stream');
/*
If connection's signaling state is neither "stable" nor "have-local-offer", return a promise rejected with a newly created InvalidStateError.
*/
promise_test(t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
const states = [];
pc.addEventListener('signalingstatechange', () => states.push(pc.signalingState));
return generateVideoReceiveOnlyOffer(pc)
.then(offer =>
pc.setRemoteDescription(offer)
.then(() => {
assert_equals(pc.signalingState, 'have-remote-offer');
return promise_rejects(t, 'InvalidStateError',
pc.createOffer());
})
)
}, 'createOffer() should fail when signaling state is not stable or have-local-offer');
/*
* TODO
* 4.3.2 createOffer