1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 function getNaClTimeMs() {
7 return parseFloat(document.getElementById('NaCl').textContent);
10 function getRoundTimeMs() {
11 return parseFloat(document.getElementById('Round').textContent);
14 function getTotalTimeMs() {
15 return parseFloat(document.getElementById('Total').textContent);
18 function delayTest(test, delayMs) {
19 test.log('Setting delay to ' + delayMs + 'ms');
20 document.getElementById('delay').value = delayMs;
22 test.log('Clicking start.');
23 var startEl = document.getElementById('start');
24 startEl.dispatchEvent(new CustomEvent('click'));
26 test.log('Waiting 1 second for test to finish.');
27 var intervalId = window.setInterval(function() {
28 if (itrCount !== itrMax) {
29 test.log('Not finished, waiting another second.');
33 window.clearInterval(intervalId);
34 test.log('NaCl time: ' + getNaClTimeMs().toFixed(2) + 'ms');
35 test.log('Roundtrip time: ' + getRoundTimeMs().toFixed(2) + 'ms');
36 test.log('Total time: ' + getTotalTimeMs().toFixed(2) + 'ms');
37 test.log('Finished.');
42 common.tester.addAsyncTest('delay_0', function(test) {
44 delayTest(test, delayMs);
47 common.tester.addAsyncTest('delay_3', function(test) {
49 delayTest(test, delayMs);