2019-12-06 09:25:22 +00:00
<!doctype html>
< html >
< head >
< meta charset = "utf-8" >
< title > Testing ICE candidate filtering when using data channel< / title >
< script src = "../../resources/testharness.js" > < / script >
< script src = "../../resources/testharnessreport.js" > < / script >
< / head >
< body >
< script >
promise_test(async (test) => {
2020-05-27 07:48:17 +00:00
let pc = new RTCPeerConnection();
2019-12-06 09:25:22 +00:00
pc.createDataChannel('sendDataChannel');
2020-05-27 07:48:17 +00:00
let offer = await pc.createOffer();
2019-12-06 09:25:22 +00:00
pc.setLocalDescription(offer);
// This test is a bit racy, we are trying to have network process crash between the time it receives a monitor start request and the time it answers that request.
2020-08-05 16:11:59 +00:00
if (window.testRunner & & testRunner.terminateNetworkProcess) {
2019-12-06 09:25:22 +00:00
setTimeout(() => testRunner.terminateNetworkProcess(), 0);
2020-08-05 16:11:59 +00:00
await new Promise(resolve => setTimeout(resolve, 50));
let hasResponse = false;
while (!hasResponse) {
const response = await fetch(".").then(r => r, () => { return { status : -1 } });
hasResponse = response.status !== -1;
}
}
2020-05-27 07:48:17 +00:00
let pc2 = new RTCPeerConnection();
pc2.createDataChannel('sendDataChannel');
2020-08-05 16:11:59 +00:00
const iceCandidatePromise = new Promise((resolve, reject) => {
pc2.onicecandidate = resolve;
setTimeout(() => reject('ice candidate event time out'), 10000);
});
2020-05-27 07:48:17 +00:00
offer = await pc2.createOffer();
pc2.setLocalDescription(offer);
return iceCandidatePromise;
2019-12-06 09:25:22 +00:00
}, "Gathering ICE candidates from a data channel while network process is crashing");
< / script >
< / body >
< / html >