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

Unified Diff: third_party/WebKit/LayoutTests/inspector/elements/selected-element-changes-execution-context.html

Issue 1668603003: Devtools: Switch JS execution context to match inspected node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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: third_party/WebKit/LayoutTests/inspector/elements/selected-element-changes-execution-context.html
diff --git a/third_party/WebKit/LayoutTests/inspector/elements/selected-element-changes-execution-context.html b/third_party/WebKit/LayoutTests/inspector/elements/selected-element-changes-execution-context.html
new file mode 100644
index 0000000000000000000000000000000000000000..9328ee22cf68776f9715eb8442dc152558591b30
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/elements/selected-element-changes-execution-context.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/elements-test.js"></script>
+<script>
+function test()
+{
+ InspectorTest.expandElementsTree(selectNode);
+ var previousContext;
+
+ function selectNode()
+ {
+ previousContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
+ InspectorTest.selectNodeWithId("head", iframeNodeSelected);
+ }
+
+ function iframeNodeSelected()
+ {
+ var node = WebInspector.panels.elements.selectedDOMNode();
+ var currentContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
+ InspectorTest.addResult("Context has changed:");
+ InspectorTest.addResult(previousContext.id !== currentContext.id);
+ InspectorTest.addResult("Context matches node frameId: ");
+ InspectorTest.addResult(currentContext.frameId == node.frameId());
+ previousContext = currentContext;
+ InspectorTest.selectNodeWithId("element", elementSelected);
+ }
+
+ function elementSelected()
+ {
+ var node = WebInspector.panels.elements.selectedDOMNode();
+ var currentContext = WebInspector.context.flavor(WebInspector.ExecutionContext);
+ InspectorTest.addResult("Context has changed:");
+ InspectorTest.addResult(previousContext.id !== currentContext.id);
+ InspectorTest.addResult("Context matches node frameId: ");
+ InspectorTest.addResult(currentContext.frameId == node.frameId());
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+<body>
+ <p>Tests that the execution context is changed to match new selected node.</p>
+ <iframe src="resources/set-outer-html-body-iframe.html" onload="runTest()"></iframe>
+ <div id="element"></div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698