Index: third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html |
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..df73a9c4df9d1522c3e5bce64d569ed3f1ffbb53 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/filter-does-not-match.html |
@@ -0,0 +1,97 @@ |
+<!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 non_matching_services = ['battery_service']; |
+let non_matching_name = 'Some Device'; |
+let non_matching_namePrefix = 'Some'; |
+ |
+let test_specs = [{ |
+ filters: [{ |
+ services: non_matching_services, |
+ name: non_matching_name, |
+ namePrefix: non_matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ services: matching_services, |
+ name: non_matching_name, |
+ namePrefix: non_matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ services: non_matching_services, |
+ name: matching_name, |
+ namePrefix: non_matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ services: matching_services, |
+ name: matching_name, |
+ namePrefix: non_matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ services: non_matching_services, |
+ name: non_matching_name, |
+ namePrefix: matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ services: matching_services, |
+ name: non_matching_name, |
+ namePrefix: matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ services: non_matching_services, |
+ name: matching_name, |
+ namePrefix: matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ services: non_matching_services, |
+ }] |
+}, { |
+ filters: [{ |
+ services: non_matching_services, |
+ name: non_matching_name, |
+ }] |
+}, { |
+ filters: [{ |
+ services: non_matching_services, |
+ namePrefix: non_matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ name: non_matching_name, |
+ }] |
+}, { |
+ filters: [{ |
+ name: non_matching_name, |
+ namePrefix: non_matching_namePrefix |
+ }] |
+}, { |
+ filters: [{ |
+ namePrefix: non_matching_namePrefix |
+ }] |
+}]; |
+ |
+promise_test(t => { |
+ return setBluetoothFakeAdapter('GlucoseHeartRateAdapter') |
+ .then(() => { |
+ let test_promises = Promise.resolve(); |
+ test_specs.forEach(args => { |
+ test_promises = test_promises.then(() => promise_rejects( |
+ t, 'NotFoundError', requestDeviceWithKeyDown(args))); |
+ }); |
+ return test_promises; |
+ }); |
+}, 'If at least one filter member doesn\'t match the promise must reject.'); |
+</script> |