Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/writeValue.html

Issue 1844153002: bluetooth: Split writeValue tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-testrunner-mojo
Patch Set: Merge Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/bluetooth/writeValue-blacklist.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/bluetooth/writeValue.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/writeValue.html b/third_party/WebKit/LayoutTests/bluetooth/writeValue.html
deleted file mode 100644
index 0baac29cbfff2add256242e75faa3910b3fdffff..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/bluetooth/writeValue.html
+++ /dev/null
@@ -1,130 +0,0 @@
-<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/bluetooth-helpers.js"></script>
-<script>
-'use strict';
-
-test(t => { assert_exists(window, 'testRunner'); t.done(); },
- 'window.testRunner is required for the following tests.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}],
- optionalServices: ['generic_access']}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('generic_access'))
- .then(service => service.getCharacteristic('gap.device_name'))
- .then(characteristic => {
- return setBluetoothFakeAdapter('EmptyAdapter')
- .then(() => assert_promise_rejects_with_message(
- characteristic.writeValue(new ArrayBuffer(1 /* length */)),
- new DOMException(
- 'Bluetooth Device is no longer in range.', 'NetworkError'),
- 'Device went out of range.'));
- });
-}, 'Device goes out of range. Reject with NetworkError.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}],
- optionalServices: ['generic_access']}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('generic_access'))
- .then(service => service.getCharacteristic('gap.device_name'))
- .then(characteristic => {
- return setBluetoothFakeAdapter('MissingServiceHeartRateAdapter')
- .then(() => assert_promise_rejects_with_message(
- characteristic.writeValue(new ArrayBuffer(1 /* length */)),
- new DOMException('GATT Service no longer exists.',
- 'InvalidStateError'),
- 'Service got removed.'));
- });
-}, 'Service gets removed. Reject with InvalidStateError.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}],
- optionalServices: ['generic_access']}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('generic_access'))
- .then(service => service.getCharacteristic('gap.device_name'))
- .then(characteristic => {
- return setBluetoothFakeAdapter('MissingCharacteristicHeartRateAdapter')
- .then(() => assert_promise_rejects_with_message(
- characteristic.writeValue(new ArrayBuffer(1 /* length */)),
- new DOMException(
- 'GATT Characteristic no longer exists.', 'InvalidStateError'),
- 'Characteristic got removed.'));
- });
-}, 'Characteristic gets removed. Reject with InvalidStateError.');
-
-gatt_errors_tests.forEach(testSpec => {
- promise_test(() => {
- return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: [errorUUID(0xA0)]}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService(errorUUID(0xA0)))
- .then(service => service.getCharacteristic(testSpec.uuid))
- .then(characteristic => {
- return assert_promise_rejects_with_message(
- characteristic.writeValue(new Uint8Array([1])),
- testSpec.error,
- 'Trying to write to a characteristic failed.');
- });
- }, testSpec.testName);
-});
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}],
- optionalServices: ['generic_access']}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('generic_access'))
- .then(service => service.getCharacteristic('gap.device_name'))
- .then(characteristic => {
- return assert_promise_rejects_with_message(
- characteristic.writeValue(new Uint8Array(513 /* length */)),
- new DOMException(
- 'Value can\'t exceed 512 bytes.', 'InvalidModificationError'),
- 'Value passed was too long.');
- });
-}, 'Trying to write more than 512 bytes should return an error.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}],
- optionalServices: ['generic_access']}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('generic_access'))
- .then(service => service.getCharacteristic('gap.device_name'))
- .then(characteristic => Promise.all(
- [characteristic.writeValue(new Uint8Array(1 /* length */)),
- characteristic.writeValue(new ArrayBuffer(1 /* length */)),
- characteristic.writeValue(new DataView(new ArrayBuffer(1 /* length */)))]));
-}, 'A regular write request to a writable characteristic should succeed.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}],
- optionalServices: ['generic_access']}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('generic_access'))
- .then(service => service.getCharacteristic('gap.device_name'))
- .then(characteristic => {
- assert_equals(characteristic.value, null);
- let textEncoder = new TextEncoder();
- let newValue = textEncoder.encode('foo');
- return characteristic.writeValue(newValue).then(() => {
- assert_array_equals(characteristic.value.buffer, newValue.buffer);
- });
- });
-}, 'A regular write request to a writable characteristic should update value.');
-</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/bluetooth/writeValue-blacklist.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698