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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/resources/node-tracker.js

Issue 2955943002: DevTools: migrate inspector-protocol/dom tests to a new test runner (Closed)
Patch Set: rebaseline Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/inspector-protocol/resources/node-tracker.js
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/resources/node-tracker.js b/third_party/WebKit/LayoutTests/inspector-protocol/resources/node-tracker.js
new file mode 100644
index 0000000000000000000000000000000000000000..07a04fa2b1ba7eb005c005934da9ff6d27a97852
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/resources/node-tracker.js
@@ -0,0 +1,28 @@
+(class NodeTracker {
+ constructor(dp) {
+ this._nodes = new Map();
+ dp.DOM.onSetChildNodes(message => message.params.nodes.forEach(node => this._addNode(node)));
+ }
+
+ addDocumentNode(documentNode) {
+ this._addNode(documentNode);
+ }
+
+ _addNode(node) {
+ this._nodes.set(node.nodeId, node);
+ if (node.children)
+ node.children.forEach(node => this._addNode(node));
+ }
+
+ nodeForId(nodeId) {
+ return this._nodes.get(nodeId) || null;
+ }
+
+ nodes() {
+ return Array.from(this._nodes.values());
+ }
+
+ nodeIds() {
+ return Array.from(this._nodes.keys());
+ }
+})
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector-protocol/resources/inspector-protocol-test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698