mirror of
https://github.com/servo/servo.git
synced 2025-06-28 02:53:48 +01:00
73 lines
2.7 KiB
HTML
73 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<title>RequestDevice Test Cases</title>
|
|
<body>
|
|
<div id="buttons"></div>
|
|
<pre id="log"></pre>
|
|
<script src="bluetooth_functions.js"></script>
|
|
<script>
|
|
var testCases = [];
|
|
//Test 1
|
|
testCases.push({filters: []});
|
|
//Test 2
|
|
testCases.push({filters: [{notExpectedMember: []}]});
|
|
//Test 3
|
|
testCases.push({filters: [{services: ['battery_service']}]});
|
|
//Test 4
|
|
testCases.push({filters: [{name: 'raspberrypi'}]});
|
|
//Test 5
|
|
testCases.push({filters: [{namePrefix: 'rasp'}]});
|
|
//Test 6
|
|
testCases.push({filters:[{services: []}]});
|
|
//Test 7
|
|
testCases.push({filters:[{services: [], namePrefix:'rasp'}]});
|
|
//Test 8
|
|
testCases.push({filters: [{services: ['not_a_service_name']}]});
|
|
//Test 9
|
|
testCases.push({filters: [{services: ['1234567891000-1000-8000-00805f9b34fb']}]});
|
|
//Test 10
|
|
testCases.push({filters: [{services: ['12345678-1234-1234-1234-123456789abc']}]});
|
|
//Test 11
|
|
testCases.push({filters: [{services: [0x0000]}]});
|
|
//Test 12
|
|
testCases.push({filters: [{services: [0x180f]}]});
|
|
//Test 13
|
|
testCases.push({filters: [{services: [0x12345678]}]});
|
|
//Test 14
|
|
testCases.push({filters: [{services: [0x00001812]}]});
|
|
//Test 15
|
|
testCases.push({filters: [{services: ['f000ffc0-0451-4000-b000-000000000000']}]});
|
|
//Test 16
|
|
testCases.push({filters: [{name: 'this_device_name_is_longer_than_29_bytes'}]});
|
|
//Test 17
|
|
testCases.push({filters: [{namePrefix: 'this_device_name_prefix_is_longer_than_29_bytes'}]});
|
|
//Test 18
|
|
testCases.push({filters: [{namePrefix: ''}]});
|
|
//Test 19
|
|
testCases.push({filters: [{namePrefix: 'rasp'}], optionalServices: ['1234567891000-1000-8000-00805f9b34fb']});
|
|
//Test 20
|
|
testCases.push({filters: [{namePrefix: 'rasp'}], optionalServices: ['12345678-1234-1234-1234-123456789abc']});
|
|
//Test 21
|
|
testCases.push({filters: [{namePrefix: 'rasp'}], optionalServices: ['f000ffc0-0451-4000-b000-000000000000', 0x1812]});
|
|
|
|
function onButtonClick(testNumber) {
|
|
clear();
|
|
try {
|
|
log('Requesting Bluetooth Device...');
|
|
var device = window.navigator.bluetooth.requestDevice(testCases[testNumber]);
|
|
|
|
log('Found a device!');
|
|
log('> Name: ' + device.name);
|
|
log('> Id: ' + device.id);
|
|
log('> Appearance: ' + device.adData.appearance);
|
|
log('> Tx Power: ' + device.adData.txPower + ' dBm');
|
|
log('> RSSI: ' + device.adData.rssi + ' dBm');
|
|
} catch(err) {
|
|
log(err);
|
|
}
|
|
}
|
|
|
|
populate(testCases);
|
|
</script>
|
|
</body>
|
|
</html>
|