async function goTo(state, videoToUse = video) {
      /** @type {!Map<string, function(): !Promise>} */
      const actions = new Map()
          .set('detach', () => {
            return player.detach();
          })
          .set('attach', () => {
            return player.attach(
                videoToUse || video, /* initMediaSource= */ false);
          })
          .set('media-source', () => {
            return player.attach(
                videoToUse || video, /* initMediaSource= */ true);
          })
          .set('load', () => {
            return player.load('test:sintel');
          })
          .set('src-equals', () => {
            return player.load(SMALL_MP4_CONTENT_URI, 0, 'video/mp4');
          });

      const action = actions.get(state);
      expect(action).toBeTruthy();
      await action();
      expect(lastStateChange).toBe(state);
    }
Go to a specific state. This does not ensure the current state before
starting the state change.

@param {string} state
@param {HTMLVideoElement=} videoToUse
@return {!Promise}