Commit 7baff434 authored by philipj@opera.com's avatar philipj@opera.com

Convert LayoutTests/http/tests/resources/testharness.js from CRLF to LF

It's not possible to land patches using CQ for CRLF files:
https://codereview.chromium.org/213283002/

Also convert testharnessreport.js while in the area.

BUG=355489
TBR=dpranke@chromium.org

Review URL: https://codereview.chromium.org/214133003

git-svn-id: svn://svn.chromium.org/blink/trunk@170121 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3982faf7
This source diff could not be displayed because it is too large. You can view the blob instead.
/* /*
* THIS FILE INTENTIONALLY LEFT BLANK * THIS FILE INTENTIONALLY LEFT BLANK
* *
* More specifically, this file is intended for vendors to implement * More specifically, this file is intended for vendors to implement
* code needed to integrate testharness.js tests with their own test systems. * code needed to integrate testharness.js tests with their own test systems.
* *
* Typically such integration will attach callbacks when each test is * Typically such integration will attach callbacks when each test is
* has run, using add_result_callback(callback(test)), or when the whole test file has * has run, using add_result_callback(callback(test)), or when the whole test file has
* completed, using add_completion_callback(callback(tests, harness_status)). * completed, using add_completion_callback(callback(tests, harness_status)).
* *
* For more documentation about the callback functions and the * For more documentation about the callback functions and the
* parameters they are called with see testharness.js * parameters they are called with see testharness.js
*/ */
// Setup for WebKit JavaScript tests // Setup for WebKit JavaScript tests
if (self.testRunner) { if (self.testRunner) {
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
} }
// Function used to convert the test status code into // Function used to convert the test status code into
// the corresponding string // the corresponding string
function convertResult(resultStatus){ function convertResult(resultStatus){
if(resultStatus == 0) if(resultStatus == 0)
return("PASS"); return("PASS");
else if(resultStatus == 1) else if(resultStatus == 1)
return("FAIL"); return("FAIL");
else if(resultStatus == 2) else if(resultStatus == 2)
return("TIMEOUT"); return("TIMEOUT");
else else
return("NOTRUN"); return("NOTRUN");
} }
/* Disable the default output of testharness.js. The default output formats /* Disable the default output of testharness.js. The default output formats
* test results into an HTML table. When that table is dumped as text, no * test results into an HTML table. When that table is dumped as text, no
* spacing between cells is preserved, and it is therefore not readable. By * spacing between cells is preserved, and it is therefore not readable. By
* setting output to false, the HTML table will not be created * setting output to false, the HTML table will not be created
*/ */
setup({"output":false}); setup({"output":false});
/* Using a callback function, test results will be added to the page in a /* Using a callback function, test results will be added to the page in a
* manner that allows dumpAsText to produce readable test results * manner that allows dumpAsText to produce readable test results
*/ */
add_completion_callback(function (tests, harness_status){ add_completion_callback(function (tests, harness_status){
// Create element to hold results // Create element to hold results
var results = document.createElement("pre"); var results = document.createElement("pre");
// Declare result string // Declare result string
var resultStr = "\n"; var resultStr = "\n";
// Check harness_status. If it is not 0, tests did not // Check harness_status. If it is not 0, tests did not
// execute correctly, output the error code and message // execute correctly, output the error code and message
if(harness_status.status != 0){ if(harness_status.status != 0){
resultStr += "Harness Error. harness_status.status = " + resultStr += "Harness Error. harness_status.status = " +
harness_status.status + harness_status.status +
" , harness_status.message = " + " , harness_status.message = " +
harness_status.message; harness_status.message;
} }
else { else {
// Iterate through tests array and build string that contains // Iterate through tests array and build string that contains
// results for all tests // results for all tests
for(var i=0; i<tests.length; i++){ for(var i=0; i<tests.length; i++){
resultStr += convertResult(tests[i].status) + " " + resultStr += convertResult(tests[i].status) + " " +
( (tests[i].name!=null) ? tests[i].name : "" ) + " " + ( (tests[i].name!=null) ? tests[i].name : "" ) + " " +
( (tests[i].message!=null) ? tests[i].message : "" ) + ( (tests[i].message!=null) ? tests[i].message : "" ) +
"\n"; "\n";
} }
} }
// Set results element's innerHTML to the results string // Set results element's innerHTML to the results string
results.innerHTML = resultStr; results.innerHTML = resultStr;
// Add results element to document // Add results element to document
document.body.appendChild(results); document.body.appendChild(results);
if (self.testRunner) if (self.testRunner)
testRunner.notifyDone(); testRunner.notifyDone();
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment