summaryrefslogtreecommitdiff
path: root/test/parallel/test-zlib-dictionary.js
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2017-03-22 19:45:03 -0700
committerAnna Henningsen <anna@addaleax.net>2017-04-03 09:50:09 +0200
commit91383e47fdbb87ae45365396dd0150dcad8ed967 (patch)
treeb68f4883bf29d10bf78aa097fd3c3c8ca736d855 /test/parallel/test-zlib-dictionary.js
parent2d039ffa29e4c4366a1028555b71cb36b7129fb1 (diff)
downloadandroid-node-v8-91383e47fdbb87ae45365396dd0150dcad8ed967.tar.gz
android-node-v8-91383e47fdbb87ae45365396dd0150dcad8ed967.tar.bz2
android-node-v8-91383e47fdbb87ae45365396dd0150dcad8ed967.zip
zlib: support Uint8Array in convenience methods
Also support Uint8Array as a `dictionary` option. PR-URL: https://github.com/nodejs/node/pull/12001 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-zlib-dictionary.js')
-rw-r--r--test/parallel/test-zlib-dictionary.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/parallel/test-zlib-dictionary.js b/test/parallel/test-zlib-dictionary.js
index fd70d73556..a3b55bc72d 100644
--- a/test/parallel/test-zlib-dictionary.js
+++ b/test/parallel/test-zlib-dictionary.js
@@ -41,6 +41,7 @@ const spdyDict = Buffer.from([
'ation/xhtmltext/plainpublicmax-agecharset=iso-8859-1utf-8gzipdeflateHTTP/1',
'.1statusversionurl\0'
].join(''));
+const spdyDictUint8Array = new Uint8Array(spdyDict);
const input = [
'HTTP/1.1 200 Ok',
@@ -49,7 +50,7 @@ const input = [
''
].join('\r\n');
-function basicDictionaryTest() {
+function basicDictionaryTest(spdyDict) {
let output = '';
const deflate = zlib.createDeflate({ dictionary: spdyDict });
const inflate = zlib.createInflate({ dictionary: spdyDict });
@@ -75,7 +76,7 @@ function basicDictionaryTest() {
deflate.end();
}
-function deflateResetDictionaryTest() {
+function deflateResetDictionaryTest(spdyDict) {
let doneReset = false;
let output = '';
const deflate = zlib.createDeflate({ dictionary: spdyDict });
@@ -108,7 +109,7 @@ function deflateResetDictionaryTest() {
});
}
-function rawDictionaryTest() {
+function rawDictionaryTest(spdyDict) {
let output = '';
const deflate = zlib.createDeflateRaw({ dictionary: spdyDict });
const inflate = zlib.createInflateRaw({ dictionary: spdyDict });
@@ -134,7 +135,7 @@ function rawDictionaryTest() {
deflate.end();
}
-function deflateRawResetDictionaryTest() {
+function deflateRawResetDictionaryTest(spdyDict) {
let doneReset = false;
let output = '';
const deflate = zlib.createDeflateRaw({ dictionary: spdyDict });
@@ -167,7 +168,9 @@ function deflateRawResetDictionaryTest() {
});
}
-basicDictionaryTest();
-deflateResetDictionaryTest();
-rawDictionaryTest();
-deflateRawResetDictionaryTest();
+for (const dict of [spdyDict, spdyDictUint8Array]) {
+ basicDictionaryTest(dict);
+ deflateResetDictionaryTest(dict);
+ rawDictionaryTest(dict);
+ deflateRawResetDictionaryTest(dict);
+}