OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <div id='container'></div> | 2 <div id='container'></div> |
3 <script src="../../../../resources/testharness.js"></script> | 3 <script src="../../../../resources/testharness.js"></script> |
4 <script src="../../../../resources/testharnessreport.js"></script> | 4 <script src="../../../../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 var test = async_test("This test checks that an element's compositor proxy can b
e sent from the main thread to the compositor thread."); | 7 var test = async_test("This test checks that an element's compositor proxy can b
e sent from the main thread to the compositor thread and back again."); |
8 | 8 |
9 var lastAttribute = ''; | 9 var lastAttribute = ''; |
10 function checkResponse(opacity, transform) { | 10 function checkResponse(proxy, opacity, transform) { |
| 11 assert_equals(typeof proxy, 'object'); |
11 assert_true(opacity || transform); | 12 assert_true(opacity || transform); |
12 assert_not_equals(opacity, transform); | 13 assert_not_equals(opacity, transform); |
13 var currentAttribute = opacity ? 'opacity' : 'transform'; | 14 var currentAttribute = opacity ? 'opacity' : 'transform'; |
14 if (lastAttribute == '') { | 15 if (lastAttribute == '') { |
15 lastAttribute = currentAttribute; | 16 lastAttribute = currentAttribute; |
16 } else { | 17 } else { |
17 assert_not_equals(lastAttribute, currentAttribute); | 18 assert_not_equals(lastAttribute, currentAttribute); |
18 test.done(); | 19 test.done(); |
19 } | 20 } |
20 } | 21 } |
21 | 22 |
22 function processMessage(msg) { | 23 function processMessage(msg) { |
23 var message = msg.data; | 24 var message = msg.data; |
24 assert_equals('response', message.type); | 25 checkResponse(message.proxy, message.opacity, message.transform); |
25 checkResponse(message.opacity, message.transform); | |
26 } | 26 } |
27 | 27 |
28 var first = new CompositorWorker('resources/proxy-echo.js'); | 28 var first = new CompositorWorker('resources/proxy-echo.js'); |
29 first.onmessage = processMessage; | 29 first.onmessage = processMessage; |
30 var proxy = new CompositorProxy(document.getElementById('container'), ['opacity'
]); | 30 var proxy = new CompositorProxy(document.getElementById('container'), ['opacity'
]); |
31 assert_true(proxy.supports('opacity')); | 31 assert_true(proxy.supports('opacity')); |
32 assert_false(proxy.supports('touch')); | |
33 assert_false(proxy.supports('transform')); | 32 assert_false(proxy.supports('transform')); |
34 assert_false(proxy.supports('scrollTop')); | 33 assert_false(proxy.supports('scrollTop')); |
35 first.postMessage(proxy); | 34 first.postMessage(proxy); |
36 | 35 |
37 var second = new CompositorWorker('resources/proxy-echo.js'); | 36 var second = new CompositorWorker('resources/proxy-echo.js'); |
38 second.onmessage = processMessage; | 37 second.onmessage = processMessage; |
39 proxy = new CompositorProxy(document.getElementById('container'), ['transform'])
; | 38 proxy = new CompositorProxy(document.getElementById('container'), ['transform'])
; |
40 assert_true(proxy.supports('transform')); | 39 assert_true(proxy.supports('transform')); |
41 assert_false(proxy.supports('opacity')); | 40 assert_false(proxy.supports('opacity')); |
42 assert_false(proxy.supports('touch')); | |
43 assert_false(proxy.supports('scrollTop')); | 41 assert_false(proxy.supports('scrollTop')); |
44 second.postMessage(proxy); | 42 second.postMessage(proxy); |
45 | 43 |
46 </script> | 44 </script> |
OLD | NEW |