| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../http/tests/inspector/elements-test.js"></script> |
| 5 | |
| 6 <script> | 5 <script> |
| 7 | 6 |
| 8 function click() | 7 function click() |
| 9 { | 8 { |
| 10 var target = document.getElementById("host"); | 9 var target = document.getElementById("inspected"); |
| 11 var rect = target.getBoundingClientRect(); | 10 var rect = target.getBoundingClientRect(); |
| 12 // Simulate the mouse click over the target to trigger an event dispatch. | 11 // Simulate the mouse click over the target to trigger an event dispatch. |
| 13 if (window.eventSender) { | 12 eventSender.mouseMoveTo(rect.left + 10, rect.top + 10); |
| 14 window.eventSender.mouseMoveTo(rect.left + 10, rect.top + 10); | 13 eventSender.mouseDown(); |
| 15 window.eventSender.mouseDown(); | 14 eventSender.mouseUp(); |
| 16 window.eventSender.mouseUp(); | |
| 17 } | |
| 18 } | 15 } |
| 19 | 16 |
| 20 function test() | 17 function test() |
| 21 { | 18 { |
| 22 InspectorTest.domModel.setInspectMode(DOMAgent.InspectMode.SearchForNode, st
ep2); | 19 InspectorTest.cpuProfilerModel.startRecording(); |
| 20 InspectorTest.cpuProfilerModel.stopRecording(); |
| 21 InspectorTest.domModel.setInspectMode(DOMAgent.InspectMode.SearchForNode, cl
ickAtInspected); |
| 23 | 22 |
| 24 function step2() | 23 function clickAtInspected() |
| 25 { | 24 { |
| 26 InspectorTest.firstElementsTreeOutline().addEventListener(WebInspector.E
lementsTreeOutline.Events.SelectedNodeChanged, step3); | 25 InspectorTest.firstElementsTreeOutline().addEventListener(WebInspector.E
lementsTreeOutline.Events.SelectedNodeChanged, dumpAndFinish); |
| 27 InspectorTest.evaluateInPage("click()"); | 26 InspectorTest.evaluateInPage("click()"); |
| 28 } | 27 } |
| 29 | 28 |
| 30 function step3() | 29 function dumpAndFinish() |
| 31 { | 30 { |
| 32 InspectorTest.firstElementsTreeOutline().removeEventListener(WebInspecto
r.ElementsTreeOutline.Events.SelectedNodeChanged, step3); | 31 InspectorTest.firstElementsTreeOutline().removeEventListener(WebInspecto
r.ElementsTreeOutline.Events.SelectedNodeChanged, dumpAndFinish); |
| 33 var selectedElement = InspectorTest.firstElementsTreeOutline().selectedT
reeElement; | 32 var selectedElement = InspectorTest.firstElementsTreeOutline().selectedT
reeElement; |
| 34 InspectorTest.addResult("Node selected: " + selectedElement.node().getAt
tribute("id")); | 33 InspectorTest.addResult("Node selected: " + selectedElement.node().getAt
tribute("id")); |
| 35 InspectorTest.completeTest(); | 34 InspectorTest.completeTest(); |
| 36 } | 35 } |
| 37 } | 36 } |
| 38 | 37 |
| 39 </script> | 38 </script> |
| 40 </head> | 39 </head> |
| 41 | 40 |
| 42 <body onload="runTest()"> | 41 <body onload="runTest()"> |
| 43 | 42 <p> |
| 44 <p>Test that devtools can inspect text element under shadow root.</p> | 43 Tests that inspect mode works after profiling start/stop. |
| 45 | 44 </p> |
| 46 <div><div><div id="host"></div></div></div> | 45 <div id="inspected" style="width:100px;height:100px;"></div> |
| 47 <script> | |
| 48 var host = document.querySelector('#host'); | |
| 49 var sr = host.createShadowRoot(); | |
| 50 sr.innerHTML = "Text Text Text<br>Text Text Text"; | |
| 51 </script> | |
| 52 | |
| 53 </body> | 46 </body> |
| 54 </html> | 47 </html> |
| OLD | NEW |