Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: LayoutTests/inspector/elements/elements-panel-selection-on-refresh.html

Issue 208223002: DevTools: [Elements] Restore selected shadow DOM elements on reload (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/elements/elements-panel-selection-on-refresh.html
diff --git a/LayoutTests/inspector/elements/elements-panel-selection-on-refresh.html b/LayoutTests/inspector/elements/elements-panel-selection-on-refresh.html
index 93f29f5e49593e324aab40dc558cc7ed1c6f408f..93c1b948798c3e62cb7ae67fc62055b9d542deae 100644
--- a/LayoutTests/inspector/elements/elements-panel-selection-on-refresh.html
+++ b/LayoutTests/inspector/elements/elements-panel-selection-on-refresh.html
@@ -6,25 +6,82 @@
function test()
{
- InspectorTest.selectNodeWithId("test-topic", step1);
- function step1()
+ InspectorTest.runTestSuite([
+ function setup(next)
+ {
+ WebInspector.settings.showUAShadowDOM.set(true);
+ InspectorTest.expandElementsTree(next);
+ },
+
+ function testOrdinaryElement(next)
+ {
+ selectReloadAndDump(next, InspectorTest.expandedNodeWithId("test-topic"));
+ },
+
+ function testAuthorShadowRoot(next)
+ {
+ InspectorTest.findNode(isAuthorShadowRoot, selectReloadAndDump.bind(null, next));
+ },
+
+ function testUserAgentShadowRoot(next)
+ {
+ InspectorTest.findNode(isUserAgentShadowRoot, selectReloadAndDump.bind(null, next));
+ },
+
+ function testAuthorShadowRootChild(next)
+ {
+ InspectorTest.findNode(isAuthorShadowRootChild, selectReloadAndDump.bind(null, next));
+ },
+
+ function testUserAgentShadowRootChild(next)
+ {
+ InspectorTest.findNode(isUserAgentShadowRootChild, selectReloadAndDump.bind(null, next));
+ }
+ ]);
+
+ function isAuthorShadowRoot(node)
{
- InspectorTest.reloadPage(step2);
+ return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Author;
}
-
- function step2()
+
+ function isUserAgentShadowRoot(node)
+ {
+ return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.UserAgent;
+ }
+
+ function isAuthorShadowRootChild(node)
{
- InspectorTest.runAfterPendingDispatches(step3);
+ return isAuthorShadowRoot(node.parentNode);
}
- function step3()
+ function isUserAgentShadowRootChild(node)
{
- // We should have "test-topic" element selected after refresh.
- var selectedElement = WebInspector.panels.elements.treeOutline.selectedTreeElement;
- var nodeName = selectedElement ? selectedElement.representedObject.nodeName() : "null";
- InspectorTest.addResult("Selected element should be 'P', was: '" + nodeName + "'");
- InspectorTest.completeTest();
+ return isUserAgentShadowRoot(node.parentNode);
+ }
+
+ function selectReloadAndDump(next, node)
+ {
+ InspectorTest.selectNode(node);
+ InspectorTest.reloadPage(step1);
+
+ function step1()
+ {
+ InspectorTest.runAfterPendingDispatches(step2);
+ }
+
+ function step2()
+ {
+ dumpSelectedNode();
+ next();
+ }
+
+ function dumpSelectedNode()
+ {
+ var selectedElement = WebInspector.panels.elements.treeOutline.selectedTreeElement;
+ var nodeName = selectedElement ? selectedElement.representedObject.nodeNameInCorrectCase() : "null";
+ InspectorTest.addResult("Selected node: '" + nodeName + "'");
+ }
}
}
@@ -35,6 +92,10 @@ function test()
<p id="test-topic">
Tests that elements panel preserves selected node on page refresh.
</p>
-
+<span id="hostElement"></span>
+<script>
+var root = document.getElementById("hostElement").createShadowRoot();
+root.innerHTML = "<input type='text'>";
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698