| <!DOCTYPE html> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/resources/testdriver.js"></script> |
| <script src="/resources/testdriver-vendor.js"></script> |
| <script src="/bluetooth/resources/bluetooth-test.js"></script> |
| <script src="/bluetooth/resources/bluetooth-fake-devices.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}]} |
| ]; |
| |
| bluetooth_test(t => { |
| return setBluetoothFakeAdapter('GlucoseHeartRateAdapter').then(() => { |
| let test_promises = Promise.resolve(); |
| test_specs.forEach(args => { |
| test_promises = test_promises.then( |
| () => promise_rejects_dom( |
| t, 'NotFoundError', requestDeviceWithTrustedClick(args))); |
| }); |
| return test_promises; |
| }); |
| }, 'If at least one filter member doesn\'t match the promise must reject.'); |
| </script> |