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

Side by Side Diff: LayoutTests/inspector-protocol/layers/layers-for-node.html

Issue 18729002: Enable message delivering in inspector-protocol tests when on pause (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: follow codereview Created 7 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
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/protocol-test.js"></script> 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/protocol-test.js"></script>
4 <script type="text/javascript"> 4 <script type="text/javascript">
5 5
6 function addCompositedLayer() 6 function addCompositedLayer()
7 { 7 {
8 var element = document.createElement("div"); 8 var element = document.createElement("div");
9 element.className = "composited"; 9 element.className = "composited";
10 element.id = "last-element"; 10 element.id = "last-element";
(...skipping 21 matching lines...) Expand all
32 callback: getDocument 32 callback: getDocument
33 }); 33 });
34 }; 34 };
35 35
36 function getDocument(result) 36 function getDocument(result)
37 { 37 {
38 step({ 38 step({
39 name: "Get the Document", 39 name: "Get the Document",
40 command: "DOM.getDocument", 40 command: "DOM.getDocument",
41 parameters: {}, 41 parameters: {},
42 callback: getInitialLayerTree 42 callback: makeDeferredCallback(getInitialLayerTree)
43 }); 43 });
44 }; 44 };
45 45
46 function getInitialLayerTree(result) 46 function getInitialLayerTree(result)
47 { 47 {
48 documentNode = result.root; 48 documentNode = result.root;
49 step({ 49 step({
50 name: "Get the initial layer tree", 50 name: "Get the initial layer tree",
51 command: "LayerTree.layersForNode", 51 command: "LayerTree.layersForNode",
52 parameters: {"nodeId": documentNode.nodeId}, 52 parameters: {"nodeId": documentNode.nodeId},
53 callback: gotInitialLayerTree 53 callback: gotInitialLayerTree
54 }); 54 });
55 }; 55 };
56 56
57 function gotInitialLayerTree(result) 57 function gotInitialLayerTree(result)
58 { 58 {
59 initialLayers = result.layers; 59 initialLayers = result.layers;
60 60
61 dumpLayers(initialLayers); 61 dumpLayers(initialLayers);
62 62
63 step({ 63 step({
64 name: "Message the page to add a new composited layer", 64 name: "Message the page to add a new composited layer",
65 command: "Runtime.evaluate", 65 command: "Runtime.evaluate",
66 parameters: {"expression": "addCompositedLayer()"}, 66 parameters: {"expression": "addCompositedLayer()"},
67 callback: getModifiedLayerTree 67 callback: makeDeferredCallback(getModifiedLayerTree)
68 }); 68 });
69 }; 69 };
70 70
71 function getModifiedLayerTree(result) 71 function getModifiedLayerTree(result)
72 { 72 {
73 step({ 73 step({
74 name: "Get the modified layer tree", 74 name: "Get the modified layer tree",
75 command: "LayerTree.layersForNode", 75 command: "LayerTree.layersForNode",
76 parameters: {"nodeId": documentNode.nodeId}, 76 parameters: {"nodeId": documentNode.nodeId},
77 callback: gotModifiedLayerTree 77 callback: gotModifiedLayerTree
78 }); 78 });
79 }; 79 };
80 80
81 var layerCount = 0;
82
83 function gotModifiedLayerTree(result) 81 function gotModifiedLayerTree(result)
84 { 82 {
85 dumpLayers(result.layers); 83 dumpLayers(result.layers);
86 84
87 var mutations = layerMutations(initialLayers, result.layers); 85 var mutations = layerMutations(initialLayers, result.layers);
88 var newLayer = mutations.additions[0]; 86 var newLayer = mutations.additions[0];
89 87
90 step({ 88 step({
91 name: "Get attributes for the newly inserted node", 89 name: "Get attributes for the newly inserted node",
92 command: "DOM.getAttributes", 90 command: "DOM.getAttributes",
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 if (messageObject.hasOwnProperty("error")) { 165 if (messageObject.hasOwnProperty("error")) {
168 InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")"); 166 InspectorTest.log("FAIL: " + messageObject.error.message + " (" + messageObject.error.code + ")");
169 InspectorTest.completeTest(); 167 InspectorTest.completeTest();
170 return; 168 return;
171 } 169 }
172 170
173 InspectorTest.log("PASS"); 171 InspectorTest.log("PASS");
174 test.callback(messageObject.result); 172 test.callback(messageObject.result);
175 }); 173 });
176 }; 174 };
175
176 // Makes next step deferred to let backend do its asynchronous processing an d sending us all pending notifications.
177 // Scheduling on timer with no delay is enough deferring.
yurys 2013/07/16 06:56:18 Good point, now it should work same way it was bef
178 function makeDeferredCallback(callback)
179 {
180 return function(result)
181 {
182 setTimeout(callback.bind(this, result), 0);
183 };
184 }
177 185
178 function assert(name, actual, expected) 186 function assert(name, actual, expected)
179 { 187 {
180 if (expected === actual) 188 if (expected === actual)
181 InspectorTest.log("PASS: " + name + "."); 189 InspectorTest.log("PASS: " + name + ".");
182 else 190 else
183 InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual); 191 InspectorTest.log("FAIL: " + name + ". Expected " + expected + " but got " + actual);
184 }; 192 };
185 193
186 }; 194 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 <div class="composited"> 235 <div class="composited">
228 <div class="composited"></div> 236 <div class="composited"></div>
229 </div> 237 </div>
230 238
231 <div class="regular offset"> 239 <div class="regular offset">
232 <div class="composited"></div> 240 <div class="composited"></div>
233 </div> 241 </div>
234 242
235 </body> 243 </body>
236 </html> 244 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698