Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / frameworks-with-async-callstack.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 window.callbackFromFramework = function(next)
9 {
10     return next();
11 }
12
13 function testFunction()
14 {
15     setTimeout(timeout1, 0);
16 }
17
18 function timeout1()
19 {
20     Framework.safeRun(Framework.empty, callback1);
21 }
22
23 function callback1()
24 {
25     Framework.doSomeAsyncChainCalls(callback2);
26 }
27
28 function callback2()
29 {
30     debugger;
31 }
32
33 function test()
34 {
35     var frameworkRegexString = "/framework\\.js$";
36     var maxAsyncCallStackDepth = 4;
37
38     WebInspector.settings.skipStackFramesPattern.set(frameworkRegexString);
39
40     InspectorTest.setQuiet(true);
41     InspectorTest.startDebuggerTest(step1);
42
43     function step1()
44     {
45         DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, step2);
46     }
47
48     function step2()
49     {
50         InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
51     }
52
53     function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
54     {
55         InspectorTest.captureStackTrace(callFrames, asyncStackTrace, { "dropFrameworkCallFrames": false });
56         InspectorTest.addResult("\nPrinting visible call stack:");
57         InspectorTest.captureStackTrace(callFrames, asyncStackTrace, { "dropFrameworkCallFrames": true });
58         InspectorTest.completeDebuggerTest();
59     }
60 }
61
62 </script>
63 </head>
64
65 <body onload="runTest()">
66 <input type='button' onclick='testFunction()' value='Test'/>
67 <p>
68 Tests the async call stacks and framework black-boxing features working together.
69 </p>
70 </body>
71 </html>