[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Wed Apr 7 23:24:25 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit d778f68535eb0b49e5e0b37319ff92f637adec9d
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 5 23:28:42 2009 +0000

    2009-11-05  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: beautify layout tests.
    
            https://bugs.webkit.org/show_bug.cgi?id=31189
    
            * inspector/console-dir-expected.txt:
            * inspector/console-dir.html:
            * inspector/console-dirxml-expected.txt:
            * inspector/console-dirxml.html:
            * inspector/console-format-collections-expected.txt:
            * inspector/console-format-collections.html:
            * inspector/console-format-expected.txt:
            * inspector/console-format.html:
            * inspector/console-tests-expected.txt:
            * inspector/console-tests.html:
            * inspector/console-tests.js: Added.
            (dumpConsoleMessages.callback):
            (dumpConsoleMessages):
            (dumpConsoleMessagesWithClasses.callback):
            (dumpConsoleMessagesWithClasses):
            (frontendScript_dumpConsoleMessages):
            * inspector/css-syntax-highlight.html: Removed.
            * inspector/elements-panel-structure-expected.txt:
            * inspector/elements-panel-structure.html:
            * inspector/elements-tests.js: Added.
            (frontendScript_expandDOMSubtree.processChildren):
            (frontendScript_expandDOMSubtree):
            * inspector/evaluate-in-frontend.html:
            * inspector/evaluate-in-frontend.js: Removed.
            * inspector/inspector-test.js: Added.
            ():
            (evaluateInWebInspector):
            (notifyDone):
            (output):
            (window.didEvaluateForTestInFrontend):
            * inspector/javascript-syntax-highlight.html: Removed.
            * inspector/styles-iframe.html:
            * inspector/syntax-highlight-css-expected.txt: Renamed from LayoutTests/inspector/css-syntax-highlight-expected.txt.
            * inspector/syntax-highlight-css.html: Added.
            * inspector/syntax-highlight-javascript-expected.txt: Renamed from LayoutTests/inspector/javascript-syntax-highlight-expected.txt.
            * inspector/syntax-highlight-javascript.html: Added.
            * inspector/syntax-highlight.js: Added.
            (doit.callback):
            (doit):
            (frontendScript_dumpSyntaxHighlight):
            * inspector/timeline-trivial.html:
            * platform/qt/Skipped:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50582 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8cc7e24..d88a73c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,54 @@
+2009-11-05  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: beautify layout tests.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31189
+
+        * inspector/console-dir-expected.txt:
+        * inspector/console-dir.html:
+        * inspector/console-dirxml-expected.txt:
+        * inspector/console-dirxml.html:
+        * inspector/console-format-collections-expected.txt:
+        * inspector/console-format-collections.html:
+        * inspector/console-format-expected.txt:
+        * inspector/console-format.html:
+        * inspector/console-tests-expected.txt:
+        * inspector/console-tests.html:
+        * inspector/console-tests.js: Added.
+        (dumpConsoleMessages.callback):
+        (dumpConsoleMessages):
+        (dumpConsoleMessagesWithClasses.callback):
+        (dumpConsoleMessagesWithClasses):
+        (frontendScript_dumpConsoleMessages):
+        * inspector/css-syntax-highlight.html: Removed.
+        * inspector/elements-panel-structure-expected.txt:
+        * inspector/elements-panel-structure.html:
+        * inspector/elements-tests.js: Added.
+        (frontendScript_expandDOMSubtree.processChildren):
+        (frontendScript_expandDOMSubtree):
+        * inspector/evaluate-in-frontend.html:
+        * inspector/evaluate-in-frontend.js: Removed.
+        * inspector/inspector-test.js: Added.
+        ():
+        (evaluateInWebInspector):
+        (notifyDone):
+        (output):
+        (window.didEvaluateForTestInFrontend):
+        * inspector/javascript-syntax-highlight.html: Removed.
+        * inspector/styles-iframe.html:
+        * inspector/syntax-highlight-css-expected.txt: Renamed from LayoutTests/inspector/css-syntax-highlight-expected.txt.
+        * inspector/syntax-highlight-css.html: Added.
+        * inspector/syntax-highlight-javascript-expected.txt: Renamed from LayoutTests/inspector/javascript-syntax-highlight-expected.txt.
+        * inspector/syntax-highlight-javascript.html: Added.
+        * inspector/syntax-highlight.js: Added.
+        (doit.callback):
+        (doit):
+        (frontendScript_dumpSyntaxHighlight):
+        * inspector/timeline-trivial.html:
+        * platform/qt/Skipped:
+
 2009-11-05  Shu Chang  <Chang.Shu at nokia.com>
 
         Reviewed by Adele Peterson.
diff --git a/LayoutTests/inspector/console-dir-expected.txt b/LayoutTests/inspector/console-dir-expected.txt
index 9d76a04..0779ba5 100644
--- a/LayoutTests/inspector/console-dir-expected.txt
+++ b/LayoutTests/inspector/console-dir-expected.txt
@@ -1,9 +1,9 @@
-CONSOLE MESSAGE: line 8: [object HTMLDocument]
-CONSOLE MESSAGE: line 9: test1,test2
-CONSOLE MESSAGE: line 10: [object NodeList]
+CONSOLE MESSAGE: line 9: [object HTMLDocument]
+CONSOLE MESSAGE: line 10: test1,test2
+CONSOLE MESSAGE: line 11: [object NodeList]
 Tests that console logging dumps proper messages.
 
-console-dir.html:8HTMLDocument
-console-dir.html:9Array
-console-dir.html:10NodeList
+console-dir.html:9HTMLDocument
+console-dir.html:10Array
+console-dir.html:11NodeList
 
diff --git a/LayoutTests/inspector/console-dir.html b/LayoutTests/inspector/console-dir.html
index 31ccd86..3b86e85 100755
--- a/LayoutTests/inspector/console-dir.html
+++ b/LayoutTests/inspector/console-dir.html
@@ -1,6 +1,7 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
+<script src="console-tests.js"></script>
 <script>
 
 function doit()
@@ -9,13 +10,7 @@ function doit()
     console.dir(["test1", "test2"]);
     console.dir(document.childNodes);
 
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i)
-            output(result[i].text);
-        notifyDone();
-    }
-    evaluateInWebInspector("dumpConsoleMessages", callback);
+    dumpConsoleMessages();
 }
 
 </script>
