| <!-- |
| 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> |