OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <div id="container"></div> |
| 3 <script src="../../../resources/testharness.js"></script> |
| 4 <script src="../../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 async_test(function(test) { |
| 7 if (!window.internals) |
| 8 return; |
| 9 window.addEventListener('load', function() { |
| 10 // The container should not have a layer. |
| 11 var container = document.getElementById('container'); |
| 12 var docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
| 13 assert_equals(1, docLayer.children.length); |
| 14 assert_equals('undefined', typeof docLayer.children[0].children); |
| 15 |
| 16 // Creating a proxy should force the container to have a layer. |
| 17 var proxy = new CompositorProxy(container, ['opacity']); |
| 18 docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
| 19 assert_equals(1, docLayer.children.length); |
| 20 assert_equals(1, docLayer.children[0].children.length); |
| 21 |
| 22 // Detach the element from the document. The corresponding layer should
be removed. |
| 23 container.parentNode.removeChild(container); |
| 24 docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
| 25 assert_equals(1, docLayer.children.length); |
| 26 assert_equals('undefined', typeof docLayer.children[0].children); |
| 27 |
| 28 // Add the element back to the document. The corresponding layer should
reappear. |
| 29 document.body.appendChild(container); |
| 30 docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
| 31 assert_equals(1, docLayer.children.length); |
| 32 assert_equals(1, docLayer.children[0].children.length); |
| 33 |
| 34 // Disconnecting the proxy should also remove the layer. |
| 35 proxy.disconnect(); |
| 36 docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
| 37 assert_equals(1, docLayer.children.length); |
| 38 assert_equals('undefined', typeof docLayer.children[0].children); |
| 39 |
| 40 test.done(); |
| 41 }); |
| 42 }, "This test checks that creating a CompositorProxy forces the element to have
a layer"); |
| 43 </script> |
OLD | NEW |