mirror of
https://github.com/servo/servo.git
synced 2025-06-25 09:34:32 +01:00
Refactoring the WebBluetooth html tests.
This commit is contained in:
parent
9c0e7b1cf2
commit
5d3556a99d
23 changed files with 1112 additions and 119 deletions
32
tests/html/bluetooth/bluetooth_functions.js
Normal file
32
tests/html/bluetooth/bluetooth_functions.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
function clear() {
|
||||
document.getElementById("log").textContent = "";
|
||||
}
|
||||
|
||||
function log(line) {
|
||||
document.getElementById("log").textContent += timeStamp() + line + '\n';
|
||||
}
|
||||
|
||||
function asciiToDecimal(bytestr) {
|
||||
var result = [];
|
||||
for(i = 0; i < bytestr.length; i++) {
|
||||
result[i] = bytestr.charCodeAt(i) ;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function populate(testCases){
|
||||
for(i = 0; i < testCases.length; ++i) {
|
||||
var btn = document.createElement('button');
|
||||
btn.setAttribute('onclick','onButtonClick(' + i + ')');
|
||||
btn.innerHTML = 'Test '+ (i+1);
|
||||
document.getElementById('buttons').appendChild(btn);
|
||||
}
|
||||
}
|
||||
|
||||
function timeStamp() {
|
||||
var date = new Date;
|
||||
var hours = date.getHours();
|
||||
var minutes = "0" + date.getMinutes();
|
||||
var seconds = "0" + date.getSeconds();
|
||||
return hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2) + ' ';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue