40 lines
1.2 KiB
HTML
40 lines
1.2 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Testing a lot of data channel connections on the same web process</title>
|
|
<script src="../../resources/testharness.js"></script>
|
|
<script src="../../resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<script src ="../routines.js"></script>
|
|
<script>
|
|
for (var cptr = 0;cptr < 256; cptr++) {
|
|
promise_test((test) => {
|
|
var localChannel;
|
|
var remoteChannel;
|
|
|
|
return new Promise((resolve, reject) => {
|
|
createConnections((localConnection) => {
|
|
localChannel = localConnection.createDataChannel('sendDataChannel');
|
|
localChannel.onopen = () => {
|
|
localChannel.send("one");
|
|
}
|
|
}, (remoteConnection) => {
|
|
remoteConnection.ondatachannel = (event) => {
|
|
remoteChannel = event.channel;
|
|
remoteChannel.onmessage = () => { resolve(); }
|
|
};
|
|
});
|
|
setTimeout(() => { reject("Test timed out"); }, 5000);
|
|
}).then(() => {
|
|
localChannel.close();
|
|
remoteChannel.close();
|
|
closeConnections();
|
|
});
|
|
}, "Basic data channel exchange from offerer to receiver " + cptr);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|