@@ -26,8 +21,5 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="output">
-</div>
-
 </body>
 </html>
diff --git a/LayoutTests/inspector/console-dirxml-expected.txt b/LayoutTests/inspector/console-dirxml-expected.txt
index a6cb83d..b69d2c3 100644
--- a/LayoutTests/inspector/console-dirxml-expected.txt
+++ b/LayoutTests/inspector/console-dirxml-expected.txt
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: line 8: [object HTMLDocument]
+CONSOLE MESSAGE: line 9: [object HTMLDocument]
 Tests that console logging dumps proper messages.
 
-console-dirxml.html:8Document
+console-dirxml.html:9Document
 
diff --git a/LayoutTests/inspector/console-dirxml.html b/LayoutTests/inspector/console-dirxml.html
index 80ebfef..41ff791 100755
--- a/LayoutTests/inspector/console-dirxml.html
+++ b/LayoutTests/inspector/console-dirxml.html
@@ -1,19 +1,14 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
+<script src="console-tests.js"></script>
 <script>
 
 function doit()
 {
     console.dirxml(document);
 
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i)
-            output(result[i].text);
-        notifyDone();
-    }
-    evaluateInWebInspector("dumpConsoleMessages", callback);
+    dumpConsoleMessages();
 }
 
 </script>
@@ -24,8 +19,5 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="output">
-</div>
-
 </body>
 </html>
diff --git a/LayoutTests/inspector/console-format-collections-expected.txt b/LayoutTests/inspector/console-format-collections-expected.txt
index 9e4e86d..6b2eaee 100644
--- a/LayoutTests/inspector/console-format-collections-expected.txt
+++ b/LayoutTests/inspector/console-format-collections-expected.txt
@@ -1,15 +1,15 @@
-CONSOLE MESSAGE: line 14: [object NodeList]
-CONSOLE MESSAGE: line 18: [object HTMLCollection]
-CONSOLE MESSAGE: line 22: [object HTMLOptionsCollection]
-CONSOLE MESSAGE: line 26: [object HTMLAllCollection]
-CONSOLE MESSAGE: line 30: [object HTMLCollection]
-CONSOLE MESSAGE: line 34: [object NodeList]
+CONSOLE MESSAGE: line 15: [object NodeList]
+CONSOLE MESSAGE: line 19: [object HTMLCollection]
+CONSOLE MESSAGE: line 23: [object HTMLOptionsCollection]
+CONSOLE MESSAGE: line 27: [object HTMLAllCollection]
+CONSOLE MESSAGE: line 31: [object HTMLCollection]
+CONSOLE MESSAGE: line 35: [object NodeList]
 Tests that console nicely formats HTML Collections and NodeLists.
 
