function setupManifest(
      firstPeriodStartTime, secondPeriodStartTime, presentationDuration,
      aesKey, secondaryAudioVariant = false) {
    const segmentDurations = {
      audio: segmentData[ContentType.AUDIO].segmentDuration,
      video: segmentData[ContentType.VIDEO].segmentDuration,
      text: segmentData[ContentType.TEXT].segmentDuration,
    };

    const timestampOffsets = {
      audio: segmentData[ContentType.AUDIO].timestampOffset,
      video: segmentData[ContentType.VIDEO].timestampOffset,
      text: segmentData[ContentType.TEXT].timestampOffset,
    };

    if (segmentData['trickvideo']) {
      segmentDurations['trickvideo'] =
          segmentData['trickvideo'].segmentDuration;
      timestampOffsets['trickvideo'] =
          segmentData['trickvideo'].timestampOffset;
    }
    manifest = shaka.test.StreamingEngineUtil.createManifest(
        /** @type {!shaka.media.PresentationTimeline} */(timeline),
        [firstPeriodStartTime, secondPeriodStartTime],
        presentationDuration, segmentDurations, initSegmentRanges,
        timestampOffsets, aesKey, secondaryAudioVariant);

    audioStream = manifest.variants[0].audio;
    videoStream = manifest.variants[0].video;
    variant = manifest.variants[0];
    textStream = manifest.textStreams[0];

    // This Stream is only used to verify that StreamingEngine can setup
    // Streams correctly.
    alternateVideoStream =
        shaka.test.StreamingEngineUtil.createMockVideoStream(8);
    alternateVariant = {
      audio: audioStream,
      video: /** @type {shaka.extern.Stream} */ (alternateVideoStream),
      id: 0,
      language: 'und',
      disabledUntilTime: 0,
      primary: false,
      bandwidth: 0,
      allowedByApplication: true,
      allowedByKeySystem: true,
      decodingInfos: [],
    };
    manifest.variants.push(alternateVariant);
  }
@param {number} firstPeriodStartTime
@param {number} secondPeriodStartTime
@param {number} presentationDuration
@param {shaka.extern.aesKey=} aesKey
@param {boolean=} secondaryAudioVariant