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

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

Issue 1884133005: bluetooth: Separate readValue tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo-read-value
Patch Set: Fix typo Created 4 years, 8 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
Index: third_party/WebKit/LayoutTests/bluetooth/readValue.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/readValue.html b/third_party/WebKit/LayoutTests/bluetooth/readValue.html
deleted file mode 100644
index 9bb4418bf5d293c0f4da0b44f65a8227bc3609b1..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/bluetooth/readValue.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="../resources/bluetooth/bluetooth-helpers.js"></script>
-<script>
-'use strict';
-
-test(t => { assert_true(window.testRunner instanceof Object); 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.readValue(),
- 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.readValue(),
- 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(gattService => gattService.getPrimaryService('generic_access'))
- .then(service => service.getCharacteristic('gap.device_name'))
- .then(characteristic => {
- return setBluetoothFakeAdapter('MissingCharacteristicHeartRateAdapter')
- .then(() => assert_promise_rejects_with_message(
- characteristic.readValue(),
- 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.readValue(),
- testSpec.error,
- 'Trying to read the 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 => characteristic.readValue())
- .then(value => {
- let decoder = new TextDecoder('utf-8');
- let value_str = decoder.decode(value);
- assert_equals(value_str, 'Heart Rate Device');
- });
-}, 'Request for characteristic. Should return right characteristic');
-
-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);
- return characteristic.readValue().then(() => {
- let decoder = new TextDecoder('utf-8');
- let value_str = decoder.decode(characteristic.value);
- assert_equals(value_str, 'Heart Rate Device');
- })
- });
-}, 'Request for characteristic. Should update characteristic.value');
-</script>

Powered by Google App Engine
This is Rietveld 408576698