function verifyStream(stream, streamDb, drmInfo = null) {
    if (!streamDb) {
      expect(stream).toBeFalsy();
      return;
    }

    const expectedDrmInfos = streamDb.encrypted ? [drmInfo] : [];

    /** @type {!shaka.extern.Stream} */
    const expectedStream = {
      id: jasmine.any(Number),
      originalId: jasmine.any(String),
      groupId: streamDb.groupId,
      createSegmentIndex: jasmine.any(Function),
      segmentIndex: jasmine.any(shaka.media.SegmentIndex),
      mimeType: streamDb.mimeType,
      codecs: streamDb.codecs,
      frameRate: streamDb.frameRate,
      pixelAspectRatio: streamDb.pixelAspectRatio,
      hdr: streamDb.hdr,
      colorGamut: streamDb.colorGamut,
      videoLayout: streamDb.videoLayout,
      width: streamDb.width || undefined,
      height: streamDb.height || undefined,
      kind: streamDb.kind,
      drmInfos: expectedDrmInfos,
      encrypted: streamDb.encrypted,
      keyIds: streamDb.keyIds,
      language: streamDb.language,
      originalLanguage: streamDb.originalLanguage,
      label: streamDb.label,
      type: streamDb.type,
      primary: streamDb.primary,
      trickModeVideo: null,
      dependencyStream: null,
      emsgSchemeIdUris: null,
      roles: streamDb.roles,
      forced: streamDb.forced,
      channelsCount: streamDb.channelsCount,
      audioSamplingRate: streamDb.audioSamplingRate,
      spatialAudio: streamDb.spatialAudio,
      closedCaptions: streamDb.closedCaptions,
      tilesLayout: streamDb.tilesLayout,
      mssPrivateData: streamDb.mssPrivateData,
      accessibilityPurpose: null,
      external: streamDb.external,
      fastSwitching: streamDb.fastSwitching,
      fullMimeTypes: new Set([shaka.util.MimeUtils.getFullType(
          streamDb.mimeType, streamDb.codecs)]),
      isAudioMuxedInVideo: streamDb.isAudioMuxedInVideo,
      baseOriginalId: null,
    };

    expect(stream).toEqual(expectedStream);

    // Assume that we don't have to call createSegmentIndex.

    streamDb.segments.forEach((segmentDb, i) => {
      const uri = shaka.offline.OfflineUri.segment(
          'mechanism', 'cell', segmentDb.dataKey);

      const initSegmentReference = segmentDb.initSegmentKey != null ?
          jasmine.any(shaka.media.InitSegmentReference) :
          null;

      /** @type {shaka.media.SegmentReference} */
      const segment =
          stream.segmentIndex
              .getIteratorForTime(segmentDb.startTime).next().value;

      /** @type {shaka.media.SegmentReference} */
      const sameSegment =
          stream.segmentIndex
              .getIteratorForTime(segmentDb.endTime - 0.1).next().value;

      expect(segment).toBe(sameSegment);
      expect(segment.startTime).toBe(segmentDb.startTime);
      expect(segment.endTime).toBe(segmentDb.endTime);
      expect(segment.startByte).toBe(0);
      expect(segment.endByte).toBe(null);
      expect(segment.getUris()).toEqual([uri.toString()]);
      expect(segment.initSegmentReference).toEqual(initSegmentReference);
      expect(segment.timestampOffset).toBe(segmentDb.timestampOffset);
    });
  }
@param {?shaka.extern.Stream} stream
@param {?shaka.extern.StreamDB} streamDb
@param {(?shaka.extern.DrmInfo)=} drmInfo
@suppress {checkTypes}