Truly independent web browser
Tests/LibWeb: Remove the bufferedAmount test that fails on Windows
Luke Wilde3a62637dd1b5
diff --git a/Tests/LibWeb/Fixtures/http-test-server.py b/Tests/LibWeb/Fixtures/http-test-server.pyindex eea2207eee1..7bff6391fe3 100755--- a/Tests/LibWeb/Fixtures/http-test-server.py+++ b/Tests/LibWeb/Fixtures/http-test-server.py@@ -42,8 +42,7 @@ Endpoints:"ignore_range": true. Then it sends the entire body, as a server that doesn't support ranges does.- GET <any path> with an "Upgrade: websocket" header: Performs a WebSocket handshake and then echoesevery text/binary frame back to the client verbatim. With a "send-binary=<size>" query parameter, the- server first sends a binary frame of that many bytes: a 1, zeros, and then a 2. With a- "read_unblock_token=<token>" query parameter, the server reads nothing until GET /unblock/<token>.+ server first sends a binary frame of that many bytes: a 1, zeros, and then a 2.- GET /reflect-websocket-cookie with an "Upgrade: websocket" header: As above, but first sends thehandshake's Cookie header (or an empty string) as a text frame.- GET /websocket-close-without-response with an "Upgrade: websocket" header: Closes the connection without@@ -815,9 +814,6 @@ class TestHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):payload[-1] = 2self._send_websocket_frame(bytes(payload), opcode=0x2)- if "read_unblock_token" in query:- unblock_events.setdefault(query["read_unblock_token"][0], threading.Event()).wait()-while True:frame = self._read_websocket_frame()if frame is None:@@ -870,9 +866,7 @@ class TestHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):if payload is None:return Noneif is_masked:- # One XOR over the whole payload as an integer keeps large messages quick to unmask.- repeated_mask = (mask * (length // 4 + 1))[:length]- payload = (int.from_bytes(payload, "big") ^ int.from_bytes(repeated_mask, "big")).to_bytes(length, "big")+ payload = bytes(payload[i] ^ mask[i % 4] for i in range(length))return opcode, payloaddef _build_ws_frame(self, data, opcode=0x1):diff --git a/Tests/LibWeb/Text/expected/WebSocket/buffered-amount-counts-what-is-not-yet-transmitted.txt b/Tests/LibWeb/Text/expected/WebSocket/buffered-amount-counts-what-is-not-yet-transmitted.txtdeleted file mode 100644index 1150b7166ee..00000000000--- a/Tests/LibWeb/Text/expected/WebSocket/buffered-amount-counts-what-is-not-yet-transmitted.txt+++ /dev/null@@ -1,3 +0,0 @@-Buffered after send(): true-Buffered while the server reads nothing: true-Echoed 67108864 bytes, bufferedAmount: 0diff --git a/Tests/LibWeb/Text/input/WebSocket/buffered-amount-counts-what-is-not-yet-transmitted.html b/Tests/LibWeb/Text/input/WebSocket/buffered-amount-counts-what-is-not-yet-transmitted.htmldeleted file mode 100644index b916061a110..00000000000--- a/Tests/LibWeb/Text/input/WebSocket/buffered-amount-counts-what-is-not-yet-transmitted.html+++ /dev/null@@ -1,32 +0,0 @@-<!DOCTYPE html>-<script src="../include.js"></script>-<script>- asyncTest(async done => {- const port = internals.getEchoServerPort();- const token = `buffered-amount-${Math.random()}`;- const ws = new WebSocket(`ws://localhost:${port}/?read_unblock_token=${token}`);- ws.binaryType = "arraybuffer";- await new Promise(resolve => (ws.onopen = resolve));-- // Far more than the operating system buffers while the server reads nothing. Windows takes in the whole of a- // message while its buffer has room, however large, so there the second message is what stays behind.- const size = 32 * 1024 * 1024;- ws.send(new Uint8Array(size));- ws.send(new Uint8Array(size));- println(`Buffered after send(): ${ws.bufferedAmount === 2 * size}`);-- // A round trip to the server runs many tasks.- await fetch(`http://localhost:${port}/recorded-request-count/nothing`);- println(`Buffered while the server reads nothing: ${ws.bufferedAmount > 0}`);-- // The first echo can arrive while the second message is still being sent.- let echoed = 0;- ws.onmessage = event => {- echoed += event.data.byteLength;- if (echoed < 2 * size) return;- println(`Echoed ${echoed} bytes, bufferedAmount: ${ws.bufferedAmount}`);- done();- };- await fetch(`http://localhost:${port}/unblock/${token}`);- });-</script>