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