-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstartup5.html
More file actions
116 lines (105 loc) · 3.81 KB
/
startup5.html
File metadata and controls
116 lines (105 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE HTML>
<html>
<body onload="test()">
<script>
function test() {
var t = (new Date()).getTime();
console.log("TIME " + t + "\n");
var h = getQueryStringValue("start");
// Calculate elapsed time
var elapsed = (t - parseInt(h));
console.log("ELAPSED:" + elapsed + "\n");
document.write("<div><b>ELAPSED:" + elapsed + "</b></div>");
sendresults(elapsed);
console.log("-----------\n");
console.log("KILL\n");
}
/* If key not found returns 'notfound' which will fail in nice
interesting ways so that it's hopefully visible */
function getQueryStringValue(key) {
var query = window.location.search.substring(1);
var pairs = query.split("&");
for(var i=0; i < pairs.length; i++) {
p = pairs[i].split("=");
if (p[0] == key)
return p[1];
}
return 'notfound';
}
function sendresults(result) {
var serverIP = getQueryStringValue("ip");
var phoneID = getQueryStringValue("phone");
var browserID = getQueryStringValue("browser");
var testID = getQueryStringValue("test");
var revID = getQueryStringValue("revision");
var androidver = getQueryStringValue("androidver");
var builddate = getQueryStringValue("builddate");
var json = makeJSON(revID, androidver, phoneID, browserID, testID, builddate, result);
var url = "http://" + serverIP + "?data=" + encodeURIComponent(JSON.stringify(json));
// This hack is courtesy of BYK, our own personal A*team life saver.
var e = new Image();
e.src = url;
}
function makeJSON(revid, androidver, phoneid, browserid, testid, builddate, result) {
// Makes the assumption that the builddate is *seconds* since epoc.
// This actually the form that the ES database wants starttime in.
// Must make a date time that matches it though:
var date = new Date(builddate * 1000);
var reportdate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
var json = {
"testsuites": [
{
"testsuite": "xbrowserstartup",
"testfailures": [],
"failed": 0,
"testgroup_id":null,
"perfdata": [
{
"test": testid,
"perfdata": [
{
"type": testid + '-startup',
"browser": browserid,
"phone": phoneid,
"result": result
}
]
}
],
"elapsedtime": null,
"cmdline": null,
"passed":1,
"todo":0,
"date":reportdate,
"starttime": builddate
}
],
"index": "xbrowserstartup",
"testgroup": {
"harness": "xbrowserstartup",
"machine": phoneid,
"platform": "android",
"version": null,
"branch": null,
"frameworkfailures": null,
"pending": false,
"revision": revid,
"buildtype": "opt",
"date": reportdate,
"testrun": testid,
"logurl": null,
"testgroup": "xbrowserstartup",
"builder": null,
"productname": browserid,
"buildurl": null,
"os": androidver,
"tree": null,
"buildid": null,
"starttime":builddate
}
};
return json;
}
</script>
</body>
</html>