blob: bb4f56b314f1251221ceaae7630fa1944d0e8993 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>RTCPeerConnection address harvesting</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(async t => {
let pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
pc.createDataChannel('foo');
let candidates = [];
pc.onicecandidate = function(event) {
if (event.candidate) {
candidates.push(event.candidate);
}
}
let gatheringDone = new Promise(function(resolve, reject) {
pc.onicegatheringstatechange = function() {
if (pc.iceGatheringState == 'complete') {
resolve();
}
}
});
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);
await gatheringDone;
assert_true(candidates.length > 0);
pc.close();
}, 'Test that address harvesting does not cause crash');
</script>
</body>
</html>