waitUntilPlayheadReaches(mediaElement, timeGoal) {
    this.improveTestSpeed_(mediaElement);

    // The name of what we're waiting for
    const goalName = 'movement from ' + mediaElement.currentTime +
                     ' to ' + timeGoal;

    // The cleanup on timeout
    let timer = null;
    const cleanup = () => {
      if (timer) {
        timer.stop();
      }
      this.eventManager_.unlisten(mediaElement, 'timeupdate');
      this.eventManager_.unlisten(mediaElement, 'ended');
    };

    // The conditions for success
    const p = new Promise((resolve) => {
      const check = () => {
        if (mediaElement.currentTime >= timeGoal || mediaElement.ended) {
          cleanup();
          resolve();
        }
      };

      timer = new shaka.util.Timer(check);
      timer.tickEvery(/* seconds= */ 1);
      this.eventManager_.listen(mediaElement, 'timeupdate', check);
      this.eventManager_.listen(mediaElement, 'ended', check);
    });

    return this.waitUntilGeneric_(goalName, p, cleanup, mediaElement);
  }
Wait for the video playhead to reach a certain target time.
Promise is resolved when the playhead reaches |timeGoal| or the video ends.

@param {!HTMLMediaElement} mediaElement
@param {number} timeGoal
@return {!Promise}