Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement RTCPeerConnection.onicecandidateerror and add web-platform-…
…test Bug: webrtc:3098 https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-onicecandidateerror
- Loading branch information
1 parent
66dc9c9
commit 9c1e2de
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>RTCPeerConnection.prototype.onicecandidateerror</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="RTCPeerConnection-helper.js"></script> | ||
<script> | ||
|
||
promise_test(async t => { | ||
const config = { | ||
iceServers: [{urls: "turn:123", username: "123", credential: "123"}] | ||
}; | ||
const pc = new RTCPeerConnection(config); | ||
t.add_cleanup(() => pc.close()); | ||
const onErrorPromise = addEventListenerPromise(t, pc, 'icecandidateerror', e => { | ||
assert_true(event instanceof RTCPeerConnectionIceErrorEvent, | ||
'Expect event to be instance of RTCPeerConnectionIceErrorEvent'); | ||
// Do not hardcode any specific errors here. Instead only verify | ||
// that all the fields contain something expected | ||
assert_true(event.errorCode >= 300 && event.errorCode <= 799, "errorCode"); | ||
assert_true(event.errorText.includes("."), "errorText"); | ||
assert_true(event.hostCandidate.includes(":"), "hostCandidate"); | ||
assert_true(event.url.includes("123"), "url"); | ||
}); | ||
const offerOptions = {offerToReceiveAudio: 1}; | ||
await pc.setLocalDescription(await pc.createOffer(offerOptions)); | ||
await onErrorPromise; | ||
}, 'Surfacing onicecandidateerror'); | ||
|
||
</script> |