3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
7 function nonFormattedFunction() { var i = 2 + 2; var a = 4; return a + i; }
11 console.error("Test message.");
16 if (window.testRunner) {
17 testRunner.waitUntilDone();
18 testRunner.showWebInspector();
25 var panel = WebInspector.inspectorView.showPanel("sources");
27 var scriptFormatter = InspectorTest.scriptFormatter();
29 InspectorTest.runDebuggerTestSuite([
30 function testConsoleMessagesForFormattedScripts(next)
32 InspectorTest.showScriptSource("script-formatter-console.html", didShowScriptSource);
34 function didShowScriptSource(frame)
37 InspectorTest.evaluateInPage("f1()", didEvaluate);
40 function didEvaluate()
42 dumpConsoleMessageURLs();
43 InspectorTest.addResult("Pre-format row message list:");
44 InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._rowMessageBuckets)));
45 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorAction.prototype, "_updateButton", uiSourceCodeScriptFormatted);
46 scriptFormatter._toggleFormatScriptSource();
49 function uiSourceCodeScriptFormatted()
51 dumpConsoleMessageURLs();
52 InspectorTest.addResult("Post-format row message list:");
53 var formattedSourceFrame = panel.visibleView;
54 InspectorTest.addResult(JSON.stringify(Object.keys(formattedSourceFrame._rowMessageBuckets)));
60 function dumpConsoleMessageURLs()
62 WebInspector.inspectorView.panel("console");
63 var messages = WebInspector.ConsolePanel._view()._visibleViewMessages;
64 for (var i = 0; i < messages.length; ++i) {
65 var element = messages[i].toMessageElement();
66 var anchor = element.querySelector(".console-message-url");
67 InspectorTest.addResult(anchor.textContent);
76 <body onload="onload()">
77 <p>Tests that the script formatting changes console line numbers.