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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-childNodeCount.html

Issue 2955943002: DevTools: migrate inspector-protocol/dom tests to a new test runner (Closed)
Patch Set: rebaseline Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/inspector-protocol-test.js"></script>
4 <script>
5
6 function addNode()
7 {
8 var container = document.getElementById("container");
9 container.appendChild(document.createElement("div"));
10 }
11
12 function removeNode()
13 {
14 var container = document.getElementById("container");
15 container.firstChild.remove();
16 }
17
18 function test()
19 {
20 var nodeInfo = {};
21 var containerNodeId;
22 InspectorTest.eventHandler["DOM.setChildNodes"] = setChildNodes;
23 InspectorTest.eventHandler["DOM.childNodeCountUpdated"] = childNodeCountUpda ted;
24
25 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
26
27 function onGotDocument(msg)
28 {
29 if (InspectorTest.completeTestIfError(msg))
30 return;
31 InspectorTest.sendCommand("DOM.querySelector", { nodeId: msg.result.root .nodeId, selector: "#container" }, onQuerySelector);
32 }
33
34 function onQuerySelector(msg)
35 {
36 if (InspectorTest.completeTestIfError(msg))
37 return;
38 containerNodeId = msg.result.nodeId;
39 InspectorTest.log("Node arrived with childNodeCount: " + nodeInfo[contai nerNodeId].childNodeCount);
40
41 InspectorTest.sendCommand("Runtime.evaluate", { expression: "addNode()"} );
42 InspectorTest.sendCommand("Runtime.evaluate", { expression: "removeNode( )"});
43 InspectorTest.sendCommand("Runtime.evaluate", { expression: "removeNode( )"});
44 InspectorTest.sendCommand("Runtime.evaluate", { expression: "removeNode( )"},
45 InspectorTest.completeTest.bind(InspectorTest));
46 }
47
48 function setChildNodes(message)
49 {
50 var nodes = message.params.nodes;
51 for (var i = 0; i < nodes.length; ++i) {
52 nodeInfo[nodes[i].nodeId] = nodes[i];
53 delete nodes[i].nodeId;
54 }
55 }
56
57 function childNodeCountUpdated(message)
58 {
59 if (message.params.nodeId === containerNodeId)
60 InspectorTest.log("childCountUpdated: " + message.params.childNodeCo unt);
61 }
62 }
63
64 </script>
65 </head>
66 <body onload="runTest()">
67 <div id="container" style="display:none"><div>child1</div><div>child2</div></div >
68 </body>
69 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698