Revision: 5140
Author:   [email protected]
Date:     Tue Nov  6 16:59:57 2012
Log:      Improve debuggability of Rhino-driven test files.
http://codereview.appspot.com/6827055

The test files which are executed by RhinoTestBed.runJsUnittestFromHtml
were written such that the URL / must be served off of ant-lib/, which
is incompatible with the test server started by 'ant brserve'. As a
workaround, the needed files from ant-lib are now copied to ant-testlib,
and the test HTML files now use relative URLs.

Also add all such test files to test-index.html.

[email protected]

http://code.google.com/p/google-caja/source/detail?r=5140

Modified:
 /trunk/build.xml
 /trunk/tests/com/google/caja/plugin/css-stylesheet-test.html
 /trunk/tests/com/google/caja/plugin/csslexer-test.html
 /trunk/tests/com/google/caja/plugin/cssparser_test.html
 /trunk/tests/com/google/caja/plugin/html-css-sanitizer-minified-test.html
 /trunk/tests/com/google/caja/plugin/html-css-sanitizer-test.html
 /trunk/tests/com/google/caja/plugin/html-emitter-test.html
 /trunk/tests/com/google/caja/plugin/html-sanitizer-legacy-test.html
 /trunk/tests/com/google/caja/plugin/html-sanitizer-minified-test.html
 /trunk/tests/com/google/caja/plugin/html-sanitizer-regress.html
 /trunk/tests/com/google/caja/plugin/html-sanitizer-test.html
 /trunk/tests/com/google/caja/plugin/sanitizecss_test.html
 /trunk/tests/com/google/caja/plugin/test-index.js
 /trunk/tests/com/google/caja/plugin/uri_test.html

=======================================
--- /trunk/build.xml    Tue Oct 30 17:04:11 2012
+++ /trunk/build.xml    Tue Nov  6 16:59:57 2012
@@ -1143,6 +1143,26 @@
     <copy todir="${testlib}/com/google/caja/plugin/proxies">
       <fileset dir="${third_party}/js/proxies" />
     </copy>
+    <copy todir="${testlib}">
+ <!-- For RhinoTestBed tests; arrange files so that they can use the same + relative URLs in browser. TODO(kpreid): Clean up the whole mess. -->
+      <fileset dir="${lib}">
+        <include name="**/caja/plugin/csslexer.js"/>
+        <include name="**/caja/plugin/cssparser.js"/>
+        <include name="**/caja/plugin/css-defs.js"/>
+        <include name="**/caja/plugin/html4-defs.js"/>
+        <include name="**/caja/plugin/uri.js"/>
+        <include name="**/caja/plugin/sanitizecss.js"/>
+        <include name="**/caja/plugin/html-sanitizer.js"/>
+        <include name="**/caja/plugin/bridal.js"/>
+        <include name="**/caja/plugin/html-emitter.js"/>
+        <include name="**/caja/plugin/html-sanitizer-minified.js"/>
+        <include name="**/caja/plugin/html-sanitizer-legacy.js"/>
+        <include name="**/caja/plugin/html-css-sanitizer-bundle.js"/>
+        <include name="**/caja/plugin/html-css-sanitizer-minified.js"/>
+        <include name="**/caja/plugin/html-sanitizer-bundle.js"/>
+      </fileset>
+    </copy>
     <copy todir="${testlib}">
       <fileset dir="${third_party}">
         <include name="js/es5conform/**/*.js"/>
=======================================
--- /trunk/tests/com/google/caja/plugin/css-stylesheet-test.html Tue Oct 23 10:12:27 2012 +++ /trunk/tests/com/google/caja/plugin/css-stylesheet-test.html Tue Nov 6 16:59:57 2012
@@ -19,12 +19,12 @@
 <style>
 p { font-family: monospace; white-space: pre-wrap }
 </style>
-<script type="text/javascript" src="/com/google/caja/plugin/html4-defs.js"></script> -<script type="text/javascript" src="/com/google/caja/plugin/css-defs.js"></script> -<script type="text/javascript" src="/com/google/caja/plugin/uri.js"></script> -<script type="text/javascript" src="/com/google/caja/plugin/csslexer.js"></script> -<script type="text/javascript" src="/com/google/caja/plugin/cssparser.js"></script> -<script type="text/javascript" src="/com/google/caja/plugin/sanitizecss.js"></script>
+<script type="text/javascript" src="html4-defs.js"></script>
+<script type="text/javascript" src="css-defs.js"></script>
+<script type="text/javascript" src="uri.js"></script>
+<script type="text/javascript" src="csslexer.js"></script>
+<script type="text/javascript" src="cssparser.js"></script>
+<script type="text/javascript" src="sanitizecss.js"></script>
 <script type="text/javascript" src="jsUnitCore.js"
  ></script>
 <script type="text/javascript" src="jsunit.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/csslexer-test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/csslexer-test.html Tue Nov 6 16:59:57 2012
