Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / script-formatter-breakpoints-4.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 src="resources/unformatted4.js"></script>
6
7 <script>
8
9 function f1()
10 {
11     var a=0;var b=1;var c=3;var d=4;var e=5;
12     var f=0;
13     return 0;
14 }
15
16 var test = function()
17 {
18     WebInspector.breakpointManager._storage._breakpoints = {};
19     var panel = WebInspector.inspectorView.showPanel("sources");
20     var scriptFormatter = InspectorTest.scriptFormatter();
21
22     InspectorTest.runDebuggerTestSuite([
23         function testBreakpointSetInOriginalAndRemovedInFormatted(next)
24         {
25             InspectorTest.showScriptSource("script-formatter-breakpoints-4.html", didShowScriptSource);
26
27             function didShowScriptSource(sourceFrame)
28             {
29                 InspectorTest.addResult("Adding breakpoint.");
30                 InspectorTest.addSniffer(WebInspector.BreakpointManager.Breakpoint.prototype, "_addResolvedLocation", breakpointResolved);
31                 InspectorTest.setBreakpoint(sourceFrame, 11, "", true);
32             }
33
34             function breakpointResolved()
35             {
36                 InspectorTest.addResult("Formatting.");
37                 InspectorTest.addSniffer(WebInspector.ScriptFormatterEditorAction.prototype, "_updateButton", uiSourceCodeScriptFormatted);
38                 scriptFormatter._toggleFormatScriptSource();
39             }
40
41             function uiSourceCodeScriptFormatted()
42             {
43                 InspectorTest.addResult("Removing breakpoint.");
44                 var formattedSourceFrame = panel.visibleView;
45                 InspectorTest.removeBreakpoint(formattedSourceFrame, 16);
46                 InspectorTest.addResult("Unformatting.");
47                 scriptFormatter._discardFormattedUISourceCodeScript(panel.visibleView.uiSourceCode());
48                 var breakpoints = WebInspector.breakpointManager._storage._setting.get();
49                 InspectorTest.assertEquals(breakpoints.length, 0, "There should not be any breakpoints in the storage.");
50                 next();
51             }
52         }
53     ]);
54
55 }
56 </script>
57 </head>
58 <body onload="runTest()">
59 <p>Tests the script formatting is working fine with breakpoints.
60 </p>
61 </body>
62 </html>