Skip to content

Commit 405df60

Browse files
Test with both allowShared and allowResizable
1 parent 3a0fec2 commit 405df60

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

test/buffer-source.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,23 @@ for (const type of bufferSourceConstructors) {
312312

313313
commonNotOk(allowResizableSUT);
314314
});
315+
316+
describe("with [AllowShared, AllowResizable]", () => {
317+
const allowSharedAndResizableSUT = (v, opts) => {
318+
return conversions[typeName](v, { ...opts, allowShared: true, allowResizable: true });
319+
};
320+
321+
for (const { label, creator, typeName: innerTypeName, isDetached, isForged } of bufferSourceCreators) {
322+
const testFunction = innerTypeName === typeName &&
323+
!isDetached &&
324+
!isForged ?
325+
testOk :
326+
testNotOk;
327+
testFunction(label, allowSharedAndResizableSUT, creator);
328+
}
329+
330+
commonNotOk(allowSharedAndResizableSUT);
331+
});
315332
});
316333
}
317334

@@ -405,6 +422,26 @@ describe("WebIDL ArrayBufferView type", () => {
405422

406423
commonNotOk(allowResizableSUT);
407424
});
425+
426+
describe("with [AllowShared, AllowResizable]", () => {
427+
const allowResizableSUT = (v, opts) => {
428+
return conversions.ArrayBufferView(v, { ...opts, allowShared: true, allowResizable: true });
429+
};
430+
431+
for (const { label, creator, typeName, isDetached, isForged } of bufferSourceCreators) {
432+
const testFunction =
433+
typeName !== "ArrayBuffer" &&
434+
typeName !== "SharedArrayBuffer" &&
435+
!isDetached &&
436+
!isForged ?
437+
testOk :
438+
testNotOk;
439+
440+
testFunction(label, allowResizableSUT, creator);
441+
}
442+
443+
commonNotOk(allowResizableSUT);
444+
});
408445
});
409446

410447
describe("WebIDL BufferSource type", () => {
@@ -438,4 +475,17 @@ describe("WebIDL BufferSource type", () => {
438475

439476
commonNotOk(allowResizableSUT);
440477
});
478+
479+
describe("with [AllowShared, AllowResizable]", () => {
480+
const allowResizableSUT = (v, opts) => {
481+
return conversions.BufferSource(v, { ...opts, allowShared: true, allowResizable: true });
482+
};
483+
484+
for (const { label, creator, isDetached, isForged } of bufferSourceCreators) {
485+
const testFunction = !isDetached && !isForged ? testOk : testNotOk;
486+
testFunction(label, allowResizableSUT, creator);
487+
}
488+
489+
commonNotOk(allowResizableSUT);
490+
});
441491
});

0 commit comments

Comments
 (0)