Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: third_party/WebKit/LayoutTests/transitions/interrupted-all-transition.html

Issue 2621853002: CSS Transitions: Fix flaky interrupted-all-transition.html (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698