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

Unified Diff: LayoutTests/inspector/elements/elements-panel-shadow-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: Comments addressed 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-shadow-selection-on-refresh.html
diff --git a/LayoutTests/inspector/elements/elements-panel-shadow-selection-on-refresh.html b/LayoutTests/inspector/elements/elements-panel-shadow-selection-on-refresh.html
new file mode 100644
index 0000000000000000000000000000000000000000..f3f7ea1d7625101d85f42d1da646d68307201bb6
--- /dev/null
+++ b/LayoutTests/inspector/elements/elements-panel-shadow-selection-on-refresh.html
@@ -0,0 +1,96 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/elements-test.js"></script>
+<script>
+
+function test()
+{
+
+ InspectorTest.runTestSuite([
+ function setup(next)
+ {
+ WebInspector.settings.showUAShadowDOM.set(true);
+ InspectorTest.expandElementsTree(next);
+ },
+
+ 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)
+ {
+ return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.Author;
+ }
+
+ function isUserAgentShadowRoot(node)
+ {
+ return node && node.shadowRootType() === WebInspector.DOMNode.ShadowRootTypes.UserAgent;
+ }
+
+ function isAuthorShadowRootChild(node)
+ {
+ return isAuthorShadowRoot(node.parentNode);
+ }
+
+ function isUserAgentShadowRootChild(node)
+ {
+ 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 + "'");
+ }
+ }
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that elements panel preserves selected shadow DOM 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