Title: [125889] trunk/Source/WebCore
Revision
125889
Author
[email protected]
Date
2012-08-17 06:00:01 -0700 (Fri, 17 Aug 2012)

Log Message

Web Inspector: enhance external test-runner and add cleanup code
https://bugs.webkit.org/show_bug.cgi?id=94231

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

add 'click on test result to select for next run' feature.
remember the users size for the inspector popup.
refactor server URLs to one location at top of file.
use the same value for both tests and scanner servers.
remove one extra instruction on the page.
refactor clean up code.
close the two popup windows if the test-runner.html is reloaded.

* inspector/front-end/test-runner.html:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125888 => 125889)


--- trunk/Source/WebCore/ChangeLog	2012-08-17 12:33:16 UTC (rev 125888)
+++ trunk/Source/WebCore/ChangeLog	2012-08-17 13:00:01 UTC (rev 125889)
@@ -1,3 +1,20 @@
+2012-08-17  John J. Barton  <[email protected]>
+
+        Web Inspector: enhance external test-runner and add cleanup code
+        https://bugs.webkit.org/show_bug.cgi?id=94231
+
+        Reviewed by Pavel Feldman.
+
+        add 'click on test result to select for next run' feature.
+        remember the users size for the inspector popup.
+        refactor server URLs to one location at top of file.
+        use the same value for both tests and scanner servers.
+        remove one extra instruction on the page.
+        refactor clean up code.
+        close the two popup windows if the test-runner.html is reloaded.
+
+        * inspector/front-end/test-runner.html:
+
 2012-08-17  Simon Hausmann  <[email protected]>
 
         Unreviewed trivial follow-up fix to r125873: Add missing adoptRef to avoid leaks.

Modified: trunk/Source/WebCore/inspector/front-end/test-runner.html (125888 => 125889)


--- trunk/Source/WebCore/inspector/front-end/test-runner.html	2012-08-17 12:33:16 UTC (rev 125888)
+++ trunk/Source/WebCore/inspector/front-end/test-runner.html	2012-08-17 13:00:01 UTC (rev 125889)
@@ -28,6 +28,10 @@
 
 <script>
 
+var layoutTestsServer = "http://localhost:8002/";
+var scannerServer = "http://localhost:8002/";
+var remoteDebuggingServer = "http://localhost:9222/";
+
 var tests = [];
 var skipList = [
     // HALT
@@ -65,9 +69,15 @@
 
 function run(debug)
 {
-    var iframe = document.createElement("iframe");
-    iframe.src = ""
-    document.body.appendChild(iframe);
+    if (window.testScannerIframe) 
+        document.body.removeChild(window.testScannerIframe);
+
+    if (window.runner)
+        window.runner.cleanup();
+
+    window.testScannerIframe = document.createElement("iframe");
+    window.testScannerIframe.src = "" + "LayoutTests/http/tests/inspector/resources/test-scanner.html";
+    document.body.appendChild(window.testScannerIframe);
     window.debug = debug;
 }
 
@@ -106,7 +116,7 @@
     var filter = document.getElementById("filter").value;
     while (test = tests.shift()) {
         if (!filter || test[0].match(filter)) {
-            new StandaloneTestRunner("http://localhost:8001" + test[0], test[1], runNextTest.bind(null));
+            new StandaloneTestRunner(layoutTestsServer + test[0], test[1], runNextTest.bind(null));
             return;
         }
     }
@@ -129,12 +139,12 @@
             return;
         }
     }
-
+    window.runner = this;
     this._testPage = window.open("about:blank", "inspected", "width=800,height=600");
 
     window.remoteDebuggingHandshake = this._remoteDebuggingHandshake.bind(this);
     var script = document.createElement("script");
-    script.src = ""
+    script.src = "" + "json?jsonp=remoteDebuggingHandshake";
     document.head.appendChild(script);
 }
 
@@ -147,16 +157,21 @@
             if (data[i].url !== "about:blank")
                 continue;
             this._debuggerURL = data[i].webSocketDebuggerUrl.replace("://", "=");
