Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/transitions/interrupted-all-transition.html |
| diff --git a/third_party/WebKit/LayoutTests/transitions/interrupted-all-transition.html b/third_party/WebKit/LayoutTests/transitions/interrupted-all-transition.html |
| index ba9961aa132169576089181ea8acc9688885bf31..cdbed7414926c26dd17f66b28e347c7abfa3444b 100644 |
| --- a/third_party/WebKit/LayoutTests/transitions/interrupted-all-transition.html |
| +++ b/third_party/WebKit/LayoutTests/transitions/interrupted-all-transition.html |
| @@ -2,6 +2,9 @@ |
| <html> |
| <head> |
| + <meta charset="utf-8"> |
| + <script src="../resources/testharness.js"></script> |
| + <script src="../resources/testharnessreport.js"></script> |
| <style> |
| #container { |
| position: relative; |
| @@ -19,39 +22,44 @@ |
| transition-timing-function: linear; |
| } |
| </style> |
| - <script> |
| - if (window.testRunner) { |
| - testRunner.dumpAsText(); |
| - testRunner.waitUntilDone(); |
| - } |
| - |
| - function startTransition() |
| - { |
| - var box = document.getElementById('box'); |
| - box.style.left = '300px'; |
| - box.style.opacity = 0.5; |
| - window.setTimeout(function() { |
| - box.style.left = '0px'; |
| - |
| - window.setTimeout(function() { |
| - var boxPos = parseInt(window.getComputedStyle(box).left); |
| - document.getElementById('result').innerHTML = (boxPos < 200) ? "PASS" : "FAIL"; |
| - if (window.testRunner) |
| - testRunner.notifyDone(); |
| - }, 250); |
| - }, 500); |
| - } |
| - window.addEventListener('load', startTransition, false) |
| - </script> |
| </head> |
| <body> |
| -<p>Box should start moving left after left style is reset after 500ms</p> |
| <div id="container"> |
| <div id="box"> |
| </div> |
| </div> |
| -<div id="result"> |
| -</div> |
| + <script> |
| + 'use strict'; |
| + |
| + function waitForProgress() { |
|
alancutter (OOO until 2018)
2017/01/11 04:17:29
Please link to bug here as explanation.
Eric Willigers
2017/01/11 06:11:41
Done.
|
| + var initialLeft = getComputedStyle(box).left; |
| + return new Promise(resolve => { |
| + function poll() { |
| + var currentLeft = getComputedStyle(box).left; |
| + if (currentLeft === initialLeft) { |
| + requestAnimationFrame(poll); |
| + } else { |
| + resolve(); |
| + } |
| + } |
| + requestAnimationFrame(poll); |
| + }); |
| + } |
| + |
| + async_test(t => { |
| + box.offsetTop; // Force style recalc |
| + box.style.left = '300px'; |
| + box.style.opacity = 0.5; |
| + var previousLeft; |
| + waitForProgress().then(() => { |
| + previousLeft = getComputedStyle(box).left; |
| + box.style.left = '0px'; |
| + }).then(waitForProgress).then(t.step_func_done(() => { |
| + var currentLeft = getComputedStyle(box).left; |
| + assert_less_than(parseFloat(currentLeft), parseFloat(previousLeft)); |
|
alancutter (OOO until 2018)
2017/01/10 08:42:42
We should see progress after a single raf.
Eric Willigers
2017/01/11 03:47:22
Ideally we would.
See https://bugs.chromium.org/p/
|
| + })); |
| + }, 'Box should start moving left after left style is reset'); |
| + </script> |
| </body> |
| </html> |