Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-async / async-callstack-events.html
blob05b1d1d53b66a4ad457e861f845ecf7abcb6e70a
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>
7 function testFunction()
9 for (var name in window) {
10 if (/^doTest[A-Z]/.test(name) && typeof window[name] === "function")
11 window[name]();
15 function setSelection(start, end)
17 var node = document.getElementById("content").firstChild;
18 var range = document.createRange();
19 range.setStart(node, start);
20 range.setEnd(node, end);
21 var selection = window.getSelection();
22 selection.removeAllRanges();
23 if (start !== end)
24 selection.addRange(range);
27 function doTestSelectionChange()
29 setSelection(0, 0);
30 document.addEventListener("selectionchange", onSelectionChange, false);
31 setSelection(0, 4);
32 setSelection(0, 8);
33 setSelection(0, 0);
36 function onSelectionChange()
38 document.removeEventListener("selectionchange", onSelectionChange, false);
39 debugger;
42 function doTestHashChange()
44 window.addEventListener("hashchange", onHashChange1, false);
45 window.addEventListener("hashchange", onHashChange2, true);
46 location.hash = location.hash + "x";
49 function onHashChange1()
51 window.removeEventListener("hashchange", onHashChange1, false);
52 debugger;
55 function onHashChange2()
57 window.removeEventListener("hashchange", onHashChange2, true);
58 debugger;
61 function doTestMediaEvents()
63 var video = document.getElementById("video");
64 video.addEventListener("play", onVideoPlay, false);
65 video.play();
68 function onVideoPlay()
70 video.removeEventListener("play", onVideoPlay, false);
71 debugger;
74 var test = function()
76 var totalDebuggerStatements = 4;
77 var maxAsyncCallStackDepth = 4;
78 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallStackDepth);
81 </script>
82 </head>
84 <body onload="runTest()">
85 <video id="video" src="../../../media/content/test.ogv"></video>
86 <p id="content">
87 Tests asynchronous call stacks for various DOM events.
88 </p>
89 </body>
90 </html>