OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | |
5 <script> | |
6 | |
7 function nonFormattedFunction() { var i = 2 + 2; var a = 4; return a + i; } | |
8 | |
9 function f1() | |
10 { | |
11 console.error("Test message."); | |
12 } | |
13 | |
14 function onload() | |
15 { | |
16 if (window.testRunner) { | |
17 testRunner.waitUntilDone(); | |
18 testRunner.showWebInspector(); | |
19 } | |
20 runTest(); | |
21 } | |
22 | |
23 var test = function() | |
24 { | |
25 var panel = WebInspector.inspectorView.showPanel("sources"); | |
26 var worker = new Worker("ScriptFormatterWorker.js"); | |
27 var sourceFrame; | |
28 var scriptFormatter = InspectorTest.scriptFormatter(); | |
29 | |
30 InspectorTest.runDebuggerTestSuite([ | |
31 function testConsoleMessagesForFormattedScripts(next) | |
32 { | |
33 InspectorTest.showScriptSource("script-formatter-console.html", didS
howScriptSource); | |
34 | |
35 function didShowScriptSource(frame) | |
36 { | |
37 sourceFrame = frame; | |
38 InspectorTest.evaluateInPage("f1()", didEvaluate); | |
39 } | |
40 | |
41 function didEvaluate() | |
42 { | |
43 dumpConsoleMessageURLs(); | |
44 InspectorTest.addResult("Pre-format row message list:"); | |
45 InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._
rowMessages))); | |
46 InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._
messageBubbles))); | |
47 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorActio
n.prototype, "_updateButton", uiSourceCodeScriptFormatted); | |
48 scriptFormatter._toggleFormatScriptSource(); | |
49 } | |
50 | |
51 function uiSourceCodeScriptFormatted() | |
52 { | |
53 dumpConsoleMessageURLs(); | |
54 InspectorTest.addResult("Post-format row message list:"); | |
55 var formattedSourceFrame = panel.visibleView; | |
56 InspectorTest.addResult(JSON.stringify(Object.keys(formattedSour
ceFrame._rowMessages))); | |
57 InspectorTest.addResult(JSON.stringify(Object.keys(formattedSour
ceFrame._messageBubbles))); | |
58 next(); | |
59 } | |
60 } | |
61 ]); | |
62 | |
63 function dumpConsoleMessageURLs() | |
64 { | |
65 WebInspector.inspectorView.panel("console"); | |
66 var messages = WebInspector.ConsolePanel._view()._visibleViewMessages; | |
67 for (var i = 0; i < messages.length; ++i) { | |
68 var element = messages[i].toMessageElement(); | |
69 var anchor = element.querySelector(".console-message-url"); | |
70 InspectorTest.addResult(anchor.textContent); | |
71 } | |
72 } | |
73 } | |
74 | |
75 </script> | |
76 | |
77 </head> | |
78 | |
79 <body onload="onload()"> | |
80 <p>Tests that the script formatting changes console line numbers. | |
81 </p> | |
82 | |
83 </body> | |
84 </html> | |
OLD | NEW |