Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-async / async-callstack-in-console.html
blobbe8b774bbba091d8639b119e65b2ca9c12ccb572
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="../../../http/tests/inspector/console-test.js"></script>
6 <script>
8 function testFunction()
10 debugger;
11 console.clear();
12 setTimeout(timeout1, 0);
15 function timeout1()
17 console.trace();
18 setTimeout(timeout2, 0);
21 function timeout2()
23 setTimeout(timeout3, 0);
24 throw Error("foo");
27 function timeout3()
29 console.trace();
30 var iframeWidnow = document.getElementById("iframe").contentWindow;
31 tryPostMessage(iframeWidnow, "http://www.example.com");
34 function tryPostMessage(win, origin)
36 try {
37 win.postMessage("Trying origin=" + origin, origin);
38 } catch(ex) {
39 console.error("FAIL: Error sending message to " + origin + ". " + ex);
43 var test = function()
45 var maxAsyncCallStackDepth = 4;
46 var numberOfConsoleMessages = 5;
48 InspectorTest.setQuiet(true);
49 InspectorTest.startDebuggerTest(step1);
51 function step1()
53 InspectorTest.DebuggerAgent.setPauseOnExceptions(WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions);
54 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(0);
55 InspectorTest.runTestFunctionAndWaitUntilPaused(step2);
58 function step2()
60 InspectorTest.DebuggerAgent.setAsyncCallStackDepth(maxAsyncCallStackDepth, didPause);
63 function didPause()
65 InspectorTest.waitUntilNthMessageReceived(numberOfConsoleMessages, expandAndDumpConsoleMessages);
66 InspectorTest.resumeExecution();
69 function expandAndDumpConsoleMessages()
71 InspectorTest.expandConsoleMessages(dumpConsoleMessages);
74 function dumpConsoleMessages()
76 InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textContentWithLineBreaks);
77 InspectorTest.completeDebuggerTest();
81 </script>
82 </head>
84 <body onload="runTest()">
85 <p>
86 Tests asynchronous call stacks printed in console.
87 </p>
88 <div><iframe src="../debugger/resources/post-message-listener.html"
89 id="iframe" width="800" height="100" style="border: 1px solid black;">
90 </iframe></div>
91 </body>
92 </html>