-console-format-collections.html:14[<select id="sel" name="sel">]
-console-format-collections.html:18[<script src="evaluate-in-frontend.js">, <script>]
-console-format-collections.html:22[<option value="1">one</option>, <option value="2">two</option>]
-console-format-collections.html:26[<html>, <head>, <script src="evaluate-in-frontend.js">, <script>, <body onload="onload()">, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">, <form id="f">, <select id="sel" name="sel">, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="output">]
-console-format-collections.html:30[<select id="sel" name="sel">, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
-console-format-collections.html:34[<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
+console-format-collections.html:15[<select id="sel" name="sel">]
+console-format-collections.html:19[<script src="inspector-test.js">, <script src="console-tests.js">, <script>]
+console-format-collections.html:23[<option value="1">one</option>, <option value="2">two</option>]
+console-format-collections.html:27[<html>, <head>, <script src="inspector-test.js">, <script src="console-tests.js">, <script>, <body onload="onload()">, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">, <form id="f">, <select id="sel" name="sel">, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="output">]
+console-format-collections.html:31[<select id="sel" name="sel">, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
+console-format-collections.html:35[<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
 
diff --git a/LayoutTests/inspector/console-format-collections.html b/LayoutTests/inspector/console-format-collections.html
index b53faf8..606b580 100644
--- a/LayoutTests/inspector/console-format-collections.html
+++ b/LayoutTests/inspector/console-format-collections.html
@@ -1,6 +1,7 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
+<script src="console-tests.js"></script>
 <script>
 
 function doit()
@@ -33,11 +34,7 @@ function doit()
     var radioNodeList = formElement.x;
     console.log(radioNodeList);
 
-    evaluateInWebInspector("dumpConsoleMessages", function(result) {
-        for (var i = 0; i < result.length; ++i)
-            output(result[i].text);
-        notifyDone();
-    });
+    dumpConsoleMessages();
 }
 
 </script>
@@ -58,8 +55,5 @@ Tests that console nicely formats HTML Collections and NodeLists.
     </form>
 </div>
 
-<div id="output">
-</div>
-
 </body>
 </html>
diff --git a/LayoutTests/inspector/console-format-expected.txt b/LayoutTests/inspector/console-format-expected.txt
index 06361db..55f650b 100644
--- a/LayoutTests/inspector/console-format-expected.txt
+++ b/LayoutTests/inspector/console-format-expected.txt
@@ -1,11 +1,11 @@
-CONSOLE MESSAGE: line 8: Message format number %i, %d and %f
-CONSOLE MESSAGE: line 9: Message %s for %s
-CONSOLE MESSAGE: line 10: Object %o
-CONSOLE MESSAGE: line 15: test,test2,,,test4
+CONSOLE MESSAGE: line 9: Message format number %i, %d and %f
+CONSOLE MESSAGE: line 10: Message %s for %s
+CONSOLE MESSAGE: line 11: Object %o
+CONSOLE MESSAGE: line 16: test,test2,,,test4
 Tests that console logging dumps proper messages.
 
-console-format.html:8Message format number 1, 2 and 3.5
-console-format.html:9Message format for string
-console-format.html:10Object Object
-console-format.html:15["test", "test2", undefined, undefined, "test4"]
+console-format.html:9Message format number 1, 2 and 3.5
+console-format.html:10Message format for string
+console-format.html:11Object Object
+console-format.html:16["test", "test2", undefined, undefined, "test4"]
 
diff --git a/LayoutTests/inspector/console-format.html b/LayoutTests/inspector/console-format.html
index c9ea027..2d6cd0c 100755
--- a/LayoutTests/inspector/console-format.html
+++ b/LayoutTests/inspector/console-format.html
@@ -1,6 +1,7 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
+<script src="console-tests.js"></script>
 <script>
 
 function doit()
@@ -14,13 +15,7 @@ function doit()
     array[4] = "test4";
     console.log(array);
 
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i)
-            output(result[i].text);
-        notifyDone();
-    }
-    evaluateInWebInspector("dumpConsoleMessages", callback);
+    dumpConsoleMessages();
 }
 
 </script>
@@ -31,8 +26,5 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="output">
-</div>
-
 </body>
 </html>
diff --git a/LayoutTests/inspector/console-tests-expected.txt b/LayoutTests/inspector/console-tests-expected.txt
index e041610..7ce27a2 100644
--- a/LayoutTests/inspector/console-tests-expected.txt
+++ b/LayoutTests/inspector/console-tests-expected.txt
@@ -1,25 +1,25 @@
-CONSOLE MESSAGE: line 8: log
-CONSOLE MESSAGE: line 9: debug
-CONSOLE MESSAGE: line 10: info
-CONSOLE MESSAGE: line 11: warn
-CONSOLE MESSAGE: line 12: error
-CONSOLE MESSAGE: line 14: repeated
-CONSOLE MESSAGE: line 14: repeated
-CONSOLE MESSAGE: line 14: repeated
-CONSOLE MESSAGE: line 14: repeated
-CONSOLE MESSAGE: line 14: repeated
-CONSOLE MESSAGE: line 19: 1
+CONSOLE MESSAGE: line 9: log
+CONSOLE MESSAGE: line 10: debug
+CONSOLE MESSAGE: line 11: info
+CONSOLE MESSAGE: line 12: warn
+CONSOLE MESSAGE: line 13: error
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 20: 1
 Tests that console logging dumps proper messages.
 
-console-tests.html:8log console-message console-js-source console-log-level
-console-tests.html:9debug console-message console-js-source console-log-level
-console-tests.html:10info console-message console-js-source console-log-level
-console-tests.html:11warn console-message console-js-source console-warning-level
-console-tests.html:12error console-message console-js-source console-error-level
-5console-tests.html:14repeated console-message console-js-source console-log-level repeated-message
-console-tests.html:16count: 1 console-message console-js-source console-log-level
-console-tests.html:16count: 2 console-message console-js-source console-log-level
-console-tests.html:17group console-message console-js-source console-log-level console-group-title
+console-tests.html:9log console-message console-js-source console-log-level
+console-tests.html:10debug console-message console-js-source console-log-level
+console-tests.html:11info console-message console-js-source console-log-level
+console-tests.html:12warn console-message console-js-source console-warning-level
+console-tests.html:13error console-message console-js-source console-error-level
+5console-tests.html:15repeated console-message console-js-source console-log-level repeated-message
+console-tests.html:17count: 1 console-message console-js-source console-log-level
+console-tests.html:17count: 2 console-message console-js-source console-log-level
+console-tests.html:18group console-message console-js-source console-log-level console-group-title
 console-message console-js-source console-log-level
-console-tests.html:191 2 3 console-message console-js-source console-log-level
+console-tests.html:201 2 3 console-message console-js-source console-log-level
 
diff --git a/LayoutTests/inspector/console-tests.html b/LayoutTests/inspector/console-tests.html
index 49c0a30..07b0b18 100755
--- a/LayoutTests/inspector/console-tests.html
+++ b/LayoutTests/inspector/console-tests.html
@@ -1,6 +1,7 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
+<script src="console-tests.js"></script>
 <script>
 
 function doit()
@@ -18,14 +19,7 @@ function doit()
     console.groupEnd();
     console.log('1', '2', '3');
 
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i) {
-            output(result[i].text + " " + result[i].clazz);
-        }
-        notifyDone();
-    }
-    evaluateInWebInspector("dumpConsoleMessages", callback);
+    dumpConsoleMessagesWithClasses();
 }
 
 </script>