-            this._openTestPage();
+            this._navigateTestPage();
             break;
         }
     },
 
-    _openTestPage: function()
+    _navigateTestPage: function()
     {
-        window.runner = this;
         this._testPage.location.href = ""
-        this._inspectorWindowLoading = window.open(StandaloneTestRunner.FrontendLocation + "?" + this._debuggerURL, "inspector", "width=600,height=400");
+        var width = localStorage.getItem('inspectorWidth') || 600;
+        var height = localStorage.getItem('inspectorHeight') || 400;
+        var features = "width=" + Math.max(width , 600) + ",height=" + Math.max(height, 400);
+        this._inspectorWindowLoading = window.open(StandaloneTestRunner.FrontendLocation + "?" + this._debuggerURL, "inspector", features);
+        
+        window.addEventListener('unload', this.cleanup.bind(this));
+        
         this._watchDog = setTimeout(this._timeout.bind(this), 10000);
     },
 
@@ -179,15 +194,16 @@
         if (this._done)
             return;
         this._done = true;
-        delete window.runner;
 
-        if (!window.debug) {
-            this._testPage.close();
-            this._inspectorWindow.close();
-        }
+        if (!window.debug) 
+            this.cleanup()
+
         clearTimeout(this._watchDog);
 
-        if (actual === this._expected) {
+        this._treeElement._onselect_ = this.onTreeElementSelect.bind(this);
+
+        // TODO pavel  is the  RHS || condition wanted?
+        if (actual === this._expected || actual === this._expected + "\n") {
             this._treeElement.title = this._testPath + ": SUCCESS";
             this._next("pass");
             return;
@@ -246,13 +262,29 @@
         this._treeElement.title = this._testPath + ": TIMEOUT";
         this._treeElement.listItemElement.addStyleClass("timeout");
         this._done = true;
-        if (!window.debug) {
-            this._testPage.close();
-            this._inspectorWindow.close();
-        }
+        if (!window.debug) 
+            this.cleanup();
+
         this._next("timeout");
     },
 
+    cleanup: function ()
+    {
+        localStorage.setItem('inspectorWidth', this._inspectorWindowLoading.outerWidth);
+        localStorage.setItem('inspectorHeight', this._inspectorWindowLoading.outerHeight);
+        this._inspectorWindowLoading.close();
+        this._testPage.close();
+        delete window.runner;
+    },
+
+    onTreeElementSelect: function () 
+    {
+        var baseEndSentinel = '/inspector/';
+        var baseChars = this._testPath.indexOf(baseEndSentinel) + baseEndSentinel.length;
+        if (baseChars > 0) 
+            document.getElementById("filter").value = this._testPath.substr(baseChars);
+    },
+
     display: function() { }
 }
 
@@ -266,8 +298,8 @@
         return;
     }
 
-    if (runner)
-        runner[method].apply(runner, signature);
+    if (window.runner)
+        window.runner[method].apply(window.runner, signature);
 }
 
 window.addEventListener("message", onMessageFromTestPage, true);
@@ -278,15 +310,13 @@
 <ul>
 <li>Check out WebKit source tree: git clone http://git.chromium.org/external/Webkit.git</li>
 <li>Run "Tools/Scripts/new-run-webkit-httpd --root=. --port=8002 --server=start"</li>
-<li>Visit <a href=""
->http://localhost:8002/Source/WebCore/inspector/front-end/test-runner.html</a></li>
 <li>Run Chrome Canary (ToT Chromium) with following flags: "--remote-debugging-port=9222 --user-data-dir=testProfile http://localhost:8002/Source/WebCore/inspector/front-end/test-runner.html</li>
 </ul>
 
 <button _onclick_="run()">Run</button>
 <button _onclick_="run(true)">Debug</button>
 <button _onclick_="interrupt()">Interrupt</button>
-Filter: <input id="filter" type="text"></input><br>
+Filter: <input id="filter" type="text" size="40"></input><small><i>Click on results to load filter</i></small><br>
 
 <span>Passed: <span id="pass">0</span></span>
 <span>Failed: <span id="fail">0</span></span>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to