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

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

Issue 1898263002: bluetooth: Separate connection tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-get-primary-service
Patch Set: Add name to test Created 4 years, 7 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/connect/connectGATT.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/bluetooth/connect.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/connect.html b/third_party/WebKit/LayoutTests/bluetooth/connect.html
deleted file mode 100644
index da801f2491c89eea1a62604072fccf7fcc3276b0..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/bluetooth/connect.html
+++ /dev/null
@@ -1,154 +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']}]}))
- .then(device => {
- return setBluetoothFakeAdapter('EmptyAdapter')
- .then(() => assert_promise_rejects_with_message(
- device.gatt.connect(),
- new DOMException('Bluetooth Device is no longer in range.',
- 'NetworkError'),
- 'Device went out of range.'));
- });
-}, 'Device goes out of range. Reject with NetworkError.');
-
-// The following tests make sure the Web Bluetooth implementation
-// responds correctly to the different types of errors the
-// underlying platform might throw.
-
-// Each implementation maps these devices to specific code paths
-// that result in different errors thus increasing code coverage
-// when testing. Therefore some of these devices might not be useful
-// for all implementations.
-[{
- testName: 'Unknown error when connnecting.',
- uuid: errorUUID(0x0),
- error: new DOMException('Unknown error when connecting to the device.',
- 'NetworkError')
-}, {
- testName: 'Connection was already in progress.',
- uuid: errorUUID(0x1),
- error: new DOMException('Connection already in progress.',
- 'NetworkError')
-}, {
- testName: 'Connection failed.',
- uuid: errorUUID(0x2),
- error: new DOMException('Connection failed for unknown reason.',
- 'NetworkError')
-}, {
- testName: 'Authentication failed when connecting.',
- uuid: errorUUID(0x3),
- error: new DOMException('Authentication failed.',
- 'NetworkError')
-}, {
- testName: 'Authentication canceled when connecting.',
- uuid: errorUUID(0x4),
- error: new DOMException('Authentication canceled.',
- 'NetworkError')
-}, {
- testName: 'Authentication rejected when connecting.',
- uuid: errorUUID(0x5),
- error: new DOMException('Authentication rejected.',
- 'NetworkError')
-}, {
- testName: 'Authentication timed out when connecting.',
- uuid: errorUUID(0x6),
- error: new DOMException('Authentication timeout.',
- 'NetworkError')
-}, {
- testName: 'Tried to connect to an unsupported device.',
- uuid: errorUUID(0x7),
- error: new DOMException('Unsupported device.',
- 'NetworkError')
-}, {
- testName: 'A write operation exceeds the maximum length of the attribute.',
- uuid: errorUUID(0x8),
- error: new DOMException('Attribute length invalid.',
- 'NetworkError')
-}, {
- testName: 'A remote device connection is congested.',
- uuid: errorUUID(0x9),
- error: new DOMException('Connection congested.',
- 'NetworkError')
-}, {
- testName: 'Insufficient encryption for a given operation.',
- uuid: errorUUID(0xa),
- error: new DOMException('Insufficient encryption.',
- 'NetworkError')
-}, {
- testName: 'A read or write operation was requested with an invalid offset.',
- uuid: errorUUID(0xb),
- error: new DOMException('Offset invalid.',
- 'NetworkError')
-}, {
- testName: 'GATT read operation is not permitted.',
- uuid: errorUUID(0xc),
- error: new DOMException('Read not permitted.',
- 'NetworkError')
-}, {
- testName: 'The given request is not supported.',
- uuid: errorUUID(0xd),
- error: new DOMException('Request not supported.',
- 'NetworkError')
-}, {
- testName: 'GATT write operation is not permitted.',
- uuid: errorUUID(0xe),
- error: new DOMException('Write not permitted.',
- 'NetworkError')
-}].forEach(testSpec => {
- promise_test(() => {
- return setBluetoothFakeAdapter('FailingConnectionsAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: [testSpec.uuid]}]}))
- // This test was not returning the assert_promise_rejects_with_message
- // promise so when the underlying implementation of BluetoothDevice
- // changed no one noticed that the promise started to reject.
- // Furthermore, no platform returns the new errors added so they
- // need to be cleaned up.
- // TODO(ortuno): Re-enable the test when the errors are cleaned up.
- // http://crbug.com/598341
- // .then(device => assert_promise_rejects_with_message(
- // device.gatt.connect(),
- // testSpec.error,
- // 'Adapter failed to connect to device.'))
- }, testSpec.testName);
-});
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => assert_true(gattServer.connected));
-}, 'Device will connect');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => {
- return Promise.all([device.gatt.connect(), device.gatt.connect()])
- }).then(gattServers => {
- assert_equals(gattServers[0], gattServers[1]);
- });
-});
-
-// TODO(ortuno): Remove connectGATT in M52.
-// http://crbug.com/582292
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.connectGATT())
-}, 'Make sure deprecated method is still usable.')
-</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/bluetooth/connect/connectGATT.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698