Upstream version 8.37.180.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.experimentsSettings.frameworksDebuggingSupport.enableForTest();
39     WebInspector.settings.skipStackFramesSwitch.set(true);
40     WebInspector.settings.skipStackFramesPattern.set(frameworkRegexString);
41
42     InspectorTest.setQuiet(true);
43     InspectorTest.startDebuggerTest(step1);
44
45     function step1()
46     {
47         DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, step2);
48     }
49
50     function step2()
51     {
52         InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
53     }
54
55     function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
56     {
57         InspectorTest.captureStackTrace(callFrames, asyncStackTrace, { "dropFrameworkCallFrames": false });
58         InspectorTest.addResult("\nPrinting visible call stack:");
59         InspectorTest.captureStackTrace(callFrames, asyncStackTrace, { "dropFrameworkCallFrames": true });
60         InspectorTest.completeDebuggerTest();
61     }
62 }
63
64 </script>
65 </head>
66
67 <body onload="runTest()">
68 <input type='button' onclick='testFunction()' value='Test'/>
69 <p>
70 Tests the async call stacks and framework black-boxing features working together.
71 </p>
72 </body>
73 </html>