Skip to content

Commit 8405bbd

Browse files
odejesushchromium-wpt-export-bot
authored andcommitted
bluetooth: Gen tests to standalone window tests
This change updates the Bluetooth test generator to generate the tests as standalone window tests. This update allows the tests to be formatted with clang-format. The new generated tests now have the extension .https.window.js and have been processed with `git cl format --js` Bug: 994756 Change-Id: Ide5f1308905e3a35eccc7800391ea6e15f06741f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1757881 Commit-Queue: Ovidio de Jesús Ruiz-Henríquez <[email protected]> Reviewed-by: Reilly Grant <[email protected]> Cr-Commit-Position: refs/heads/master@{#688791}
1 parent 7b7272a commit 8405bbd

File tree

150 files changed

+2123
-2231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+2123
-2231
lines changed

bluetooth/characteristic/getDescriptor/gen-characteristic-is-removed.https.html

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
// Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py
7+
'use strict';
8+
const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
9+
const expected = new DOMException(
10+
'GATT Characteristic no longer exists.', 'InvalidStateError');
11+
let fake_peripheral, characteristic, fake_characteristic;
12+
13+
bluetooth_test(
14+
() =>
15+
getMeasurementIntervalCharacteristic()
16+
.then(
17+
_ => (
18+
{fake_peripheral, characteristic, fake_characteristic} = _))
19+
.then(() => characteristic.getDescriptor(user_description.name))
20+
.then(
21+
() => null,
22+
(e) => assert_unreached('Caught error unexpectedly.', e))
23+
.then(() => fake_characteristic.remove())
24+
.then(() => fake_peripheral.simulateGATTServicesChanged())
25+
.then(
26+
() => assert_promise_rejects_with_message(
27+
characteristic.getDescriptor(user_description.name),
28+
expected)),
29+
test_desc);

bluetooth/characteristic/getDescriptor/gen-descriptor-get-same-object.https.html

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
// Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py
7+
'use strict';
8+
const test_desc = 'Calls to getDescriptor should return the same object.';
9+
let characteristic;
10+
11+
bluetooth_test(
12+
() => getMeasurementIntervalCharacteristic()
13+
.then(_ => ({characteristic} = _))
14+
.then(() => Promise.all([
15+
characteristic.getDescriptor(user_description.alias),
16+
characteristic.getDescriptor(user_description.name),
17+
characteristic.getDescriptor(user_description.uuid)
18+
]))
19+
.then(descriptors_arrays => {
20+
assert_true(descriptors_arrays.length > 0)
21+
22+
// Convert to arrays if necessary.
23+
for (let i = 0; i < descriptors_arrays.length; i++) {
24+
descriptors_arrays[i] = [].concat(descriptors_arrays[i]);
25+
}
26+
27+
for (let i = 1; i < descriptors_arrays.length; i++) {
28+
assert_equals(
29+
descriptors_arrays[0].length,
30+
descriptors_arrays[i].length);
31+
}
32+
33+
let base_set = new Set(descriptors_arrays[0]);
34+
for (let descriptors of descriptors_arrays) {
35+
descriptors.forEach(
36+
descriptor => assert_true(base_set.has(descriptor)));
37+
}
38+
}),
39+
test_desc);

bluetooth/characteristic/getDescriptor/gen-service-is-removed.https.html

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
// Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py
7+
// TODO(https://crbug.com/672127) Use this test case to test the rest of
8+
// characteristic functions.
9+
'use strict';
10+
const test_desc = 'Service is removed. Reject with InvalidStateError.';
11+
const expected =
12+
new DOMException('GATT Service no longer exists.', 'InvalidStateError');
13+
let characteristic, fake_peripheral, fake_service;
14+
15+
bluetooth_test(
16+
() => getMeasurementIntervalCharacteristic()
17+
.then(_ => ({characteristic, fake_peripheral, fake_service} = _))
18+
.then(() => fake_service.remove())
19+
.then(() => fake_peripheral.simulateGATTServicesChanged())
20+
.then(
21+
() => assert_promise_rejects_with_message(
22+
characteristic.getDescriptor(user_description.name),
23+
expected, 'Service got removed.')),
24+
test_desc);

bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed-with-uuid.https.html

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
// Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py
7+
'use strict';
8+
const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
9+
const expected = new DOMException(
10+
'GATT Characteristic no longer exists.', 'InvalidStateError');
11+
let fake_peripheral, characteristic, fake_characteristic;
12+
13+
bluetooth_test(
14+
() =>
15+
getMeasurementIntervalCharacteristic()
16+
.then(
17+
_ => (
18+
{fake_peripheral, characteristic, fake_characteristic} = _))
19+
.then(() => characteristic.getDescriptor(user_description.name))
20+
.then(
21+
() => null,
22+
(e) => assert_unreached('Caught error unexpectedly.', e))
23+
.then(() => fake_characteristic.remove())
24+
.then(() => fake_peripheral.simulateGATTServicesChanged())
25+
.then(
26+
() => assert_promise_rejects_with_message(
27+
characteristic.getDescriptors(user_description.name),
28+
expected)),
29+
test_desc);

bluetooth/characteristic/getDescriptors/gen-characteristic-is-removed.https.html

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
// Generated by //third_party/WebKit/LayoutTests/bluetooth/generate.py
7+
'use strict';
8+
const test_desc = 'Characteristic gets removed. Reject with InvalidStateError.';
9+
const expected = new DOMException(
10+
'GATT Characteristic no longer exists.', 'InvalidStateError');
11+
let fake_peripheral, characteristic, fake_characteristic;
12+
13+
bluetooth_test(
14+
() =>
15+
getMeasurementIntervalCharacteristic()
16+
.then(
17+
_ => (
18+
{fake_peripheral, characteristic, fake_characteristic} = _))
19+
.then(() => characteristic.getDescriptor(user_description.name))
20+
.then(
21+
() => null,
22+
(e) => assert_unreached('Caught error unexpectedly.', e))
23+
.then(() => fake_characteristic.remove())
24+
.then(() => fake_peripheral.simulateGATTServicesChanged())
25+
.then(
26+
() => assert_promise_rejects_with_message(
27+
characteristic.getDescriptors(), expected)),
28+
test_desc);

0 commit comments

Comments
 (0)