OLD | NEW |
1 // An version of Dromaeo's original htmlrunner adapted for the | 1 // An version of Dromaeo's original htmlrunner adapted for the |
2 // Dart-based test driver. | 2 // Dart-based test driver. |
3 | 3 |
4 var _operations = []; | 4 var _operations = []; |
5 var _N_RUNS = 5; | 5 var _N_RUNS = 5; |
6 var _nRanTests = 0; | 6 var _nRanTests = 0; |
7 var _nTests = 0; | 7 var _nTests = 0; |
8 var _T_DISTRIBUTION = 2.776; | 8 var _T_DISTRIBUTION = 2.776; |
9 | 9 |
10 function startTest() { | 10 function startTest() { |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 } | 33 } |
34 window.setTimeout(handler, 0); | 34 window.setTimeout(handler, 0); |
35 } | 35 } |
36 | 36 |
37 function _postMessage(command, data) { | 37 function _postMessage(command, data) { |
38 var payload = { 'command': command }; | 38 var payload = { 'command': command }; |
39 if (data) { | 39 if (data) { |
40 payload['data'] = data; | 40 payload['data'] = data; |
41 } | 41 } |
42 window.top.postMessage(JSON.stringify(payload), '*'); | 42 window.parent.postMessage(JSON.stringify(payload), '*'); |
43 } | 43 } |
44 | 44 |
45 function test(name, fn) { | 45 function test(name, fn) { |
46 _nTests++; | 46 _nTests++; |
47 _operations.push(function () { | 47 _operations.push(function () { |
48 // List of number of runs in seconds. | 48 // List of number of runs in seconds. |
49 var runsPerSecond = []; | 49 var runsPerSecond = []; |
50 // Run the test several times. | 50 // Run the test several times. |
51 try { | 51 try { |
52 // TODO(antonm): use .setTimeout to schedule next run as JS | 52 // TODO(antonm): use .setTimeout to schedule next run as JS |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 }); | 133 }); |
134 } | 134 } |
135 | 135 |
136 function endTest() { | 136 function endTest() { |
137 _postMessage('inited', { 'nTests': _nTests }); | 137 _postMessage('inited', { 'nTests': _nTests }); |
138 } | 138 } |
139 | 139 |
140 function prep(fn) { | 140 function prep(fn) { |
141 _operations.push(fn); | 141 _operations.push(fn); |
142 } | 142 } |
OLD | NEW |