| 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-helpers.js"></script> | 4 <script src="resources/bluetooth-helpers.js"></script> |
| 5 <script> | 5 <script> |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, | 8 test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, |
| 9 'window.testRunner is required for the following tests.'); | 9 'window.testRunner is required for the following tests.'); |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 .then(device => device.connectGATT()) | 79 .then(device => device.connectGATT()) |
| 80 .then(gattServer => gattServer.getPrimaryService('generic_access')) | 80 .then(gattServer => gattServer.getPrimaryService('generic_access')) |
| 81 .then(service => service.getCharacteristic('gap.device_name')) | 81 .then(service => service.getCharacteristic('gap.device_name')) |
| 82 .then(characteristic => characteristic.readValue()) | 82 .then(characteristic => characteristic.readValue()) |
| 83 .then(value => { | 83 .then(value => { |
| 84 let decoder = new TextDecoder('utf-8'); | 84 let decoder = new TextDecoder('utf-8'); |
| 85 let value_str = decoder.decode(value); | 85 let value_str = decoder.decode(value); |
| 86 assert_equals(value_str, 'Heart Rate Device'); | 86 assert_equals(value_str, 'Heart Rate Device'); |
| 87 }); | 87 }); |
| 88 }, 'Request for characteristic. Should return right characteristic'); | 88 }, 'Request for characteristic. Should return right characteristic'); |
| 89 |
| 90 promise_test(() => { |
| 91 testRunner.setBluetoothMockDataSet('HeartRateAdapter'); |
| 92 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) |
| 93 .then(device => device.connectGATT()) |
| 94 .then(gattServer => gattServer.getPrimaryService('generic_access')) |
| 95 .then(service => service.getCharacteristic('gap.device_name')) |
| 96 .then(characteristic => { |
| 97 assert_equals(characteristic.value, null); |
| 98 return characteristic.readValue().then(() => { |
| 99 let decoder = new TextDecoder('utf-8'); |
| 100 let value_str = decoder.decode(characteristic.value); |
| 101 assert_equals(value_str, 'Heart Rate Device'); |
| 102 }) |
| 103 }); |
| 104 }, 'Request for characteristic. Should update characteristic.value'); |
| 89 </script> | 105 </script> |
| OLD | NEW |