aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/unittest/run.html
diff options
context:
space:
mode:
authorEinar Egilsson2011-08-26 15:11:28 +0200
committerEinar Egilsson2011-08-26 15:11:28 +0200
commite3b36411d27c6fa6575b386738f9bfd3d582c50a (patch)
tree6f1f129bb38005e3bf9e597363e7181f318e0aec /chrome/content/unittest/run.html
parent32da992f75bf6046a8b1d829e742ef1bf0f98d89 (diff)
Deleted old files
Diffstat (limited to 'chrome/content/unittest/run.html')
-rw-r--r--chrome/content/unittest/run.html99
1 files changed, 0 insertions, 99 deletions
diff --git a/chrome/content/unittest/run.html b/chrome/content/unittest/run.html
deleted file mode 100644
index 57970d1..0000000
--- a/chrome/content/unittest/run.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!-- $Id$ -->
-<html>
- <head>
- <title>Redirector Unit Tests</title>
- <style type="text/css">
- body { font-family: Verdana, Arial; color:black; background-color:white; font-size:0.8em; width:800px; margin:auto; text-align:center;}
- a { color:blue; }
- h1 { text-align:center; margin:10px 0px; }
- table { margin:10px auto; border:solid 1px black; width:700px; border-collapse:collapse;}
- td { border:solid 1px black; padding:3px; }
- td.result { width:20px; height:20px; padding:0;}
- td.result div { width:70%; height:70%; margin:auto; }
- button { margin:20px auto; }
- </style>
- <script type="text/javascript">
-
- //Global variables
- var subscriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
- var redirector = Components.classes["@einaregilsson.com/redirector;1"].getService(Components.interfaces.rdIRedirector);
-
- function setupTest(name, testcase) {
- var table = document.createElement('table');
- var row = document.createElement('tr');
- var cell = document.createElement('th');
- var testdata;
- cell.setAttribute('colspan', 2);
- row.appendChild(cell);
- table.appendChild(row);
- cell.innerHTML = name;
- document.getElementById('tests').appendChild(table);
- for (var i = 0; i < testcase.tests.length; i++) {
- var testdata = testcase.tests[i];
- row = document.createElement('tr');
- cell = document.createElement('td');
- cell.setAttribute('class', 'result');
- var dot = document.createElement('div');
- dot.setAttribute('id', name + '_' + i);
- cell.appendChild(dot);
-
- row.appendChild(cell);
- cell = document.createElement('td');
- cell.innerHTML = testcase.describe(testdata);
- row.appendChild(cell);
- table.appendChild(row);
- }
- }
-
- function setup() {
- //quick and dirty cleanup
- document.getElementById('tests').innerHTML = '';
- subscriptLoader.loadSubScript('chrome://redirector/content/code/redirect.js');
- subscriptLoader.loadSubScript('chrome://redirector/content/unittest/testcases.js');
- redirector.reload();
-
- var sorted = [];
- for (var name in tests) {
- sorted.push(name);
- }
-
- sorted.sort();
- for each(var name in sorted) {
- setupTest(name, tests[name]);
- }
- }
-
- function runTests() {
- for (var testcaseName in tests) {
- var testcase = tests[testcaseName];
- for (var i = 0; i < testcase.tests.length; i++) {
- try {
- var dot = document.getElementById(testcaseName + '_' + i);
- var result = testcase.run(testcase.tests[i]);
- if (result && result.passed) {
- dot.style.backgroundColor = '#17f816';
- } else {
- dot.style.backgroundColor = '#ff0000';
- if (result && result.message) {
- dot.parentNode.nextSibling.innerHTML += '<br/><span style="color:red;">' + result.message + '</span>';
- }
- }
- } catch(e) {
- dot.style.backgroundColor = '#ff0000';
- dot.parentNode.nextSibling.innerHTML += '<br/><span style="color:red;">' + e + '</span>';
- ;
- }
- }
- }
- }
-
- </script>
- </head>
- <body onload="setup();">
- <h1>Redirector Unit Tests</h1>
- <button onclick="runTests();">Run tests</button>
- <button onclick="setup();">Reload tests</button>
- <div id="tests">
- </div>
- </body>
-</html> \ No newline at end of file