Add a new test and extra checks to DashDownloadServiceTest
Modified old testRemoveAction to test removing content after it's fully downloaded. Added a new testRemoveBeforeDownloadComplete which tests removing content before it's fully downloaded. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=160507573
This commit is contained in:
parent
81d077c037
commit
50530147d0
@ -63,11 +63,11 @@ import java.util.HashMap;
|
|||||||
* .newDefaultData()
|
* .newDefaultData()
|
||||||
* .appendReadData(defaultData)
|
* .appendReadData(defaultData)
|
||||||
* .endData()
|
* .endData()
|
||||||
* .setData("http:///1", data1)
|
* .setData("http://1", data1)
|
||||||
* .newData("test_file")
|
* .newData("test_file")
|
||||||
* .appendReadError(new IOException())
|
* .appendReadError(new IOException())
|
||||||
* .appendReadData(data2);
|
* .appendReadData(data2)
|
||||||
* // No need to call endData at the end
|
* .endData();
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
public final class FakeDataSource implements DataSource {
|
public final class FakeDataSource implements DataSource {
|
||||||
@ -139,7 +139,7 @@ public final class FakeDataSource implements DataSource {
|
|||||||
(int) Math.min(Math.max(0, dataSpec.position - scannedLength), segment.length);
|
(int) Math.min(Math.max(0, dataSpec.position - scannedLength), segment.length);
|
||||||
scannedLength += segment.length;
|
scannedLength += segment.length;
|
||||||
findingCurrentSegmentIndex &= segment.isErrorSegment() ? segment.exceptionCleared
|
findingCurrentSegmentIndex &= segment.isErrorSegment() ? segment.exceptionCleared
|
||||||
: segment.bytesRead == segment.length;
|
: (!segment.isActionSegment() && segment.bytesRead == segment.length);
|
||||||
if (findingCurrentSegmentIndex) {
|
if (findingCurrentSegmentIndex) {
|
||||||
currentSegmentIndex++;
|
currentSegmentIndex++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user