Changeset 65575 in webkit


Ignore:
Timestamp:
Aug 17, 2010 4:57:42 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-17 Mihai Parparita <mihaip@chromium.org>

Reviewed by Dimitri Glazkov.

transitions/change-values-during-transition.html fails intermittently
https://bugs.webkit.org/show_bug.cgi?id=28461

Make test less flaky during high CPU usage by changing the expectation
from a hardcoded value to an interpolated one based on when the timeout
actually fires. Made the test much more reliable when running with
--iterations=100 while maxing out the CPU on my machine with a
background process.

  • transitions/change-values-during-transition.html:
Location:
trunk/LayoutTests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65573 r65575  
     12010-08-17  Mihai Parparita  <mihaip@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        transitions/change-values-during-transition.html fails intermittently
     6        https://bugs.webkit.org/show_bug.cgi?id=28461
     7
     8        Make test less flaky during high CPU usage by changing the expectation
     9        from a hardcoded value to an interpolated one based on when the timeout
     10        actually fires. Made the test much more reliable when running with
     11        --iterations=100 while maxing out the CPU on my machine with a
     12        background process.
     13
     14        * transitions/change-values-during-transition.html:
     15
    1162010-08-17  Mihai Parparita  <mihaip@chromium.org>
    217
  • trunk/LayoutTests/transitions/change-values-during-transition.html

    r51613 r65575  
    1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    2    "http://www.w3.org/TR/html4/loose.dtd">
     1<!DOCTYPE html>
    32
    43<html lang="en">
     
    2423    var result = "PASS";
    2524    const defaultTolerance = 10;
     25    var transitionStartTime;
    2626   
    2727    function isCloseEnough(actual, desired)
     
    4545    }
    4646   
    47     function check1()
     47    function checkIntermediateValue()
    4848    {
    49         var xPos = getXPosition();
    50         if (!isCloseEnough(xPos, 50))
    51             result = "FAIL(was:"+xPos+", s/b:50)";
     49        // We should be roughly halfway in the transition from 0 to 100, but the
     50        // timeout may not fire exactly then. Figure out where we should be
     51        // based on a linear interpolation of timestamps.
     52        var actualXPos = getXPosition();
     53        var expectedXPos = (new Date().getTime() - transitionStartTime)/1000 * 100;
     54        if (!isCloseEnough(actualXPos, expectedXPos))
     55            result = 'FAIL for intermediate value (was: ' + actualXPos + ', expected: ' + expectedXPos + ')';
    5256    }
    5357
    54     function check2()
     58    function checkFinalValue()
    5559    {
    56         var xPos = getXPosition();
    57         if (!isCloseEnough(xPos, 0))
    58             result += "FAIL(was:"+xPos+", s/b:0)";
    59            
     60        var actualXPos = getXPosition();
     61        var transitionFraction = (new Date().getTime() - transitionStartTime)/100;
     62        var expectedXPos = 100 - Math.min(transitionFraction, 1) * 100;
     63 
     64        if (!isCloseEnough(actualXPos, expectedXPos)) {
     65            if (result == 'PASS')
     66                result = '';
     67            result += 'FAIL for final value (was: ' + actualXPos + ', expected: ' + expectedXPos + ')';
     68        }
     69       
    6070        document.getElementById('result').innerText = result;
    6171        if (window.layoutTestController)
     
    6777        var box = document.getElementById('box');
    6878        box.style.webkitTransform = 'translateX(0)';
     79        transitionStartTime = new Date().getTime();
    6980    }
    7081
     
    7283    {
    7384        var box = document.getElementById('box');
    74         setTimeout("changeValues()", 100);
    75         setTimeout("check1()", 500);
    76         setTimeout("check2()", 1300);
     85        setTimeout(changeValues, 100);
     86        setTimeout(checkIntermediateValue, 500);
     87        setTimeout(checkFinalValue, 1300);
    7788        box.style.webkitTransform = 'translateX(100px)';
     89        transitionStartTime = new Date().getTime();
    7890    }
    7991   
Note: See TracChangeset for help on using the changeset viewer.