alltests.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4. Copyright 2009 The Closure Library Authors. All Rights Reserved.
  5. Use of this source code is governed by the Apache License, Version 2.0.
  6. See the COPYING file for details.
  7. -->
  8. <head>
  9. <title>Closure - All JsUnit Tests</title>
  10. <script src="closure/goog/base.js"></script>
  11. <script src="alltests.js"></script>
  12. <script>
  13. goog.require('goog.userAgent.product');
  14. goog.require('goog.testing.MultiTestRunner');
  15. </script>
  16. <link rel="stylesheet" href="closure/goog/css/multitestrunner.css" type="text/css">
  17. <style>
  18. h1 {
  19. font: normal x-large arial, helvetica, sans-serif;
  20. margin: 0;
  21. }
  22. p, form {
  23. font: normal small sans-serif;
  24. margin: 0;
  25. }
  26. #header {
  27. position: absolute;
  28. right: 10px;
  29. top: 13px;
  30. }
  31. #footer {
  32. margin-top: 8px;
  33. }
  34. a {
  35. text-decoration: none;
  36. }
  37. a:hover {
  38. text-decoration: underline;
  39. }
  40. .warning {
  41. font-size: 14px;
  42. font-weight: bold;
  43. width: 80%;
  44. }
  45. </style>
  46. </head>
  47. <body>
  48. <script>
  49. if (goog.userAgent.product.CHROME &&
  50. window.location.toString().indexOf('file:') == 0) {
  51. document.write(
  52. '<div class="warning">' +
  53. 'WARNING: Due to Chrome\'s security restrictions ' +
  54. 'this test will not be able to load files off your local disk ' +
  55. 'unless you start Chrome with:<br>' +
  56. '<code>--allow-file-access-from-files</code></div><br>');
  57. }
  58. </script>
  59. <h1>Closure - All JsUnit Tests</h1>
  60. <p id="header"></p>
  61. <div id="runner"></div>
  62. <!-- Use a form so browser persists input values -->
  63. <form id="footer" onsubmit="return false">
  64. Settings:<br>
  65. <input type="checkbox" name="hidepasses" id="hidepasses" checked>
  66. <label for="hidepasses">Hide passes</label><br>
  67. <input type="checkbox" name="parallel" id="parallel" checked>
  68. <label for="parallel">Run in parallel</label>
  69. <small>(timing stats not available if enabled)</small><br>
  70. <input type="text" name="filter" id="filter" value="">
  71. <label for="filter">Run only tests for path</label>
  72. </form>
  73. <script>
  74. var hidePassesInput = document.getElementById('hidepasses');
  75. var parallelInput = document.getElementById('parallel');
  76. var filterInput = document.getElementById('filter');
  77. function setFilterFunction() {
  78. var matchValue = filterInput.value || '';
  79. testRunner.setFilterFunction(function(testPath) {
  80. return testPath.indexOf(matchValue) > -1;
  81. });
  82. }
  83. // Create a test runner and render it.
  84. var testRunner = new goog.testing.MultiTestRunner()
  85. .setName(document.title)
  86. .setBasePath('./')
  87. .setPoolSize(parallelInput.checked ? 8 : 1)
  88. .setStatsBucketSizes(5, 500)
  89. .setHidePasses(hidePassesInput.checked)
  90. //.setVerbosePasses(true)
  91. .addTests(_allTests);
  92. testRunner.render(document.getElementById('runner'));
  93. goog.events.listen(hidePassesInput, 'click', function(e) {
  94. testRunner.setHidePasses(e.target.checked);
  95. });
  96. goog.events.listen(parallelInput, 'click', function(e) {
  97. testRunner.setPoolSize(e.target.checked ? 8 : 1);
  98. });
  99. goog.events.listen(filterInput, 'keyup', setFilterFunction);
  100. setFilterFunction();
  101. </script>
  102. </body>
  103. </html>