@@ -36,8 +30,5 @@ function doit()
 Tests that console logging dumps proper messages.
 </p>
 
-<div id="output">
-</div>
-
 </body>
 </html>
diff --git a/LayoutTests/inspector/console-tests.js b/LayoutTests/inspector/console-tests.js
new file mode 100755
index 0000000..bc5d2e9
--- /dev/null
+++ b/LayoutTests/inspector/console-tests.js
@@ -0,0 +1,35 @@
+// Inspected Page functions.
+
+function dumpConsoleMessages() {
+    function callback(result)
+    {
+        for (var i = 0; i < result.length; ++i)
+            output(result[i].text);
+        notifyDone();
+    }
+    evaluateInWebInspector("frontend_dumpConsoleMessages", callback);
+}
+
+function dumpConsoleMessagesWithClasses() {
+    function callback(result)
+    {
+        for (var i = 0; i < result.length; ++i)
+            output(result[i].text + " " + result[i].clazz);
+        notifyDone();
+    }
+    evaluateInWebInspector("frontend_dumpConsoleMessages", callback);
+}
+
+
+// Frontend functions.
+
+function frontend_dumpConsoleMessages()
+{
+    var result = [];
+    var messages = WebInspector.console.messages;
+    for (var i = 0; i < messages.length; ++i) {
+        var element = messages[i].toMessageElement();
+        result.push({ text: element.textContent.replace(/\u200b/g, ""), clazz: element.getAttribute("class")});
+    }
+    return result;
+}
diff --git a/LayoutTests/inspector/css-syntax-highlight.html b/LayoutTests/inspector/css-syntax-highlight.html
deleted file mode 100644
index aeb8339..0000000
--- a/LayoutTests/inspector/css-syntax-highlight.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<html>
-<head>
-<script src="evaluate-in-frontend.js"></script>
-<script>
-
-function doit()
-{
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i)
-            output(result[i]);
-        notifyDone();
-    }
-    evaluateInWebInspector("doitAndDump", callback);
-}
-
-</script>
-</head>
-
-<body onload="onload()">
-<p>
-Tests that CSSSourceSyntaxHighlighter detects the tokens.
-</p>
-
-<div id="frontend-script" style="display:none">
-function doitAndDump(testController) {
-    testController.waitUntilDone();
-    setTimeout(function() {
-        var result = [];
-        
-        result.push(dumpSyntaxHighlight("a[href='/']"));
-        result.push(dumpSyntaxHighlight("#content > a:hover"));
-        result.push(dumpSyntaxHighlight("@import url(style.css);"));
-        result.push(dumpSyntaxHighlight("@import url(\"style.css\") projection, tv;"));
-        result.push(dumpSyntaxHighlight("@media screen { body { color: red; } }"));
-        result.push(dumpSyntaxHighlight("@font-face { font-family: MyHelvetica; }"));
-        result.push(dumpSyntaxHighlight("p { color: color; red: red; }"));
-        result.push(dumpSyntaxHighlight("p { color: red !important; }"));
-        
-        testController.notifyDone(result);
-        
-    }, 0);
-}
-function dumpSyntaxHighlight(str) {
-    var node = document.createElement("span");
-    node.textContent = str;
-    var javascriptSyntaxHighlighter = new WebInspector.CSSSourceSyntaxHighlighter(null, null);
-    javascriptSyntaxHighlighter.syntaxHighlightNode(node);
-    var node_parts = [];
-    for (var i = 0; i < node.childNodes.length; i++) {
-        if (node.childNodes[i].getAttribute) {
-            node_parts.push(node.childNodes[i].getAttribute("class"));
-        } else {
-            node_parts.push("*");
-        }
-    }
-    return node_parts.join(",");
-}
-</div>
-
-<div id="output">
-</div>
-
-</body>
-</html>
diff --git a/LayoutTests/inspector/elements-panel-structure-expected.txt b/LayoutTests/inspector/elements-panel-structure-expected.txt
index 2285f99..35a054d 100644
--- a/LayoutTests/inspector/elements-panel-structure-expected.txt
+++ b/LayoutTests/inspector/elements-panel-structure-expected.txt
@@ -6,7 +6,8 @@ Tests that elements panel shows dom tree structure.
 <body onload="onload()">
 <p>Tests that elements panel shows dom tree structure.
 </p>
