Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / compositorworker / compositor-proxy-postmessage.html
blob9ab7454974269479df3e247b3d1c41da86734fb7
1 <!DOCTYPE html>
2 <div id='container'></div>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script>
7 var test = async_test("This test checks that an element's compositor proxy can be sent from the main thread to the compositor thread.");
9 var lastAttribute = '';
10 function checkResponse(opacity, transform) {
11 assert_true(opacity || transform);
12 assert_not_equals(opacity, transform);
13 var currentAttribute = opacity ? 'opacity' : 'transform';
14 if (lastAttribute == '') {
15 lastAttribute = currentAttribute;
16 } else {
17 assert_not_equals(lastAttribute, currentAttribute);
18 test.done();
22 function processMessage(msg) {
23 var message = msg.data;
24 assert_equals('response', message.type);
25 checkResponse(message.opacity, message.transform);
28 var first = new CompositorWorker('resources/proxy-echo.js');
29 first.onmessage = processMessage;
30 var proxy = new CompositorProxy(document.getElementById('container'), ['opacity']);
31 assert_true(proxy.supports('opacity'));
32 assert_false(proxy.supports('touch'));
33 assert_false(proxy.supports('transform'));
34 assert_false(proxy.supports('scrollTop'));
35 first.postMessage(proxy);
37 var second = new CompositorWorker('resources/proxy-echo.js');
38 second.onmessage = processMessage;
39 proxy = new CompositorProxy(document.getElementById('container'), ['transform']);
40 assert_true(proxy.supports('transform'));
41 assert_false(proxy.supports('opacity'));
42 assert_false(proxy.supports('touch'));
43 assert_false(proxy.supports('scrollTop'));
44 second.postMessage(proxy);
46 </script>