PublicApiFunctionalTest.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:android-downloadprovider 作者:
@Suppress
public void testExtremelyLarge() throws Exception {
    // NOTE: suppressed since this takes several minutes to run
    final long length = 3 * GB_IN_BYTES;
    final InputStream body = new FakeInputStream(length);

    enqueueResponse(new MockResponse().setResponseCode(HTTP_OK).setBody(body, length)
            .setHeader("Content-type", "text/plain")
            .setSocketPolicy(SocketPolicy.DISCONNECT_AT_END));

    final Download download = enqueueRequest(getRequest()
            .setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "extreme.bin"));
    download.runUntilStatus(DownloadManager.STATUS_SUCCESSFUL, 10 * DateUtils.MINUTE_IN_MILLIS);

    assertEquals(length, download.getLongField(DownloadManager.COLUMN_TOTAL_SIZE_BYTES));
    assertEquals(length, download.getLongField(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号