OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 <script src="resources/bluetooth-helpers.js"></script> |
| 5 <script> |
| 6 'use strict'; |
| 7 |
| 8 test(t => { assert_true(window.testRunner instanceof Object); t.done(); }, |
| 9 'window.testRunner is required for the following tests.'); |
| 10 |
| 11 // TODO(ortuno): Write tests to check that "Disconnect" was actually |
| 12 // called on the device. |
| 13 // http://crbug.com/569716 |
| 14 promise_test(() => { |
| 15 testRunner.setBluetoothMockDataSet('HeartRateAdapter'); |
| 16 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) |
| 17 .then(device => device.connectGATT()) |
| 18 .then(gattServer => { |
| 19 gattServer.disconnect(); |
| 20 assert_false(gattServer.connected); |
| 21 }); |
| 22 }, '\'connected\' is set to false after disconnect is called.'); |
| 23 |
| 24 promise_test(() => { |
| 25 testRunner.setBluetoothMockDataSet('HeartRateAdapter'); |
| 26 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) |
| 27 .then(device => device.connectGATT()) |
| 28 .then(gattServer => { |
| 29 gattServer.disconnect(); |
| 30 assert_false(gattServer.connected); |
| 31 gattServer.disconnect(); |
| 32 assert_false(gattServer.connected); |
| 33 }); |
| 34 }, 'Calling disconnect twice in a row still results in \'connected\' ' + |
| 35 'being false.'); |
| 36 |
| 37 promise_test(() => { |
| 38 testRunner.setBluetoothMockDataSet('HeartRateAdapter'); |
| 39 return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]}) |
| 40 .then(device => { |
| 41 return device.connectGATT().then(gattServer => { |
| 42 gattServer.disconnect(); |
| 43 assert_false(gattServer.connected); |
| 44 }) |
| 45 .then(() => device.connectGATT()).then(gattServer => { |
| 46 gattServer.disconnect(); |
| 47 assert_false(gattServer.connected); |
| 48 }); |
| 49 }); |
| 50 }, 'Connect + Disconnect twice still results in \'connected\' being false.'); |
| 51 </script> |
OLD | NEW |