-<div id="frontend-script" style="display:none">
-<pre id="output">
+<pre id="outputPre">
+<div id="output">
 </body>
 </html>
+
diff --git a/LayoutTests/inspector/elements-panel-structure.html b/LayoutTests/inspector/elements-panel-structure.html
index c9744e8..9afc1ce 100755
--- a/LayoutTests/inspector/elements-panel-structure.html
+++ b/LayoutTests/inspector/elements-panel-structure.html
@@ -1,39 +1,42 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
+<script src="elements-tests.js"></script>
 <script>
 
 function doit()
 {
     function callback(result)
     {
-        var output = document.getElementById("output");
+        var output = document.getElementById("outputPre");
         output.textContent = result.replace(/\u200b/g, "").replace(/\n/g, "").replace(/</g, "\n<");
         notifyDone();
     }
-    evaluateInWebInspector("dumpElements", callback);
+    evaluateInWebInspector("frontend_dumpAllElements", callback);
 }
 
-</script>
-</head>
 
-<body onload="onload()">
-<p>
-Tests that elements panel shows dom tree structure.
-</p>
+// Frontend functions.
 
-<div id="frontend-script" style="display:none">
-function dumpElements(testController)
+function frontend_dumpAllElements(testController)
 {
     testController.waitUntilDone();
-    expandDOMSubtree(WebInspector.domAgent.document);
+    // Need test to be async to expand whole the tree first.
+    frontend_expandDOMSubtree(WebInspector.domAgent.document);
     testController.runAfterPendingDispatches(function() {
         testController.notifyDone(WebInspector.panels.elements.treeOutline.element.textContent);
     });
 }
-</div>
 
-<pre id="output">
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+Tests that elements panel shows dom tree structure.
+</p>
+
+<pre id="outputPre">
 </pre>
 
 </body>
diff --git a/LayoutTests/inspector/elements-tests.js b/LayoutTests/inspector/elements-tests.js
new file mode 100755
index 0000000..fcf9b51
--- /dev/null
+++ b/LayoutTests/inspector/elements-tests.js
@@ -0,0 +1,11 @@
+// Frontend functions.
+
+function frontend_expandDOMSubtree(node)
+{
+    function processChildren(children)
+    {
+       for (var i = 0; children && i < children.length; ++i)
+           frontend_expandDOMSubtree(children[i]);
+    }
+    WebInspector.domAgent.getChildNodesAsync(node, processChildren);
+}
diff --git a/LayoutTests/inspector/evaluate-in-frontend.html b/LayoutTests/inspector/evaluate-in-frontend.html
index 451a957..36a757d 100755
--- a/LayoutTests/inspector/evaluate-in-frontend.html
+++ b/LayoutTests/inspector/evaluate-in-frontend.html
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
 <script>
 
 function doit()
@@ -10,7 +10,15 @@ function doit()
         output("2 + 2 = " + result);
         notifyDone();
     }
-    evaluateInWebInspector("sum(2, 2)", callback);
+    evaluateInWebInspector("frontend_sum(2, 2)", callback);
+}
+
+
+// Frontend functions.
+
+function frontend_sum(a, b)
+{
+    return a + b;
 }
 
 </script>
@@ -21,15 +29,5 @@ function doit()
 This tests that layout test can evaluate scripts in the web inspector context.
 </p>
 
-<div id="frontend-script" style="display:none">
-function sum(a, b)
-{
-    return a + b;
-}
-</div>
-
-<div id="output">
-</div>
-
 </body>
 </html>
