Changeset 65575 in webkit
- Timestamp:
- Aug 17, 2010 4:57:42 PM (14 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r65573 r65575 1 2010-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 1 16 2010-08-17 Mihai Parparita <mihaip@chromium.org> 2 17 -
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> 3 2 4 3 <html lang="en"> … … 24 23 var result = "PASS"; 25 24 const defaultTolerance = 10; 25 var transitionStartTime; 26 26 27 27 function isCloseEnough(actual, desired) … … 45 45 } 46 46 47 function check 1()47 function checkIntermediateValue() 48 48 { 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 + ')'; 52 56 } 53 57 54 function check 2()58 function checkFinalValue() 55 59 { 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 60 70 document.getElementById('result').innerText = result; 61 71 if (window.layoutTestController) … … 67 77 var box = document.getElementById('box'); 68 78 box.style.webkitTransform = 'translateX(0)'; 79 transitionStartTime = new Date().getTime(); 69 80 } 70 81 … … 72 83 { 73 84 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); 77 88 box.style.webkitTransform = 'translateX(100px)'; 89 transitionStartTime = new Date().getTime(); 78 90 } 79 91
Note: See TracChangeset
for help on using the changeset viewer.