| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Tests that a change from the worker thread is received on the main thread. |
| 4 --> |
| 5 <script> |
| 6 window.jsTestIsAsync = true; |
| 7 </script> |
| 8 <script src="../../resources/js-test.js"></script> |
| 9 |
| 10 <script> |
| 11 if (window.internals) { |
| 12 internals.settings.setCompositorWorkerEnabled(true); |
| 13 } |
| 14 |
| 15 var cw; |
| 16 onload = function() { |
| 17 cw = new CompositorWorker('resources/basic-plumbing-worker-to-main.js'); |
| 18 cw.onmessage = continueTest; |
| 19 var keys = ['opacity', 'transform', 'scrollTop', 'scrollLeft']; |
| 20 cw.postMessage({'proxy': new CompositorProxy(document.getElementById('box'), k
eys)}); |
| 21 } |
| 22 |
| 23 function continueTest(e) { |
| 24 requestAnimationFrame(finishTest); |
| 25 } |
| 26 |
| 27 function finishTest(timestamp) { |
| 28 var box = document.getElementById('box'); |
| 29 requestAnimationFrame(function(timestamp) { |
| 30 shouldBe(box.style.opacity, '0.5'); |
| 31 shouldBe(JSON.stringify(box.scrollLeft), '10'); |
| 32 shouldBe(JSON.stringify(box.scrollTop), '20'); |
| 33 shouldBe("'" + box.style.transform + "'", '\'matrix3d(1px, 0px, 0px, 0px, 0p
x, 1px, 0px, 0px, 0px, 0px, 1px, 0px, 30px, 0px, 0px, 1px)\''); |
| 34 if (window.testRunner) |
| 35 testRunner.notifyDone(); |
| 36 }); |
| 37 } |
| 38 </script> |
| 39 |
| 40 <style> |
| 41 #box { |
| 42 width: 100px; |
| 43 height: 100px; |
| 44 overflow: scroll; |
| 45 } |
| 46 |
| 47 #scrolled { |
| 48 background: white; |
| 49 width: 300px; |
| 50 height: 300px; |
| 51 } |
| 52 </style> |
| 53 |
| 54 <div id="box"> |
| 55 <div id="scrolled"></div> |
| 56 </div> |
| OLD | NEW |