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:
eguven 2017-06-29 03:28:21 -07:00 committed by Oliver Woodman
parent 81d077c037
commit 50530147d0

View File

@ -63,11 +63,11 @@ import java.util.HashMap;
* .newDefaultData()
* .appendReadData(defaultData)
* .endData()
* .setData("http:///1", data1)
* .setData("http://1", data1)
* .newData("test_file")
* .appendReadError(new IOException())
* .appendReadData(data2);
* // No need to call endData at the end
* .appendReadData(data2)
* .endData();
* </pre>
*/
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);
scannedLength += segment.length;
findingCurrentSegmentIndex &= segment.isErrorSegment() ? segment.exceptionCleared
: segment.bytesRead == segment.length;
: (!segment.isActionSegment() && segment.bytesRead == segment.length);
if (findingCurrentSegmentIndex) {
currentSegmentIndex++;
}