Web Inspector: split script-formatter test into multiple tests.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Nov 2011 12:19:57 +0000 (12:19 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Nov 2011 12:19:57 +0000 (12:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=71607

Patch by Pavel Feldman <pfeldman@chromium.org> on 2011-11-07
Reviewed by Yury Semikhatsky.

Source/WebCore:

Tests: inspector/debugger/script-formatter-breakpoints.html
       inspector/debugger/script-formatter-console.html

* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._removeSourceFrame):

LayoutTests:

* inspector/debugger/script-formatter-breakpoints-expected.txt: Added.
* inspector/debugger/script-formatter-breakpoints.html: Added.
* inspector/debugger/script-formatter-console-expected.txt: Added.
* inspector/debugger/script-formatter-console.html: Added.
* inspector/debugger/script-formatter-expected.txt:
* inspector/debugger/script-formatter.html:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99405 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/debugger/script-formatter-breakpoints-expected.txt [new file with mode: 0644]
LayoutTests/inspector/debugger/script-formatter-breakpoints.html [new file with mode: 0644]
LayoutTests/inspector/debugger/script-formatter-console-expected.txt [new file with mode: 0644]
LayoutTests/inspector/debugger/script-formatter-console.html [new file with mode: 0644]
LayoutTests/inspector/debugger/script-formatter-expected.txt
LayoutTests/inspector/debugger/script-formatter.html
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/ScriptsPanel.js

index ea45095..a20b8a1 100644 (file)
@@ -1,3 +1,20 @@
+2011-11-07  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: split script-formatter test into multiple tests.
+        https://bugs.webkit.org/show_bug.cgi?id=71607
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/script-formatter-breakpoints-expected.txt: Added.
+        * inspector/debugger/script-formatter-breakpoints.html: Added.
+        * inspector/debugger/script-formatter-console-expected.txt: Added.
+        * inspector/debugger/script-formatter-console.html: Added.
+        * inspector/debugger/script-formatter-expected.txt:
+        * inspector/debugger/script-formatter.html:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+
 2011-11-07  Philippe Normand  <pnormand@igalia.com>
 
         Unreviewed, fast/dom/gc-11.html is now passing on GTK, it seems.
diff --git a/LayoutTests/inspector/debugger/script-formatter-breakpoints-expected.txt b/LayoutTests/inspector/debugger/script-formatter-breakpoints-expected.txt
new file mode 100644 (file)
index 0000000..ac90a0f
--- /dev/null
@@ -0,0 +1,15 @@
+Tests the script formatting is working fine with breakpoints.
+
+Debugger was enabled.
+
+Running: testBreakpointsInOriginalAndFormattedSource
+Script execution paused.
+Script execution resumed.
+Page reloaded.
+Navigated to test-navigation.html
+Page reloaded.
+Navigated back to test page.
+Script execution paused.
+Script execution resumed.
+Debugger was disabled.
+
diff --git a/LayoutTests/inspector/debugger/script-formatter-breakpoints.html b/LayoutTests/inspector/debugger/script-formatter-breakpoints.html
new file mode 100644 (file)
index 0000000..be9eb02
--- /dev/null
@@ -0,0 +1,96 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+
+<script>
+
+function f1()
+{
+    var a=0;var b=1;var c=3;var d=4;var e=5;
+    var f=0;
+    return 0;
+}
+
+function f2()
+{
+    var x = 0;
+    return 0;
+}
+
+var test = function()
+{
+    var panel = WebInspector.panels.scripts;
+
+    InspectorTest.runDebuggerTestSuite([
+        function testBreakpointsInOriginalAndFormattedSource(next)
+        {
+            var root;
+            InspectorTest.showScriptSource("script-formatter-breakpoints.html", didShowScriptSource);
+
+            function didShowScriptSource(sourceFrame)
+            {
+                root = sourceFrame._url.substr(0, sourceFrame._url.lastIndexOf("/") + 1);
+                InspectorTest.setBreakpoint(sourceFrame, 10, "", true);
+                InspectorTest.waitUntilPaused(pausedInF1);
+                InspectorTest.evaluateInPageWithTimeout("f1()");
+            }
+
+            function pausedInF1(callFrames)
+            {
+                InspectorTest.assertEquals("f1", callFrames[0].functionName);
+                InspectorTest.resumeExecution(resumed);
+            }
+
+            function resumed()
+            {
+                InspectorTest.navigate(root + "resources/test-navigation.html", didNavigateAnotherPage);
+            }
+
+            function didNavigateAnotherPage()
+            {
+                InspectorTest.addResult("Navigated to test-navigation.html");
+                panel._toggleFormatSource();
+                InspectorTest.showScriptSource("test-navigation.html", didShowAnotherPage);
+            }
+
+            function didShowAnotherPage(sourceFrame)
+            {
+                InspectorTest.navigate(root + "script-formatter-breakpoints.html", didNavigateBack);
+            }
+
+            function didNavigateBack()
+            {
+                InspectorTest.addResult("Navigated back to test page.");
+                InspectorTest.showScriptSource("script-formatter-breakpoints.html", didShowFormattedScriptSource);
+            }
+
+            function didShowFormattedScriptSource(sourceFrame)
+            {
+                // There should be no breakpoint in f1 since script is pretty-printed now.
+                InspectorTest.evaluateInPageWithTimeout("f1()");
+                InspectorTest.setBreakpoint(panel.visibleView, 24, "", true);
+                InspectorTest.waitUntilPaused(pausedInF2);
+                InspectorTest.evaluateInPageWithTimeout("f2()");
+            }
+
+            function pausedInF2(callFrames)
+            {
+                InspectorTest.assertEquals("f2", callFrames[0].functionName);
+                panel._toggleFormatSource();
+                InspectorTest.resumeExecution(next);
+            }
+        }
+    ]);
+}
+
+</script>
+
+</head>
+
+<body onload="runTest()">
+<p>Tests the script formatting is working fine with breakpoints.
+</p>
+
+</body>
+</html>
diff --git a/LayoutTests/inspector/debugger/script-formatter-console-expected.txt b/LayoutTests/inspector/debugger/script-formatter-console-expected.txt
new file mode 100644 (file)
index 0000000..6e35ff8
--- /dev/null
@@ -0,0 +1,10 @@
+CONSOLE MESSAGE: line 10: Test message.
+Tests that the script formatting changes console line numbers.
+
+Debugger was enabled.
+
+Running: testConsoleMessagesForFormattedScripts
+script-formatter-console.html:10
+script-formatter-console.html:13
+Debugger was disabled.
+
diff --git a/LayoutTests/inspector/debugger/script-formatter-console.html b/LayoutTests/inspector/debugger/script-formatter-console.html
new file mode 100644 (file)
index 0000000..4c46d5b
--- /dev/null
@@ -0,0 +1,63 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+
+<script>
+
+function f1()
+{
+    console.log("Test message.");
+}
+
+var test = function()
+{
+    var panel = WebInspector.panels.scripts;
+    var worker = new Worker("ScriptFormatterWorker.js");
+
+    InspectorTest.runDebuggerTestSuite([
+        function testConsoleMessagesForFormattedScripts(next)
+        {
+            InspectorTest.showScriptSource("script-formatter-console.html", didShowScriptSource);
+
+            function didShowScriptSource(sourceFrame)
+            {
+                InspectorTest.evaluateInPage("f1()", didEvaluate);
+            }
+
+            function didEvaluate()
+            {
+                dumpConsoleMessageURLs();
+                InspectorTest.addSniffer(WebInspector, "formatLinkText", setTimeout.bind(window, didFormatLinkText, 0));
+                panel._toggleFormatSource();
+            }
+
+            function didFormatLinkText()
+            {
+                dumpConsoleMessageURLs();
+                next();
+            }
+        }
+    ]);
+
+    function dumpConsoleMessageURLs()
+    {
+        var messages = WebInspector.console.messages;
+        for (var i = 0; i < messages.length; ++i) {
+            var element = messages[i].toMessageElement();
+            var anchor = element.querySelector(".console-message-url");
+            InspectorTest.addResult(anchor.textContent);
+        }
+    }
+}
+
+</script>
+
+</head>
+
+<body onload="runTest()">
+<p>Tests that the script formatting changes console line numbers.
+</p>
+
+</body>
+</html>
index a02ae81..188bb36 100644 (file)
@@ -1,4 +1,3 @@
-CONSOLE MESSAGE: line 24: Test message.
 Tests the script formatting functionality.
 
 Debugger was enabled.
@@ -15,19 +14,5 @@ function f() {
 function g() {
 }
 </script></body></html>
-
-Running: testBreakpointsInOriginalAndFormattedSource
-Script execution paused.
-Script execution resumed.
-Page reloaded.
-Navigated to test-navigation.html
-Page reloaded.
-Navigated back to test page.
-Script execution paused.
-Script execution resumed.
-
-Running: testConsoleMessagesForFormattedScripts
-script-formatter.html:24
-script-formatter.html:32
 Debugger was disabled.
 
index 3c95d46..f83762a 100644 (file)
@@ -6,24 +6,6 @@
 
 <script>
 
-function f1()
-{
-    var a=0;var b=1;var c=3;var d=4;var e=5;
-    var f=0;
-    return 0;
-}
-
-function f2()
-{
-    var x = 0;
-    return 0;
-}
-
-function f3()
-{
-    console.log("Test message.");
-}
-
 var test = function()
 {
     var panel = WebInspector.panels.scripts;
@@ -108,92 +90,6 @@ var test = function()
 
             var content = "<html><body><script>function f(){}<" + "/script><script>function g(){}<" + "/script></body></html>";
             worker.postMessage({ mimeType: "text/html", content: content });
-        },
-
-        function testBreakpointsInOriginalAndFormattedSource(next)
-        {
-            var root;
-            InspectorTest.showScriptSource("script-formatter.html", didShowScriptSource);
-
-            function didShowScriptSource(sourceFrame)
-            {
-                root = sourceFrame._url.substr(0, sourceFrame._url.lastIndexOf("/") + 1);
-                InspectorTest.setBreakpoint(sourceFrame, 11, "", true);
-                InspectorTest.waitUntilPaused(pausedInF1);
-                InspectorTest.evaluateInPageWithTimeout("f1()");
-            }
-
-            function pausedInF1(callFrames)
-            {
-                InspectorTest.assertEquals("f1", callFrames[0].functionName);
-                InspectorTest.resumeExecution(resumed);
-            }
-
-            function resumed()
-            {
-                InspectorTest.navigate(root + "resources/test-navigation.html", didNavigateAnotherPage);
-            }
-
-            function didNavigateAnotherPage()
-            {
-                InspectorTest.addResult("Navigated to test-navigation.html");
-                panel._toggleFormatSource();
-                InspectorTest.showScriptSource("test-navigation.html", didShowAnotherPage);
-            }
-
-            function didShowAnotherPage(sourceFrame)
-            {
-                InspectorTest.navigate(root + "script-formatter.html", didNavigateBack);
-            }
-
-            function didNavigateBack()
-            {
-                InspectorTest.addResult("Navigated back to test page.");
-                InspectorTest.showScriptSource("script-formatter.html", didShowFormattedScriptSource);
-            }
-
-            function didShowFormattedScriptSource(sourceFrame)
-            {
-                // There should be no breakpoint in f1 since script is pretty-printed now.
-                InspectorTest.evaluateInPageWithTimeout("f1()");
-                InspectorTest.setBreakpoint(panel.visibleView, 24, "", true);
-                InspectorTest.waitUntilPaused(pausedInF2);
-                InspectorTest.evaluateInPageWithTimeout("f2()");
-            }
-
-            function pausedInF2(callFrames)
-            {
-                InspectorTest.assertEquals("f2", callFrames[0].functionName);
-                panel._toggleFormatSource();
-                InspectorTest.resumeExecution(next);
-            }
-        },
-
-        function testConsoleMessagesForFormattedScripts(next)
-        {
-            function dumpConsoleMessageURLs()
-            {
-                var messages = WebInspector.console.messages;
-                for (var i = 0; i < messages.length; ++i) {
-                    var element = messages[i].toMessageElement();
-                    var anchor = element.querySelector(".console-message-url");
-                    InspectorTest.addResult(anchor.textContent);
-                }
-            }
-            InspectorTest.evaluateInPage("f3()", didEvaluate);
-
-            function didEvaluate()
-            {
-                dumpConsoleMessageURLs();
-                InspectorTest.addSniffer(WebInspector, "formatLinkText", setTimeout.bind(window, didFormatLinkText, 0));
-                panel._toggleFormatSource();
-            }
-
-            function didFormatLinkText()
-            {
-                dumpConsoleMessageURLs();
-                next();
-            }
         }
     ]);
 }
