| OLD | NEW |
| (Empty) |
| 1 function initialize_layersTest() | |
| 2 { | |
| 3 | |
| 4 var layers; | |
| 5 var layerTreeChangeCallback; | |
| 6 | |
| 7 InspectorTest.step = function(test) | |
| 8 { | |
| 9 InspectorTest.sendCommand(test.command, test.parameters, function(messageObj
ect) { | |
| 10 if (messageObject.hasOwnProperty("error")) { | |
| 11 InspectorTest.log("FAIL: " + messageObject.error.message + " (" + me
ssageObject.error.code + ")"); | |
| 12 InspectorTest.completeTest(); | |
| 13 return; | |
| 14 } | |
| 15 if (test.callback) | |
| 16 test.callback(messageObject.result); | |
| 17 }); | |
| 18 }; | |
| 19 | |
| 20 function onLayerTreeChanged(message) | |
| 21 { | |
| 22 layers = message.params.layers; | |
| 23 if (layerTreeChangeCallback) { | |
| 24 var callback = layerTreeChangeCallback; | |
| 25 layerTreeChangeCallback = null; | |
| 26 callback(layers); | |
| 27 } | |
| 28 } | |
| 29 | |
| 30 InspectorTest.setLayerTreeChangeCallback = function(callback) | |
| 31 { | |
| 32 layerTreeChangeCallback = callback; | |
| 33 } | |
| 34 | |
| 35 InspectorTest.enableLayerTreeAgent = function(callback) | |
| 36 { | |
| 37 if (layers) { | |
| 38 callback(layers); | |
| 39 return; | |
| 40 } | |
| 41 InspectorTest.eventHandler["LayerTree.layerTreeDidChange"] = onLayerTreeChan
ged; | |
| 42 InspectorTest.setLayerTreeChangeCallback(callback); | |
| 43 InspectorTest.sendCommand("DOM.getDocument", {}, function() { | |
| 44 InspectorTest.sendCommand("LayerTree.enable", {}, function() { }); | |
| 45 }); | |
| 46 } | |
| 47 | |
| 48 } | |
| OLD | NEW |