Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: LayoutTests/resources/testharnessreport.js

Issue 109763007: Reland r159735 - support for test harness (text-only) tests w/o expected results. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update testharness-based baselines Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * THIS FILE INTENTIONALLY LEFT BLANK 2 * THIS FILE INTENTIONALLY LEFT BLANK
3 * 3 *
4 * More specifically, this file is intended for vendors to implement 4 * More specifically, this file is intended for vendors to implement
5 * code needed to integrate testharness.js tests with their own test systems. 5 * code needed to integrate testharness.js tests with their own test systems.
6 * 6 *
7 * Typically such integration will attach callbacks when each test is 7 * Typically such integration will attach callbacks when each test is
8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has 8 * has run, using add_result_callback(callback(test)), or when the whole test fi le has
9 * completed, using add_completion_callback(callback(tests, harness_status)). 9 * completed, using add_completion_callback(callback(tests, harness_status)).
10 * 10 *
(...skipping 25 matching lines...) Expand all
36 // test results into an HTML table. When that table is dumped as text, no 36 // test results into an HTML table. When that table is dumped as text, no
37 // spacing between cells is preserved, and it is therefore not readable. By 37 // spacing between cells is preserved, and it is therefore not readable. By
38 // setting output to false, the HTML table will not be created. 38 // setting output to false, the HTML table will not be created.
39 setup({output: false}); 39 setup({output: false});
40 40
41 // Using a callback function, test results will be added to the page in a 41 // Using a callback function, test results will be added to the page in a
42 // manner that allows dumpAsText to produce readable test results. 42 // manner that allows dumpAsText to produce readable test results.
43 add_completion_callback(function (tests, harnessStatus) 43 add_completion_callback(function (tests, harnessStatus)
44 { 44 {
45 // An array to hold string pieces, which will be joined later to produce the final result. 45 // An array to hold string pieces, which will be joined later to produce the final result.
46 var resultsArray = ["\n"]; 46 var resultsArray = ["This is a testharness.js-based test.\n"];
47 47
48 if (harnessStatus.status !== 0) { 48 if (harnessStatus.status !== 0) {
49 resultsArray.push("Harness Error. harnessStatus.status = ", 49 resultsArray.push("Harness Error. harnessStatus.status = ",
50 harnessStatus.status, 50 harnessStatus.status,
51 " , harnessStatus.message = ", 51 " , harnessStatus.message = ",
52 harnessStatus.message); 52 harnessStatus.message);
53 } else if (tests.length == 0) {
54 results.Array.push("FAIL: No tests actually ran.\n");
53 } else { 55 } else {
54 for (var i = 0; i < tests.length; i++) { 56 for (var i = 0; i < tests.length; i++) {
55 resultsArray.push(convertResultStatusToString(tests[i].status), 57 resultsArray.push(convertResultStatusToString(tests[i].status),
56 " ", 58 " ",
57 tests[i].name !== null ? tests[i].name : "", 59 tests[i].name !== null ? tests[i].name : "",
58 " ", 60 " ",
59 tests[i].message !== null ? tests[i].message : "", 61 tests[i].message !== null ? tests[i].message : "",
60 "\n"); 62 "\n");
61 } 63 }
62 } 64 }
65 resultsArray.push("Harness: the test ran to completion.\n")
63 66
64 var resultElement = document.createElement("pre"); 67 var resultElement = document.createElement("pre");
65 resultElement.textContent = resultsArray.join(""); 68 resultElement.textContent = resultsArray.join("");
66 document.body.appendChild(resultElement); 69 document.body.appendChild(resultElement);
67 70
68 if (window.testRunner) 71 if (window.testRunner)
69 testRunner.notifyDone(); 72 testRunner.notifyDone();
70 }); 73 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698