gen-get-same-object.https.window.js (1629B)
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 getCharacteristic should return the same object.'; 11 12 bluetooth_bidi_test( 13 () => 14 getHealthThermometerService() 15 .then(({service}) => Promise.all([ 16 service.getCharacteristic('measurement_interval'), 17 service.getCharacteristic('measurement_interval') 18 ])) 19 .then( 20 ([characteristics_first_call, characteristics_second_call]) => { 21 // Convert to arrays if necessary. 22 characteristics_first_call = 23 [].concat(characteristics_first_call); 24 characteristics_second_call = 25 [].concat(characteristics_second_call); 26 27 let first_call_set = new Set(characteristics_first_call); 28 assert_equals( 29 characteristics_first_call.length, first_call_set.size); 30 let second_call_set = new Set(characteristics_second_call); 31 assert_equals( 32 characteristics_second_call.length, second_call_set.size); 33 34 characteristics_first_call.forEach(characteristic => { 35 assert_true(second_call_set.has(characteristic)); 36 }); 37 }), 38 test_desc);