Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / pretty-print-javascript-5.html
blob8bee335d5e9f116b1416ad74b2b316656ebc38de
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 src="../../http/tests/inspector/sources-test.js"></script>
6 <script src="debugger/resources/obfuscated.js"></script>
8 <script>
10 function test()
12 var testJSFormatter = InspectorTest.testPrettyPrint.bind(InspectorTest, "text/javascript");
14 InspectorTest.runTestSuite([
15 function forInFormatting(next)
17 var mappingQueries = ["myMap", "print"];
18 testJSFormatter("for(var key in myMap)print(key);", mappingQueries, next);
21 function forOfFormatting(next)
23 var mappingQueries = ["myMap", "print"];
24 testJSFormatter("for(var value of myMap)print(value);", mappingQueries, next);
27 function commaBetweenStatementsFormatting(next)
29 var mappingQueries = ["noop", "hasNew"];
30 testJSFormatter("rebuild(),show(),hasNew?refresh():noop();", mappingQueries, next);
33 function complexScriptFormatting(next)
35 InspectorTest.showScriptSource("obfuscated.js", didShowScriptSource);
37 function didShowScriptSource(sourceFrame)
39 var mappingQueries = [
40 "function",
41 "formatted1",
42 "variable1",
43 " return \"functionWithComments\"",
44 "onmessage",
45 "indent_start",
46 "function require",
47 "var regexp",
48 "importScripts",
49 "formatted2"
51 testJSFormatter(sourceFrame._textEditor.text(), mappingQueries, next);
55 function ifStatementIndentRegression(next)
57 var mappingQueries = ["pretty", "reset"];
58 testJSFormatter("{if (a>b){a();pretty();}else if (a+b)e();reset();}", mappingQueries, next);
60 ]);
63 </script>
65 </head>
67 <body onload="runTest()">
68 <p>Verifies JavaScript pretty-printing functionality.</p>
69 </body>
70 </html>