OLD | NEW |
(Empty) | |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startHTML(` |
| 3 <div id='node' style='background-color: red; height: 100px'></div> |
| 4 `, 'Tests that the animation is correctly paused.'); |
| 5 |
| 6 dp.Animation.enable(); |
| 7 session.evaluate(` |
| 8 window.animation = node.animate([{ width: '100px' }, { width: '2000px' }], {
duration: 10000, iterations: Infinity }); |
| 9 `); |
| 10 |
| 11 var response = await dp.Animation.onceAnimationStarted(); |
| 12 testRunner.log('Animation started'); |
| 13 await dp.Animation.setPaused({ animations: [ response.params.animation.id ], p
aused: true }); |
| 14 |
| 15 var nodeWidth = await session.evaluate('node.offsetWidth'); |
| 16 var rafWidth = await session.evaluateAsync(` |
| 17 (function rafWidth() { |
| 18 var callback; |
| 19 var promise = new Promise((fulfill) => callback = fulfill); |
| 20 if (window.testRunner) |
| 21 testRunner.layoutAndPaintAsyncThen(() => callback(node.offsetWidth))
; |
| 22 return promise; |
| 23 })() |
| 24 `); |
| 25 testRunner.log(rafWidth === nodeWidth); |
| 26 testRunner.completeTest(); |
| 27 }) |
OLD | NEW |