function createStreamingEngine(config) {
    onError = jasmine.createSpy('onError');
    onError.and.callFake(fail);
    onEvent = jasmine.createSpy('onEvent');
    onSegmentAppended = jasmine.createSpy('onSegmentAppended');
    beforeAppendSegment = jasmine.createSpy('beforeAppendSegment');
    getBandwidthEstimate = jasmine.createSpy('getBandwidthEstimate');
    getBandwidthEstimate.and.returnValue(1e3);
    getPlaybackRate = jasmine.createSpy('getPlaybackRate');
    getPlaybackRate.and.returnValue(1);
    disableStream = jasmine.createSpy('disableStream');
    disableStream.and.callFake(() => false);

    beforeAppendSegment.and.callFake((segment) => {
      return Promise.resolve();
    });

    const defaultConfig =
        shaka.util.PlayerConfiguration.createDefault().streaming;

    if (!config) {
      config = defaultConfig;
      config.rebufferingGoal = 2;
      config.bufferingGoal = 5;
      config.bufferBehind = Infinity;
      config.maxDisabledTime = 0; // Do not disable stream by default
      // We don't want to evict segments in tests where there is no need to
      // test them.
      config.evictionGoal = 30;
    }

    if (defaultConfig.segmentPrefetchLimit == config.segmentPrefetchLimit) {
      config.segmentPrefetchLimit = 0; // Do not prefetch segments by default
    }

    goog.asserts.assert(
        presentationTimeInSeconds != undefined,
        'All tests should have defined an initial presentation time by now!');
    const playerInterface = {
      getPresentationTime: () => presentationTimeInSeconds,
      getBandwidthEstimate: Util.spyFunc(getBandwidthEstimate),
      getPlaybackRate: Util.spyFunc(getPlaybackRate),
      video: shaka.test.UiUtils.createVideoElement(),
      mediaSourceEngine: mediaSourceEngine,
      netEngine: /** @type {!shaka.net.NetworkingEngine} */(netEngine),
      onError: Util.spyFunc(onError),
      onEvent: Util.spyFunc(onEvent),
      onSegmentAppended: Util.spyFunc(onSegmentAppended),
      onInitSegmentAppended: () => {},
      beforeAppendSegment: Util.spyFunc(beforeAppendSegment),
      disableStream: Util.spyFunc(disableStream),
    };
    streamingEngine = new shaka.media.StreamingEngine(
        /** @type {shaka.extern.Manifest} */(manifest), playerInterface);
    streamingEngine.configure(config);
  }
Creates the StreamingEngine.

@param {shaka.extern.StreamingConfiguration=} config Optional
  configuration object which overrides the default one.