Skip to content

Commit 1ec445c

Browse files
committed
Bug 1574541 [wpt PR 18504] - bluetooth: descriptor tests to standalone window, a=testonly
Automatic update from web-platform-tests bluetooth: descriptor tests to standalone window This change updates the descriptor tests in wpt/ to be standalone window tests. This change allows tests to be formatted with clang-format. Bug: 994756 Change-Id: Ifcedeadd35d0775793269572fec478eaa5dbe06d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757889 Reviewed-by: Matt Reynolds <mattreynoldschromium.org> Reviewed-by: Reilly Grant <reillygchromium.org> Commit-Queue: Reilly Grant <reillygchromium.org> Auto-Submit: Ovidio de Jesús Ruiz-Henríquez <odejesushchromium.org> Cr-Commit-Position: refs/heads/master{#689260} -- wpt-commits: e6dc25e5af4343c1220996a54ba24a735d3ce81c wpt-pr: 18504 UltraBlame original commit: b29a7ed648b3de5cafc81d1d5834feb56567a6fe
1 parent 7d2a7cf commit 1ec445c

File tree

4 files changed

+42
-49
lines changed

4 files changed

+42
-49
lines changed

testing/web-platform/tests/bluetooth/descriptor/readValue/read-succeeds.https.html

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
4+
5+
6+
'use strict';
7+
const test_desc = `A read request succeeds and returns the descriptor's value.`;
8+
9+
bluetooth_test(async () => {
10+
const {descriptor, fake_descriptor} = await getUserDescriptionDescriptor();
11+
12+
const EXPECTED_VALUE = [0, 1, 2];
13+
await fake_descriptor.setNextReadResponse(GATT_SUCCESS, EXPECTED_VALUE);
14+
15+
const value = await descriptor.readValue();
16+
assert_array_equals(Array.from(new Uint8Array(value.buffer)), EXPECTED_VALUE);
17+
}, test_desc);

testing/web-platform/tests/bluetooth/descriptor/writeValue/buffer-is-detached.https.html

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
3+
4+
5+
6+
'use strict';
7+
const test_desc = 'writeValue() fails when passed a detached buffer';
8+
9+
function detachBuffer(buffer) {
10+
window.postMessage('', '*', [buffer]);
11+
}
12+
13+
bluetooth_test(async (t) => {
14+
const {descriptor, fake_descriptor} = await getUserDescriptionDescriptor();
15+
16+
const typed_array = Uint8Array.of(1, 2);
17+
detachBuffer(typed_array.buffer);
18+
await promise_rejects(
19+
t, 'InvalidStateError', descriptor.writeValue(typed_array));
20+
21+
const array_buffer = Uint8Array.of(3, 4).buffer;
22+
detachBuffer(array_buffer);
23+
await promise_rejects(
24+
t, 'InvalidStateError', descriptor.writeValue(array_buffer));
25+
}, test_desc);

0 commit comments

Comments
 (0)