Title: [125927] trunk/LayoutTests
Revision
125927
Author
[email protected]
Date
2012-08-17 13:10:39 -0700 (Fri, 17 Aug 2012)

Log Message

Web Inspector: Refactor InspectorTest to split evals for initialization from runTest
https://bugs.webkit.org/show_bug.cgi?id=93520

Patch by John J. Barton <[email protected]> on 2012-08-17
Reviewed by Pavel Feldman.

 Split function runTestInFrontend() into initialization and runTestInFrontEnd parts;
 send them to the front-end in two different evaluateInFrontEnd calls, resulting in
 two different eval() calls. In debug setup, we'll get two different UISourceCodes,
 much easier to debug with.

Refactoring, all inspector tests pass.

* http/tests/inspector/inspector-test.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125926 => 125927)


--- trunk/LayoutTests/ChangeLog	2012-08-17 19:57:19 UTC (rev 125926)
+++ trunk/LayoutTests/ChangeLog	2012-08-17 20:10:39 UTC (rev 125927)
@@ -1,3 +1,19 @@
+2012-08-17  John J. Barton  <[email protected]>
+
+        Web Inspector: Refactor InspectorTest to split evals for initialization from runTest
+        https://bugs.webkit.org/show_bug.cgi?id=93520
+
+        Reviewed by Pavel Feldman.
+
+         Split function runTestInFrontend() into initialization and runTestInFrontEnd parts;
+         send them to the front-end in two different evaluateInFrontEnd calls, resulting in
+         two different eval() calls. In debug setup, we'll get two different UISourceCodes,
+         much easier to debug with.        
+
+        Refactoring, all inspector tests pass.
+
+        * http/tests/inspector/inspector-test.js:
+
 2012-08-17  John Mellor  <[email protected]>
 
         Text Autosizing: Increase line height in proportion to font size.

Modified: trunk/LayoutTests/http/tests/inspector/inspector-test.js (125926 => 125927)


--- trunk/LayoutTests/http/tests/inspector/inspector-test.js	2012-08-17 19:57:19 UTC (rev 125926)
+++ trunk/LayoutTests/http/tests/inspector/inspector-test.js	2012-08-17 20:10:39 UTC (rev 125927)
@@ -371,8 +371,9 @@
 
 };
 
-var runTestCallId = 0;
-var completeTestCallId = 1;
+var initializeCallId = 0;
+var runTestCallId = 1;
+var completeTestCallId = 2;
 var frontendReopeningCount = 0;
 
 function reopenFrontend()
@@ -419,7 +420,7 @@
     testRunner.dumpAsText();
     testRunner.waitUntilDone();
 
-    function runTestInFrontend(initializationFunctions, testFunction, completeTestCallId)
+    function initializeFrontend(initializationFunctions)
     {
         if (window.InspectorTest) {
             InspectorTest.pageLoaded();
@@ -427,8 +428,7 @@
         }
 
         InspectorTest = {};
-        InspectorTest.completeTestCallId = completeTestCallId;
-
+    
         for (var i = 0; i < initializationFunctions.length; ++i) {
             try {
                 initializationFunctions[i]();
@@ -437,12 +437,20 @@
                 InspectorTest.completeTest();
             }
         }
+    }
 
+    function runTestInFrontend(testFunction, completeTestCallId)
+    {
+        if (InspectorTest.completeTestCallId) 
+            return;
+
+        InspectorTest.completeTestCallId = completeTestCallId;
+
         WebInspector.showPanel("audits");
         try {
             testFunction();
         } catch (e) {
-            console.error("Exception during test execution: " + e);
+            console.error("Exception during test execution: " + e,  (e.stack ? e.stack : "") );
             InspectorTest.completeTest();
         }
     }
@@ -452,8 +460,12 @@
         if (name.indexOf("initialize_") === 0 && typeof window[name] === "function" && name !== "initialize_InspectorTest")
             initializationFunctions.push(window[name].toString());
     }
-    var parameters = ["[" + initializationFunctions + "]", test, completeTestCallId];
-    var toEvaluate = "(" + runTestInFrontend + ")(" + parameters.join(", ") + ");";
+    var parameters = ["[" + initializationFunctions + "]"];
+    var toEvaluate = "(" + initializeFrontend + ")(" + parameters.join(", ") + ");";
+    testRunner.evaluateInWebInspector(initializeCallId, toEvaluate);
+
+    parameters = [test, completeTestCallId];
+    toEvaluate = "(" + runTestInFrontend + ")(" + parameters.join(", ") + ");";
     testRunner.evaluateInWebInspector(runTestCallId, toEvaluate);
 
     if (enableWatchDogWhileDebugging) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to