gecko-dev/dom/imptests/testharnessreport.js

128 строки
3.8 KiB
JavaScript
Исходник Обычный вид История

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
var W3CTest = {
/**
* Dictionary mapping a test URL to either the string "all", which means that
* all tests in this file are expected to fail, or a dictionary mapping test
* names to either the boolean |true|, or the string "debug". The former
* means that this test is expected to fail in all builds, and the latter
* that it is only expected to fail in debug builds.
*/
"expectedFailures": {},
/**
* List of test results, needed by TestRunner to update the UI.
*/
"tests": [],
/**
* Reference to the TestRunner object in the parent frame.
*/
"runner": parent === this ? null : parent.TestRunner || parent.wrappedJSObject.TestRunner,
/**
* Prefixes for the error logging. Indexed first by int(todo) and second by
* int(result).
*/
"prefixes": [
["TEST-UNEXPECTED-FAIL", "TEST-PASS"],
["TEST-KNOWN-FAIL", "TEST-UNEXPECTED-PASS"]
],
/**
* Returns the URL of the current test, relative to the root W3C tests
* directory. Used as a key into the expectedFailures dictionary.
*/
"getURL": function() {
Bug 752202 - Shorten the paths to imported tests some more to hopefully fix C-C windows builds; rs=Standard8 --HG-- rename : dom/imported-tests/Makefile.in => dom/imptests/Makefile.in rename : dom/imported-tests/README => dom/imptests/README rename : dom/imported-tests/WebIDLParser.js => dom/imptests/WebIDLParser.js rename : dom/imported-tests/failures.txt => dom/imptests/failures.txt rename : dom/imported-tests/html.json => dom/imptests/html.json rename : dom/imported-tests/html.mk => dom/imptests/html.mk rename : dom/imported-tests/html.txt => dom/imptests/html.txt rename : dom/imported-tests/html/tests/submission/Mozilla/Makefile.in => dom/imptests/html/tests/submission/Mozilla/Makefile.in rename : dom/imported-tests/html/tests/submission/Mozilla/nested-document-write-external.js => dom/imptests/html/tests/submission/Mozilla/nested-document-write-external.js rename : dom/imported-tests/html/tests/submission/Mozilla/test_body-onload.html => dom/imptests/html/tests/submission/Mozilla/test_body-onload.html rename : dom/imported-tests/html/tests/submission/Mozilla/test_pageload-image.html => dom/imptests/html/tests/submission/Mozilla/test_pageload-image.html rename : dom/imported-tests/html/tests/submission/Mozilla/test_pageload-video.html => dom/imptests/html/tests/submission/Mozilla/test_pageload-video.html rename : dom/imported-tests/html/tests/submission/Mozilla/test_script-for-onload.html => dom/imptests/html/tests/submission/Mozilla/test_script-for-onload.html rename : dom/imported-tests/html/tests/submission/Mozilla/test_window-onerror-parse-error.html => dom/imptests/html/tests/submission/Mozilla/test_window-onerror-parse-error.html rename : dom/imported-tests/html/tests/submission/Mozilla/test_window-onerror-runtime-error-throw.html => dom/imptests/html/tests/submission/Mozilla/test_window-onerror-runtime-error-throw.html rename : dom/imported-tests/html/tests/submission/Mozilla/test_window-onerror-runtime-error.html => dom/imptests/html/tests/submission/Mozilla/test_window-onerror-runtime-error.html rename : dom/imported-tests/idlharness.js => dom/imptests/idlharness.js rename : dom/imported-tests/importTestsuite.py => dom/imptests/importTestsuite.py rename : dom/imported-tests/parseManifest.py => dom/imptests/parseManifest.py rename : dom/imported-tests/testharness.css => dom/imptests/testharness.css rename : dom/imported-tests/testharness.js => dom/imptests/testharness.js rename : dom/imported-tests/testharnessreport.js.in => dom/imptests/testharnessreport.js.in rename : dom/imported-tests/updateTestharness.py => dom/imptests/updateTestharness.py rename : dom/imported-tests/webapps.json => dom/imptests/webapps.json rename : dom/imported-tests/webapps.mk => dom/imptests/webapps.mk rename : dom/imported-tests/webapps.txt => dom/imptests/webapps.txt rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/Makefile.in => dom/imptests/webapps/DOMCore/tests/submissions/Opera/Makefile.in rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-01.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-01.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-02.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-02.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-03.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-03.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-04.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-04.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-05.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-05.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-06.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-06.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-07.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-07.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-08.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-08.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-09.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-09.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-10.xml => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-10.xml rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-11.xml => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-11.xml rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-12.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-12.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-13.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-13.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-14.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-14.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-15.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-15.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-16.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-16.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-17.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-17.htm rename : dom/imported-tests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-18.htm => dom/imptests/webapps/DOMCore/tests/submissions/Opera/test_getElementsByClassName-18.htm rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/Makefile.in => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/Makefile.in rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/Makefile.in => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/Makefile.in rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_change_item_iframe.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_change_item_iframe.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_security_iframe.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_security_iframe.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_set_item_clear_iframe.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_set_item_clear_iframe.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_set_item_iframe.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/local_set_item_iframe.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/session_change_item_iframe.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/session_change_item_iframe.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/session_set_item_clear_iframe.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/session_set_item_clear_iframe.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/iframe/session_set_item_iframe.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/session_set_item_iframe.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_constructor.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_constructor.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_key.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_key.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_newvalue.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_newvalue.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_oldvalue.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_oldvalue.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_storagearea.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_storagearea.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_storageeventinit.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_storageeventinit.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_url.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_local_url.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_key.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_key.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_newvalue.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_newvalue.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_oldvalue.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_oldvalue.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_storagearea.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_storagearea.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_storageeventinit.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_storageeventinit.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_url.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_event_session_url.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_clear.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_clear.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_getitem.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_getitem.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_key.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_key.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_length.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_length.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_removeitem.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_removeitem.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_security.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_security.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_setitem.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_local_setitem.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_clear.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_clear.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_getitem.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_getitem.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_key.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_key.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_length.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_length.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_removeitem.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_removeitem.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_setitem.html => dom/imptests/webapps/WebStorage/tests/submissions/Infraware/test_storage_session_setitem.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Makefile.in => dom/imptests/webapps/WebStorage/tests/submissions/Makefile.in rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_event_constructor_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_event_constructor_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_clear_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_clear_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_getitem_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_getitem_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_in_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_in_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_index_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_index_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_length_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_length_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_removeitem_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_removeitem_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_setitem_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_local_setitem_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_clear_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_clear_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_getitem_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_getitem_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_in_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_in_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_index_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_index_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_length_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_length_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_removeitem_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_removeitem_js.html rename : dom/imported-tests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_setitem_js.html => dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/test_storage_session_setitem_js.html rename : dom/imported-tests/writeReporter.py => dom/imptests/writeReporter.py
2012-05-05 18:00:30 +04:00
return this.runner.currentTestURL.substring("/tests/dom/imptests/".length);
},
/**
* Lets the test runner know about a test result.
*/
"_log": function(test) {
var msg = this.prefixes[+test.todo][+test.result] + " | ";
if (this.runner.currentTestURL)
msg += this.runner.currentTestURL;
msg += " | " + test.message;
this.runner[(test.result === !test.todo) ? "log" : "error"](msg);
},
/**
* Reports a test result. The argument is an object with the following
* properties:
*
* o message (string): message to be reported
* o result (boolean): whether this test failed
* o todo (boolean): whether this test is expected to fail
*/
"report": function(test) {
this.tests.push(test);
this._log(test);
},
/**
* Returns true if this test is expected to fail, and false otherwise.
*/
"_todo": function(test) {
if (this.expectedFailures === "all") {
return true;
}
var value = this.expectedFailures[test.name];
return value === true || (value === "debug" && !!SpecialPowers.isDebugBuild);
},
/**
* Callback function for testharness.js. Called when one test in a file
* finishes.
*/
"result": function(test) {
var url = this.getURL();
this.report({
"message": test.message || test.name,
"result": test.status === test.PASS,
"todo": this._todo(test)
});
},
/**
* Callback function for testharness.js. Called when the entire test file
* finishes.
*/
"finish": function(tests, status) {
var url = this.getURL();
this.report({
"message": "Finished test, status " + status.status,
"result": status.status === status.OK,
"todo":
url in this.expectedFailures &&
this.expectedFailures[url] === "error"
});
this.runner.testFinished(this.tests);
}
};
(function() {
if (!W3CTest.runner) {
return;
}
// Get expected fails. If there aren't any, there will be a 404, which is
// fine. Anything else is unexpected.
var request = new XMLHttpRequest();
request.open("GET", "/tests/dom/imptests/failures/" + W3CTest.getURL() + ".json", false);
request.send();
if (request.status === 200) {
W3CTest.expectedFailures = JSON.parse(request.responseText);
} else if (request.status !== 404) {
is(request.status, 404, "Request status neither 200 nor 404");
}
add_result_callback(W3CTest.result.bind(W3CTest));
add_completion_callback(W3CTest.finish.bind(W3CTest));
setup({
"output": false,
"timeout": 1000000,
});
})();