Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / websocket / multiple-connections-throttled.html
blobbfabce4ec68fdb1c662bf74a5a0c73d226a2482a
1 <!DOCTYPE HTML>
2 <script src="/js-test-resources/js-test.js"></script>
3 <script>
4 description("Test that WebSocket connections are throttled.");
6 window.jsTestIsAsync = true;
8 var socketCount = 300;
9 var openedCount = 0;
10 var closedCount = 0;
12 // Expected behavior:
13 // 1. A handshake to "ws://127.0.0.1:8880/delayed-handshake" is started.
14 // This stays pending for 1 second.
15 // 2. Another 299 WebSockets to "ws://127.0.0.1:8880/echo" are created.
16 // 45 connections are rejected by per-renderer WebSocket throttling,
17 // and 254 connections to "ws://127.0.0.1:8880/echo" stay pending.
18 // 3. The handshake to "ws://127.0.0.1:8880/delayed-handshake"
19 // (started in Step 1) is completed.
20 // 4. The handshakes of 254 connections to "ws://127.0.0.1:8880/echo"
21 // (created in Step 2) are started and are completed without delay.
23 for (i = 0; i < socketCount; ++i) {
24 var ws = new WebSocket(i == 0 ?
25 "ws://127.0.0.1:8880/delayed-handshake" :
26 "ws://127.0.0.1:8880/echo");
28 ws.onopen = function(ws) {
29 ++openedCount;
30 ws.close();
31 }.bind(undefined, ws);
33 ws.onclose = function() {
34 ++closedCount;
35 if (closedCount === socketCount) {
36 shouldBeEqualToNumber("openedCount", 255);
37 finishJSTest();
41 </script>