3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/console-test.js"></script>
5 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
8 function nonFormattedFunction() { var i
= 2 + 2; var a
= 4; return a
+ i
; }
12 console
.error("Test message.");
17 if (window
.testRunner
) {
18 testRunner
.waitUntilDone();
19 testRunner
.showWebInspector();
26 var panel
= WebInspector
.panels
.sources
;
30 InspectorTest
.runDebuggerTestSuite([
31 function testSetup(next
)
33 InspectorTest
.scriptFormatter().then(function(sf
) {
39 function testConsoleMessagesForFormattedScripts(next
)
41 InspectorTest
.showScriptSource("script-formatter-console.html", didShowScriptSource
);
43 function didShowScriptSource(frame
)
46 InspectorTest
.evaluateInPage("f1()", didEvaluate
);
49 function didEvaluate()
51 dumpConsoleMessageURLs();
52 InspectorTest
.addResult("Pre-format row message list:");
53 InspectorTest
.addResult(JSON
.stringify(Object
.keys(sourceFrame
._rowMessageBuckets
)));
54 InspectorTest
.addSniffer(WebInspector
.ScriptFormatterEditorAction
.prototype, "_updateButton", uiSourceCodeScriptFormatted
);
55 scriptFormatter
._toggleFormatScriptSource();
58 function uiSourceCodeScriptFormatted()
60 dumpConsoleMessageURLs();
61 InspectorTest
.addResult("Post-format row message list:");
62 var formattedSourceFrame
= panel
.visibleView
;
63 InspectorTest
.addResult(JSON
.stringify(Object
.keys(formattedSourceFrame
._rowMessageBuckets
)));
69 function dumpConsoleMessageURLs()
71 var messages
= WebInspector
.ConsolePanel
._view()._visibleViewMessages
;
72 for (var i
= 0; i
< messages
.length
; ++i
) {
73 var element
= messages
[i
].toMessageElement();
74 var anchor
= element
.querySelector(".console-message-url");
75 InspectorTest
.addResult(anchor
.textContent
);
84 <body onload=
"onload()">
85 <p>Tests that the script formatting changes console line numbers.