@@ -19,7 +19,7 @@
 <style>
 p { font-family: monospace; white-space: pre-wrap }
 </style>
-<script type="text/javascript" src="/com/google/caja/plugin/csslexer.js"></script>
+<script type="text/javascript" src="csslexer.js"></script>
 <script type="text/javascript" src="jsUnitCore.js"
  ></script>
 <script type="text/javascript" src="jsunit.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/cssparser_test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/cssparser_test.html Tue Nov 6 16:59:57 2012
@@ -2,15 +2,15 @@
 <html>
   <head>
     <title>CSS Parser Test</title>
-    <script src="/com/google/caja/plugin/csslexer.js"></script>
-    <script src="/com/google/caja/plugin/cssparser.js"></script>
+    <script src="csslexer.js"></script>
+    <script src="cssparser.js"></script>
     <script src="jsUnitCore.js"></script>
     <script src="jsunit.js"></script>
     <script src="cssparser_test.js"></script>
   </head>
   <body>
     <p>Run <code>ant AllTests</code> and view this from under
-    <code>ant-lib</code>, or run under Rhino via
+    <code>ant-testlib</code>, or run under Rhino via
     <code>CssParserTest.java</code></p>
     <script>jsunitRun()</script>
   </body>
=======================================
--- /trunk/tests/com/google/caja/plugin/html-css-sanitizer-minified-test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/html-css-sanitizer-minified-test.html Tue Nov 6 16:59:57 2012
@@ -17,7 +17,7 @@
 <html>
   <head>
     <title>HTML Sanitizer Tests</title>
-<script type="text/javascript" src="/com/google/caja/plugin/html-css-sanitizer-minified.js"></script> +<script type="text/javascript" src="html-css-sanitizer-minified.js"></script>
 <script type="text/javascript" src="jsUnitCore.js"
  ></script>
 <script type="text/javascript" src="jsunit.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/html-css-sanitizer-test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/html-css-sanitizer-test.html Tue Nov 6 16:59:57 2012
@@ -17,7 +17,7 @@
 <html>
   <head>
     <title>HTML Sanitizer Tests</title>
-<script type="text/javascript" src="/com/google/caja/plugin/html-css-sanitizer-bundle.js"></script>
+<script type="text/javascript" src="html-css-sanitizer-bundle.js"></script>
 <script type="text/javascript" src="jsUnitCore.js"
  ></script>
 <script type="text/javascript" src="jsunit.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/html-emitter-test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/html-emitter-test.html Tue Nov 6 16:59:57 2012
@@ -17,10 +17,10 @@
 <html>
   <head>
     <title>HTML Emitter Tests</title>
- <script type="text/javascript" src="/com/google/caja/plugin/html4-defs.js"></script> - <script type="text/javascript" src="/com/google/caja/plugin/html-sanitizer.js"></script> - <script type="text/javascript" src="/com/google/caja/plugin/bridal.js"></script> - <script type="text/javascript" src="/com/google/caja/plugin/html-emitter.js"></script>
+    <script type="text/javascript" src="html4-defs.js"></script>
+    <script type="text/javascript" src="html-sanitizer.js"></script>
+    <script type="text/javascript" src="bridal.js"></script>
+    <script type="text/javascript" src="html-emitter.js"></script>
     <script type="text/javascript" src="jsUnitCore.js"></script>
  </head>

=======================================
--- /trunk/tests/com/google/caja/plugin/html-sanitizer-legacy-test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/html-sanitizer-legacy-test.html Tue Nov 6 16:59:57 2012
@@ -17,8 +17,8 @@
 <html>
   <head>
     <title>HTML Sanitizer Tests</title>
-<script type="text/javascript" src="/com/google/caja/plugin/html4-defs.js"></script> -<script type="text/javascript" src="/com/google/caja/plugin/html-sanitizer-legacy.js"></script>
+<script type="text/javascript" src="html4-defs.js"></script>
+<script type="text/javascript" src="html-sanitizer-legacy.js"></script>
 <script type="text/javascript" src="jsUnitCore.js"></script>
 <script type="text/javascript" src="jsunit.js"></script>
 <script type="text/javascript" src="html-sanitizer-test.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/html-sanitizer-minified-test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/html-sanitizer-minified-test.html Tue Nov 6 16:59:57 2012
@@ -17,7 +17,7 @@
 <html>
   <head>
     <title>HTML Sanitizer Tests</title>
