Index: LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html |
diff --git a/LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html b/LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..90aea1f7ee7645f7dd9f62a3361af4106b2270d8 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html |
@@ -0,0 +1,46 @@ |
+<!DOCTYPE html> |
+<div id="container"></div> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script> |
+if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+async_test(function(test) { |
+ if (!window.internals) |
+ return; |
+ window.addEventListener('load', function() { |
+ // The container should not have a layer. |
+ var container = document.getElementById('container'); |
+ var docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals('undefined', typeof docLayer.children[0].children); |
+ |
+ // Creating a proxy should force the container to have a layer. |
+ var proxy = new CompositorProxy(container, ['opacity']); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals(1, docLayer.children[0].children.length); |
+ |
+ // Detach the element from the document. The corresponding layer should be removed. |
+ container.parentNode.removeChild(container); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals('undefined', typeof docLayer.children[0].children); |
+ |
+ // Add the element back to the document. The corresponding layer should reappear. |
+ document.body.appendChild(container); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals(1, docLayer.children[0].children.length); |
+ |
+ // Disconnecting the proxy should also remove the layer. |
+ proxy.disconnect(); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals('undefined', typeof docLayer.children[0].children); |
+ |
+ test.done(); |
+ }); |
+}, "This test checks that creating a CompositorProxy forces the element to have a layer"); |
+</script> |