getPrefetchedSegment(reference) {
    if (!(reference instanceof shaka.media.SegmentReference)) {
      return null;
    }
    /**
     * The unit tests assume a segment is already prefetched
     * if it was ever passed to prefetchSegmentsByTime() as param.
     * Otherwise return null so the streaming engine being tested
     * will do actual fetch.
     */
    if (this.requestedReferences_.has(reference)) {
      const segmentData = this.segmentData_[this.streamObj_.type];
      return new shaka.net.NetworkingEngine.PendingRequest(
          Promise.resolve({
            uri: reference.getUris()[0],
            data: segmentData.segments[
                segmentData.segmentStartTimes.indexOf(reference.startTime)
            ],
            headers: {},
          }),
          () => Promise.resolve(null),
          new shaka.net.NetworkingEngine.NumBytesRemainingClass(),
      );
    }
    return null;
  }
@override
@param {shaka.media.InitSegmentReference|
    shaka.media.SegmentReference} reference