Skip to content

Commit e6dc25e

Browse files
odejesushchromium-wpt-export-bot
authored andcommitted
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 <[email protected]> Reviewed-by: Reilly Grant <[email protected]> Commit-Queue: Reilly Grant <[email protected]> Auto-Submit: Ovidio de Jesús Ruiz-Henríquez <[email protected]> Cr-Commit-Position: refs/heads/master@{#689260}
1 parent a1cec16 commit e6dc25e

File tree

4 files changed

+42
-49
lines changed

4 files changed

+42
-49
lines changed

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+
// META: script=/resources/testharness.js
2+
// META: script=/resources/testharnessreport.js
3+
// META: script=/resources/testdriver.js
4+
// META: script=/resources/testdriver-vendor.js
5+
// META: script=/bluetooth/resources/bluetooth-helpers.js
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);

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+
// META: script=/resources/testharness.js
2+
// META: script=/resources/testharnessreport.js
3+
// META: script=/resources/testdriver.js
4+
// META: script=/resources/testdriver-vendor.js
5+
// META: script=/bluetooth/resources/bluetooth-helpers.js
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)