diff --git a/LayoutTests/inspector/evaluate-in-frontend.js b/LayoutTests/inspector/evaluate-in-frontend.js
deleted file mode 100755
index ac3f998..0000000
--- a/LayoutTests/inspector/evaluate-in-frontend.js
+++ /dev/null
@@ -1,96 +0,0 @@
-var lastCallId = 0;
-var callbacks = {};
-
-if (window.layoutTestController) {
-    layoutTestController.dumpAsText();
-    layoutTestController.waitUntilDone();
-}
-
-// We ignore initial load of the page, enable inspector and initiate reload. This allows inspector controller
-// to capture events that happen during the initial page load.
-var ignoreLoad = window.location.href.indexOf("?reload") === -1;
-if (ignoreLoad) {
-    setTimeout(function() {
-        if (window.layoutTestController)
-            layoutTestController.showWebInspector();
-        window.location.href += "?reload";
-    }, 0);
-}
-
-function onload()
-{
-    if (ignoreLoad)
-        return;
-
-    var toInject = expandDOMSubtree.toString() + "\n" + dumpConsoleMessages.toString();
-    if (document.getElementById("frontend-script"))
-        toInject += "\n" + document.getElementById("frontend-script").textContent;
-    evaluateInWebInspector(toInject, doit);
-
-    // Make sure web inspector window is closed before the test is interrupted.
-    setTimeout(function() {
-        alert("Internal timeout exceeded.")
-        if (window.layoutTestController) {
-            layoutTestController.closeWebInspector();
-            layoutTestController.notifyDone();
-        }
-    }, 10000);
-}
-
-function evaluateInWebInspector(script, callback)
-{
-    var callId = lastCallId++;
-    callbacks[callId] = callback;
-    setTimeout(function() {
-        if (window.layoutTestController)
-            layoutTestController.evaluateInWebInspector(callId, script);
-    }, 0);
-}
-
-function notifyDone()
-{
-    setTimeout(function() {
-        if (window.layoutTestController) {
-            layoutTestController.closeWebInspector();
-            layoutTestController.notifyDone();
-        }
-    }, 0);
-}
-
-function output(text)
-{
-    var output = document.getElementById("output");
-    output.appendChild(document.createTextNode(text));
-    output.appendChild(document.createElement("br"));
-}
-
-window.didEvaluateForTestInFrontend = function(callId, jsonResult)
-{
-    if (callbacks[callId]) {
-        callbacks[callId].call(this, JSON.parse(jsonResult));
-        delete callbacks[callId];
-    }
-};
-
-// Injected utility functions.
-
-function expandDOMSubtree(node)
-{
-    function processChildren(children)
-    {
-       for (var i = 0; children && i < children.length; ++i)
-           expandDOMSubtree(children[i]);
-    }
-    WebInspector.domAgent.getChildNodesAsync(node, processChildren);
-}
-
-function dumpConsoleMessages()
-{
-    var result = [];
-    var messages = WebInspector.console.messages;
-    for (var i = 0; i < messages.length; ++i) {
-        var element = messages[i].toMessageElement();
-        result.push({ text: element.textContent.replace(/\u200b/g, ""), clazz: element.getAttribute("class")});
-    }
-    return result;
-}
diff --git a/LayoutTests/inspector/inspector-test.js b/LayoutTests/inspector/inspector-test.js
new file mode 100755
index 0000000..60c3761
--- /dev/null
+++ b/LayoutTests/inspector/inspector-test.js
@@ -0,0 +1,79 @@
+var lastCallId = 0;
+var callbacks = {};
+
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+// We ignore initial load of the page, enable inspector and initiate reload. This allows inspector controller
+// to capture events that happen during the initial page load.
+var ignoreLoad = window.location.href.indexOf("?reload") === -1;
+if (ignoreLoad) {
+    setTimeout(function() {
+        if (window.layoutTestController)
+            layoutTestController.showWebInspector();
+        window.location.href += "?reload";
+    }, 0);
+}
+
+function onload()
+{
+    if (ignoreLoad)
+        return;
+
+    var outputElement = document.createElement("div");
+    outputElement.id = "output";
+    document.body.appendChild(outputElement);
+
+    var toInject = [];
+    for (var name in window) {
+        if (name.indexOf("frontend_") === 0 && typeof window[name] === "function")
+            toInject.push(window[name].toString());
+    }
+    evaluateInWebInspector(toInject.join("\n"), doit);
+
+    // Make sure web inspector window is closed before the test is interrupted.
+    setTimeout(function() {
+        alert("Internal timeout exceeded.")
+        if (window.layoutTestController) {
+            layoutTestController.closeWebInspector();
+            layoutTestController.notifyDone();
+        }
+    }, 10000);
+}
+
+function evaluateInWebInspector(script, callback)
+{
+    var callId = lastCallId++;
+    callbacks[callId] = callback;
+    setTimeout(function() {
+        if (window.layoutTestController)
+            layoutTestController.evaluateInWebInspector(callId, script);
+    }, 0);
+}
+
+function notifyDone()
+{
+    setTimeout(function() {
+        if (window.layoutTestController) {
+            layoutTestController.closeWebInspector();
+            layoutTestController.notifyDone();
+        }
+    }, 0);
+}
+
+function output(text)
+{
+    var output = document.getElementById("output");
+    output.appendChild(document.createTextNode(text));
+    output.appendChild(document.createElement("br"));
+}
+
+function didEvaluateForTestInFrontend(callId, jsonResult)
+{
+    if (callbacks[callId]) {
+        callbacks[callId].call(this, JSON.parse(jsonResult));
+        delete callbacks[callId];
+    }
+}
diff --git a/LayoutTests/inspector/javascript-syntax-highlight.html b/LayoutTests/inspector/javascript-syntax-highlight.html
deleted file mode 100644
index 88d46d6..0000000
--- a/LayoutTests/inspector/javascript-syntax-highlight.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<html>
-<head>
-<script src="evaluate-in-frontend.js"></script>
-<script>
-
-function doit()
-{
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i)
-            output(result[i]);
-        notifyDone();
-    }
-    evaluateInWebInspector("doitAndDump", callback);
-}
-
-</script>
-</head>
-
-<body onload="onload()">
-<p>
-Tests that JavaScriptSourceSyntaxHighlighter detects the tokens.
-</p>
-
-<div id="frontend-script" style="display:none">
-function doitAndDump(testController) {
-    testController.waitUntilDone();
-    setTimeout(function() {
-        var result = [];
-        
-        result.push(dumpSyntaxHighlight("return'foo';"));
-        result.push(dumpSyntaxHighlight("/\\\//g"));
-        result.push(dumpSyntaxHighlight("//ig';"));
-        result.push(dumpSyntaxHighlight("1 / 2 + /a/.test('a');"));
-        result.push(dumpSyntaxHighlight("\"\\\"/\".length / 2"));
-        result.push(dumpSyntaxHighlight("var foo = 1/*/***//2"));
-        result.push(dumpSyntaxHighlight("/*comment*//.*/.test('a')"));
-        result.push(dumpSyntaxHighlight("'f\\\noo';"));
-        result.push(dumpSyntaxHighlight("'\\f\\b\\t';"));
-        result.push(dumpSyntaxHighlight("'/\\\n/';"));
-        result.push(dumpSyntaxHighlight("foo/**\n/\n*/foo"));
-        
-        testController.notifyDone(result);
-        
-    }, 0);
-}
-function dumpSyntaxHighlight(str) {
-    var node = document.createElement("span");
-    node.textContent = str;
-    var javascriptSyntaxHighlighter = new WebInspector.JavaScriptSourceSyntaxHighlighter(null, null);
-    javascriptSyntaxHighlighter.syntaxHighlightNode(node);
-    var node_parts = [];
-    for (var i = 0; i < node.childNodes.length; i++) {
-        if (node.childNodes[i].getAttribute) {
-            node_parts.push(node.childNodes[i].getAttribute("class"));
-        } else {
-            node_parts.push("*");
-        }
-    }
-    return node_parts.join(",");
-}
-</div>
-
-<div id="output">
-</div>
-
-</body>
-</html>
diff --git a/LayoutTests/inspector/styles-iframe.html b/LayoutTests/inspector/styles-iframe.html
index 16f35c1..d40a3cd 100755
--- a/LayoutTests/inspector/styles-iframe.html
+++ b/LayoutTests/inspector/styles-iframe.html
@@ -5,7 +5,8 @@
   body { background:blue; }
 </style>
 
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
+<script src="elements-tests.js"></script>
 <script>
 
 function runAfterIframeIsLoaded(continuation)
