 
   # ----------- testchunks ----------------
   testChunks = (pdf) ->
+    hash = new Crypto.SHA256
     sendChunk = () ->
       chunkEnd = chunkStart + chunkSize
       chunkData = pdf.slice(chunkStart, chunkEnd)

      chunkStart += chunkSize

    chunkStart = 0
    streamLength = pdf.length

    sendChunk() while chunkStart < streamLength
    hash.finalize


    # test whole file
    console.log "Getting " + pdfPath
    oReq = new XMLHttpRequest
    oReq.open "GET", pdfPath, true
    oReq.responseType = 'arraybuffer'
    oReq.onload = (oEvent) ->
      pdf = oReq.response
      test.equal "ByteLength " + pdf.byteLength, "ByteLength " + pdfByteLength
      hash = new Crypto.SHA256
      hash.update
        data: pdf
      hash.finalize
        onDone: (sha256) ->
          console.log sha256
          test.equal "whole " + sha256, "whole " + pdfHash
          onComplete()
      testChunks pdf

    oReq.send null

  else
    bin = Assets.getBinary pdfFilename
    pdf = new Buffer new Uint8Array bin.buffer

    # testing chunks on server
    testChunks(pdf)
    #onComplete()

    # import file as blob
