OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Coverage controller logic - used by coverage test harness to embed tests in | 6 * Coverage controller logic - used by coverage test harness to embed tests in |
7 * DumpRenderTree and extract coverage information. | 7 * content shell and extract coverage information. |
8 */ | 8 */ |
9 | 9 |
10 var LONG_LINE = 60000; | 10 var LONG_LINE = 60000; |
11 | 11 |
12 function onReceive(e) { | 12 function onReceive(e) { |
13 if (e.data == 'unittest-suite-done') { | 13 if (e.data == 'unittest-suite-done') { |
14 var s = JSON.stringify(top._$jscoverage); | 14 var s = JSON.stringify(top._$jscoverage); |
15 var res = ''; | 15 var res = ''; |
16 // DumpRenderTree has a bug on lines longer than 2^16, so we split them | 16 // conent shell has a bug on lines longer than 2^16, so we split them |
17 while (s.length > LONG_LINE) { | 17 while (s.length > LONG_LINE) { |
18 res += s.substr(0, LONG_LINE) + '<br>\n'; | 18 res += s.substr(0, LONG_LINE) + '<br>\n'; |
19 s = s.substr(LONG_LINE); | 19 s = s.substr(LONG_LINE); |
20 } | 20 } |
21 res += s; | 21 res += s; |
22 window.document.body.innerHTML = res; | 22 window.document.body.innerHTML = res; |
23 window.layoutTestController.notifyDone(); | 23 window.layoutTestController.notifyDone(); |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 if (window.layoutTestController) { | 27 if (window.layoutTestController) { |
28 window.layoutTestController.dumpAsText(); | 28 window.layoutTestController.dumpAsText(); |
29 window.layoutTestController.waitUntilDone(); | 29 window.layoutTestController.waitUntilDone(); |
30 window.addEventListener("message", onReceive, false); | 30 window.addEventListener("message", onReceive, false); |
31 } | 31 } |
OLD | NEW |