Merge "Fix DownloadManager tests." into nyc-dev
am: 4938d6e
* commit '4938d6e161733b69a291d2ddf16d25efb41030cb':
Fix DownloadManager tests.
Change-Id: I306883251d72e655a361a30217bf825e0fe8beea
This commit is contained in:
@@ -284,20 +284,30 @@ public class DownloadManagerFunctionalTest extends DownloadManagerBaseTest {
|
|||||||
Uri uri = getServerUri(DEFAULT_FILENAME);
|
Uri uri = getServerUri(DEFAULT_FILENAME);
|
||||||
enqueueResponse(buildResponse(HTTP_PARTIAL_CONTENT));
|
enqueueResponse(buildResponse(HTTP_PARTIAL_CONTENT));
|
||||||
|
|
||||||
doErrorTest(uri, DownloadManager.ERROR_UNHANDLED_HTTP_CODE);
|
doErrorTest(uri, DownloadManager.ERROR_CANNOT_RESUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the download failure error from an unhandled HTTP status code
|
* Tests the download failure error from an unhandled HTTP status code
|
||||||
*/
|
*/
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public void testErrorHttpDataError_invalidRedirect() throws Exception {
|
public void testRelativeRedirect() throws Exception {
|
||||||
Uri uri = getServerUri(DEFAULT_FILENAME);
|
Uri uri = getServerUri(DEFAULT_FILENAME);
|
||||||
final MockResponse resp = buildResponse(HTTP_REDIRECT);
|
final MockResponse resp = buildResponse(HTTP_REDIRECT);
|
||||||
resp.setHeader("Location", "://blah.blah.blah.com");
|
resp.setHeader("Location", ":" + uri.getSchemeSpecificPart());
|
||||||
enqueueResponse(resp);
|
enqueueResponse(resp);
|
||||||
|
|
||||||
doErrorTest(uri, DownloadManager.ERROR_HTTP_DATA_ERROR);
|
byte[] blobData = generateData(DEFAULT_FILE_SIZE, DataType.TEXT);
|
||||||
|
enqueueResponse(buildResponse(HTTP_OK, blobData));
|
||||||
|
|
||||||
|
Request request = new Request(uri);
|
||||||
|
request.setTitle(DEFAULT_FILENAME);
|
||||||
|
|
||||||
|
long dlRequest = mDownloadManager.enqueue(request);
|
||||||
|
waitForDownloadOrTimeout(dlRequest);
|
||||||
|
|
||||||
|
verifyAndCleanupSingleFileDownload(dlRequest, blobData);
|
||||||
|
assertEquals(1, mReceiver.numDownloadsCompleted());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user