Title: [200255] trunk/LayoutTests
Revision
200255
Author
rn...@webkit.org
Date
2016-04-29 12:39:44 -0700 (Fri, 29 Apr 2016)

Log Message

test harness tests complain about testRunner not being declared inside a browser
https://bugs.webkit.org/show_bug.cgi?id=157056

Reviewed by Alex Christensen.

Don't run the code meant to re-format results for DRT/WTR when testRunner is not defined (i.e. inside a browser).
Also fixed various styling issues with this _javascript_ file and removed useless comments.

* resources/testharnessreport.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200254 => 200255)


--- trunk/LayoutTests/ChangeLog	2016-04-29 18:24:57 UTC (rev 200254)
+++ trunk/LayoutTests/ChangeLog	2016-04-29 19:39:44 UTC (rev 200255)
@@ -1,3 +1,15 @@
+2016-04-29  Ryosuke Niwa  <rn...@webkit.org>
+
+        test harness tests complain about testRunner not being declared inside a browser
+        https://bugs.webkit.org/show_bug.cgi?id=157056
+
+        Reviewed by Alex Christensen.
+
+        Don't run the code meant to re-format results for DRT/WTR when testRunner is not defined (i.e. inside a browser).
+        Also fixed various styling issues with this _javascript_ file and removed useless comments.
+
+        * resources/testharnessreport.js:
+
 2016-04-29  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r200232.

Modified: trunk/LayoutTests/resources/testharnessreport.js (200254 => 200255)


--- trunk/LayoutTests/resources/testharnessreport.js	2016-04-29 18:24:57 UTC (rev 200254)
+++ trunk/LayoutTests/resources/testharnessreport.js	2016-04-29 19:39:44 UTC (rev 200255)
@@ -25,66 +25,50 @@
 
 // Function used to convert the test status code into
 // the corresponding string
-function convertResult(resultStatus){
-	if(resultStatus == 0)
-		return("PASS");
-	else if(resultStatus == 1)
-		return("FAIL");
-	else if(resultStatus == 2)
-		return("TIMEOUT");
-	else
-		return("NOTRUN");
+function convertResult(resultStatus)
+{
+    if(resultStatus == 0)
+        return("PASS");
+    else if(resultStatus == 1)
+        return("FAIL");
+    else if(resultStatus == 2)
+        return("TIMEOUT");
+    else
+        return("NOTRUN");
 }
 
-/* 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
-*  spacing between cells is preserved, and it is therefore not readable. By
-*  setting output to false, the HTML table will not be created
-*/
-setup({"output": false, "explicit_timeout": !!testRunner});
+if (self.testRunner) {
+    /* 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
+    *  spacing between cells is preserved, and it is therefore not readable. By
+    *  setting output to false, the HTML table will not be created
+    */
+    setup({"output": false, "explicit_timeout": true});
 
-/*  Using a callback function, test results will be added to the page in a 
-*   manner that allows dumpAsText to produce readable test results
-*/
-add_completion_callback(function (tests, harness_status){
-	
-	// Create element to hold results
-	var results = document.createElement("pre");
-	
-	// Declare result string
-	var resultStr = "\n";
-	
-	// Check harness_status.  If it is not 0, tests did not
-	// execute correctly, output the error code and message
-	if(harness_status.status != 0){
-		resultStr += "Harness Error (" + 
-					 convertResult(harness_status.status) +
-					 "), message = " +
-					 harness_status.message + "\n\n";
-	}
-	// Iterate through tests array and build string that contains
-	// results for all tests
-	for(var i = 0; i < tests.length; i++) {
-		var message = (tests[i].message != null) ? tests[i].message : "";
-		if (tests[i].status == 1 && !tests[i].dumpStack) {
-			// Remove stack for failed tests for proper string comparison without file paths.
-			// For a test to dump the stack set its dumpStack attribute to true.
-			var stackIndex = message.indexOf("(stack:");
-			if (stackIndex > 0) {
-				message = message.substr(0, stackIndex);
-			}
-		}
-		resultStr += convertResult(tests[i].status) + " " + 
-					( (tests[i].name!=null) ? tests[i].name : "" ) + " " +
-					message +
-					"\n";
-        }			
+    /*  Using a callback function, test results will be added to the page in a 
+    *   manner that allows dumpAsText to produce readable test results
+    */
+    add_completion_callback(function (tests, harness_status) {
+        var results = document.createElement("pre");
+        var resultStr = "\n";
 
-	results.innerText = resultStr;
+        if(harness_status.status != 0)
+            resultStr += "Harness Error (" + convertResult(harness_status.status) + "), message = " + harness_status.message + "\n\n";
 
-	// Add results element to document
-	document.body.appendChild(results);
+        for (var i = 0; i < tests.length; i++) {
+            var message = (tests[i].message != null) ? tests[i].message : "";
+            if (tests[i].status == 1 && !tests[i].dumpStack) {
+                // Remove stack for failed tests for proper string comparison without file paths.
+                // For a test to dump the stack set its dumpStack attribute to true.
+                var stackIndex = message.indexOf("(stack:");
+                if (stackIndex > 0)
+                    message = message.substr(0, stackIndex);
+            }
+            resultStr += convertResult(tests[i].status) + " " +  (tests[i].name != null ? tests[i].name || "") + " " + message + "\n";
+        }
 
- 	if (self.testRunner)
- 		testRunner.notifyDone();
-});
+        results.innerText = resultStr;
+        document.body.appendChild(results);
+        testRunner.notifyDone();
+    });
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to