index b8a57f1..077d972 100644 (file)
@@ -486,5 +486,3 @@ fast/canvas/webgl/uniform-location-length-limits.html
 # It needs a rebaseline
 fast/repaint/table-extra-bottom-grow.html
 
-# https://bugs.webkit.org/show_bug.cgi?id=71581
-inspector/debugger/script-formatter.html
index 071ba81..99f281f 100644 (file)
@@ -2432,10 +2432,6 @@ editing/pasteboard/smart-paste-008.html
 # https://bugs.webkit.org/show_bug.cgi?id=69719
 fast/text/line-initial-and-final-swashes.html
 
-# [Qt] inspector/debugger/script-formatter.html failed after r97056
-# https://bugs.webkit.org/show_bug.cgi?id=69757
-inspector/debugger/script-formatter.html
-
 # [Qt] Assertion fail in CSSPrimitiveValue ctor
 # https://bugs.webkit.org/show_bug.cgi?id=69933
 fast/borders/inline-mask-overlay-image-outset-vertical-rl.html
index da5256f..a3e226c 100644 (file)
@@ -1444,5 +1444,3 @@ fast/events/platform-wheelevent-paging-y-in-non-scrolling-page.html
 fast/events/platform-wheelevent-paging-y-in-scrolling-div.html
 fast/events/platform-wheelevent-paging-y-in-scrolling-page.html
 
-# https://bugs.webkit.org/show_bug.cgi?id=71581
-inspector/debugger/script-formatter.html
index b5d3470..61ceb03 100644 (file)
@@ -1,3 +1,16 @@
+2011-11-07  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: split script-formatter test into multiple tests.
+        https://bugs.webkit.org/show_bug.cgi?id=71607
+
+        Reviewed by Yury Semikhatsky.
+
+        Tests: inspector/debugger/script-formatter-breakpoints.html
+               inspector/debugger/script-formatter-console.html
+
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._removeSourceFrame):
+
 2011-11-07  Keishi Hattori  <keishi@webkit.org>
 
         Change ColorChooser from singleton to ordinary object
index b804a33..a28fb7a 100644 (file)
@@ -657,7 +657,8 @@ WebInspector.ScriptsPanel.prototype = {
     _removeSourceFrame: function(uiSourceCode)
     {
         var option = uiSourceCode._option;
-        if (option)
+        // FIXME: find out why we are getting here with option detached.
+        if (option && this._filesSelectElement === option.parentElement)
             this._filesSelectElement.removeChild(option);
 
         var sourceFrame = uiSourceCode._sourceFrame;