- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / debugger / script-formatter-console.html
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 var test = function()
15 {
16     var panel = WebInspector.panels.sources;
17     var worker = new Worker("ScriptFormatterWorker.js");
18     var sourceFrame;
19
20     InspectorTest.runDebuggerTestSuite([
21         function testConsoleMessagesForFormattedScripts(next)
22         {
23             InspectorTest.showScriptSource("script-formatter-console.html", didShowScriptSource);
24
25             function didShowScriptSource(frame)
26             {
27                 sourceFrame = frame;
28                 InspectorTest.evaluateInPage("f1()", didEvaluate);
29             }
30
31             function didEvaluate()
32             {
33                 dumpConsoleMessageURLs();
34                 InspectorTest.addResult("Pre-format row message list:");
35                 InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._rowMessages)));
36                 InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._messageBubbles)));
37                 InspectorTest.addSniffer(WebInspector.UISourceCode.prototype, "updateLiveLocations", didFormatLinkText);
38                 sourceFrame._uiSourceCode.setFormatted(true);
39             }
40
41             function didFormatLinkText()
42             {
43                 dumpConsoleMessageURLs();
44                 InspectorTest.addResult("Post-format row message list:");
45                 InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._rowMessages)));
46                 InspectorTest.addResult(JSON.stringify(Object.keys(sourceFrame._messageBubbles)));
47                 next();
48             }
49         }
50     ]);
51
52     function dumpConsoleMessageURLs()
53     {
54         var messages = WebInspector.console.messages;
55         for (var i = 0; i < messages.length; ++i) {
56             var element = messages[i].toMessageElement();
57             var anchor = element.querySelector(".console-message-url");
58             InspectorTest.addResult(anchor.textContent);
59         }
60     }
61 }
62
63 </script>
64
65 </head>
66
67 <body onload="runTest()">
68 <p>Tests that the script formatting changes console line numbers.
69 </p>
70
71 </body>
72 </html>