3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
7 function testFunction()
9 var proto
= Object
.create(HTMLElement
.prototype);
10 proto
.createdCallback
= function createdCallback()
12 output('Invoked createdCallback.');
14 proto
.attachedCallback
= function attachedCallback()
16 output('Invoked attachedCallback.');
18 proto
.detachedCallback
= function detachedCallback()
20 output('Invoked detachedCallback.');
22 proto
.attributeChangedCallback
= function attributeChangedCallback()
24 output('Invoked attributeChangedCallback.');
26 var FooElement
= document
.registerElement('x-foo', { prototype: proto
});
28 var foo
= new FooElement();
30 foo
.setAttribute('a', 'b');
32 document
.body
.appendChild(foo
);
39 InspectorTest
.startDebuggerTest(step1
, true);
43 InspectorTest
.runTestFunctionAndWaitUntilPaused(step2
);
46 function checkTopFrameFunction(callFrames
, expectedName
)
48 var topFunctionName
= callFrames
[0].functionName
;
49 if (expectedName
=== topFunctionName
)
50 InspectorTest
.addResult("PASS: Did step into event listener(" + expectedName
+ ").");
52 InspectorTest
.addResult("FAIL: Unexpected top function: expected " + expectedName
+ ", found " + topFunctionName
);
55 function stepOverThenIn(name
, callback
)
57 InspectorTest
.addResult("Stepping to " + name
+ "...");
58 WebInspector
.panels
.sources
._stepOverButton
.element
.click();
59 InspectorTest
.waitUntilResumed(InspectorTest
.waitUntilPaused
.bind(InspectorTest
, function() {
60 InspectorTest
.addResult("Stepping into " + name
+ "...");
61 WebInspector
.panels
.sources
._stepIntoButton
.element
.click();
62 InspectorTest
.waitUntilResumed(InspectorTest
.waitUntilPaused
.bind(InspectorTest
, callback
));
68 stepOverThenIn('constructor', step3
);
71 function step3(callFrames
)
73 checkTopFrameFunction(callFrames
, 'createdCallback');
74 InspectorTest
.resumeExecution(InspectorTest
.waitUntilPaused
.bind(InspectorTest
, step4
));
79 stepOverThenIn('setAttribute', step5
);
82 function step5(callFrames
)
84 checkTopFrameFunction(callFrames
, 'attributeChangedCallback');
85 InspectorTest
.resumeExecution(InspectorTest
.waitUntilPaused
.bind(InspectorTest
, step6
));
90 stepOverThenIn('attachedCallback', step7
);
93 function step7(callFrames
)
95 checkTopFrameFunction(callFrames
, 'attachedCallback');
96 InspectorTest
.resumeExecution(InspectorTest
.waitUntilPaused
.bind(InspectorTest
, step8
));
101 stepOverThenIn('detachedCallback', step9
);
104 function step9(callFrames
)
106 checkTopFrameFunction(callFrames
, 'detachedCallback');
107 InspectorTest
.completeDebuggerTest();
114 <body onload=
"runTest()">
116 Tests that stepping into custom element methods will lead to a pause in the callbacks.