Elim cr-checkbox
[chromium-blink-merge.git] / chrome / test / data / third_party / spaceport / js / fullReport.js
blobc768bd97f138d4bffceb41c484f34f816941ea5b
1 define([ 'tables', 'util/report' ], function (tables, report) {
2 function val(id) {
3 var el = document.getElementById(id);
4 var customEl = document.getElementById(id + '-custom');
6 return el.value || (customEl && customEl.value);
9 function getAgentMetadata() {
10 if (typeof window !== 'undefined' && window) {
11 return {
12 userAgent: window.navigator.userAgent,
13 language: window.navigator.language,
14 browser: val('ua-browser'),
15 name: val('ua-device-name'),
16 os: val('ua-os'),
17 type: val('ua-type'),
18 misc: val('ua-misc')
20 } else {
21 return null;
25 function csvReport(results, agentMetadata) {
26 agentMetadata = agentMetadata || getAgentMetadata();
28 var reports = [ ];
29 if (agentMetadata) {
30 reports.push(report.csvByObject(agentMetadata));
33 Object.keys(tables.performance).forEach(function (testName) {
34 var layout = report.makeTableLayout(tables.performance[testName]);
35 reports.push(report.csvByLayout(results[testName], layout, [ testName ]));
36 });
38 return reports.join('\n\n') + '\n';
41 return {
42 csvReport: csvReport,
43 getAgentMetadata: getAgentMetadata
45 });