gen-get-same-object.https.window.js (1574B)
1 // META: script=/resources/testdriver.js?feature=bidi 2 // META: script=/resources/testdriver-vendor.js 3 // META: script=/common/gc.js 4 // META: script=/bluetooth/resources/bluetooth-test.js 5 // META: script=/bluetooth/resources/bluetooth-fake-devices.js 6 // META: timeout=long 7 // Generated by 8 // //bluetooth/bidi/generate.py 9 'use strict'; 10 const test_desc = 'Calls to getCharacteristics should return the same object.'; 11 12 bluetooth_bidi_test( 13 () => 14 getHealthThermometerService() 15 .then(({service}) => Promise.all([ 16 service.getCharacteristics(), service.getCharacteristics() 17 ])) 18 .then( 19 ([characteristics_first_call, characteristics_second_call]) => { 20 // Convert to arrays if necessary. 21 characteristics_first_call = 22 [].concat(characteristics_first_call); 23 characteristics_second_call = 24 [].concat(characteristics_second_call); 25 26 let first_call_set = new Set(characteristics_first_call); 27 assert_equals( 28 characteristics_first_call.length, first_call_set.size); 29 let second_call_set = new Set(characteristics_second_call); 30 assert_equals( 31 characteristics_second_call.length, second_call_set.size); 32 33 characteristics_first_call.forEach(characteristic => { 34 assert_true(second_call_set.has(characteristic)); 35 }); 36 }), 37 test_desc);