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

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html

Issue 1910933002: bluetooth: Separate requestDevice tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo-gatt-connect
Patch Set: Replace uses of assert_promise_rejects because it was removed. 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
Index: third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html
new file mode 100644
index 0000000000000000000000000000000000000000..5cd584122466edd0922b0b3f1cef7fad416089b9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-matches.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
+<script>
+
+let matching_services = [heart_rate.uuid];
+let matching_name = 'Heart Rate Device';
+let matching_namePrefix = 'Heart';
+
+let test_specs = [{
+ filters: [{
+ services: matching_services,
+ }]
+}, {
+ filters: [{
+ services: matching_services,
+ name: matching_name,
+ }]
+}, {
+ filters: [{
+ services: matching_services,
+ namePrefix: matching_namePrefix
+ }]
+}, {
+ filters: [{
+ name: matching_name,
+ }],
+ optionalServices: matching_services
+}, {
+ filters: [{
+ name: matching_name,
+ namePrefix: matching_namePrefix
+ }],
+ optionalServices: matching_services
+}, {
+ filters: [{
+ namePrefix: matching_namePrefix
+ }],
+ optionalServices: matching_services
+}, {
+ filters: [{
+ services: matching_services,
+ name: matching_name,
+ namePrefix: matching_namePrefix
+ }]
+}];
+
+promise_test(() => {
+ return setBluetoothFakeAdapter('GlucoseHeartRateAdapter')
+ .then(() => {
+ let test_promises = Promise.resolve();
+ test_specs.forEach(args => {
+ test_promises = test_promises
+ .then(() => requestDeviceWithKeyDown(args))
+ .then(device => {
+ // We always have access to the services in matching_services
+ // because we include them in a filter or in optionalServices.
+ assert_in_array(matching_services[0], device.uuids);
+ assert_equals(device.name, matching_name);
+ assert_true(device.name.startsWith(matching_namePrefix));
+ });
+ });
+ return test_promises;
+ });
+}, 'Matches a filter if all present members match.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698