Bug 1903442 [wpt PR 46824] - avoid failing entire suites when Float16Array is undefined, a=testonly

Automatic update from web-platform-tests
Avoid failing entire suites when Float16Array is undefined

Followup to https://github.com/web-platform-tests/wpt/pull/45483.

https://github.com/web-platform-tests/wpt/pull/46278 and https://github.com/web-platform-tests/wpt/pull/45670 did part of this already.
--

wpt-commits: da8d6860b22271d8ef4dc7894509692aaab9adf8
wpt-pr: 46824
This commit is contained in:
Kevin Gibbons
2024-06-20 16:57:57 +00:00
committed by moz-wptsync-bot
parent 8768cc3196
commit 61a47593c2
3 changed files with 24 additions and 12 deletions

View File

@@ -290,14 +290,22 @@ test_blob(function() {
new Int16Array([0x4150, 0x5353]),
new Uint32Array([0x53534150]),
new Int32Array([0x53534150]),
new Float16Array([2.65625, 58.59375]),
new Float32Array([0xD341500000])
]);
}, {
expected: "PASSPASSPASSPASSPASSPASSPASSPASS",
expected: "PASSPASSPASSPASSPASSPASSPASS",
type: "",
desc: "Passing typed arrays as elements of the blobParts array should work."
});
test_blob(function() {
return new Blob([
new Float16Array([2.65625, 58.59375])
]);
}, {
expected: "PASS",
type: "",
desc: "Passing a Float16Array as element of the blobParts array should work."
});
test_blob(function() {
return new Blob([
// 0x535 3415053534150

View File

@@ -3,6 +3,14 @@ test(function() {
assert_throws_dom("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float16Array(6))
}, "Float16Array")
assert_throws_dom("TypeMismatchError", function() {
const len = 65536 / Float16Array.BYTES_PER_ELEMENT + 1;
self.crypto.getRandomValues(new Float16Array(len));
}, "Float16Array (too long)")
}, "Float16 arrays");
test(function() {
assert_throws_dom("TypeMismatchError", function() {
self.crypto.getRandomValues(new Float32Array(6))
}, "Float32Array")
@@ -10,10 +18,6 @@ test(function() {
self.crypto.getRandomValues(new Float64Array(6))
}, "Float64Array")
assert_throws_dom("TypeMismatchError", function() {
const len = 65536 / Float16Array.BYTES_PER_ELEMENT + 1;
self.crypto.getRandomValues(new Float16Array(len));
}, "Float16Array (too long)")
assert_throws_dom("TypeMismatchError", function() {
const len = 65536 / Float32Array.BYTES_PER_ELEMENT + 1;
self.crypto.getRandomValues(new Float32Array(len));

View File

@@ -49,7 +49,7 @@ const bufferSourceChunksForDeflate = [
},
{
name: 'Float16Array',
value: new Float16Array(new Uint8Array(compressedBytesWithDeflate).buffer)
value: () => new Float16Array(new Uint8Array(compressedBytesWithDeflate).buffer)
},
{
name: 'Float32Array',
@@ -100,7 +100,7 @@ const bufferSourceChunksForGzip = [
},
{
name: 'Float16Array',
value: new Float16Array(new Uint8Array(compressedBytesWithGzip).buffer)
value: () => new Float16Array(new Uint8Array(compressedBytesWithGzip).buffer)
},
{
name: 'Float32Array',
@@ -151,7 +151,7 @@ const bufferSourceChunksForDeflateRaw = [
},
{
name: 'Float16Array',
value: new Float16Array(new Uint8Array(compressedBytesWithDeflateRaw).buffer)
value: () => new Float16Array(new Uint8Array(compressedBytesWithDeflateRaw).buffer)
},
{
name: 'Float32Array',
@@ -172,7 +172,7 @@ for (const chunk of bufferSourceChunksForDeflate) {
const ds = new DecompressionStream('deflate');
const reader = ds.readable.getReader();
const writer = ds.writable.getWriter();
const writePromise = writer.write(chunk.value);
const writePromise = writer.write(typeof chunk.value === 'function' ? chunk.value() : chunk.value);
writer.close();
const { value } = await reader.read();
assert_array_equals(Array.from(value), deflateExpectedChunkValue, 'value should match');
@@ -184,7 +184,7 @@ for (const chunk of bufferSourceChunksForGzip) {
const ds = new DecompressionStream('gzip');
const reader = ds.readable.getReader();
const writer = ds.writable.getWriter();
const writePromise = writer.write(chunk.value);
const writePromise = writer.write(typeof chunk.value === 'function' ? chunk.value() : chunk.value);
writer.close();
const { value } = await reader.read();
assert_array_equals(Array.from(value), gzipExpectedChunkValue, 'value should match');
@@ -196,7 +196,7 @@ for (const chunk of bufferSourceChunksForDeflateRaw) {
const ds = new DecompressionStream('deflate-raw');
const reader = ds.readable.getReader();
const writer = ds.writable.getWriter();
const writePromise = writer.write(chunk.value);
const writePromise = writer.write(typeof chunk.value === 'function' ? chunk.value() : chunk.value);
writer.close();
const { value } = await reader.read();
assert_array_equals(Array.from(value), deflateRawExpectedChunkValue, 'value should match');