-<script type="text/javascript" src="/com/google/caja/plugin/html-sanitizer-minified.js"></script>
+<script type="text/javascript" src="html-sanitizer-minified.js"></script>
 <script type="text/javascript" src="jsUnitCore.js"></script>
 <script type="text/javascript" src="jsunit.js"></script>
 <script type="text/javascript" src="html-sanitizer-test.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/html-sanitizer-regress.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/html-sanitizer-regress.html Tue Nov 6 16:59:57 2012
@@ -16,16 +16,16 @@
 <html>
   <head>
     <title>HTML Sanitizer Regression Test</title>
-<script type="text/javascript" src="/com/google/caja/plugin/html4-defs.js"></script>
+<script type="text/javascript" src="html4-defs.js"></script>

-<script type="text/javascript" src="/com/google/caja/plugin/html-sanitizer-legacy.js"></script>
+<script type="text/javascript" src="html-sanitizer-legacy.js"></script>
 <script>var html0 = html; html = void 0;</script>

-<script type="text/javascript" src="/com/google/caja/plugin/html-sanitizer.js"></script>
+<script type="text/javascript" src="html-sanitizer.js"></script>
 <script>var html1 = html; html = void 0;</script>

 <!-- optional -->
-<!-- <script type="text/javascript" src="/com/google/caja/plugin/html-sanitizer-exp.js"></script> --> +<!-- <script type="text/javascript" src="html-sanitizer-exp.js"></script> -->
 <script>var html2 = html; html = void 0;</script>

 <script type="text/javascript" src="jsUnitCore.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/html-sanitizer-test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/html-sanitizer-test.html Tue Nov 6 16:59:57 2012
@@ -17,7 +17,7 @@
 <html>
   <head>
     <title>HTML Sanitizer Tests</title>
-<script type="text/javascript" src="/com/google/caja/plugin/html-sanitizer-bundle.js"></script>
+<script type="text/javascript" src="html-sanitizer-bundle.js"></script>
 <script type="text/javascript" src="jsUnitCore.js"></script>
 <script type="text/javascript" src="jsunit.js"></script>
 <script type="text/javascript" src="html-sanitizer-test.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/sanitizecss_test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/sanitizecss_test.html Tue Nov 6 16:59:57 2012
@@ -2,9 +2,9 @@
 <html>
   <head>
     <title>CSS Matcher Test</title>
-    <script src="/com/google/caja/plugin/css-defs.js"></script>
-    <script src="/com/google/caja/plugin/csslexer.js"></script>
-    <script src="/com/google/caja/plugin/sanitizecss.js"></script>
+    <script src="css-defs.js"></script>
+    <script src="csslexer.js"></script>
+    <script src="sanitizecss.js"></script>
     <script src="jsUnitCore.js"></script>
     <script src="jsunit.js"></script>
     <script src="sanitizecss_test.js"></script>
=======================================
--- /trunk/tests/com/google/caja/plugin/test-index.js Fri Oct 19 15:00:59 2012 +++ /trunk/tests/com/google/caja/plugin/test-index.js Tue Nov 6 16:59:57 2012
@@ -57,6 +57,20 @@
     'modules-test.html',
   ];

+  var headless_rhino_tests = [
+    'csslexer-test.html',
+    'cssparser_test.html',
+    'css-stylesheet-test.html',
+    'html-emitter-test.html',
+    'html-sanitizer-test.html',
+    'html-sanitizer-minified-test.html',
+    'html-sanitizer-regress.html',
+    'html-css-sanitizer-test.html',
+    'html-css-sanitizer-minified-test.html',
+    'sanitizecss_test.html',
+    'uri_test.html',
+  ];
+
   var tests_ul = document.getElementById('tests');

   function addSeparator() {
@@ -93,6 +107,12 @@

   var i, item;

+  for (i = 0; i < headless_rhino_tests.length; i++) {
+    addBare(headless_rhino_tests[i]);
+  }
+
+  addSeparator();
+
   for (i = 0; i < bare_tests.length; i++) {
     addBare(bare_tests[i]);
   }
=======================================
--- /trunk/tests/com/google/caja/plugin/uri_test.html Wed Jun 27 13:42:15 2012 +++ /trunk/tests/com/google/caja/plugin/uri_test.html Tue Nov 6 16:59:57 2012
@@ -2,7 +2,7 @@
 <html>
   <head>
     <title>URI Test</title>
-    <script src="/com/google/caja/plugin/uri.js"></script>
+    <script src="uri.js"></script>
     <script src="jsUnitCore.js"></script>
     <script src="jsunit.js"></script>
     <script src="uri_test.js"></script>

Reply via email to