Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../../resources/testharness.js"></script> | |
| 3 <script src="../../../resources/testharnessreport.js"></script> | |
| 4 | |
| 5 <div id="parent"></div> | |
| 6 | |
| 7 <script> | |
| 8 function assertComposited(properties, isComposited) { | |
| 9 var element = document.createElement('div'); | |
| 10 document.getElementById('parent').appendChild(element); | |
| 11 | |
| 12 var properties = typeof properties == "string" ? [properties] : properties; | |
| 13 var obj = {}; | |
|
alancutter (OOO until 2018)
2015/07/02 04:44:47
s/obj/keyframe/
| |
| 14 | |
| 15 properties.forEach(function(property) { | |
| 16 obj[property] = 'initial'; | |
|
alancutter (OOO until 2018)
2015/07/02 04:44:47
Nice.
| |
| 17 }); | |
| 18 | |
| 19 var animation = element.animate([obj, obj], { | |
| 20 duration: 4000, | |
| 21 iterations: Infinity | |
| 22 }); | |
| 23 | |
| 24 var asyncHandle = async_test("Compositor Test with " + properties); | |
| 25 requestAnimationFrame(function() { | |
| 26 requestAnimationFrame(function() { | |
| 27 | |
| 28 assert_equals(internals.isCompositedAnimation(animation), isComposited, pr operties + (isComposited ? " should " : " should not ") + "be composited"); | |
|
alancutter (OOO until 2018)
2015/07/02 04:44:47
You need to wrap this in asyncHandle.step(function
| |
| 29 | |
| 30 animation.cancel(); | |
| 31 asyncHandle.done(); | |
| 32 }); | |
| 33 }); | |
| 34 } | |
| 35 | |
| 36 var assertIsComposited = function(properties) { return assertComposited(properti es, true); } | |
| 37 var assertIsNotComposited = function(properties) { return assertComposited(prope rties, false); } | |
| 38 | |
| 39 assertIsComposited('transform'); | |
| 40 assertIsComposited('opacity'); | |
| 41 | |
| 42 assertIsComposited('translate'); | |
| 43 assertIsComposited('rotate'); | |
| 44 assertIsComposited('scale'); | |
| 45 | |
| 46 assertIsComposited(['transform', 'opacity']); | |
| 47 assertIsComposited(['translate', 'opacity']); | |
| 48 assertIsComposited(['rotate', 'opacity']); | |
| 49 assertIsComposited(['scale', 'opacity']); | |
| 50 | |
| 51 assertIsNotComposited(['transform', 'translate']); | |
| 52 assertIsNotComposited(['transform', 'scale']); | |
| 53 assertIsNotComposited(['transform', 'rotate']); | |
| 54 | |
| 55 assertIsNotComposited(['translate', 'scale']); | |
| 56 assertIsNotComposited(['translate', 'rotate']); | |
| 57 assertIsNotComposited(['rotate', 'scale']); | |
| 58 | |
| 59 assertIsNotComposited(['translate', 'rotate', 'scale']); | |
| 60 assertIsNotComposited(['transform', 'translate', 'rotate', 'scale']); | |
| 61 </script> | |
| OLD | NEW |