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