Bug 1150090 - Intermittent browser_animation_actors_11.js. r=bgrins, a=test-only
authorPatrick Brosset <pbrosset@mozilla.com>
Thu, 02 Apr 2015 10:37:53 +0200
changeset 266911 c2a9b8a5763f717e421dd5a4f4ded5e03705932e
parent 266910 2eecf1fbd302c7fa7f8db344ff5f3f4a46fc6544
child 266912 df2609b5415a448f1a6af276b9d96fe0ea8529bf
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins, test-only
bugs1150090
milestone39.0a2
Bug 1150090 - Intermittent browser_animation_actors_11.js. r=bgrins, a=test-only
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();
 });