Added option to run CSP tests and code to allow passing a variable to every test (to allow running w/prefixes)
authorbhill2
Thu, 02 May 2013 14:22:52 -0700
changeset 95 9001d279213e
parent 94 eb112c0fe3d8
child 96 a801916fe189
Added option to run CSP tests and code to allow passing a variable to every test (to allow running w/prefixes)
tests/testRunner/index.html
tests/testRunner/runner.js
--- a/tests/testRunner/index.html	Thu May 02 14:20:55 2013 -0700
+++ b/tests/testRunner/index.html	Thu May 02 14:22:52 2013 -0700
@@ -5,5 +5,7 @@
 <link rel=stylesheet href=runner.css>
 <script src=runner.js></script>
 <p>
-<!-- <button value=/webappsec/tests/cors/submitted/cors1.0/>Run CORS 1.0 tests</button> -->
-<button value=/webappsec/tests/cors/submitted/opera/staging/>Run CORS 1.0 tests</button>
+<button value="/webappsec/tests/cors/submitted/opera/staging/">Run CORS 1.0 tests</button>
+<button value="/webappsec/tests/csp/submitted/WG/">Run CSP 1.0 tests</button>
+<button value="/webappsec/tests/csp/submitted/WG/" name="?prefixed=true">Run CSP 1.0 tests (prefixed)</button>
+</p>
--- a/tests/testRunner/runner.js	Thu May 02 14:20:55 2013 -0700
+++ b/tests/testRunner/runner.js	Thu May 02 14:22:52 2013 -0700
@@ -1,7 +1,7 @@
 "use strict";
 var runner;
 
-function Runner(aPath) {
+function Runner(aPath, options) {
   this.mStartTime = (new Date()).getTime();
   this.mPath = aPath;
   this.mTimeouts = 0;
@@ -20,6 +20,7 @@
   this.mTests = [];
   this.mTestCount = -1;
   this.mSkipManual = false;
+  this.testOptions = options;
 };
 Runner.prototype = {
   "sTimeout": 10000, //ms
@@ -163,7 +164,7 @@
 
       case "manual":
         if (chunks[1]) {
-          this.mTests.push({ url: aPath + chunks[1], passes: 0, fails: 0, type: "manual" });
+          this.mTests.push({ url: aPath + chunks[1] + this.testOptions, passes: 0, fails: 0, type: "manual" });
         }
         break;
 
@@ -175,14 +176,14 @@
         for (var j = 2, jl = chunks.length; j < jl; j += 2) {
           reftests.push([chunks[j], aPath + chunks[1], aPath + chunks[j + 1]]);
         }
-        this.mTests.push({ type: "reftest", url: aPath + chunks[1], passes: 0, fails: 0, tests: reftests })
+        this.mTests.push({ type: "reftest", url: aPath + chunks[1] + this.testOptions, passes: 0, fails: 0, tests: reftests })
         break;
 
       default:
         if (chunks.length > 1) {
           break;
         }
-        this.mTests.push({ url: aPath + chunks[0], passes: 0, fails: 0, type: "automated" });
+        this.mTests.push({ url: aPath + chunks[0] + this.testOptions, passes: 0, fails: 0, type: "automated" });
       }
     }
     return dirs;
@@ -463,7 +464,7 @@
 }
 
 function startRunning() {
-  runner = new Runner(this.value);
+  runner = new Runner(this.value, this.name);
   runner.start();
 }