OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 style.parentNode.removeChild(style); | 97 style.parentNode.removeChild(style); |
98 } else { | 98 } else { |
99 var resultString = ''; | 99 var resultString = ''; |
100 for (var i = 0; i < targets.length; i++) { | 100 for (var i = 0; i < targets.length; i++) { |
101 resultString += targets[i].getResultString() + '\n'; | 101 resultString += targets[i].getResultString() + '\n'; |
102 } | 102 } |
103 var results = document.createElement('div'); | 103 var results = document.createElement('div'); |
104 results.style.whiteSpace = 'pre'; | 104 results.style.whiteSpace = 'pre'; |
105 results.textContent = resultString; | 105 results.textContent = resultString; |
| 106 results.id = 'results'; |
106 document.body.appendChild(results); | 107 document.body.appendChild(results); |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
110 function convertToReference() { | 111 function convertToReference() { |
111 console.assert(isRefTest); | 112 console.assert(isRefTest); |
112 var scripts = document.querySelectorAll('script'); | 113 var scripts = document.querySelectorAll('script'); |
113 for (var i = 0; i < scripts.length; i++) { | 114 for (var i = 0; i < scripts.length; i++) { |
114 scripts[i].parentNode.removeChild(scripts[i]); | 115 scripts[i].parentNode.removeChild(scripts[i]); |
115 } | 116 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 277 |
277 var finished = false; | 278 var finished = false; |
278 function finishTest() { | 279 function finishTest() { |
279 finished = true; | 280 finished = true; |
280 dumpResults(); | 281 dumpResults(); |
281 if (afterTestCallback) { | 282 if (afterTestCallback) { |
282 afterTestCallback(); | 283 afterTestCallback(); |
283 } | 284 } |
284 if (window.testRunner) { | 285 if (window.testRunner) { |
285 if (!isRefTest) { | 286 if (!isRefTest) { |
| 287 var results = document.querySelector('#results'); |
| 288 document.documentElement.textContent = ''; |
| 289 document.documentElement.appendChild(results); |
286 testRunner.dumpAsText(); | 290 testRunner.dumpAsText(); |
287 } | 291 } |
288 testRunner.notifyDone(); | 292 testRunner.notifyDone(); |
289 } | 293 } |
290 } | 294 } |
291 | 295 |
292 if (window.testRunner) { | 296 if (window.testRunner) { |
293 testRunner.waitUntilDone(); | 297 testRunner.waitUntilDone(); |
294 } | 298 } |
295 | 299 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 finishTest(); | 349 finishTest(); |
346 }, 10000); | 350 }, 10000); |
347 } | 351 } |
348 | 352 |
349 window.runAsRefTest = runAsRefTest; | 353 window.runAsRefTest = runAsRefTest; |
350 window.testInterpolationAt = testInterpolationAt; | 354 window.testInterpolationAt = testInterpolationAt; |
351 window.assertInterpolation = assertInterpolation; | 355 window.assertInterpolation = assertInterpolation; |
352 window.convertToReference = convertToReference; | 356 window.convertToReference = convertToReference; |
353 window.afterTest = afterTest; | 357 window.afterTest = afterTest; |
354 })(); | 358 })(); |
OLD | NEW |