testBasicThrottling() {
    if (!window.Blob) {
      return;
    }

    const hashFn = new Md5();
    const blobHasher = new BlobHasher(hashFn, 5);
    const blob = new BlobMock('The quick brown fox jumps over the lazy dog');
    let throttledEvents = 0;
    let completeEvents = 0;
    events.listen(blobHasher, BlobHasher.EventType.THROTTLED, () => {
      ++throttledEvents;
    });
    events.listen(blobHasher, BlobHasher.EventType.COMPLETE, () => {
      ++completeEvents;
    });

    // Start a throttled hash. No chunks should be processed yet.
    blobHasher.setHashingLimit(0);
    assertEquals(0, throttledEvents);
    blobHasher.hash(blob);
    assertEquals(1, throttledEvents);
    assertEquals(0, blobHasher.getBytesProcessed());
    assertNull(blobHasher.fileReader_);

    // One chunk should be processed.
    blobHasher.setHashingLimit(4);
    assertEquals(1, throttledEvents);
    assertEquals(1, readFromBlob(blobHasher, 1));
    assertEquals(2, throttledEvents);
    assertEquals(4, blobHasher.getBytesProcessed());

    // One more chunk should be processed.
    blobHasher.setHashingLimit(5);
    assertEquals(2, throttledEvents);
    assertEquals(1, readFromBlob(blobHasher, 1));
    assertEquals(3, throttledEvents);
    assertEquals(5, blobHasher.getBytesProcessed());

    // Two more chunks should be processed.
    blobHasher.setHashingLimit(15);
    assertEquals(3, throttledEvents);
    assertEquals(2, readFromBlob(blobHasher, 2));
    assertEquals(4, throttledEvents);
    assertEquals(15, blobHasher.getBytesProcessed());

    // The entire blob should be processed.
    blobHasher.setHashingLimit(Infinity);
    const expectedChunks = Math.ceil(blob.size / 5) - 3;
    assertEquals(expectedChunks, readFromBlob(blobHasher, expectedChunks));
    assertEquals(4, throttledEvents);
    assertEquals(1, completeEvents);
    assertEquals(
        '9e107d9d372bb6826bd81d3542a419d6',
        crypt.byteArrayToHex(blobHasher.getHash()));
  }
@suppress {checkTypes,visibility} suppression added to enable type
     checking