Debian Codegraph @

testing/web-platform/mozilla/tests/dom/throttling/throttling-ws.window.js

raw
1 // META: script=resources/ws.sub.js
2 // META: script=resources/throttling.js
3 let server = "ws://" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
4
5 setup(() => waitForLoad()
6 .then(() => "setup done"));
7
8 promise_test(t => addWebSocket(t, server)
9 .then(() => busy(100))
10 .then(() => getThrottlingRate(100))
11 .then(rate => {
12 assert_less_than(rate, 10, "Timeout was throttled");
13 }), "Don't throttle when there are open WebSockets.");
14
15 promise_test(t => inFrame(t)
16 .then(win => win.addWebSocket(t, server))
17 .then(() => busy(100))
18 .then(() => getThrottlingRate(100))
19 .then(rate => {
20 assert_less_than(rate, 10, "Timeout was throttled");
21 }), "Don't throttle when there are open WebSockets in iframe.");
22
23 promise_test(t => inFrame(t)
24 .then(win => addWebSocket(t, server)
25 .then(() => win.busy(100))
26 .then(() => win.getThrottlingRate(100)))
27 .then(rate => {
28 assert_less_than(rate, 10, "Timeout was throttled");
29 }), "Don't throttle iframe when there are open WebSockets in parent.");
30
31 promise_test(t => inFrame(t)
32 .then(win => win.addWebSocket(t, server)
33 .then(() => win.busy(100))
34 .then(() => win.getThrottlingRate(100)))
35 .then(rate => {
36 assert_less_than(rate, 10, "Timeout was throttled");
37 }), "Don't throttle iframe when there are open WebSockets in iframe.");