Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / debugger-disable-add-breakpoint.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 testFunction()
8 {
9     return 0;
10 }
11
12 var test = function()
13 {
14     var testName = WebInspector.resourceTreeModel.inspectedPageURL();
15     testName = testName.substring(testName.lastIndexOf('/') + 1);
16     InspectorTest.startDebuggerTest(step1);
17     var testSourceFrame;
18     function step1()
19     {
20         InspectorTest.showScriptSource(testName, step2);
21     }
22
23     function step2(sourceFrame)
24     {
25         testSourceFrame = sourceFrame;
26         InspectorTest.addResult("Main resource was shown.");
27         WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, step3, this);
28         WebInspector.debuggerModel.disableDebugger();
29     }
30
31     function step3()
32     {
33         WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, step3, this);
34         InspectorTest.addResult("Debugger disabled.");
35         InspectorTest.setBreakpoint(testSourceFrame, 8, "", true);
36         InspectorTest.addResult("Breakpoint added");
37         WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, step4, this);
38         WebInspector.debuggerModel.enableDebugger();
39     }
40
41     function step4()
42     {
43         WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, step4, this);
44         InspectorTest.addResult("Debugger was enabled");
45         InspectorTest.runTestFunctionAndWaitUntilPaused(step5);
46     }
47
48     function step5()
49     {
50         InspectorTest.resumeExecution(step6);
51     }
52
53     function step6()
54     {
55         InspectorTest.addResult("Disable debugger again");
56         WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled, step7, this);
57         WebInspector.debuggerModel.disableDebugger();
58     }
59
60     function step7()
61     {
62         InspectorTest.addResult("Debugger disabled");
63         var breakpoint = WebInspector.breakpointManager.findBreakpointOnLine(testSourceFrame.uiSourceCode(), 8);
64         breakpoint.remove();
65         InspectorTest.addResult("Breakpoint removed");
66         WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled, step8, this);
67         WebInspector.debuggerModel.enableDebugger();
68     }
69
70     function step8()
71     {
72         InspectorTest.addResult("Debugger enabled");
73         InspectorTest.addResult("Evaluating test function.");
74         InspectorTest.evaluateInConsole("testFunction()", step9);
75     }
76
77     function step9()
78     {
79         InspectorTest.addResult("function evaluated without a pause on the breakpoint.")
80         InspectorTest.completeDebuggerTest();
81     }
82 };
83
84 </script>
85 </head>
86
87 <body onload="runTest()">
88 <p>
89 Tests that breakpoints are correctly handled while debugger is turned off</a>
90 </p>
91 </body>
92 </html>