Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / skip-stack-frames-steps.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/framework.js"></script>
6 <script>
7
8 function testFunction()
9 {
10     for (var i = 1, func; func = eval("typeof test" + i + " === 'function' && test" + i); ++i)
11         func();
12 }
13
14 function callback()
15 {
16     return 0;
17 }
18
19 function test1()
20 {
21     debugger;
22     Framework.empty();
23 }
24
25 function test2()
26 {
27     debugger;
28     Framework.doSomeWork();
29 }
30
31 function test3()
32 {
33     debugger;
34     Framework.safeRun(Framework.empty, callback); // Should step into callback
35 }
36
37 function test4()
38 {
39     debugger;
40     Framework.safeRun(Framework.doSomeWork, callback); // Should NOT step into callback (otherwise too many StepIns)
41 }
42
43 function test5()
44 {
45     debugger;
46     Framework.safeRun(Framework.empty, Framework.throwFrameworkException, callback); // Should be enough to step into callback
47 }
48
49 function test()
50 {
51     var frameworkRegexString = "/framework\\.js$";
52     var totalDebuggerStatements = 5;
53
54     InspectorTest.setQuiet(true);
55     InspectorTest.startDebuggerTest(step1);
56
57     function step1()
58     {
59         DebuggerAgent.skipStackFrames(frameworkRegexString, step2);
60     }
61
62     function step2()
63     {
64         InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
65     }
66
67     var step = 0;
68     var stepInCount = 0;
69     function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
70     {
71         if (stepInCount < 2) {
72             ++stepInCount;
73             WebInspector.panels.sources._stepIntoButton.element.click();
74             InspectorTest.waitUntilResumed(InspectorTest.waitUntilPaused.bind(InspectorTest, didPause));
75             return;
76         }
77
78         stepInCount = 0;
79         InspectorTest.captureStackTrace(callFrames);
80         InspectorTest.addResult("");
81         if (++step < totalDebuggerStatements)
82             InspectorTest.resumeExecution(InspectorTest.waitUntilPaused.bind(InspectorTest, didPause));
83         else
84             InspectorTest.completeDebuggerTest();
85     }
86 }
87
88 </script>
89 </head>
90
91 <body onload="runTest()">
92 <input type='button' onclick='testFunction()' value='Test'/>
93 <p>
94 Tests the skip stack frames feature when stepping.
95 </p>
96 </body>
97 </html>