@@ -34,34 +35,25 @@ function doit()
             }
             notifyDone();
         }
-        evaluateInWebInspector("dumpStyles", callback);
+        evaluateInWebInspector("frontend_dumpStyles", callback);
     });
 }
 
-</script>
-</head>
-
-<body onload="onload()">
-<p>
-Tests that proper (and different) styles are returned for body elements of main document and iframe.
-</p>
-
-<iframe src='resources/styles-iframe-data.html'></iframe>
 
-<div id="frontend-script" style="display:none">
+// Frontend functions.
 
-function dumpStyles(testController)
+function frontend_dumpStyles(testController)
 {
     testController.waitUntilDone();
 
-    expandDOMSubtree(WebInspector.domAgent.document);
+    frontend_expandDOMSubtree(WebInspector.domAgent.document);
 
     testController.runAfterPendingDispatches(function() {
-        dumpStylesContinuation(testController);
+        frontend_dumpStylesContinuation(testController);
     });
 }
 
-function dumpStylesContinuation(testController)
+function frontend_dumpStylesContinuation(testController)
 {
     // 1. Get styles for body, store them in mainStyles var.
     var bodyId = WebInspector.domAgent.document.body.id;
@@ -90,10 +82,16 @@ function dumpStylesContinuation(testController)
     }
     InjectedScriptAccess.getStyles(iframeBodyId, false, iframeCallback);
 }
-</div>
 
-<div id="output">
-</div>
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+Tests that proper (and different) styles are returned for body elements of main document and iframe.
+</p>
+
+<iframe src="resources/styles-iframe-data.html"></iframe>
 
 </body>
 </html>
