aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/compression/decompression-empty-input.any.js
diff options
context:
space:
mode:
authorWPT Sync Bot <josh+wptsync@joshmatthews.net>2019-10-01 10:52:57 +0000
committerWPT Sync Bot <josh+wptsync@joshmatthews.net>2019-10-01 13:54:31 +0000
commit38ab56be1a5a5850d51b85b19ed730f12d294f6c (patch)
treec24ee2fe0b252985a03d87c6f1546a6642ac8e06 /tests/wpt/web-platform-tests/compression/decompression-empty-input.any.js
parent1b6715158dd9f04d63545f0c47a4605af3966aa9 (diff)
downloadservo-38ab56be1a5a5850d51b85b19ed730f12d294f6c.tar.gz
servo-38ab56be1a5a5850d51b85b19ed730f12d294f6c.zip
Update web-platform-tests to revision f1e1bd6bfa544af8059ff8ef79d622281f9ec0a8
Diffstat (limited to 'tests/wpt/web-platform-tests/compression/decompression-empty-input.any.js')
-rw-r--r--tests/wpt/web-platform-tests/compression/decompression-empty-input.any.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/compression/decompression-empty-input.any.js b/tests/wpt/web-platform-tests/compression/decompression-empty-input.any.js
new file mode 100644
index 00000000000..ff4cff522a4
--- /dev/null
+++ b/tests/wpt/web-platform-tests/compression/decompression-empty-input.any.js
@@ -0,0 +1,30 @@
+// META: global=worker
+
+'use strict';
+
+const gzipEmptyValue = new Uint8Array([31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+const deflateEmptyValue = new Uint8Array([120, 156, 3, 0, 0, 0, 0, 1]);
+
+promise_test(async t => {
+ const ds = new DecompressionStream('gzip');
+ const reader = ds.readable.getReader();
+ const writer = ds.writable.getWriter();
+ const writePromise = writer.write(gzipEmptyValue);
+ writer.close();
+ const { value, done } = await reader.read();
+ assert_true(done, "read() should set done");
+ assert_equals(value, undefined, "value should be undefined");
+ await writePromise;
+}, 'decompressing gzip empty input should work');
+
+promise_test(async t => {
+ const ds = new DecompressionStream('deflate');
+ const reader = ds.readable.getReader();
+ const writer = ds.writable.getWriter();
+ const writePromise = writer.write(deflateEmptyValue);
+ writer.close();
+ const { value, done } = await reader.read();
+ assert_true(done, "read() should set done");
+ assert_equals(value, undefined, "value should be undefined");
+ await writePromise;
+}, 'decompressing deflate empty input should work');