Bug 1150090 - Intermittent browser_animation_actors_11.js; r=bgrins
authorPatrick Brosset <pbrosset@mozilla.com>
Thu, 02 Apr 2015 10:37:53 +0200
changeset 237976 3a6dfc65f76b02f3a19dde14cb2eeaa5368648a0
parent 237975 bf76e4b4c179ab70a337731bd27d5464195749b2
child 237977 8729d31593600656d347c16721852cb6072fcf27
push id58080
push userryanvm@gmail.com
push dateTue, 07 Apr 2015 20:23:52 +0000
treeherdermozilla-inbound@105106bde936 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1150090
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1150090 - Intermittent browser_animation_actors_11.js; r=bgrins
toolkit/devtools/server/tests/browser/browser_animation_actors_11.js
--- a/toolkit/devtools/server/tests/browser/browser_animation_actors_11.js
+++ b/toolkit/devtools/server/tests/browser/browser_animation_actors_11.js
@@ -22,28 +22,34 @@ add_task(function*() {
   info("Retrieve an animated node");
   let node = yield walker.querySelector(walker.rootNode, ".simple-animation");
 
   info("Retrieve the animation player for the node");
   let [player] = yield animations.getAnimationPlayersForNode(node);
 
   ok(player.setCurrentTime, "Player has the setCurrentTime method");
 
-  info("Set the current time to currentTime + 5s");
-  yield player.setCurrentTime(player.initialState.currentTime + 5000);
+  info("Check that the setCurrentTime method can be called");
+  // Note that we don't check that it sets the animation to the right time here,
+  // this is too prone to intermittent failures, we'll do this later after
+  // pausing the animation. Here we merely test that the method doesn't fail.
+  yield player.setCurrentTime(player.initialState.currentTime + 1000);
 
-  // We're not really interested in making sure the currentTime is set precisely
-  // and doing this could lead to intermittents, so only check that the new time
-  // is now above the initial time.
-  let state = yield player.getCurrentState();
-  ok(state.currentTime > player.initialState.currentTime,
+  info("Pause the animation so we can really test if setCurrentTime works");
+  yield player.pause();
+  let pausedState = yield player.getCurrentState();
+
+  info("Set the current time to currentTime + 5s");
+  yield player.setCurrentTime(pausedState.currentTime + 5000);
+
+  let updatedState1 = yield player.getCurrentState();
+  is(Math.round(updatedState1.currentTime - pausedState.currentTime), 5000,
     "The currentTime was updated to +5s");
 
   info("Set the current time to currentTime - 2s");
-  yield player.setCurrentTime(state.currentTime - 2000);
-
-  let newState = yield player.getCurrentState();
-  ok(newState.currentTime < state.currentTime,
+  yield player.setCurrentTime(updatedState1.currentTime - 2000);
+  let updatedState2 = yield player.getCurrentState();
+  is(Math.round(updatedState2.currentTime - updatedState1.currentTime), -2000,
     "The currentTime was updated to -2s");
 
   yield closeDebuggerClient(client);
   gBrowser.removeCurrentTab();
 });