edc72dffe6698a807dc96f0e1c519db27c00d10a
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / frameworks-steppings.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     debugger;
11     Framework.safeRun(function callback1() {
12         Framework.safeRun(Framework.empty, callback2);
13     });
14 }
15
16 function callback2()
17 {
18     Framework.safeRun(Framework.empty, Framework.empty); // Should be skipped: all callbacks are inside frameworks.
19     Framework.safeRun(Framework.empty, Framework.throwFrameworkException, callback3); // Should be enough to step into callback3
20 }
21
22 function callback3()
23 {
24     var func = Framework.bind(callback4, null, 1);
25     func = Framework.bind(func, null, 2);
26     func = Framework.bind(func, null, 3);
27     Framework.safeRun(func, Framework.doSomeWork);
28 }
29
30 function callback4()
31 {
32     Framework.safeRun(Framework.doSomeWork, function() {
33         return 0; // Should NOT step into this callback (otherwise too many StepIns)
34     });
35     try {
36         Framework.throwFrameworkException("message");
37     } catch (e) {
38         window.ex = e;
39     }
40 }
41
42 function test()
43 {
44     var frameworkRegexString = "/framework\\.js$";
45     WebInspector.settings.skipStackFramesPattern.set(frameworkRegexString);
46
47     InspectorTest.setQuiet(true);
48     InspectorTest.startDebuggerTest(step1);
49
50     function step1()
51     {
52         InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
53     }
54
55     function step2()
56     {
57         var actions = [
58             "Print", // debugger;
59             "StepInto", "StepInto", "Print", // callback1
60             "StepInto", "Print", // callback2
61             "StepInto", "Print", // callback2, skipped
62             "StepInto", "Print", // callback3
63             "StepInto", "StepInto", "StepInto", "StepInto", "Print", // callback4
64             "StepInto", "Print", // callback4, skipped
65             "StepInto", "Print", // callback4, inside catch
66             "StepOut", "Print", // return to callback3
67             "StepOver", "Print", // return to callback2
68             "StepInto", "Print", // return to callback1
69         ];
70         InspectorTest.waitUntilPausedAndPerformSteppingActions(actions, step3);
71     }
72
73     function step3()
74     {
75         InspectorTest.completeDebuggerTest();
76     }
77 }
78
79 </script>
80 </head>
81
82 <body onload="runTest()">
83 <input type='button' onclick='testFunction()' value='Test'/>
84 <p>
85 Tests stepping into/over/out with framework black-boxing.
86 </p>
87 </body>
88 </html>