diff --git a/LayoutTests/inspector/css-syntax-highlight-expected.txt b/LayoutTests/inspector/syntax-highlight-css-expected.txt
similarity index 100%
rename from LayoutTests/inspector/css-syntax-highlight-expected.txt
rename to LayoutTests/inspector/syntax-highlight-css-expected.txt
diff --git a/LayoutTests/inspector/syntax-highlight-css.html b/LayoutTests/inspector/syntax-highlight-css.html
new file mode 100644
index 0000000..de6b766
--- /dev/null
+++ b/LayoutTests/inspector/syntax-highlight-css.html
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script src="inspector-test.js"></script>
+<script src="syntax-highlight.js"></script>
+<script>
+
+// Frontend functions.
+
+function frontend_dumpSyntaxHighlightCSS(str)
+{
+    return frontend_dumpSyntaxHighlight(str, WebInspector.CSSSourceSyntaxHighlighter);
+}
+
+function frontend_doitAndDump() {
+    var result = [];
+    result.push(frontend_dumpSyntaxHighlightCSS("a[href='/']"));
+    result.push(frontend_dumpSyntaxHighlightCSS("#content > a:hover"));
+    result.push(frontend_dumpSyntaxHighlightCSS("@import url(style.css);"));
+    result.push(frontend_dumpSyntaxHighlightCSS("@import url(\"style.css\") projection, tv;"));
+    result.push(frontend_dumpSyntaxHighlightCSS("@media screen { body { color: red; } }"));
+    result.push(frontend_dumpSyntaxHighlightCSS("@font-face { font-family: MyHelvetica; }"));
+    result.push(frontend_dumpSyntaxHighlightCSS("p { color: color; red: red; }"));
+    result.push(frontend_dumpSyntaxHighlightCSS("p { color: red !important; }"));
+    return result;
+}
+
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+Tests that CSSSourceSyntaxHighlighter detects the tokens.
+</p>
+
+</body>
+</html>
diff --git a/LayoutTests/inspector/javascript-syntax-highlight-expected.txt b/LayoutTests/inspector/syntax-highlight-javascript-expected.txt
similarity index 100%
rename from LayoutTests/inspector/javascript-syntax-highlight-expected.txt
rename to LayoutTests/inspector/syntax-highlight-javascript-expected.txt
diff --git a/LayoutTests/inspector/syntax-highlight-javascript.html b/LayoutTests/inspector/syntax-highlight-javascript.html
new file mode 100644
index 0000000..97700e8
--- /dev/null
+++ b/LayoutTests/inspector/syntax-highlight-javascript.html
@@ -0,0 +1,40 @@
+<html>
+<head>
+<script src="inspector-test.js"></script>
+<script src="syntax-highlight.js"></script>
+<script>
+
+// Frontend functions.
+
+function frontend_dumpSyntaxHighlightJS(str)
+{
+    return frontend_dumpSyntaxHighlight(str, WebInspector.JavaScriptSourceSyntaxHighlighter);
+}
+
+function frontend_doitAndDump() {
+    var result = [];
+    
+    result.push(frontend_dumpSyntaxHighlightJS("return'foo';"));
+    result.push(frontend_dumpSyntaxHighlightJS("/\\\//g"));
+    result.push(frontend_dumpSyntaxHighlightJS("//ig';"));
+    result.push(frontend_dumpSyntaxHighlightJS("1 / 2 + /a/.test('a');"));
+    result.push(frontend_dumpSyntaxHighlightJS("\"\\\"/\".length / 2"));
+    result.push(frontend_dumpSyntaxHighlightJS("var foo = 1/*/***//2"));
+    result.push(frontend_dumpSyntaxHighlightJS("/*comment*//.*/.test('a')"));
+    result.push(frontend_dumpSyntaxHighlightJS("'f\\\noo';"));
+    result.push(frontend_dumpSyntaxHighlightJS("'\\f\\b\\t';"));
+    result.push(frontend_dumpSyntaxHighlightJS("'/\\\n/';"));
+    result.push(frontend_dumpSyntaxHighlightJS("foo/**\n/\n*/foo"));
+    return result;
+}
+
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+Tests that JavaScriptSourceSyntaxHighlighter detects the tokens.
+</p>
+
+</body>
+</html>
diff --git a/LayoutTests/inspector/syntax-highlight.js b/LayoutTests/inspector/syntax-highlight.js
new file mode 100644
index 0000000..e08073a
--- /dev/null
+++ b/LayoutTests/inspector/syntax-highlight.js
@@ -0,0 +1,31 @@
+// Inspected Page functions.
+
+function doit()
+{
+    function callback(result)
+    {
+        for (var i = 0; i < result.length; ++i)
+            output(result[i]);
+        notifyDone();
+    }
+    evaluateInWebInspector("frontend_doitAndDump", callback);
+}
+
+// Frontend functions.
+
+function frontend_dumpSyntaxHighlight(str, highlighterConstructor)
+{
+    var node = document.createElement("span");
+    node.textContent = str;
+    var javascriptSyntaxHighlighter = new highlighterConstructor(null, null);
+    javascriptSyntaxHighlighter.syntaxHighlightNode(node);
+    var node_parts = [];
+    for (var i = 0; i < node.childNodes.length; i++) {
+        if (node.childNodes[i].getAttribute) {
+            node_parts.push(node.childNodes[i].getAttribute("class"));
+        } else {
+            node_parts.push("*");
+        }
+    }
+    return node_parts.join(",");
+}
diff --git a/LayoutTests/inspector/timeline-trivial.html b/LayoutTests/inspector/timeline-trivial.html
index 93e8a0d..c3ca5f8 100644
--- a/LayoutTests/inspector/timeline-trivial.html
+++ b/LayoutTests/inspector/timeline-trivial.html
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="evaluate-in-frontend.js"></script>
+<script src="inspector-test.js"></script>
 <script>
 
 function doit()
@@ -12,26 +12,23 @@ function doit()
     evaluateInWebInspector("startTimeline()", callback);
 }
 
-</script>
-</head>
-
-<body onload="onload()">
-<p> 
-Trivial use of inspector frontend tests 
-</p>
 
-<div id="frontend-script" style="display:none">
+// Frontend functions.
 
-function startTimeline() {
+function frontend_startTimeline() {
     /* This test seems silly, but originally it tickled bug 31080 */
     InspectorController.startTimelineProfiler();
     return true;
 }
 
-</div>
 
-<div id="output">
-</div>
+</script>
+</head>
+
+<body onload="onload()">
+<p> 
+Trivial use of inspector frontend tests 
+</p>
 
 </body>
 </html>
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index f93cdf5..99089ac 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -116,9 +116,9 @@ fast/text/find-hidden-text.html
 
 # Missing layoutTestController.showWebInspector()
 inspector/console-format-collections.html
-inspector/css-syntax-highlight.html
-inspector/javascript-syntax-highlight.html
 inspector/styles-iframe.html
+inspector/syntax-highlight-css.html
+inspector/syntax-highlight-javascript.html
 inspector/timeline-trivial.html
 inspector/uncaught-dom1-exception.html
 inspector/uncaught-dom3-exception.html

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list