| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <script src="../../resources/bluetooth/bluetooth-helpers.js"></script> | 4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
| 5 <script> | 5 <script> |
| 6 'use strict'; | 6 'use strict'; |
| 7 promise_test(function() { | 7 promise_test(function() { |
| 8 return setBluetoothFakeAdapter('HeartRateAdapter') | 8 return setBluetoothFakeAdapter('HeartRateAdapter') |
| 9 .then(() => requestDeviceWithKeyDown({ | 9 .then(() => requestDeviceWithKeyDown({ |
| 10 filters: [{services: ['heart_rate']}], | 10 filters: [{services: ['heart_rate']}], |
| 11 optionalServices: ['generic_access']})) | 11 optionalServices: ['generic_access']})) |
| 12 .then(device => { | 12 .then(device => { |
| 13 return device.gatt.connect() | 13 return device.gatt.connect() |
| 14 .then(gattServer => Promise.all([ | 14 .then(gattServer => Promise.all([ |
| 15 gattServer.getPrimaryService(generic_access.alias), | 15 gattServer.getPrimaryService(generic_access.alias), |
| 16 gattServer.getPrimaryService(generic_access.name), | 16 gattServer.getPrimaryService(generic_access.name), |
| 17 gattServer.getPrimaryService(generic_access.uuid)])) | 17 gattServer.getPrimaryService(generic_access.uuid)])) |
| 18 .then(services => { | 18 .then(services => { |
| 19 services.forEach(service => { | 19 services.forEach(service => { |
| 20 assert_equals(service.uuid, generic_access.uuid, | 20 assert_equals(service.uuid, generic_access.uuid, |
| 21 'Service UUID should be the same as requested UUID.'); | 21 'Service UUID should be the same as requested UUID.'); |
| 22 assert_true(service.isPrimary, | 22 assert_true(service.isPrimary, |
| 23 'getPrimaryService should return a primary service.'); | 23 'getPrimaryService should return a primary service.'); |
| 24 assert_equals(service.device, device, | 24 assert_equals(service.device, device, |
| 25 'Service device should be the same as device.'); | 25 'Service device should be the same as device.'); |
| 26 }); | 26 }); |
| 27 }); | 27 }); |
| 28 }); | 28 }); |
| 29 }, 'Request for service. Should return right service'); | 29 }, 'Request for service. Should return right service'); |
| 30 </script> | 30 </script> |
| OLD | NEW |