Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / sources / debugger / custom-element-lifecycle-events.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>
6
7 function test() {
8     var setup = [
9         "var proto = Object.create(HTMLElement.prototype);",
10         "proto.createdCallback = function() { output('Invoked createdCallback.'); };",
11         "proto.attachedCallback = function() { output('Invoked attachedCallback.'); };",
12         "proto.detachedCallback = function() { output('Invoked detachedCallback.'); };",
13         "proto.attributeChangedCallback = function() { output('Invoked attributeChangedCallback.'); };",
14         "CustomElement = document.registerElement('x-foo', {prototype: proto});",
15     ].join('\n');
16
17     var lifecycleCallbacks = [
18         "created = new CustomElement();",
19         "created.setAttribute('x', '1');",
20         "document.body.appendChild(created);",
21         "created.remove();",
22     ].join('\n');
23
24     InspectorTest.startDebuggerTest(step1);
25
26     function step1() {
27         InspectorTest.evaluateInConsole(setup, function() {
28             InspectorTest.addResult("Custom element registered.");
29             InspectorTest.evaluateInConsoleAndDump("new CustomElement() instanceof CustomElement", step2);
30         });
31     }
32
33     function step2() {
34         InspectorTest.evaluateInConsole('debugger;');
35         InspectorTest.waitUntilPaused(step3);
36     }
37
38     function step3() {
39         InspectorTest.evaluateInConsoleAndDump("new CustomElement() instanceof CustomElement", step4);
40     }
41
42     function step4() {
43         InspectorTest.evaluateInConsole(lifecycleCallbacks, InspectorTest.completeDebuggerTest);
44     }
45 }
46
47 </script>
48 </head>
49
50 <body onload="runTest()">
51 <p>
52 Tests that custom element lifecycle events fire while debugger is paused.
53 </p>
54
55 </body>
56 </html>