summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/js_test_runner.html
blob: 16364dc022bc7039f3f2d7eab0bcf88b76e8c89a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!--
Copyright (c) 2009 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.

This file is a manual test runner for JavaScript unit tests. It finds all the
global functions starting with "test" and runs them. It is useful for developing
and debugging JavaScript unit tests.

See: chrome/test/data/extensions/schema_test.js for an example.
-->
<textarea style="position:absolute; left:5px; top:5px; right:5px; bottom:5px;">
</textarea>

<!-- Add a reference to the script and the script test files here. -->
<script src="../../renderer/resources/json_schema.js"></script>
<script src="extensions/json_schema_test.js"></script>

<script>
function log() {
  console.log.apply(console, arguments);
}

function runAllTests() {
  for (var p in window) {
    if (p.substring(0, 4) == "test") {
      runTest(p);
    }
  }
  window.setTimeout(function() {
    log("DONE");
  }, 0);
}

function runTest(p) {
  window.setTimeout(function() {
    var success = false;
    try {
      window[p]();
      success = true;
    } finally {
      print((success ? "PASS" : "FAIL") + " " + p);
    }
  }, 0);
}

function print(msg) {
  document.getElementsByTagName("textarea")[0].value += msg + "\n";
}

runAllTests();

</script>