Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / data / js_test_runner.html
blob16364dc022bc7039f3f2d7eab0bcf88b76e8c89a
1 <!--
2 Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
6 This file is a manual test runner for JavaScript unit tests. It finds all the
7 global functions starting with "test" and runs them. It is useful for developing
8 and debugging JavaScript unit tests.
10 See: chrome/test/data/extensions/schema_test.js for an example.
11 -->
12 <textarea style="position:absolute; left:5px; top:5px; right:5px; bottom:5px;">
13 </textarea>
15 <!-- Add a reference to the script and the script test files here. -->
16 <script src="../../renderer/resources/json_schema.js"></script>
17 <script src="extensions/json_schema_test.js"></script>
19 <script>
20 function log() {
21 console.log.apply(console, arguments);
24 function runAllTests() {
25 for (var p in window) {
26 if (p.substring(0, 4) == "test") {
27 runTest(p);
30 window.setTimeout(function() {
31 log("DONE");
32 }, 0);
35 function runTest(p) {
36 window.setTimeout(function() {
37 var success = false;
38 try {
39 window[p]();
40 success = true;
41 } finally {
42 print((success ? "PASS" : "FAIL") + " " + p);
44 }, 0);
47 function print(msg) {
48 document.getElementsByTagName("textarea")[0].value += msg + "\n";
51 runAllTests();
53 </script>