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

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

Issue 1858103004: bluetooth: Separate notification tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo-notifications
Patch Set: Merge 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/notifications/notifications.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/notifications/notifications.html b/third_party/WebKit/LayoutTests/bluetooth/notifications/notifications.html
deleted file mode 100644
index c044bad78ecf0a0dce260228dfc11a042d9db1e6..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/bluetooth/notifications/notifications.html
+++ /dev/null
@@ -1,185 +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(() => {
- let start_promise;
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- start_promise = characteristic.startNotifications();
- // We itentionally don't return the promise so that 'characteristic' goes
- // out of scope while the request is still pending.
- }).then(() => runGarbageCollection())
- .then(() => start_promise);
-}, 'Object gets garbage collected while start request is pending.');
-
-promise_test(() => {
- let stop_promise;
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return characteristic.startNotifications().then(() => {
- stop_promise = characteristic.stopNotifications();
- // We itentionally don't return the promise so that 'characteristic' goes
- // out of scope while the request is still pending.
- });
- }).then(() => runGarbageCollection())
- .then(() => stop_promise);
-}, 'Object gets garbage collected while stop request is pending.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return characteristic.startNotifications()
- .then(() => characteristic.stopNotifications());
- }).then(() => runGarbageCollection());
-}, 'Single start notifications succeeds.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return characteristic.startNotifications()
- .then(() => characteristic.startNotifications())
- .then(() => characteristic.stopNotifications());
- }).then(() => runGarbageCollection());
-}, 'Start notifications after succesfully starting before.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return characteristic.startNotifications()
- .then(() => characteristic.stopNotifications())
- .then(() => characteristic.startNotifications())
- .then(() => characteristic.stopNotifications());
- }).then(() => runGarbageCollection());
-}, 'Start -> stop -> start -> stop.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return Promise.all([characteristic.startNotifications(),
- characteristic.startNotifications(),
- characteristic.startNotifications()])
- .then(() => characteristic.stopNotifications());
- }).then(() => runGarbageCollection());
-}, 'Multiple starts in a row.');
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return Promise.all([characteristic.startNotifications(),
- characteristic.stopNotifications()]);
- }).then(() => runGarbageCollection());
-}, "Parallel start and stop.");
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return characteristic.startNotifications().then(() => {
- return Promise.all([characteristic.stopNotifications(),
- characteristic.stopNotifications()]);
- });
- }).then(() => runGarbageCollection());
-}, "Concurrent stop requests.");
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return characteristic.startNotifications()
- .then(() => characteristic.stopNotifications())
- .then(() => characteristic.stopNotifications());
- }).then(() => runGarbageCollection());
-}, "Stopping twice.");
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- return characteristic.startNotifications().then(() => {
- return Promise.all([characteristic.stopNotifications(),
- characteristic.startNotifications()]);
- }).then(() => characteristic.stopNotifications());
- }).then(() => runGarbageCollection());
-}, "Start request before stop request resolves");
-
-promise_test(() => {
- return setBluetoothFakeAdapter('HeartRateAdapter')
- .then(() => requestDeviceWithKeyDown({
- filters: [{services: ['heart_rate']}]}))
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => characteristic.stopNotifications())
- .then(() => runGarbageCollection());
-}, "Stop without starting.");
-
-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.startNotifications(),
- testSpec.error,
- 'Trying to start notifications failed.');
- });
- }, testSpec.testName);
-});
-</script>

Powered by Google App Engine
This is Rietveld 408576698