Drop prefix test- from test methods under v2/library
This is one step toward following the google3's test naming convention. See go/java-testing/getting_started#basic-test-template for details why prefix test isn't necessary. This CL is generated by following command $ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/ public void \L\1\E\2/' {} and then manually modified following tests where test method names conflict with test target. - VorbisUtilTest - VorbisReaderTest - UtilTest - DownloadManagerDashTest - DefaultOggSeekerTest - OggPageHeaderTest - HlsMasterPlaylistParserTest PiperOrigin-RevId: 298074653
This commit is contained in:
parent
c1258e7e9f
commit
a6d0caaa3c
@ -30,7 +30,7 @@ public class CTest {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
@Test
|
||||
public void testConstants() {
|
||||
public void bufferFlagConstants_equalToMediaCodecConstants() {
|
||||
// Sanity check that constant values match those defined by the platform.
|
||||
assertThat(C.BUFFER_FLAG_KEY_FRAME).isEqualTo(MediaCodec.BUFFER_FLAG_KEY_FRAME);
|
||||
assertThat(C.BUFFER_FLAG_END_OF_STREAM).isEqualTo(MediaCodec.BUFFER_FLAG_END_OF_STREAM);
|
||||
@ -39,7 +39,7 @@ public class CTest {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
@Test
|
||||
public void testEncodingConstants() {
|
||||
public void encodingConstants_equalToAudioFormatConstants() {
|
||||
// Sanity check that encoding constant values match those defined by the platform.
|
||||
assertThat(C.ENCODING_PCM_16BIT).isEqualTo(AudioFormat.ENCODING_PCM_16BIT);
|
||||
assertThat(C.ENCODING_MP3).isEqualTo(AudioFormat.ENCODING_MP3);
|
||||
|
@ -33,13 +33,13 @@ public final class Ac3UtilTest {
|
||||
Util.getBytesFromHexString("A025048860224E6F6DEDB6D5B6DBAFE6");
|
||||
|
||||
@Test
|
||||
public void testParseTrueHdSyncframeAudioSampleCount_nonSyncframe() {
|
||||
public void parseTrueHdSyncframeAudioSampleCount_nonSyncframe() {
|
||||
assertThat(Ac3Util.parseTrueHdSyncframeAudioSampleCount(TRUEHD_NON_SYNCFRAME_HEADER))
|
||||
.isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseTrueHdSyncframeAudioSampleCount_syncframe() {
|
||||
public void parseTrueHdSyncframeAudioSampleCount_syncframe() {
|
||||
assertThat(Ac3Util.parseTrueHdSyncframeAudioSampleCount(TRUEHD_SYNCFRAME_HEADER))
|
||||
.isEqualTo(TRUEHD_SYNCFRAME_SAMPLE_COUNT);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class DrmInitDataTest {
|
||||
TestUtil.buildTestData(128, 3 /* data seed */));
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
DrmInitData drmInitDataToParcel = new DrmInitData(DATA_1, DATA_2);
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
@ -61,7 +61,7 @@ public class DrmInitDataTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
public void equals() {
|
||||
DrmInitData drmInitData = new DrmInitData(DATA_1, DATA_2);
|
||||
|
||||
// Basic non-referential equality test.
|
||||
@ -95,7 +95,7 @@ public class DrmInitDataTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testGetByUuid() {
|
||||
public void getByUuid() {
|
||||
// Basic matching.
|
||||
DrmInitData testInitData = new DrmInitData(DATA_1, DATA_2);
|
||||
assertThat(testInitData.get(WIDEVINE_UUID)).isEqualTo(DATA_1);
|
||||
@ -122,14 +122,14 @@ public class DrmInitDataTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetByIndex() {
|
||||
public void getByIndex() {
|
||||
DrmInitData testInitData = new DrmInitData(DATA_1, DATA_2);
|
||||
assertThat(getAllSchemeData(testInitData)).containsAtLeast(DATA_1, DATA_2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSchemeDatasWithSameUuid() {
|
||||
public void schemeDatasWithSameUuid() {
|
||||
DrmInitData testInitData = new DrmInitData(DATA_1, DATA_1B);
|
||||
assertThat(testInitData.schemeDataCount).isEqualTo(2);
|
||||
// Deprecated get method should return first entry.
|
||||
@ -140,7 +140,7 @@ public class DrmInitDataTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSchemeDataMatches() {
|
||||
public void schemeDataMatches() {
|
||||
assertThat(DATA_1.matches(WIDEVINE_UUID)).isTrue();
|
||||
assertThat(DATA_1.matches(PLAYREADY_UUID)).isFalse();
|
||||
assertThat(DATA_2.matches(UUID_NIL)).isFalse();
|
||||
|
@ -28,7 +28,7 @@ import org.junit.runner.RunWith;
|
||||
public class MetadataTest {
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
Metadata metadataToParcel =
|
||||
new Metadata(
|
||||
new BinaryFrame("id1", new byte[] {1}), new BinaryFrame("id2", new byte[] {2}));
|
||||
|
@ -31,7 +31,7 @@ import org.junit.runner.RunWith;
|
||||
public final class EventMessageDecoderTest {
|
||||
|
||||
@Test
|
||||
public void testDecodeEventMessage() {
|
||||
public void decodeEventMessage() {
|
||||
byte[] rawEmsgBody =
|
||||
joinByteArrays(
|
||||
createByteArray(117, 114, 110, 58, 116, 101, 115, 116, 0), // scheme_id_uri = "urn:test"
|
||||
|
@ -43,15 +43,13 @@ public final class EventMessageEncoderTest {
|
||||
createByteArray(0, 1, 2, 3, 4)); // message_data = {0, 1, 2, 3, 4}
|
||||
|
||||
@Test
|
||||
public void testEncodeEventStream() throws IOException {
|
||||
byte[] foo = new byte[] {1, 2, 3};
|
||||
|
||||
public void encodeEventStream() throws IOException {
|
||||
byte[] encodedByteArray = new EventMessageEncoder().encode(DECODED_MESSAGE);
|
||||
assertThat(encodedByteArray).isEqualTo(ENCODED_MESSAGE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeDecodeEventStream() throws IOException {
|
||||
public void encodeDecodeEventStream() throws IOException {
|
||||
byte[] encodedByteArray = new EventMessageEncoder().encode(DECODED_MESSAGE);
|
||||
MetadataInputBuffer buffer = new MetadataInputBuffer();
|
||||
buffer.data = ByteBuffer.allocate(encodedByteArray.length).put(encodedByteArray);
|
||||
@ -63,7 +61,7 @@ public final class EventMessageEncoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeEventStreamMultipleTimesWorkingCorrectly() throws IOException {
|
||||
public void encodeEventStreamMultipleTimesWorkingCorrectly() throws IOException {
|
||||
EventMessage eventMessage1 =
|
||||
new EventMessage("urn:test", "123", 3000, 1000402, new byte[] {4, 3, 2, 1, 0});
|
||||
byte[] expectedEmsgBody1 =
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class EventMessageTest {
|
||||
|
||||
@Test
|
||||
public void testEventMessageParcelable() {
|
||||
public void eventMessageParcelable() {
|
||||
EventMessage eventMessage =
|
||||
new EventMessage("urn:test", "123", 3000, 1000403, new byte[] {0, 1, 2, 3, 4});
|
||||
// Write to parcel.
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class PictureFrameTest {
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
PictureFrame pictureFrameToParcel = new PictureFrame(0, "", "", 0, 0, 0, 0, new byte[0]);
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class VorbisCommentTest {
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
VorbisComment vorbisCommentFrameToParcel = new VorbisComment("key", "value");
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class ChapterFrameTest {
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
Id3Frame[] subFrames = new Id3Frame[] {
|
||||
new TextInformationFrame("TIT2", null, "title"),
|
||||
new UrlLinkFrame("WXXX", "description", "url")
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class ChapterTocFrameTest {
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
String[] children = new String[] {"child0", "child1"};
|
||||
Id3Frame[] subFrames = new Id3Frame[] {
|
||||
new TextInformationFrame("TIT2", null, "title"),
|
||||
|
@ -35,7 +35,7 @@ public final class Id3DecoderTest {
|
||||
private static final int ID3_TEXT_ENCODING_UTF_8 = 3;
|
||||
|
||||
@Test
|
||||
public void testDecodeTxxxFrame() {
|
||||
public void decodeTxxxFrame() {
|
||||
byte[] rawId3 = buildSingleFrameTag("TXXX", new byte[] {3, 0, 109, 100, 105, 97, 108, 111, 103,
|
||||
95, 86, 73, 78, 68, 73, 67, 79, 49, 53, 50, 55, 54, 54, 52, 95, 115, 116, 97, 114, 116, 0});
|
||||
Id3Decoder decoder = new Id3Decoder();
|
||||
@ -62,7 +62,7 @@ public final class Id3DecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeTextInformationFrame() {
|
||||
public void decodeTextInformationFrame() {
|
||||
byte[] rawId3 = buildSingleFrameTag("TIT2", new byte[] {3, 72, 101, 108, 108, 111, 32, 87, 111,
|
||||
114, 108, 100, 0});
|
||||
Id3Decoder decoder = new Id3Decoder();
|
||||
@ -89,7 +89,7 @@ public final class Id3DecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeWxxxFrame() {
|
||||
public void decodeWxxxFrame() {
|
||||
byte[] rawId3 = buildSingleFrameTag("WXXX", new byte[] {ID3_TEXT_ENCODING_UTF_8, 116, 101, 115,
|
||||
116, 0, 104, 116, 116, 112, 115, 58, 47, 47, 116, 101, 115, 116, 46, 99, 111, 109, 47, 97,
|
||||
98, 99, 63, 100, 101, 102});
|
||||
@ -117,7 +117,7 @@ public final class Id3DecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeUrlLinkFrame() {
|
||||
public void decodeUrlLinkFrame() {
|
||||
byte[] rawId3 = buildSingleFrameTag("WCOM", new byte[] {104, 116, 116, 112, 115, 58, 47, 47,
|
||||
116, 101, 115, 116, 46, 99, 111, 109, 47, 97, 98, 99, 63, 100, 101, 102});
|
||||
Id3Decoder decoder = new Id3Decoder();
|
||||
@ -139,7 +139,7 @@ public final class Id3DecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecodePrivFrame() {
|
||||
public void decodePrivFrame() {
|
||||
byte[] rawId3 = buildSingleFrameTag("PRIV", new byte[] {116, 101, 115, 116, 0, 1, 2, 3, 4});
|
||||
Id3Decoder decoder = new Id3Decoder();
|
||||
Metadata metadata = decoder.decode(rawId3, rawId3.length);
|
||||
@ -158,7 +158,7 @@ public final class Id3DecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeApicFrame() {
|
||||
public void decodeApicFrame() {
|
||||
byte[] rawId3 = buildSingleFrameTag("APIC", new byte[] {3, 105, 109, 97, 103, 101, 47, 106, 112,
|
||||
101, 103, 0, 16, 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 0, 1, 2, 3, 4, 5, 6, 7,
|
||||
8, 9, 0});
|
||||
@ -174,7 +174,7 @@ public final class Id3DecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeCommentFrame() {
|
||||
public void decodeCommentFrame() {
|
||||
byte[] rawId3 = buildSingleFrameTag("COMM", new byte[] {ID3_TEXT_ENCODING_UTF_8, 101, 110, 103,
|
||||
100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 0, 116, 101, 120, 116, 0});
|
||||
Id3Decoder decoder = new Id3Decoder();
|
||||
@ -201,7 +201,7 @@ public final class Id3DecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecodeMultiFrames() {
|
||||
public void decodeMultiFrames() {
|
||||
byte[] rawId3 =
|
||||
buildMultiFramesTag(
|
||||
new FrameSpec(
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class MlltFrameTest {
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
MlltFrame mlltFrameToParcel =
|
||||
new MlltFrame(
|
||||
/* mpegFramesBetweenReference= */ 1,
|
||||
|
@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
|
||||
public final class MimeTypesTest {
|
||||
|
||||
@Test
|
||||
public void testGetMediaMimeType_fromValidCodecs_returnsCorrectMimeType() {
|
||||
public void getMediaMimeType_fromValidCodecs_returnsCorrectMimeType() {
|
||||
assertThat(MimeTypes.getMediaMimeType("avc1")).isEqualTo(MimeTypes.VIDEO_H264);
|
||||
assertThat(MimeTypes.getMediaMimeType("avc1.42E01E")).isEqualTo(MimeTypes.VIDEO_H264);
|
||||
assertThat(MimeTypes.getMediaMimeType("avc1.42E01F")).isEqualTo(MimeTypes.VIDEO_H264);
|
||||
@ -76,7 +76,7 @@ public final class MimeTypesTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeTypeFromMp4ObjectType_forValidObjectType_returnsCorrectMimeType() {
|
||||
public void getMimeTypeFromMp4ObjectType_forValidObjectType_returnsCorrectMimeType() {
|
||||
assertThat(MimeTypes.getMimeTypeFromMp4ObjectType(0x60)).isEqualTo(MimeTypes.VIDEO_MPEG2);
|
||||
assertThat(MimeTypes.getMimeTypeFromMp4ObjectType(0x61)).isEqualTo(MimeTypes.VIDEO_MPEG2);
|
||||
assertThat(MimeTypes.getMimeTypeFromMp4ObjectType(0x20)).isEqualTo(MimeTypes.VIDEO_MP4V);
|
||||
@ -97,7 +97,7 @@ public final class MimeTypesTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeTypeFromMp4ObjectType_forInvalidObjectType_returnsNull() {
|
||||
public void getMimeTypeFromMp4ObjectType_forInvalidObjectType_returnsNull() {
|
||||
assertThat(MimeTypes.getMimeTypeFromMp4ObjectType(0)).isNull();
|
||||
assertThat(MimeTypes.getMimeTypeFromMp4ObjectType(0x600)).isNull();
|
||||
assertThat(MimeTypes.getMimeTypeFromMp4ObjectType(0x01)).isNull();
|
||||
|
@ -36,7 +36,7 @@ public final class NalUnitUtilTest {
|
||||
private static final int SPS_TEST_DATA_OFFSET = 3;
|
||||
|
||||
@Test
|
||||
public void testFindNalUnit() {
|
||||
public void findNalUnit() {
|
||||
byte[] data = buildTestData();
|
||||
|
||||
// Should find NAL unit.
|
||||
@ -57,7 +57,7 @@ public final class NalUnitUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindNalUnitWithPrefix() {
|
||||
public void findNalUnitWithPrefix() {
|
||||
byte[] data = buildTestData();
|
||||
|
||||
// First byte of NAL unit in data1, rest in data2.
|
||||
@ -121,7 +121,7 @@ public final class NalUnitUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSpsNalUnit() {
|
||||
public void parseSpsNalUnit() {
|
||||
NalUnitUtil.SpsData data = NalUnitUtil.parseSpsNalUnit(SPS_TEST_DATA, SPS_TEST_DATA_OFFSET,
|
||||
SPS_TEST_DATA.length);
|
||||
assertThat(data.width).isEqualTo(640);
|
||||
@ -137,7 +137,7 @@ public final class NalUnitUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnescapeDoesNotModifyBuffersWithoutStartCodes() {
|
||||
public void unescapeDoesNotModifyBuffersWithoutStartCodes() {
|
||||
assertUnescapeDoesNotModify("");
|
||||
assertUnescapeDoesNotModify("0000");
|
||||
assertUnescapeDoesNotModify("172BF38A3C");
|
||||
@ -145,13 +145,13 @@ public final class NalUnitUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnescapeModifiesBuffersWithStartCodes() {
|
||||
public void unescapeModifiesBuffersWithStartCodes() {
|
||||
assertUnescapeMatchesExpected("00000301", "000001");
|
||||
assertUnescapeMatchesExpected("0000030200000300", "000002000000");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDiscardToSps() {
|
||||
public void discardToSps() {
|
||||
assertDiscardToSpsMatchesExpected("", "");
|
||||
assertDiscardToSpsMatchesExpected("00", "");
|
||||
assertDiscardToSpsMatchesExpected("FFFF000001", "");
|
||||
|
@ -30,7 +30,7 @@ import org.junit.runner.RunWith;
|
||||
public final class ParsableBitArrayTest {
|
||||
|
||||
@Test
|
||||
public void testReadAllBytes() {
|
||||
public void readAllBytes() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
byte[] bytesRead = new byte[testData.length];
|
||||
@ -43,7 +43,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitInSameByte() {
|
||||
public void readBitInSameByte() {
|
||||
byte[] testData = TestUtil.createByteArray(0, 0b00110000);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.setPosition(10);
|
||||
@ -55,7 +55,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitInMultipleBytes() {
|
||||
public void readBitInMultipleBytes() {
|
||||
byte[] testData = TestUtil.createByteArray(1, 1 << 7);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.setPosition(6);
|
||||
@ -67,7 +67,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBits0Bits() {
|
||||
public void readBits0Bits() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -77,7 +77,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsByteAligned() {
|
||||
public void readBitsByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.readBits(8);
|
||||
@ -89,7 +89,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsNonByteAligned() {
|
||||
public void readBitsNonByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.readBits(3);
|
||||
@ -101,7 +101,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsNegativeValue() {
|
||||
public void readBitsNegativeValue() {
|
||||
byte[] testData = TestUtil.createByteArray(0xF0, 0, 0, 0);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -111,7 +111,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsToLong0Bits() {
|
||||
public void readBitsToLong0Bits() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -121,7 +121,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsToLongByteAligned() {
|
||||
public void readBitsToLongByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01, 0xFF, 0x14, 0x60);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.readBits(8);
|
||||
@ -133,7 +133,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsToLongNonByteAligned() {
|
||||
public void readBitsToLongNonByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01, 0xFF, 0x14, 0x60);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.readBits(3);
|
||||
@ -145,7 +145,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsToLongNegativeValue() {
|
||||
public void readBitsToLongNegativeValue() {
|
||||
byte[] testData = TestUtil.createByteArray(0xF0, 0, 0, 0, 0, 0, 0, 0);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -155,7 +155,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsToByteArray() {
|
||||
public void readBitsToByteArray() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01, 0xFF, 0x14, 0x60, 0x99);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -204,7 +204,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipBytes() {
|
||||
public void skipBytes() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -214,7 +214,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipBitsByteAligned() {
|
||||
public void skipBitsByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -224,7 +224,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipBitsNonByteAligned() {
|
||||
public void skipBitsNonByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -234,7 +234,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPositionByteAligned() {
|
||||
public void setPositionByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -244,7 +244,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPositionNonByteAligned() {
|
||||
public void setPositionNonByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -254,7 +254,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testByteAlignFromNonByteAligned() {
|
||||
public void byteAlignFromNonByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.setPosition(11);
|
||||
@ -267,7 +267,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testByteAlignFromByteAligned() {
|
||||
public void byteAlignFromByteAligned() {
|
||||
byte[] testData = TestUtil.createByteArray(0x3C, 0xD2, 0x5F, 0x01);
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
testArray.setPosition(16);
|
||||
@ -280,7 +280,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBytesAsStringDefaultsToUtf8() {
|
||||
public void readBytesAsStringDefaultsToUtf8() {
|
||||
byte[] testData = "a non-åscii strìng".getBytes(Charset.forName(C.UTF8_NAME));
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -289,7 +289,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBytesAsStringExplicitCharset() {
|
||||
public void readBytesAsStringExplicitCharset() {
|
||||
byte[] testData = "a non-åscii strìng".getBytes(Charset.forName(C.UTF16_NAME));
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
|
||||
@ -299,7 +299,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBytesNotByteAligned() {
|
||||
public void readBytesNotByteAligned() {
|
||||
String testString = "test string";
|
||||
byte[] testData = testString.getBytes(Charset.forName(C.UTF8_NAME));
|
||||
ParsableBitArray testArray = new ParsableBitArray(testData);
|
||||
@ -309,7 +309,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutBitsWithinByte() {
|
||||
public void putBitsWithinByte() {
|
||||
ParsableBitArray output = new ParsableBitArray(new byte[4]);
|
||||
output.skipBits(1);
|
||||
|
||||
@ -320,7 +320,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutBitsAcrossTwoBytes() {
|
||||
public void putBitsAcrossTwoBytes() {
|
||||
ParsableBitArray output = new ParsableBitArray(new byte[4]);
|
||||
output.setPosition(12);
|
||||
|
||||
@ -331,7 +331,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutBitsAcrossMultipleBytes() {
|
||||
public void putBitsAcrossMultipleBytes() {
|
||||
ParsableBitArray output = new ParsableBitArray(new byte[8]);
|
||||
output.setPosition(31); // Writing starts at 31 to test the 30th bit is not modified.
|
||||
|
||||
@ -342,7 +342,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPut32Bits() {
|
||||
public void put32Bits() {
|
||||
ParsableBitArray output = new ParsableBitArray(new byte[5]);
|
||||
output.setPosition(4);
|
||||
|
||||
@ -353,7 +353,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutFullBytes() {
|
||||
public void putFullBytes() {
|
||||
ParsableBitArray output = new ParsableBitArray(new byte[2]);
|
||||
|
||||
output.putInt(0x81, 8);
|
||||
@ -363,7 +363,7 @@ public final class ParsableBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoOverwriting() {
|
||||
public void noOverwriting() {
|
||||
ParsableBitArray output =
|
||||
new ParsableBitArray(TestUtil.createByteArray(0xFF, 0xFF, 0xFF, 0xFF, 0xFF));
|
||||
output.setPosition(1);
|
||||
|
@ -39,7 +39,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadShort() {
|
||||
public void readShort() {
|
||||
testReadShort((short) -1);
|
||||
testReadShort((short) 0);
|
||||
testReadShort((short) 1);
|
||||
@ -65,7 +65,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadInt() {
|
||||
public void readInt() {
|
||||
testReadInt(0);
|
||||
testReadInt(1);
|
||||
testReadInt(-1);
|
||||
@ -91,7 +91,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadUnsignedInt() {
|
||||
public void readUnsignedInt() {
|
||||
testReadUnsignedInt(0);
|
||||
testReadUnsignedInt(1);
|
||||
testReadUnsignedInt(Integer.MAX_VALUE);
|
||||
@ -117,7 +117,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadUnsignedIntToInt() {
|
||||
public void readUnsignedIntToInt() {
|
||||
testReadUnsignedIntToInt(0);
|
||||
testReadUnsignedIntToInt(1);
|
||||
testReadUnsignedIntToInt(Integer.MAX_VALUE);
|
||||
@ -153,7 +153,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadUnsignedLongToLong() {
|
||||
public void readUnsignedLongToLong() {
|
||||
testReadUnsignedLongToLong(0);
|
||||
testReadUnsignedLongToLong(1);
|
||||
testReadUnsignedLongToLong(Long.MAX_VALUE);
|
||||
@ -189,7 +189,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLong() {
|
||||
public void readLong() {
|
||||
testReadLong(0);
|
||||
testReadLong(1);
|
||||
testReadLong(-1);
|
||||
@ -215,7 +215,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadingMovesPosition() {
|
||||
public void readingMovesPosition() {
|
||||
ParsableByteArray parsableByteArray = getTestDataArray();
|
||||
|
||||
// Given an array at the start
|
||||
@ -226,7 +226,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOutOfBoundsThrows() {
|
||||
public void outOfBoundsThrows() {
|
||||
ParsableByteArray parsableByteArray = getTestDataArray();
|
||||
|
||||
// Given an array at the end
|
||||
@ -242,7 +242,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testModificationsAffectParsableArray() {
|
||||
public void modificationsAffectParsableArray() {
|
||||
ParsableByteArray parsableByteArray = getTestDataArray();
|
||||
|
||||
// When modifying the wrapped byte array
|
||||
@ -255,7 +255,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadingUnsignedLongWithMsbSetThrows() {
|
||||
public void readingUnsignedLongWithMsbSetThrows() {
|
||||
ParsableByteArray parsableByteArray = getTestDataArray();
|
||||
|
||||
// Given an array with the most-significant bit set on the top byte
|
||||
@ -271,7 +271,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadUnsignedFixedPoint1616() {
|
||||
public void readUnsignedFixedPoint1616() {
|
||||
ParsableByteArray parsableByteArray = getTestDataArray();
|
||||
|
||||
// When reading the integer part of a 16.16 fixed point value
|
||||
@ -282,7 +282,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadingBytesReturnsCopy() {
|
||||
public void readingBytesReturnsCopy() {
|
||||
ParsableByteArray parsableByteArray = getTestDataArray();
|
||||
|
||||
// When reading all the bytes back
|
||||
@ -295,7 +295,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLittleEndianLong() {
|
||||
public void readLittleEndianLong() {
|
||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
||||
0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, (byte) 0xFF
|
||||
@ -305,7 +305,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLittleEndianUnsignedInt() {
|
||||
public void readLittleEndianUnsignedInt() {
|
||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
||||
0x10, 0x00, 0x00, (byte) 0xFF
|
||||
});
|
||||
@ -314,7 +314,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLittleEndianInt() {
|
||||
public void readLittleEndianInt() {
|
||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
||||
0x01, 0x00, 0x00, (byte) 0xFF
|
||||
});
|
||||
@ -323,7 +323,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLittleEndianUnsignedInt24() {
|
||||
public void readLittleEndianUnsignedInt24() {
|
||||
byte[] data = {0x01, 0x02, (byte) 0xFF};
|
||||
ParsableByteArray byteArray = new ParsableByteArray(data);
|
||||
assertThat(byteArray.readLittleEndianUnsignedInt24()).isEqualTo(0xFF0201);
|
||||
@ -331,7 +331,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadInt24Positive() {
|
||||
public void readInt24Positive() {
|
||||
byte[] data = {0x01, 0x02, (byte) 0xFF};
|
||||
ParsableByteArray byteArray = new ParsableByteArray(data);
|
||||
assertThat(byteArray.readInt24()).isEqualTo(0x0102FF);
|
||||
@ -339,7 +339,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadInt24Negative() {
|
||||
public void readInt24Negative() {
|
||||
byte[] data = {(byte) 0xFF, 0x02, (byte) 0x01};
|
||||
ParsableByteArray byteArray = new ParsableByteArray(data);
|
||||
assertThat(byteArray.readInt24()).isEqualTo(0xFFFF0201);
|
||||
@ -347,7 +347,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLittleEndianUnsignedShort() {
|
||||
public void readLittleEndianUnsignedShort() {
|
||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
||||
0x01, (byte) 0xFF, 0x02, (byte) 0xFF
|
||||
});
|
||||
@ -358,7 +358,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadLittleEndianShort() {
|
||||
public void readLittleEndianShort() {
|
||||
ParsableByteArray byteArray = new ParsableByteArray(new byte[] {
|
||||
0x01, (byte) 0xFF, 0x02, (byte) 0xFF
|
||||
});
|
||||
@ -369,7 +369,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadString() {
|
||||
public void readString() {
|
||||
byte[] data = {
|
||||
(byte) 0xC3, (byte) 0xA4, (byte) 0x20,
|
||||
(byte) 0xC3, (byte) 0xB6, (byte) 0x20,
|
||||
@ -385,7 +385,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadAsciiString() {
|
||||
public void readAsciiString() {
|
||||
byte[] data = new byte[] {'t', 'e', 's', 't'};
|
||||
ParsableByteArray testArray = new ParsableByteArray(data);
|
||||
assertThat(testArray.readString(data.length, forName("US-ASCII"))).isEqualTo("test");
|
||||
@ -393,7 +393,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadStringOutOfBoundsDoesNotMovePosition() {
|
||||
public void readStringOutOfBoundsDoesNotMovePosition() {
|
||||
byte[] data = {
|
||||
(byte) 0xC3, (byte) 0xA4, (byte) 0x20
|
||||
};
|
||||
@ -407,14 +407,14 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadEmptyString() {
|
||||
public void readEmptyString() {
|
||||
byte[] bytes = new byte[0];
|
||||
ParsableByteArray parser = new ParsableByteArray(bytes);
|
||||
assertThat(parser.readLine()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadNullTerminatedStringWithLengths() {
|
||||
public void readNullTerminatedStringWithLengths() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o', 0, 'b', 'a', 'r', 0
|
||||
};
|
||||
@ -449,7 +449,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadNullTerminatedString() {
|
||||
public void readNullTerminatedString() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o', 0, 'b', 'a', 'r', 0
|
||||
};
|
||||
@ -473,7 +473,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadNullTerminatedStringWithoutEndingNull() {
|
||||
public void readNullTerminatedStringWithoutEndingNull() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o', 0, 'b', 'a', 'r'
|
||||
};
|
||||
@ -484,7 +484,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadSingleLineWithoutEndingTrail() {
|
||||
public void readSingleLineWithoutEndingTrail() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o'
|
||||
};
|
||||
@ -494,7 +494,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadSingleLineWithEndingLf() {
|
||||
public void readSingleLineWithEndingLf() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o', '\n'
|
||||
};
|
||||
@ -504,7 +504,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadTwoLinesWithCrFollowedByLf() {
|
||||
public void readTwoLinesWithCrFollowedByLf() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o', '\r', '\n', 'b', 'a', 'r'
|
||||
};
|
||||
@ -515,7 +515,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadThreeLinesWithEmptyLine() {
|
||||
public void readThreeLinesWithEmptyLine() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o', '\r', '\n', '\r', 'b', 'a', 'r'
|
||||
};
|
||||
@ -527,7 +527,7 @@ public final class ParsableByteArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFourLinesWithLfFollowedByCr() {
|
||||
public void readFourLinesWithLfFollowedByCr() {
|
||||
byte[] bytes = new byte[] {
|
||||
'f', 'o', 'o', '\n', '\r', '\r', 'b', 'a', 'r', '\r', '\n'
|
||||
};
|
||||
|
@ -32,7 +32,7 @@ public final class ParsableNalUnitBitArrayTest {
|
||||
private static final byte[] MIX_TEST_DATA = createByteArray(255, 0, 0, 3, 255, 0, 0, 127);
|
||||
|
||||
@Test
|
||||
public void testReadNoEscaping() {
|
||||
public void readNoEscaping() {
|
||||
ParsableNalUnitBitArray array =
|
||||
new ParsableNalUnitBitArray(NO_ESCAPING_TEST_DATA, 0, NO_ESCAPING_TEST_DATA.length);
|
||||
assertThat(array.readBits(24)).isEqualTo(0x000300);
|
||||
@ -44,7 +44,7 @@ public final class ParsableNalUnitBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadNoEscapingTruncated() {
|
||||
public void readNoEscapingTruncated() {
|
||||
ParsableNalUnitBitArray array = new ParsableNalUnitBitArray(NO_ESCAPING_TEST_DATA, 0, 4);
|
||||
assertThat(array.canReadBits(32)).isTrue();
|
||||
array.skipBits(32);
|
||||
@ -58,7 +58,7 @@ public final class ParsableNalUnitBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadAllEscaping() {
|
||||
public void readAllEscaping() {
|
||||
ParsableNalUnitBitArray array =
|
||||
new ParsableNalUnitBitArray(ALL_ESCAPING_TEST_DATA, 0, ALL_ESCAPING_TEST_DATA.length);
|
||||
assertThat(array.canReadBits(48)).isTrue();
|
||||
@ -70,7 +70,7 @@ public final class ParsableNalUnitBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadMix() {
|
||||
public void readMix() {
|
||||
ParsableNalUnitBitArray array =
|
||||
new ParsableNalUnitBitArray(MIX_TEST_DATA, 0, MIX_TEST_DATA.length);
|
||||
assertThat(array.canReadBits(56)).isTrue();
|
||||
@ -84,7 +84,7 @@ public final class ParsableNalUnitBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadExpGolomb() {
|
||||
public void readExpGolomb() {
|
||||
ParsableNalUnitBitArray array = new ParsableNalUnitBitArray(createByteArray(0x9E), 0, 1);
|
||||
assertThat(array.canReadExpGolombCodedNum()).isTrue();
|
||||
assertThat(array.readUnsignedExpGolombCodedInt()).isEqualTo(0);
|
||||
@ -100,7 +100,7 @@ public final class ParsableNalUnitBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadExpGolombWithEscaping() {
|
||||
public void readExpGolombWithEscaping() {
|
||||
ParsableNalUnitBitArray array =
|
||||
new ParsableNalUnitBitArray(createByteArray(0, 0, 3, 128, 0), 0, 5);
|
||||
assertThat(array.canReadExpGolombCodedNum()).isFalse();
|
||||
@ -111,7 +111,7 @@ public final class ParsableNalUnitBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReset() {
|
||||
public void reset() {
|
||||
ParsableNalUnitBitArray array = new ParsableNalUnitBitArray(createByteArray(0, 0), 0, 2);
|
||||
assertThat(array.canReadExpGolombCodedNum()).isFalse();
|
||||
assertThat(array.canReadBits(16)).isTrue();
|
||||
|
@ -40,7 +40,7 @@ import org.robolectric.annotation.Config;
|
||||
public class UtilTest {
|
||||
|
||||
@Test
|
||||
public void testAddWithOverflowDefault() {
|
||||
public void addWithOverflowDefault_withoutOverFlow_returnsSum() {
|
||||
long res = Util.addWithOverflowDefault(5, 10, /* overflowResult= */ 0);
|
||||
assertThat(res).isEqualTo(15);
|
||||
|
||||
@ -49,8 +49,11 @@ public class UtilTest {
|
||||
|
||||
res = Util.addWithOverflowDefault(Long.MIN_VALUE + 1, -1, /* overflowResult= */ 12345);
|
||||
assertThat(res).isEqualTo(Long.MIN_VALUE);
|
||||
}
|
||||
|
||||
res = Util.addWithOverflowDefault(Long.MAX_VALUE, 1, /* overflowResult= */ 12345);
|
||||
@Test
|
||||
public void addWithOverflowDefault_withOverFlow_returnsOverflowDefault() {
|
||||
long res = Util.addWithOverflowDefault(Long.MAX_VALUE, 1, /* overflowResult= */ 12345);
|
||||
assertThat(res).isEqualTo(12345);
|
||||
|
||||
res = Util.addWithOverflowDefault(Long.MIN_VALUE, -1, /* overflowResult= */ 12345);
|
||||
@ -58,7 +61,7 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubtrackWithOverflowDefault() {
|
||||
public void subtrackWithOverflowDefault_withoutUnderflow_returnsSubtract() {
|
||||
long res = Util.subtractWithOverflowDefault(5, 10, /* overflowResult= */ 0);
|
||||
assertThat(res).isEqualTo(-5);
|
||||
|
||||
@ -67,8 +70,11 @@ public class UtilTest {
|
||||
|
||||
res = Util.subtractWithOverflowDefault(Long.MAX_VALUE - 1, -1, /* overflowResult= */ 12345);
|
||||
assertThat(res).isEqualTo(Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
res = Util.subtractWithOverflowDefault(Long.MIN_VALUE, 1, /* overflowResult= */ 12345);
|
||||
@Test
|
||||
public void subtrackWithOverflowDefault_withUnderflow_returnsOverflowDefault() {
|
||||
long res = Util.subtractWithOverflowDefault(Long.MIN_VALUE, 1, /* overflowResult= */ 12345);
|
||||
assertThat(res).isEqualTo(12345);
|
||||
|
||||
res = Util.subtractWithOverflowDefault(Long.MAX_VALUE, -1, /* overflowResult= */ 12345);
|
||||
@ -76,7 +82,7 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInferContentType() {
|
||||
public void inferContentType_returnsInferredResult() {
|
||||
assertThat(Util.inferContentType("http://a.b/c.ism")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType("http://a.b/c.isml")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType("http://a.b/c.ism/Manifest")).isEqualTo(C.TYPE_SS);
|
||||
@ -646,13 +652,13 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseXsDuration() {
|
||||
public void parseXsDuration_returnsParsedDurationInMillis() {
|
||||
assertThat(parseXsDuration("PT150.279S")).isEqualTo(150279L);
|
||||
assertThat(parseXsDuration("PT1.500S")).isEqualTo(1500L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseXsDateTime() throws Exception {
|
||||
public void parseXsDateTime_returnsParsedDateTimeInMillis() throws Exception {
|
||||
assertThat(parseXsDateTime("2014-06-19T23:07:42")).isEqualTo(1403219262000L);
|
||||
assertThat(parseXsDateTime("2014-08-06T11:00:00Z")).isEqualTo(1407322800000L);
|
||||
assertThat(parseXsDateTime("2014-08-06T11:00:00,000Z")).isEqualTo(1407322800000L);
|
||||
@ -663,7 +669,7 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToUnsignedLongPositiveValue() {
|
||||
public void toUnsignedLong_withPositiveValue_returnsValue() {
|
||||
int x = 0x05D67F23;
|
||||
|
||||
long result = Util.toUnsignedLong(x);
|
||||
@ -672,7 +678,7 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToUnsignedLongNegativeValue() {
|
||||
public void toUnsignedLong_withNegativeValue_returnsValue() {
|
||||
int x = 0xF5D67F23;
|
||||
|
||||
long result = Util.toUnsignedLong(x);
|
||||
@ -681,57 +687,73 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToLongZeroValue() {
|
||||
public void toLong_withZeroValue_returnsZero() {
|
||||
assertThat(Util.toLong(0, 0)).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToLongValue() {
|
||||
public void toLong_withLongValue_returnsValue() {
|
||||
assertThat(Util.toLong(1, -4)).isEqualTo(0x1FFFFFFFCL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToLongBigValue() {
|
||||
public void toLong_withBigValue_returnsValue() {
|
||||
assertThat(Util.toLong(0x7ABCDEF, 0x12345678)).isEqualTo(0x7ABCDEF_12345678L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToLongMaxValue() {
|
||||
public void toLong_withMaxValue_returnsValue() {
|
||||
assertThat(Util.toLong(0x0FFFFFFF, 0xFFFFFFFF)).isEqualTo(0x0FFFFFFF_FFFFFFFFL);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToLongBigNegativeValue() {
|
||||
public void toLong_withBigNegativeValue_returnsValue() {
|
||||
assertThat(Util.toLong(0xFEDCBA, 0x87654321)).isEqualTo(0xFEDCBA_87654321L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToHexString() {
|
||||
public void toHexString_returnsHexString() {
|
||||
byte[] bytes = TestUtil.createByteArray(0x12, 0xFC, 0x06);
|
||||
|
||||
assertThat(Util.toHexString(bytes)).isEqualTo("12fc06");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCodecsOfType() {
|
||||
public void getCodecsOfType_withNull_returnsNull() {
|
||||
assertThat(getCodecsOfType(null, C.TRACK_TYPE_VIDEO)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCodecsOfType_withInvalidTrackType_returnsNull() {
|
||||
assertThat(getCodecsOfType("avc1.64001e,vp9.63.1", C.TRACK_TYPE_AUDIO)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCodecsOfType_withAudioTrack_returnsCodec() {
|
||||
assertThat(getCodecsOfType(" vp9.63.1, ec-3 ", C.TRACK_TYPE_AUDIO)).isEqualTo("ec-3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCodecsOfType_withVideoTrack_returnsCodec() {
|
||||
assertThat(getCodecsOfType("avc1.61e, vp9.63.1, ec-3 ", C.TRACK_TYPE_VIDEO))
|
||||
.isEqualTo("avc1.61e,vp9.63.1");
|
||||
assertThat(getCodecsOfType("avc1.61e, vp9.63.1, ec-3 ", C.TRACK_TYPE_VIDEO))
|
||||
.isEqualTo("avc1.61e,vp9.63.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCodecsOfType_withInvalidCodec_returnsNull() {
|
||||
assertThat(getCodecsOfType("invalidCodec1, invalidCodec2 ", C.TRACK_TYPE_AUDIO)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnescapeInvalidFileName() {
|
||||
public void unescapeFileName_invalidFileName_returnsNull() {
|
||||
assertThat(Util.unescapeFileName("%a")).isNull();
|
||||
assertThat(Util.unescapeFileName("%xyz")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEscapeUnescapeFileName() {
|
||||
public void escapeUnescapeFileName_returnsEscapedString() {
|
||||
assertEscapeUnescapeFileName("just+a regular+fileName", "just+a regular+fileName");
|
||||
assertEscapeUnescapeFileName("key:value", "key%3avalue");
|
||||
assertEscapeUnescapeFileName("<>:\"/\\|?*%", "%3c%3e%3a%22%2f%5c%7c%3f%2a%25");
|
||||
@ -744,7 +766,7 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCrc32() {
|
||||
public void crc32_returnsUpdatedCrc32() {
|
||||
byte[] bytes = {0x5F, 0x78, 0x04, 0x7B, 0x5F};
|
||||
int start = 1;
|
||||
int end = 4;
|
||||
@ -756,7 +778,7 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCrc8() {
|
||||
public void crc8_returnsUpdatedCrc8() {
|
||||
byte[] bytes = {0x5F, 0x78, 0x04, 0x7B, 0x5F};
|
||||
int start = 1;
|
||||
int end = 4;
|
||||
@ -768,7 +790,7 @@ public class UtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInflate() {
|
||||
public void inflate_withDeflatedData_success() {
|
||||
byte[] testData = TestUtil.buildTestData(/*arbitrary test data size*/ 256 * 1024);
|
||||
byte[] compressedData = new byte[testData.length * 2];
|
||||
Deflater compresser = new Deflater(9);
|
||||
|
@ -608,7 +608,7 @@ public final class TtmlDecoderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRubies() throws IOException, SubtitleDecoderException {
|
||||
public void rubies() throws IOException, SubtitleDecoderException {
|
||||
TtmlSubtitle subtitle = getSubtitle(RUBIES_FILE);
|
||||
|
||||
Spanned firstCue = getOnlyCueTextAtTimeUs(subtitle, 10_000_000);
|
||||
|
@ -218,7 +218,7 @@ public final class TtmlStyleTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRubyType() {
|
||||
public void rubyType() {
|
||||
TtmlStyle style = new TtmlStyle();
|
||||
|
||||
assertThat(style.getRubyType()).isEqualTo(UNSPECIFIED);
|
||||
@ -227,7 +227,7 @@ public final class TtmlStyleTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRubyPosition() {
|
||||
public void rubyPosition() {
|
||||
TtmlStyle style = new TtmlStyle();
|
||||
|
||||
assertThat(style.getRubyPosition()).isEqualTo(RubySpan.POSITION_UNKNOWN);
|
||||
|
@ -32,7 +32,7 @@ import org.junit.runner.RunWith;
|
||||
public final class DashMediaSourceTest {
|
||||
|
||||
@Test
|
||||
public void testIso8601ParserParse() throws IOException {
|
||||
public void iso8601ParserParse() throws IOException {
|
||||
DashMediaSource.Iso8601Parser parser = new DashMediaSource.Iso8601Parser();
|
||||
// UTC.
|
||||
assertParseStringToLong(1512381697000L, parser, "2017-12-04T10:01:37Z");
|
||||
@ -58,7 +58,7 @@ public final class DashMediaSourceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIso8601ParserParseMissingTimezone() throws IOException {
|
||||
public void iso8601ParserParseMissingTimezone() throws IOException {
|
||||
DashMediaSource.Iso8601Parser parser = new DashMediaSource.Iso8601Parser();
|
||||
try {
|
||||
assertParseStringToLong(0, parser, "2017-12-04T10:01:37");
|
||||
|
@ -37,28 +37,28 @@ import org.junit.runner.RunWith;
|
||||
public final class DashUtilTest {
|
||||
|
||||
@Test
|
||||
public void testLoadDrmInitDataFromManifest() throws Exception {
|
||||
public void loadDrmInitDataFromManifest() throws Exception {
|
||||
Period period = newPeriod(newAdaptationSet(newRepresentation(newDrmInitData())));
|
||||
DrmInitData drmInitData = DashUtil.loadDrmInitData(DummyDataSource.INSTANCE, period);
|
||||
assertThat(drmInitData).isEqualTo(newDrmInitData());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadDrmInitDataMissing() throws Exception {
|
||||
public void loadDrmInitDataMissing() throws Exception {
|
||||
Period period = newPeriod(newAdaptationSet(newRepresentation(null /* no init data */)));
|
||||
DrmInitData drmInitData = DashUtil.loadDrmInitData(DummyDataSource.INSTANCE, period);
|
||||
assertThat(drmInitData).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadDrmInitDataNoRepresentations() throws Exception {
|
||||
public void loadDrmInitDataNoRepresentations() throws Exception {
|
||||
Period period = newPeriod(newAdaptationSet(/* no representation */ ));
|
||||
DrmInitData drmInitData = DashUtil.loadDrmInitData(DummyDataSource.INSTANCE, period);
|
||||
assertThat(drmInitData).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadDrmInitDataNoAdaptationSets() throws Exception {
|
||||
public void loadDrmInitDataNoAdaptationSets() throws Exception {
|
||||
Period period = newPeriod(/* no adaptation set */ );
|
||||
DrmInitData drmInitData = DashUtil.loadDrmInitData(DummyDataSource.INSTANCE, period);
|
||||
assertThat(drmInitData).isNull();
|
||||
|
@ -62,7 +62,7 @@ public final class EventSampleStreamTest {
|
||||
* return format for the first call.
|
||||
*/
|
||||
@Test
|
||||
public void testReadDataReturnFormatForFirstRead() {
|
||||
public void readDataReturnFormatForFirstRead() {
|
||||
EventStream eventStream = new EventStream(SCHEME_ID, VALUE, TIME_SCALE,
|
||||
new long[0], new EventMessage[0]);
|
||||
EventSampleStream sampleStream = new EventSampleStream(eventStream, FORMAT, false);
|
||||
@ -73,11 +73,11 @@ public final class EventSampleStreamTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a non-dynamic {@link EventSampleStream} will return a buffer with
|
||||
* {@link C#BUFFER_FLAG_END_OF_STREAM} when trying to read sample out-of-bound.
|
||||
* Tests that a non-dynamic {@link EventSampleStream} will return a buffer with {@link
|
||||
* C#BUFFER_FLAG_END_OF_STREAM} when trying to read sample out-of-bound.
|
||||
*/
|
||||
@Test
|
||||
public void testReadDataOutOfBoundReturnEndOfStreamAfterFormatForNonDynamicEventSampleStream() {
|
||||
public void readDataOutOfBoundReturnEndOfStreamAfterFormatForNonDynamicEventSampleStream() {
|
||||
EventStream eventStream = new EventStream(SCHEME_ID, VALUE, TIME_SCALE,
|
||||
new long[0], new EventMessage[0]);
|
||||
EventSampleStream sampleStream = new EventSampleStream(eventStream, FORMAT, false);
|
||||
@ -90,11 +90,11 @@ public final class EventSampleStreamTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that a dynamic {@link EventSampleStream} will return {@link C#RESULT_NOTHING_READ}
|
||||
* when trying to read sample out-of-bound.
|
||||
* Tests that a dynamic {@link EventSampleStream} will return {@link C#RESULT_NOTHING_READ} when
|
||||
* trying to read sample out-of-bound.
|
||||
*/
|
||||
@Test
|
||||
public void testReadDataOutOfBoundReturnEndOfStreamAfterFormatForDynamicEventSampleStream() {
|
||||
public void readDataOutOfBoundReturnEndOfStreamAfterFormatForDynamicEventSampleStream() {
|
||||
EventStream eventStream = new EventStream(SCHEME_ID, VALUE, TIME_SCALE,
|
||||
new long[0], new EventMessage[0]);
|
||||
EventSampleStream sampleStream = new EventSampleStream(eventStream, FORMAT, true);
|
||||
@ -110,7 +110,7 @@ public final class EventSampleStreamTest {
|
||||
* return sample data after the first call.
|
||||
*/
|
||||
@Test
|
||||
public void testReadDataReturnDataAfterFormat() {
|
||||
public void readDataReturnDataAfterFormat() {
|
||||
long presentationTimeUs = 1000000;
|
||||
EventMessage eventMessage = newEventMessageWithId(1);
|
||||
EventStream eventStream = new EventStream(SCHEME_ID, VALUE, TIME_SCALE,
|
||||
@ -126,12 +126,12 @@ public final class EventSampleStreamTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that {@link EventSampleStream#skipData(long)} will skip until the given position, and
|
||||
* the next {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call
|
||||
* will return sample data from that position.
|
||||
* Tests that {@link EventSampleStream#skipData(long)} will skip until the given position, and the
|
||||
* next {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call will
|
||||
* return sample data from that position.
|
||||
*/
|
||||
@Test
|
||||
public void testSkipDataThenReadDataReturnDataFromSkippedPosition() {
|
||||
public void skipDataThenReadDataReturnDataFromSkippedPosition() {
|
||||
long presentationTimeUs1 = 1000000;
|
||||
long presentationTimeUs2 = 2000000;
|
||||
EventMessage eventMessage1 = newEventMessageWithId(1);
|
||||
@ -157,7 +157,7 @@ public final class EventSampleStreamTest {
|
||||
* will return sample data from that position.
|
||||
*/
|
||||
@Test
|
||||
public void testSeekToUsThenReadDataReturnDataFromSeekPosition() {
|
||||
public void seekToUsThenReadDataReturnDataFromSeekPosition() {
|
||||
long presentationTimeUs1 = 1000000;
|
||||
long presentationTimeUs2 = 2000000;
|
||||
EventMessage eventMessage1 = newEventMessageWithId(1);
|
||||
@ -178,12 +178,12 @@ public final class EventSampleStreamTest {
|
||||
|
||||
/**
|
||||
* Tests that {@link EventSampleStream#updateEventStream(EventStream, boolean)} will update the
|
||||
* underlying event stream, but keep the read timestamp, so the next
|
||||
* {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call
|
||||
* will return sample data from after the last read sample timestamp.
|
||||
* underlying event stream, but keep the read timestamp, so the next {@link
|
||||
* EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call will return sample
|
||||
* data from after the last read sample timestamp.
|
||||
*/
|
||||
@Test
|
||||
public void testUpdateEventStreamContinueToReadAfterLastReadSamplePresentationTime() {
|
||||
public void updateEventStreamContinueToReadAfterLastReadSamplePresentationTime() {
|
||||
long presentationTimeUs1 = 1000000;
|
||||
long presentationTimeUs2 = 2000000;
|
||||
long presentationTimeUs3 = 3000000;
|
||||
@ -212,12 +212,12 @@ public final class EventSampleStreamTest {
|
||||
|
||||
/**
|
||||
* Tests that {@link EventSampleStream#updateEventStream(EventStream, boolean)} will update the
|
||||
* underlying event stream, but keep the timestamp the stream has skipped to, so the next
|
||||
* {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call
|
||||
* will return sample data from the skipped position.
|
||||
* underlying event stream, but keep the timestamp the stream has skipped to, so the next {@link
|
||||
* EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call will return sample
|
||||
* data from the skipped position.
|
||||
*/
|
||||
@Test
|
||||
public void testSkipDataThenUpdateStreamContinueToReadFromSkippedPosition() {
|
||||
public void skipDataThenUpdateStreamContinueToReadFromSkippedPosition() {
|
||||
long presentationTimeUs1 = 1000000;
|
||||
long presentationTimeUs2 = 2000000;
|
||||
long presentationTimeUs3 = 3000000;
|
||||
@ -243,14 +243,14 @@ public final class EventSampleStreamTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that {@link EventSampleStream#skipData(long)} will only skip to the point right after
|
||||
* it last event. A following {@link EventSampleStream#updateEventStream(EventStream, boolean)}
|
||||
* will update the underlying event stream and keep the timestamp the stream has skipped to, so
|
||||
* the next {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call
|
||||
* will return sample data from the skipped position.
|
||||
* Tests that {@link EventSampleStream#skipData(long)} will only skip to the point right after it
|
||||
* last event. A following {@link EventSampleStream#updateEventStream(EventStream, boolean)} will
|
||||
* update the underlying event stream and keep the timestamp the stream has skipped to, so the
|
||||
* next {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call will
|
||||
* return sample data from the skipped position.
|
||||
*/
|
||||
@Test
|
||||
public void testSkipDataThenUpdateStreamContinueToReadDoNotSkippedMoreThanAvailable() {
|
||||
public void skipDataThenUpdateStreamContinueToReadDoNotSkippedMoreThanAvailable() {
|
||||
long presentationTimeUs1 = 1000000;
|
||||
long presentationTimeUs2 = 2000000;
|
||||
long presentationTimeUs3 = 3000000;
|
||||
@ -279,12 +279,12 @@ public final class EventSampleStreamTest {
|
||||
|
||||
/**
|
||||
* Tests that {@link EventSampleStream#updateEventStream(EventStream, boolean)} will update the
|
||||
* underlying event stream, but keep the timestamp the stream has seek to, so the next
|
||||
* {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call
|
||||
* will return sample data from the seek position.
|
||||
* underlying event stream, but keep the timestamp the stream has seek to, so the next {@link
|
||||
* EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call will return sample
|
||||
* data from the seek position.
|
||||
*/
|
||||
@Test
|
||||
public void testSeekToUsThenUpdateStreamContinueToReadFromSeekPosition() {
|
||||
public void seekToUsThenUpdateStreamContinueToReadFromSeekPosition() {
|
||||
long presentationTimeUs1 = 1000000;
|
||||
long presentationTimeUs2 = 2000000;
|
||||
long presentationTimeUs3 = 3000000;
|
||||
@ -311,12 +311,12 @@ public final class EventSampleStreamTest {
|
||||
|
||||
/**
|
||||
* Tests that {@link EventSampleStream#updateEventStream(EventStream, boolean)} will update the
|
||||
* underlying event stream, but keep the timestamp the stream has seek to, so the next
|
||||
* {@link EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call
|
||||
* will return sample data from the seek position.
|
||||
* underlying event stream, but keep the timestamp the stream has seek to, so the next {@link
|
||||
* EventSampleStream#readData(FormatHolder, DecoderInputBuffer, boolean)} call will return sample
|
||||
* data from the seek position.
|
||||
*/
|
||||
@Test
|
||||
public void testSeekToThenUpdateStreamContinueToReadFromSeekPositionEvenSeekMoreThanAvailable() {
|
||||
public void seekToThenUpdateStreamContinueToReadFromSeekPositionEvenSeekMoreThanAvailable() {
|
||||
long presentationTimeUs1 = 1000000;
|
||||
long presentationTimeUs2 = 2000000;
|
||||
long presentationTimeUs3 = 3000000;
|
||||
|
@ -38,7 +38,7 @@ public class DashManifestTest {
|
||||
private static final Format DUMMY_FORMAT = new Format.Builder().build();
|
||||
|
||||
@Test
|
||||
public void testCopy() {
|
||||
public void copy() {
|
||||
Representation[][][] representations = newRepresentations(3, 2, 3);
|
||||
DashManifest sourceManifest =
|
||||
newDashManifest(
|
||||
@ -97,7 +97,7 @@ public class DashManifestTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopySameAdaptationIndexButDifferentPeriod() {
|
||||
public void copySameAdaptationIndexButDifferentPeriod() {
|
||||
Representation[][][] representations = newRepresentations(2, 1, 1);
|
||||
DashManifest sourceManifest =
|
||||
newDashManifest(
|
||||
@ -117,7 +117,7 @@ public class DashManifestTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopySkipPeriod() {
|
||||
public void copySkipPeriod() {
|
||||
Representation[][][] representations = newRepresentations(3, 2, 3);
|
||||
DashManifest sourceManifest =
|
||||
newDashManifest(
|
||||
|
@ -31,7 +31,7 @@ public class RangedUriTest {
|
||||
private static final String FULL_URI = BASE_URI + PARTIAL_URI;
|
||||
|
||||
@Test
|
||||
public void testMerge() {
|
||||
public void merge() {
|
||||
RangedUri rangeA = new RangedUri(FULL_URI, 0, 10);
|
||||
RangedUri rangeB = new RangedUri(FULL_URI, 10, 10);
|
||||
RangedUri expected = new RangedUri(FULL_URI, 0, 20);
|
||||
@ -39,7 +39,7 @@ public class RangedUriTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeUnbounded() {
|
||||
public void mergeUnbounded() {
|
||||
RangedUri rangeA = new RangedUri(FULL_URI, 0, 10);
|
||||
RangedUri rangeB = new RangedUri(FULL_URI, 10, C.LENGTH_UNSET);
|
||||
RangedUri expected = new RangedUri(FULL_URI, 0, C.LENGTH_UNSET);
|
||||
@ -47,7 +47,7 @@ public class RangedUriTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonMerge() {
|
||||
public void nonMerge() {
|
||||
// A and B do not overlap, so should not merge
|
||||
RangedUri rangeA = new RangedUri(FULL_URI, 0, 10);
|
||||
RangedUri rangeB = new RangedUri(FULL_URI, 11, 10);
|
||||
@ -70,7 +70,7 @@ public class RangedUriTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeWithBaseUri() {
|
||||
public void mergeWithBaseUri() {
|
||||
RangedUri rangeA = new RangedUri(PARTIAL_URI, 0, 10);
|
||||
RangedUri rangeB = new RangedUri(FULL_URI, 10, 10);
|
||||
RangedUri expected = new RangedUri(FULL_URI, 0, 20);
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public class UrlTemplateTest {
|
||||
|
||||
@Test
|
||||
public void testRealExamples() {
|
||||
public void realExamples() {
|
||||
String template = "QualityLevels($Bandwidth$)/Fragments(video=$Time$,format=mpd-time-csf)";
|
||||
UrlTemplate urlTemplate = UrlTemplate.compile(template);
|
||||
String url = urlTemplate.buildUri("abc1", 10, 650000, 5000);
|
||||
@ -45,7 +45,7 @@ public class UrlTemplateTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFull() {
|
||||
public void full() {
|
||||
String template = "$Bandwidth$_a_$RepresentationID$_b_$Time$_c_$Number$";
|
||||
UrlTemplate urlTemplate = UrlTemplate.compile(template);
|
||||
String url = urlTemplate.buildUri("abc1", 10, 650000, 5000);
|
||||
@ -53,7 +53,7 @@ public class UrlTemplateTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFullWithDollarEscaping() {
|
||||
public void fullWithDollarEscaping() {
|
||||
String template = "$$$Bandwidth$$$_a$$_$RepresentationID$_b_$Time$_c_$Number$$$";
|
||||
UrlTemplate urlTemplate = UrlTemplate.compile(template);
|
||||
String url = urlTemplate.buildUri("abc1", 10, 650000, 5000);
|
||||
@ -61,7 +61,7 @@ public class UrlTemplateTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidSubstitution() {
|
||||
public void invalidSubstitution() {
|
||||
String template = "$IllegalId$";
|
||||
try {
|
||||
UrlTemplate.compile(template);
|
||||
|
@ -80,7 +80,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateWithDefaultDownloaderFactory() {
|
||||
public void createWithDefaultDownloaderFactory() {
|
||||
DownloaderConstructorHelper constructorHelper =
|
||||
new DownloaderConstructorHelper(Mockito.mock(Cache.class), DummyDataSource.FACTORY);
|
||||
DownloaderFactory factory = new DefaultDownloaderFactory(constructorHelper);
|
||||
@ -98,7 +98,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadRepresentation() throws Exception {
|
||||
public void downloadRepresentation() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -113,7 +113,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadRepresentationInSmallParts() throws Exception {
|
||||
public void downloadRepresentationInSmallParts() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -132,7 +132,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadRepresentations() throws Exception {
|
||||
public void downloadRepresentations() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -151,7 +151,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadAllRepresentations() throws Exception {
|
||||
public void downloadAllRepresentations() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -172,7 +172,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProgressiveDownload() throws Exception {
|
||||
public void progressiveDownload() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -204,7 +204,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProgressiveDownloadSeparatePeriods() throws Exception {
|
||||
public void progressiveDownloadSeparatePeriods() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -236,7 +236,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadRepresentationFailure() throws Exception {
|
||||
public void downloadRepresentationFailure() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -261,7 +261,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCounters() throws Exception {
|
||||
public void counters() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -289,7 +289,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemove() throws Exception {
|
||||
public void remove() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD)
|
||||
@ -309,7 +309,7 @@ public class DashDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepresentationWithoutIndex() throws Exception {
|
||||
public void representationWithoutIndex() throws Exception {
|
||||
FakeDataSet fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(TEST_MPD_URI, TEST_MPD_NO_INDEX)
|
||||
|
@ -111,7 +111,7 @@ public class DownloadManagerDashTest {
|
||||
// Disabled due to flakiness.
|
||||
@Ignore
|
||||
@Test
|
||||
public void testSaveAndLoadActionFile() throws Throwable {
|
||||
public void saveAndLoadActionFile() throws Throwable {
|
||||
// Configure fakeDataSet to block until interrupted when TEST_MPD is read.
|
||||
fakeDataSet
|
||||
.newData(TEST_MPD_URI)
|
||||
@ -152,14 +152,14 @@ public class DownloadManagerDashTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleDownloadRequest() throws Throwable {
|
||||
public void handleDownloadRequest_downloadSuccess() throws Throwable {
|
||||
handleDownloadRequest(fakeStreamKey1, fakeStreamKey2);
|
||||
blockUntilTasksCompleteAndThrowAnyDownloadError();
|
||||
assertCachedData(cache, new RequestSet(fakeDataSet).useBoundedDataSpecFor("audio_init_data"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleMultipleDownloadRequest() throws Throwable {
|
||||
public void handleDownloadRequest_withRequest_downloadSuccess() throws Throwable {
|
||||
handleDownloadRequest(fakeStreamKey1);
|
||||
handleDownloadRequest(fakeStreamKey2);
|
||||
blockUntilTasksCompleteAndThrowAnyDownloadError();
|
||||
@ -167,7 +167,7 @@ public class DownloadManagerDashTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleInterferingDownloadRequest() throws Throwable {
|
||||
public void handleDownloadRequest_withInferringRequest_success() throws Throwable {
|
||||
fakeDataSet
|
||||
.newData("audio_segment_2")
|
||||
.appendReadAction(() -> handleDownloadRequest(fakeStreamKey2))
|
||||
@ -181,7 +181,7 @@ public class DownloadManagerDashTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleRemoveAction() throws Throwable {
|
||||
public void handleRemoveAction_blockUntilTaskCompleted_noDownloadedData() throws Throwable {
|
||||
handleDownloadRequest(fakeStreamKey1);
|
||||
|
||||
blockUntilTasksCompleteAndThrowAnyDownloadError();
|
||||
@ -194,7 +194,7 @@ public class DownloadManagerDashTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleRemoveActionBeforeDownloadFinish() throws Throwable {
|
||||
public void handleRemoveAction_beforeDownloadFinish_noDownloadedData() throws Throwable {
|
||||
handleDownloadRequest(fakeStreamKey1);
|
||||
handleRemoveAction();
|
||||
|
||||
@ -204,7 +204,7 @@ public class DownloadManagerDashTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandleInterferingRemoveAction() throws Throwable {
|
||||
public void handleRemoveAction_withInterfering_noDownloadedData() throws Throwable {
|
||||
CountDownLatch downloadInProgressLatch = new CountDownLatch(1);
|
||||
fakeDataSet
|
||||
.newData("audio_segment_2")
|
||||
|
@ -154,7 +154,7 @@ public class DownloadServiceDashTest {
|
||||
|
||||
@Ignore // b/78877092
|
||||
@Test
|
||||
public void testMultipleDownloadRequest() throws Throwable {
|
||||
public void multipleDownloadRequest() throws Throwable {
|
||||
downloadKeys(fakeStreamKey1);
|
||||
downloadKeys(fakeStreamKey2);
|
||||
|
||||
@ -165,7 +165,7 @@ public class DownloadServiceDashTest {
|
||||
|
||||
@Ignore // b/78877092
|
||||
@Test
|
||||
public void testRemoveAction() throws Throwable {
|
||||
public void removeAction() throws Throwable {
|
||||
downloadKeys(fakeStreamKey1, fakeStreamKey2);
|
||||
|
||||
downloadManagerListener.blockUntilTasksCompleteAndThrowAnyDownloadError();
|
||||
@ -179,7 +179,7 @@ public class DownloadServiceDashTest {
|
||||
|
||||
@Ignore // b/78877092
|
||||
@Test
|
||||
public void testRemoveBeforeDownloadComplete() throws Throwable {
|
||||
public void removeBeforeDownloadComplete() throws Throwable {
|
||||
pauseDownloadCondition = new ConditionVariable();
|
||||
downloadKeys(fakeStreamKey1, fakeStreamKey2);
|
||||
|
||||
|
@ -30,7 +30,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
private ConstantBitrateSeekMap constantBitrateSeekMap;
|
||||
|
||||
@Test
|
||||
public void testIsSeekable_forKnownInputLength_returnSeekable() {
|
||||
public void isSeekable_forKnownInputLength_returnSeekable() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 1000,
|
||||
@ -41,7 +41,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsSeekable_forUnknownInputLength_returnUnseekable() {
|
||||
public void isSeekable_forUnknownInputLength_returnUnseekable() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ C.LENGTH_UNSET,
|
||||
@ -52,7 +52,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPoints_forUnseekableInput_returnSeekPoint0() {
|
||||
public void getSeekPoints_forUnseekableInput_returnSeekPoint0() {
|
||||
int firstBytePosition = 100;
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
@ -67,7 +67,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDurationUs_forKnownInputLength_returnCorrectDuration() {
|
||||
public void getDurationUs_forKnownInputLength_returnCorrectDuration() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
@ -81,7 +81,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDurationUs_forUnnnownInputLength_returnUnknownDuration() {
|
||||
public void getDurationUs_forUnnnownInputLength_returnUnknownDuration() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ C.LENGTH_UNSET,
|
||||
@ -92,7 +92,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPoints_forSeekableInput_forSyncPosition0_return1SeekPoint() {
|
||||
public void getSeekPoints_forSeekableInput_forSyncPosition0_return1SeekPoint() {
|
||||
int firstBytePosition = 100;
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
@ -107,7 +107,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPoints_forSeekableInput_forSeekPointAtSyncPosition_return1SeekPoint() {
|
||||
public void getSeekPoints_forSeekableInput_forSeekPointAtSyncPosition_return1SeekPoint() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
@ -123,7 +123,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPoints_forSeekableInput_forNonSyncSeekPosition_return2SeekPoints() {
|
||||
public void getSeekPoints_forSeekableInput_forNonSyncSeekPosition_return2SeekPoints() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
@ -140,7 +140,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPoints_forSeekableInput_forSeekPointWithinLastFrame_return1SeekPoint() {
|
||||
public void getSeekPoints_forSeekableInput_forSeekPointWithinLastFrame_return1SeekPoint() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
@ -154,7 +154,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPoints_forSeekableInput_forSeekPointAtEndOfStream_return1SeekPoint() {
|
||||
public void getSeekPoints_forSeekableInput_forSeekPointAtEndOfStream_return1SeekPoint() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
@ -168,7 +168,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTimeUsAtPosition_forPosition0_return0() {
|
||||
public void getTimeUsAtPosition_forPosition0_return0() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
@ -180,7 +180,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTimeUsAtPosition_forPositionWithinStream_returnCorrectTime() {
|
||||
public void getTimeUsAtPosition_forPositionWithinStream_returnCorrectTime() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
@ -192,7 +192,7 @@ public final class ConstantBitrateSeekMapTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTimeUsAtPosition_forPositionAtEndOfStream_returnStreamDuration() {
|
||||
public void getTimeUsAtPosition_forPositionAtEndOfStream_returnStreamDuration() {
|
||||
constantBitrateSeekMap =
|
||||
new ConstantBitrateSeekMap(
|
||||
/* inputLength= */ 2_300,
|
||||
|
@ -41,7 +41,7 @@ public class DefaultExtractorInputTest {
|
||||
private static final int LARGE_TEST_DATA_LENGTH = 8192;
|
||||
|
||||
@Test
|
||||
public void testInitialPosition() throws Exception {
|
||||
public void initialPosition() throws Exception {
|
||||
FakeDataSource testDataSource = buildDataSource();
|
||||
DefaultExtractorInput input =
|
||||
new DefaultExtractorInput(testDataSource, 123, C.LENGTH_UNSET);
|
||||
@ -49,7 +49,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadMultipleTimes() throws Exception {
|
||||
public void readMultipleTimes() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
// We expect to perform three reads of three bytes, as setup in buildTestDataSource.
|
||||
@ -65,7 +65,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadAlreadyPeeked() throws Exception {
|
||||
public void readAlreadyPeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -79,7 +79,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadPartiallyPeeked() throws Exception {
|
||||
public void readPartiallyPeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -93,7 +93,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadEndOfInputBeforeFirstByteRead() throws Exception {
|
||||
public void readEndOfInputBeforeFirstByteRead() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -105,7 +105,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadEndOfInputAfterFirstByteRead() throws Exception {
|
||||
public void readEndOfInputAfterFirstByteRead() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -117,7 +117,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadZeroLength() throws Exception {
|
||||
public void readZeroLength() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -127,7 +127,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFullyOnce() throws Exception {
|
||||
public void readFullyOnce() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
input.readFully(target, 0, TEST_DATA.length);
|
||||
@ -147,7 +147,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFullyTwice() throws Exception {
|
||||
public void readFullyTwice() throws Exception {
|
||||
// Read TEST_DATA in two parts.
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[5];
|
||||
@ -161,7 +161,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFullyTooMuch() throws Exception {
|
||||
public void readFullyTooMuch() throws Exception {
|
||||
// Read more than TEST_DATA. Should fail with an EOFException. Position should not update.
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
try {
|
||||
@ -187,7 +187,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFullyWithFailingDataSource() throws Exception {
|
||||
public void readFullyWithFailingDataSource() throws Exception {
|
||||
FakeDataSource testDataSource = buildFailingDataSource();
|
||||
DefaultExtractorInput input = new DefaultExtractorInput(testDataSource, 0, C.LENGTH_UNSET);
|
||||
try {
|
||||
@ -202,7 +202,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadFullyHalfPeeked() throws Exception {
|
||||
public void readFullyHalfPeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -216,7 +216,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipMultipleTimes() throws Exception {
|
||||
public void skipMultipleTimes() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
// We expect to perform three skips of three bytes, as setup in buildTestDataSource.
|
||||
for (int i = 0; i < 3; i++) {
|
||||
@ -226,7 +226,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLargeSkip() throws Exception {
|
||||
public void largeSkip() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
// Check that skipping the entire data source succeeds.
|
||||
int bytesToSkip = LARGE_TEST_DATA_LENGTH;
|
||||
@ -236,7 +236,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipAlreadyPeeked() throws Exception {
|
||||
public void skipAlreadyPeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
|
||||
input.advancePeekPosition(TEST_DATA.length);
|
||||
@ -247,7 +247,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipPartiallyPeeked() throws Exception {
|
||||
public void skipPartiallyPeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
|
||||
input.advancePeekPosition(TEST_DATA.length - 1);
|
||||
@ -258,7 +258,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipEndOfInputBeforeFirstByteSkipped() throws Exception {
|
||||
public void skipEndOfInputBeforeFirstByteSkipped() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
|
||||
input.skipFully(TEST_DATA.length);
|
||||
@ -269,7 +269,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipEndOfInputAfterFirstByteSkipped() throws Exception {
|
||||
public void skipEndOfInputAfterFirstByteSkipped() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
|
||||
input.skipFully(TEST_DATA.length - 1);
|
||||
@ -280,7 +280,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipZeroLength() throws Exception {
|
||||
public void skipZeroLength() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
|
||||
int bytesRead = input.skip(0);
|
||||
@ -289,7 +289,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipFullyOnce() throws Exception {
|
||||
public void skipFullyOnce() throws Exception {
|
||||
// Skip TEST_DATA.
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
input.skipFully(TEST_DATA.length);
|
||||
@ -307,7 +307,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipFullyTwice() throws Exception {
|
||||
public void skipFullyTwice() throws Exception {
|
||||
// Skip TEST_DATA in two parts.
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
input.skipFully(5);
|
||||
@ -317,7 +317,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipFullyTwicePeeked() throws Exception {
|
||||
public void skipFullyTwicePeeked() throws Exception {
|
||||
// Skip TEST_DATA.
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
|
||||
@ -332,7 +332,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipFullyTooMuch() throws Exception {
|
||||
public void skipFullyTooMuch() throws Exception {
|
||||
// Skip more than TEST_DATA. Should fail with an EOFException. Position should not update.
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
try {
|
||||
@ -356,7 +356,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipFullyWithFailingDataSource() throws Exception {
|
||||
public void skipFullyWithFailingDataSource() throws Exception {
|
||||
FakeDataSource testDataSource = buildFailingDataSource();
|
||||
DefaultExtractorInput input = new DefaultExtractorInput(testDataSource, 0, C.LENGTH_UNSET);
|
||||
try {
|
||||
@ -370,7 +370,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipFullyLarge() throws Exception {
|
||||
public void skipFullyLarge() throws Exception {
|
||||
// Tests skipping an amount of data that's larger than any internal scratch space.
|
||||
int largeSkipSize = 1024 * 1024;
|
||||
FakeDataSource testDataSource = new FakeDataSource();
|
||||
@ -390,7 +390,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekMultipleTimes() throws Exception {
|
||||
public void peekMultipleTimes() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -407,7 +407,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekAlreadyPeeked() throws Exception {
|
||||
public void peekAlreadyPeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -422,7 +422,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekPartiallyPeeked() throws Exception {
|
||||
public void peekPartiallyPeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -436,7 +436,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekEndOfInputBeforeFirstBytePeeked() throws Exception {
|
||||
public void peekEndOfInputBeforeFirstBytePeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -448,7 +448,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekEndOfInputAfterFirstBytePeeked() throws Exception {
|
||||
public void peekEndOfInputAfterFirstBytePeeked() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -460,7 +460,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekZeroLength() throws Exception {
|
||||
public void peekZeroLength() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -470,7 +470,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekFully() throws Exception {
|
||||
public void peekFully() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
input.peekFully(target, 0, TEST_DATA.length);
|
||||
@ -497,7 +497,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekFullyAfterEofExceptionPeeksAsExpected() throws Exception {
|
||||
public void peekFullyAfterEofExceptionPeeksAsExpected() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length + 10];
|
||||
|
||||
@ -514,7 +514,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResetPeekPosition() throws Exception {
|
||||
public void resetPeekPosition() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
input.peekFully(target, 0, TEST_DATA.length);
|
||||
@ -539,7 +539,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekFullyAtEndOfStreamWithAllowEndOfInputSucceeds() throws Exception {
|
||||
public void peekFullyAtEndOfStreamWithAllowEndOfInputSucceeds() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -551,7 +551,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekFullyAtEndThenReadEndOfInput() throws Exception {
|
||||
public void peekFullyAtEndThenReadEndOfInput() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -569,7 +569,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekFullyAcrossEndOfInputWithAllowEndOfInputFails() throws Exception {
|
||||
public void peekFullyAcrossEndOfInputWithAllowEndOfInputFails() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -586,7 +586,7 @@ public class DefaultExtractorInputTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResetAndPeekFullyPastEndOfStreamWithAllowEndOfInputFails() throws Exception {
|
||||
public void resetAndPeekFullyPastEndOfStreamWithAllowEndOfInputFails() throws Exception {
|
||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
||||
byte[] target = new byte[TEST_DATA.length];
|
||||
|
||||
@ -622,14 +622,6 @@ public class DefaultExtractorInputTest {
|
||||
return testDataSource;
|
||||
}
|
||||
|
||||
private static FakeDataSource buildLargeDataSource() throws Exception {
|
||||
FakeDataSource testDataSource = new FakeDataSource();
|
||||
testDataSource.getDataSet().newDefaultData()
|
||||
.appendReadData(new byte[LARGE_TEST_DATA_LENGTH]);
|
||||
testDataSource.open(new DataSpec(Uri.parse(TEST_URI)));
|
||||
return testDataSource;
|
||||
}
|
||||
|
||||
private static DefaultExtractorInput createDefaultExtractorInput() throws Exception {
|
||||
FakeDataSource testDataSource = buildDataSource();
|
||||
return new DefaultExtractorInput(testDataSource, 0, C.LENGTH_UNSET);
|
||||
|
@ -42,7 +42,7 @@ import org.junit.runner.RunWith;
|
||||
public final class DefaultExtractorsFactoryTest {
|
||||
|
||||
@Test
|
||||
public void testCreateExtractors_returnExpectedClasses() {
|
||||
public void createExtractors_returnExpectedClasses() {
|
||||
DefaultExtractorsFactory defaultExtractorsFactory = new DefaultExtractorsFactory();
|
||||
|
||||
Extractor[] extractors = defaultExtractorsFactory.createExtractors();
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class ExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testConstants() {
|
||||
public void constants() {
|
||||
// Sanity check that constant values match those defined by {@link C}.
|
||||
assertThat(Extractor.RESULT_END_OF_INPUT).isEqualTo(C.RESULT_END_OF_INPUT);
|
||||
// Sanity check that the other constant values don't overlap.
|
||||
|
@ -34,7 +34,7 @@ public class ExtractorUtilTest {
|
||||
private static final byte[] TEST_DATA = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||
|
||||
@Test
|
||||
public void testPeekToLengthEndNotReached() throws Exception {
|
||||
public void peekToLengthEndNotReached() throws Exception {
|
||||
FakeDataSource testDataSource = new FakeDataSource();
|
||||
testDataSource
|
||||
.getDataSet()
|
||||
@ -57,7 +57,7 @@ public class ExtractorUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekToLengthEndReached() throws Exception {
|
||||
public void peekToLengthEndReached() throws Exception {
|
||||
FakeDataSource testDataSource = new FakeDataSource();
|
||||
testDataSource
|
||||
.getDataSet()
|
||||
|
@ -35,7 +35,7 @@ import org.junit.runner.RunWith;
|
||||
public final class Id3PeekerTest {
|
||||
|
||||
@Test
|
||||
public void testPeekId3Data_returnNull_ifId3TagNotPresentAtBeginningOfInput()
|
||||
public void peekId3Data_returnNull_ifId3TagNotPresentAtBeginningOfInput()
|
||||
throws IOException, InterruptedException {
|
||||
Id3Peeker id3Peeker = new Id3Peeker();
|
||||
FakeExtractorInput input =
|
||||
@ -48,8 +48,7 @@ public final class Id3PeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekId3Data_returnId3Tag_ifId3TagPresent()
|
||||
throws IOException, InterruptedException {
|
||||
public void peekId3Data_returnId3Tag_ifId3TagPresent() throws IOException, InterruptedException {
|
||||
Id3Peeker id3Peeker = new Id3Peeker();
|
||||
FakeExtractorInput input =
|
||||
new FakeExtractorInput.Builder()
|
||||
@ -69,7 +68,7 @@ public final class Id3PeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPeekId3Data_returnId3TagAccordingToGivenPredicate_ifId3TagPresent()
|
||||
public void peekId3Data_returnId3TagAccordingToGivenPredicate_ifId3TagPresent()
|
||||
throws IOException, InterruptedException {
|
||||
Id3Peeker id3Peeker = new Id3Peeker();
|
||||
FakeExtractorInput input =
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class VorbisBitArrayTest {
|
||||
|
||||
@Test
|
||||
public void testReadBit() {
|
||||
public void readBit() {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0x5c, 0x50));
|
||||
assertThat(bitArray.readBit()).isFalse();
|
||||
assertThat(bitArray.readBit()).isFalse();
|
||||
@ -48,7 +48,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipBits() {
|
||||
public void skipBits() {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0xF0, 0x0F));
|
||||
bitArray.skipBits(10);
|
||||
assertThat(bitArray.getPosition()).isEqualTo(10);
|
||||
@ -62,7 +62,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPosition() throws Exception {
|
||||
public void getPosition() throws Exception {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0xF0, 0x0F));
|
||||
assertThat(bitArray.getPosition()).isEqualTo(0);
|
||||
bitArray.readBit();
|
||||
@ -74,7 +74,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetPosition() throws Exception {
|
||||
public void setPosition() throws Exception {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0xF0, 0x0F));
|
||||
assertThat(bitArray.getPosition()).isEqualTo(0);
|
||||
bitArray.setPosition(4);
|
||||
@ -84,7 +84,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadInt32() {
|
||||
public void readInt32() {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0xF0, 0x0F, 0xF0, 0x0F));
|
||||
assertThat(bitArray.readBits(32)).isEqualTo(0x0FF00FF0);
|
||||
bitArray = new VorbisBitArray(TestUtil.createByteArray(0x0F, 0xF0, 0x0F, 0xF0));
|
||||
@ -92,7 +92,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBits() throws Exception {
|
||||
public void readBits() throws Exception {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0x03, 0x22));
|
||||
assertThat(bitArray.readBits(2)).isEqualTo(3);
|
||||
bitArray.skipBits(6);
|
||||
@ -104,7 +104,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead4BitsBeyondBoundary() throws Exception {
|
||||
public void read4BitsBeyondBoundary() throws Exception {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0x2e, 0x10));
|
||||
assertThat(bitArray.readBits(7)).isEqualTo(0x2e);
|
||||
assertThat(bitArray.getPosition()).isEqualTo(7);
|
||||
@ -112,7 +112,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsBeyondByteBoundaries() throws Exception {
|
||||
public void readBitsBeyondByteBoundaries() throws Exception {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0xFF, 0x0F, 0xFF, 0x0F));
|
||||
assertThat(bitArray.readBits(32)).isEqualTo(0x0FFF0FFF);
|
||||
|
||||
@ -137,7 +137,7 @@ public final class VorbisBitArrayTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadBitsIllegalLengths() throws Exception {
|
||||
public void readBitsIllegalLengths() throws Exception {
|
||||
VorbisBitArray bitArray = new VorbisBitArray(TestUtil.createByteArray(0x03, 0x22, 0x30));
|
||||
|
||||
// reading zero bits gets 0 without advancing position
|
||||
|
@ -34,7 +34,7 @@ import org.junit.runner.RunWith;
|
||||
public final class VorbisUtilTest {
|
||||
|
||||
@Test
|
||||
public void testILog() throws Exception {
|
||||
public void iLog_returnsHighestSetBit() {
|
||||
assertThat(iLog(0)).isEqualTo(0);
|
||||
assertThat(iLog(1)).isEqualTo(1);
|
||||
assertThat(iLog(2)).isEqualTo(2);
|
||||
@ -47,7 +47,7 @@ public final class VorbisUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadIdHeader() throws Exception {
|
||||
public void readIdHeader() throws Exception {
|
||||
byte[] data =
|
||||
TestUtil.getByteArray(
|
||||
ApplicationProvider.getApplicationContext(), "binary/vorbis/id_header");
|
||||
@ -67,7 +67,7 @@ public final class VorbisUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadCommentHeader() throws IOException {
|
||||
public void readCommentHeader() throws IOException {
|
||||
byte[] data =
|
||||
TestUtil.getByteArray(
|
||||
ApplicationProvider.getApplicationContext(), "binary/vorbis/comment_header");
|
||||
@ -82,7 +82,7 @@ public final class VorbisUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadVorbisModes() throws IOException {
|
||||
public void readVorbisModes() throws IOException {
|
||||
byte[] data =
|
||||
TestUtil.getByteArray(
|
||||
ApplicationProvider.getApplicationContext(), "binary/vorbis/setup_header");
|
||||
@ -101,14 +101,15 @@ public final class VorbisUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVerifyVorbisHeaderCapturePattern() throws ParserException {
|
||||
public void verifyVorbisHeaderCapturePattern_withValidHeader_returnsTrue()
|
||||
throws ParserException {
|
||||
ParsableByteArray header = new ParsableByteArray(
|
||||
new byte[] {0x01, 'v', 'o', 'r', 'b', 'i', 's'});
|
||||
assertThat(verifyVorbisHeaderCapturePattern(0x01, header, false)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVerifyVorbisHeaderCapturePatternInvalidHeader() {
|
||||
public void verifyVorbisHeaderCapturePattern_withValidHeader_returnsFalse() {
|
||||
ParsableByteArray header = new ParsableByteArray(
|
||||
new byte[] {0x01, 'v', 'o', 'r', 'b', 'i', 's'});
|
||||
try {
|
||||
@ -120,14 +121,15 @@ public final class VorbisUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVerifyVorbisHeaderCapturePatternInvalidHeaderQuite() throws ParserException {
|
||||
public void verifyVorbisHeaderCapturePattern_withInvalidHeaderQuite_returnsFalse()
|
||||
throws ParserException {
|
||||
ParsableByteArray header = new ParsableByteArray(
|
||||
new byte[] {0x01, 'v', 'o', 'r', 'b', 'i', 's'});
|
||||
assertThat(verifyVorbisHeaderCapturePattern(0x99, header, true)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVerifyVorbisHeaderCapturePatternInvalidPattern() {
|
||||
public void verifyVorbisHeaderCapturePattern_withInvalidPattern_returnsFalse() {
|
||||
ParsableByteArray header = new ParsableByteArray(
|
||||
new byte[] {0x01, 'x', 'v', 'o', 'r', 'b', 'i', 's'});
|
||||
try {
|
||||
@ -139,7 +141,7 @@ public final class VorbisUtilTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVerifyVorbisHeaderCapturePatternQuiteInvalidPatternQuite()
|
||||
public void verifyVorbisHeaderCapturePatternQuite_withInvalidPatternQuite_returnsFalse()
|
||||
throws ParserException {
|
||||
ParsableByteArray header = new ParsableByteArray(
|
||||
new byte[] {0x01, 'x', 'v', 'o', 'r', 'b', 'i', 's'});
|
||||
|
@ -56,7 +56,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAmrExtractorReads_returnSeekableSeekMap_forNarrowBandAmr()
|
||||
public void amrExtractorReads_returnSeekableSeekMap_forNarrowBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = NARROW_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -76,7 +76,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingToPositionInFile_extractsCorrectFrame_forNarrowBandAmr()
|
||||
public void seeking_handlesSeekingToPositionInFile_extractsCorrectFrame_forNarrowBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = NARROW_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -103,7 +103,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekToEoF_extractsLastFrame_forNarrowBandAmr()
|
||||
public void seeking_handlesSeekToEoF_extractsLastFrame_forNarrowBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = NARROW_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -130,7 +130,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingBackward_extractsCorrectFrames_forNarrowBandAmr()
|
||||
public void seeking_handlesSeekingBackward_extractsCorrectFrames_forNarrowBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = NARROW_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -159,7 +159,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingForward_extractsCorrectFrames_forNarrowBandAmr()
|
||||
public void seeking_handlesSeekingForward_extractsCorrectFrames_forNarrowBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = NARROW_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -188,7 +188,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesRandomSeeks_extractsCorrectFrames_forNarrowBandAmr()
|
||||
public void seeking_handlesRandomSeeks_extractsCorrectFrames_forNarrowBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = NARROW_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -217,7 +217,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAmrExtractorReads_returnSeekableSeekMap_forWideBandAmr()
|
||||
public void amrExtractorReads_returnSeekableSeekMap_forWideBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = WIDE_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -237,7 +237,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingToPositionInFile_extractsCorrectFrame_forWideBandAmr()
|
||||
public void seeking_handlesSeekingToPositionInFile_extractsCorrectFrame_forWideBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = WIDE_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -264,7 +264,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekToEoF_extractsLastFrame_forWideBandAmr()
|
||||
public void seeking_handlesSeekToEoF_extractsLastFrame_forWideBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = WIDE_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -291,7 +291,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingBackward_extractsCorrectFrames_forWideBandAmr()
|
||||
public void seeking_handlesSeekingBackward_extractsCorrectFrames_forWideBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = WIDE_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -320,7 +320,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingForward_extractsCorrectFrames_forWideBandAmr()
|
||||
public void seeking_handlesSeekingForward_extractsCorrectFrames_forWideBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = WIDE_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -349,7 +349,7 @@ public final class AmrExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesRandomSeeks_extractsCorrectFrames_forWideBandAmr()
|
||||
public void seeking_handlesRandomSeeks_extractsCorrectFrames_forWideBandAmr()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = WIDE_BAND_AMR_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
|
@ -42,7 +42,7 @@ public final class AmrExtractorTest {
|
||||
private static final Random RANDOM = new Random(1234);
|
||||
|
||||
@Test
|
||||
public void testSniff_nonAmrSignature_returnFalse() throws IOException, InterruptedException {
|
||||
public void sniff_nonAmrSignature_returnFalse() throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
FakeExtractorInput input = fakeExtractorInputWithData(Util.getUtf8Bytes("0#!AMR\n123"));
|
||||
|
||||
@ -51,8 +51,7 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_nonAmrSignature_throwParserException()
|
||||
throws IOException, InterruptedException {
|
||||
public void read_nonAmrSignature_throwParserException() throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
FakeExtractorInput input = fakeExtractorInputWithData(Util.getUtf8Bytes("0#!AMR-WB\n"));
|
||||
|
||||
@ -65,7 +64,7 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_amrNb_returnParserException_forInvalidFrameType()
|
||||
public void read_amrNb_returnParserException_forInvalidFrameType()
|
||||
throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
|
||||
@ -83,7 +82,7 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_amrWb_returnParserException_forInvalidFrameType()
|
||||
public void read_amrWb_returnParserException_forInvalidFrameType()
|
||||
throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
|
||||
@ -101,7 +100,7 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_amrNb_returnEndOfInput_ifInputEncountersEoF()
|
||||
public void read_amrNb_returnEndOfInput_ifInputEncountersEoF()
|
||||
throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
|
||||
@ -117,7 +116,7 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_amrWb_returnEndOfInput_ifInputEncountersEoF()
|
||||
public void read_amrWb_returnEndOfInput_ifInputEncountersEoF()
|
||||
throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
|
||||
@ -133,7 +132,7 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_amrNb_returnParserException_forInvalidFrameHeader()
|
||||
public void read_amrNb_returnParserException_forInvalidFrameHeader()
|
||||
throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
|
||||
@ -155,7 +154,7 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead_amrWb_returnParserException_forInvalidFrameHeader()
|
||||
public void read_amrWb_returnParserException_forInvalidFrameHeader()
|
||||
throws IOException, InterruptedException {
|
||||
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
|
||||
|
||||
@ -177,25 +176,25 @@ public final class AmrExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractingNarrowBandSamples() throws Exception {
|
||||
public void extractingNarrowBandSamples() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
createAmrExtractorFactory(/* withSeeking= */ false), "amr/sample_nb.amr");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractingWideBandSamples() throws Exception {
|
||||
public void extractingWideBandSamples() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
createAmrExtractorFactory(/* withSeeking= */ false), "amr/sample_wb.amr");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractingNarrowBandSamples_withSeeking() throws Exception {
|
||||
public void extractingNarrowBandSamples_withSeeking() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
createAmrExtractorFactory(/* withSeeking= */ true), "amr/sample_nb_cbr.amr");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractingWideBandSamples_withSeeking() throws Exception {
|
||||
public void extractingWideBandSamples_withSeeking() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
createAmrExtractorFactory(/* withSeeking= */ true), "amr/sample_wb_cbr.amr");
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
|
||||
public class FlacExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testSample() throws Exception {
|
||||
public void sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear.flac",
|
||||
@ -35,7 +35,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithId3HeaderAndId3Enabled() throws Exception {
|
||||
public void sampleWithId3HeaderAndId3Enabled() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_with_id3.flac",
|
||||
@ -44,7 +44,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithId3HeaderAndId3Disabled() throws Exception {
|
||||
public void sampleWithId3HeaderAndId3Disabled() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
() -> new FlacExtractor(FlacExtractor.FLAG_DISABLE_ID3_METADATA),
|
||||
/* file= */ "flac/bear_with_id3.flac",
|
||||
@ -53,7 +53,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleUnseekable() throws Exception {
|
||||
public void sampleUnseekable() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_no_seek_table_no_num_samples.flac",
|
||||
@ -62,7 +62,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithVorbisComments() throws Exception {
|
||||
public void sampleWithVorbisComments() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_with_vorbis_comments.flac",
|
||||
@ -71,7 +71,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithPicture() throws Exception {
|
||||
public void sampleWithPicture() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_with_picture.flac",
|
||||
@ -80,7 +80,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOneMetadataBlock() throws Exception {
|
||||
public void oneMetadataBlock() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_one_metadata_block.flac",
|
||||
@ -89,7 +89,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoMinMaxFrameSize() throws Exception {
|
||||
public void noMinMaxFrameSize() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_no_min_max_frame_size.flac",
|
||||
@ -98,7 +98,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoNumSamples() throws Exception {
|
||||
public void noNumSamples() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_no_num_samples.flac",
|
||||
@ -107,7 +107,7 @@ public class FlacExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUncommonSampleRate() throws Exception {
|
||||
public void uncommonSampleRate() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
FlacExtractor::new,
|
||||
/* file= */ "flac/bear_uncommon_sample_rate.flac",
|
||||
|
@ -25,7 +25,7 @@ import org.junit.runner.RunWith;
|
||||
public final class FlvExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testSample() throws Exception {
|
||||
public void sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(FlvExtractor::new, "flv/sample.flv");
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
|
||||
public class DefaultEbmlReaderTest {
|
||||
|
||||
@Test
|
||||
public void testMasterElement() throws IOException, InterruptedException {
|
||||
public void masterElement() throws IOException, InterruptedException {
|
||||
ExtractorInput input = createTestInput(0x1A, 0x45, 0xDF, 0xA3, 0x84, 0x42, 0x85, 0x81, 0x01);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
expected.startMasterElement(TestProcessor.ID_EBML, 5, 4);
|
||||
@ -43,7 +43,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMasterElementEmpty() throws IOException, InterruptedException {
|
||||
public void masterElementEmpty() throws IOException, InterruptedException {
|
||||
ExtractorInput input = createTestInput(0x18, 0x53, 0x80, 0x67, 0x80);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
expected.startMasterElement(TestProcessor.ID_SEGMENT, 5, 0);
|
||||
@ -52,7 +52,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsignedIntegerElement() throws IOException, InterruptedException {
|
||||
public void unsignedIntegerElement() throws IOException, InterruptedException {
|
||||
// 0xFE is chosen because for signed integers it should be interpreted as -2
|
||||
ExtractorInput input = createTestInput(0x42, 0xF7, 0x81, 0xFE);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
@ -61,7 +61,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsignedIntegerElementLarge() throws IOException, InterruptedException {
|
||||
public void unsignedIntegerElementLarge() throws IOException, InterruptedException {
|
||||
ExtractorInput input =
|
||||
createTestInput(0x42, 0xF7, 0x88, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
@ -70,7 +70,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsignedIntegerElementTooLargeBecomesNegative()
|
||||
public void unsignedIntegerElementTooLargeBecomesNegative()
|
||||
throws IOException, InterruptedException {
|
||||
ExtractorInput input =
|
||||
createTestInput(0x42, 0xF7, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
@ -80,7 +80,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringElement() throws IOException, InterruptedException {
|
||||
public void stringElement() throws IOException, InterruptedException {
|
||||
ExtractorInput input = createTestInput(0x42, 0x82, 0x86, 0x41, 0x62, 0x63, 0x31, 0x32, 0x33);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
expected.stringElement(TestProcessor.ID_DOC_TYPE, "Abc123");
|
||||
@ -88,7 +88,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringElementWithZeroPadding() throws IOException, InterruptedException {
|
||||
public void stringElementWithZeroPadding() throws IOException, InterruptedException {
|
||||
ExtractorInput input = createTestInput(0x42, 0x82, 0x86, 0x41, 0x62, 0x63, 0x00, 0x00, 0x00);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
expected.stringElement(TestProcessor.ID_DOC_TYPE, "Abc");
|
||||
@ -96,7 +96,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringElementEmpty() throws IOException, InterruptedException {
|
||||
public void stringElementEmpty() throws IOException, InterruptedException {
|
||||
ExtractorInput input = createTestInput(0x42, 0x82, 0x80);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
expected.stringElement(TestProcessor.ID_DOC_TYPE, "");
|
||||
@ -104,7 +104,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFloatElementFourBytes() throws IOException, InterruptedException {
|
||||
public void floatElementFourBytes() throws IOException, InterruptedException {
|
||||
ExtractorInput input =
|
||||
createTestInput(0x44, 0x89, 0x84, 0x3F, 0x80, 0x00, 0x00);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
@ -113,7 +113,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFloatElementEightBytes() throws IOException, InterruptedException {
|
||||
public void floatElementEightBytes() throws IOException, InterruptedException {
|
||||
ExtractorInput input =
|
||||
createTestInput(0x44, 0x89, 0x88, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
@ -122,7 +122,7 @@ public class DefaultEbmlReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBinaryElement() throws IOException, InterruptedException {
|
||||
public void binaryElement() throws IOException, InterruptedException {
|
||||
ExtractorInput input =
|
||||
createTestInput(0xA3, 0x88, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08);
|
||||
TestProcessor expected = new TestProcessor();
|
||||
|
@ -25,23 +25,23 @@ import org.junit.runner.RunWith;
|
||||
public final class MatroskaExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testMkvSample() throws Exception {
|
||||
public void mkvSample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(MatroskaExtractor::new, "mkv/sample.mkv");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMkvFullBlocksSample() throws Exception {
|
||||
public void mkvFullBlocksSample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(MatroskaExtractor::new, "mkv/full_blocks.mkv");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWebmSubsampleEncryption() throws Exception {
|
||||
public void webmSubsampleEncryption() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
MatroskaExtractor::new, "mkv/subsample_encrypted_noaltref.webm");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWebmSubsampleEncryptionWithAltrefFrames() throws Exception {
|
||||
public void webmSubsampleEncryptionWithAltrefFrames() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(MatroskaExtractor::new, "mkv/subsample_encrypted_altref.webm");
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public final class VarintReaderTest {
|
||||
private static final long VALUE_8_BYTE_MAX_WITH_MASK = 0x1FFFFFFFFFFFFFFL;
|
||||
|
||||
@Test
|
||||
public void testReadVarintEndOfInputAtStart() throws IOException, InterruptedException {
|
||||
public void readVarintEndOfInputAtStart() throws IOException, InterruptedException {
|
||||
VarintReader reader = new VarintReader();
|
||||
// Build an input with no data.
|
||||
ExtractorInput input = new FakeExtractorInput.Builder()
|
||||
@ -104,7 +104,7 @@ public final class VarintReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadVarintExceedsMaximumAllowedLength() throws IOException, InterruptedException {
|
||||
public void readVarintExceedsMaximumAllowedLength() throws IOException, InterruptedException {
|
||||
VarintReader reader = new VarintReader();
|
||||
ExtractorInput input = new FakeExtractorInput.Builder()
|
||||
.setData(DATA_8_BYTE_0)
|
||||
@ -115,7 +115,7 @@ public final class VarintReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadVarint() throws IOException, InterruptedException {
|
||||
public void readVarint() throws IOException, InterruptedException {
|
||||
VarintReader reader = new VarintReader();
|
||||
testReadVarint(reader, true, DATA_1_BYTE_0, 1, 0);
|
||||
testReadVarint(reader, true, DATA_2_BYTE_0, 2, 0);
|
||||
@ -152,7 +152,7 @@ public final class VarintReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadVarintFlaky() throws IOException, InterruptedException {
|
||||
public void readVarintFlaky() throws IOException, InterruptedException {
|
||||
VarintReader reader = new VarintReader();
|
||||
testReadVarintFlaky(reader, true, DATA_1_BYTE_0, 1, 0);
|
||||
testReadVarintFlaky(reader, true, DATA_2_BYTE_0, 2, 0);
|
||||
|
@ -25,25 +25,25 @@ import org.junit.runner.RunWith;
|
||||
public final class Mp3ExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testMp3SampleWithXingHeader() throws Exception {
|
||||
public void mp3SampleWithXingHeader() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Mp3Extractor::new, "mp3/bear-vbr-xing-header.mp3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMp3SampleWithCbrSeeker() throws Exception {
|
||||
public void mp3SampleWithCbrSeeker() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
Mp3Extractor::new, "mp3/bear-cbr-variable-frame-size-no-seek-table.mp3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMp3SampleWithIndexSeeker() throws Exception {
|
||||
public void mp3SampleWithIndexSeeker() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
() -> new Mp3Extractor(Mp3Extractor.FLAG_ENABLE_INDEX_SEEKING),
|
||||
"mp3/bear-vbr-no-seek-table.mp3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrimmedMp3Sample() throws Exception {
|
||||
public void trimmedMp3Sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Mp3Extractor::new, "mp3/play-trimmed.mp3");
|
||||
}
|
||||
}
|
||||
|
@ -69,19 +69,19 @@ public final class XingSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTimeUsBeforeFirstAudioFrame() {
|
||||
public void getTimeUsBeforeFirstAudioFrame() {
|
||||
assertThat(seeker.getTimeUs(-1)).isEqualTo(0);
|
||||
assertThat(seekerWithInputLength.getTimeUs(-1)).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTimeUsAtFirstAudioFrame() {
|
||||
public void getTimeUsAtFirstAudioFrame() {
|
||||
assertThat(seeker.getTimeUs(XING_FRAME_POSITION + xingFrameSize)).isEqualTo(0);
|
||||
assertThat(seekerWithInputLength.getTimeUs(XING_FRAME_POSITION + xingFrameSize)).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTimeUsAtEndOfStream() {
|
||||
public void getTimeUsAtEndOfStream() {
|
||||
assertThat(seeker.getTimeUs(STREAM_LENGTH))
|
||||
.isEqualTo(STREAM_DURATION_US);
|
||||
assertThat(
|
||||
@ -90,7 +90,7 @@ public final class XingSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPointsAtStartOfStream() {
|
||||
public void getSeekPointsAtStartOfStream() {
|
||||
SeekPoints seekPoints = seeker.getSeekPoints(0);
|
||||
SeekPoint seekPoint = seekPoints.first;
|
||||
assertThat(seekPoint).isEqualTo(seekPoints.second);
|
||||
@ -99,7 +99,7 @@ public final class XingSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSeekPointsAtEndOfStream() {
|
||||
public void getSeekPointsAtEndOfStream() {
|
||||
SeekPoints seekPoints = seeker.getSeekPoints(STREAM_DURATION_US);
|
||||
SeekPoint seekPoint = seekPoints.first;
|
||||
assertThat(seekPoint).isEqualTo(seekPoints.second);
|
||||
@ -108,7 +108,7 @@ public final class XingSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTimeForAllPositions() {
|
||||
public void getTimeForAllPositions() {
|
||||
for (int offset = xingFrameSize; offset < DATA_SIZE_BYTES; offset++) {
|
||||
int position = XING_FRAME_POSITION + offset;
|
||||
// Test seeker.
|
||||
|
@ -37,7 +37,7 @@ public final class AtomParsersTest {
|
||||
+ SAMPLE_COUNT + "0001000200030004");
|
||||
|
||||
@Test
|
||||
public void testParseCommonEncryptionSinfFromParentIgnoresUnknownSchemeType() {
|
||||
public void parseCommonEncryptionSinfFromParentIgnoresUnknownSchemeType() {
|
||||
byte[] cencSinf = new byte[] {
|
||||
0, 0, 0, 24, 115, 105, 110, 102, // size (4), 'sinf' (4)
|
||||
0, 0, 0, 16, 115, 99, 104, 109, // size (4), 'schm' (4)
|
||||
@ -47,17 +47,17 @@ public final class AtomParsersTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStz2Parsing4BitFieldSize() {
|
||||
public void stz2Parsing4BitFieldSize() {
|
||||
verifyStz2Parsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(FOUR_BIT_STZ2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStz2Parsing8BitFieldSize() {
|
||||
public void stz2Parsing8BitFieldSize() {
|
||||
verifyStz2Parsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(EIGHT_BIT_STZ2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStz2Parsing16BitFieldSize() {
|
||||
public void stz2Parsing16BitFieldSize() {
|
||||
verifyStz2Parsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(SIXTEEN_BIT_STZ2)));
|
||||
}
|
||||
|
||||
|
@ -31,19 +31,19 @@ import org.junit.runner.RunWith;
|
||||
public final class FragmentedMp4ExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testSample() throws Exception {
|
||||
public void sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
getExtractorFactory(ImmutableList.of()), "mp4/sample_fragmented.mp4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleSeekable() throws Exception {
|
||||
public void sampleSeekable() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
getExtractorFactory(ImmutableList.of()), "mp4/sample_fragmented_seekable.mp4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithSeiPayloadParsing() throws Exception {
|
||||
public void sampleWithSeiPayloadParsing() throws Exception {
|
||||
// Enabling the CEA-608 track enables SEI payload parsing.
|
||||
ExtractorFactory extractorFactory =
|
||||
getExtractorFactory(
|
||||
@ -53,19 +53,19 @@ public final class FragmentedMp4ExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithAc4Track() throws Exception {
|
||||
public void sampleWithAc4Track() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
getExtractorFactory(ImmutableList.of()), "mp4/sample_ac4_fragmented.mp4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithProtectedAc4Track() throws Exception {
|
||||
public void sampleWithProtectedAc4Track() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
getExtractorFactory(ImmutableList.of()), "mp4/sample_ac4_protected.mp4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithEac3Track() throws Exception {
|
||||
public void sampleWithEac3Track() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
getExtractorFactory(ImmutableList.of()), "mp4/sample_eac3_fragmented.mp4");
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class MdtaMetadataEntryTest {
|
||||
|
||||
@Test
|
||||
public void testParcelable() {
|
||||
public void parcelable() {
|
||||
MdtaMetadataEntry mdtaMetadataEntryToParcel =
|
||||
new MdtaMetadataEntry("test", new byte[] {1, 2}, 3, 4);
|
||||
|
||||
|
@ -25,12 +25,12 @@ import org.junit.runner.RunWith;
|
||||
public final class Mp4ExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testMp4Sample() throws Exception {
|
||||
public void mp4Sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample.mp4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMp4SampleWithSlowMotionMetadata() throws Exception {
|
||||
public void mp4SampleWithSlowMotionMetadata() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_android_slow_motion.mp4");
|
||||
}
|
||||
|
||||
@ -39,17 +39,17 @@ public final class Mp4ExtractorTest {
|
||||
* atom whose size indicates that it extends 8 bytes beyond the end of the file.
|
||||
*/
|
||||
@Test
|
||||
public void testMp4SampleWithMdatTooLong() throws Exception {
|
||||
public void mp4SampleWithMdatTooLong() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_mdat_too_long.mp4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMp4SampleWithAc4Track() throws Exception {
|
||||
public void mp4SampleWithAc4Track() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_ac4.mp4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMp4SampleWithEac3Track() throws Exception {
|
||||
public void mp4SampleWithEac3Track() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Mp4Extractor::new, "mp4/sample_eac3.mp4");
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import org.junit.runner.RunWith;
|
||||
public final class PsshAtomUtilTest {
|
||||
|
||||
@Test
|
||||
public void testBuildPsshAtom() {
|
||||
public void buildPsshAtom() {
|
||||
byte[] schemeData = new byte[]{0, 1, 2, 3, 4, 5};
|
||||
byte[] psshAtom = PsshAtomUtil.buildPsshAtom(C.WIDEVINE_UUID, schemeData);
|
||||
// Read the PSSH atom back and assert its content is as expected.
|
||||
|
@ -39,7 +39,7 @@ public final class DefaultOggSeekerTest {
|
||||
private final Random random = new Random(/* seed= */ 0);
|
||||
|
||||
@Test
|
||||
public void testSetupWithUnsetEndPositionFails() {
|
||||
public void setupWithUnsetEndPositionFails() {
|
||||
try {
|
||||
new DefaultOggSeeker(
|
||||
/* streamReader= */ new TestStreamReader(),
|
||||
@ -55,7 +55,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking() throws Exception {
|
||||
public void seeking() throws Exception {
|
||||
byte[] data =
|
||||
getByteArray(ApplicationProvider.getApplicationContext(), "ogg/random_1000_pages");
|
||||
int granuleCount = 49269395;
|
||||
@ -122,7 +122,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipToNextPage() throws Exception {
|
||||
public void skipToNextPage_success() throws Exception {
|
||||
FakeExtractorInput extractorInput =
|
||||
createInput(
|
||||
TestUtil.joinByteArrays(
|
||||
@ -135,7 +135,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipToNextPageOverlap() throws Exception {
|
||||
public void skipToNextPage_withOverlappingInput_success() throws Exception {
|
||||
FakeExtractorInput extractorInput =
|
||||
createInput(
|
||||
TestUtil.joinByteArrays(
|
||||
@ -148,7 +148,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipToNextPageInputShorterThanPeekLength() throws Exception {
|
||||
public void skipToNextPage_withInputShorterThanPeekLength_success() throws Exception {
|
||||
FakeExtractorInput extractorInput =
|
||||
createInput(
|
||||
TestUtil.joinByteArrays(new byte[] {'x', 'O', 'g', 'g', 'S'}),
|
||||
@ -158,7 +158,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipToNextPageNoMatch() throws Exception {
|
||||
public void skipToNextPage_withoutMatch_throwsException() throws Exception {
|
||||
FakeExtractorInput extractorInput =
|
||||
createInput(new byte[] {'g', 'g', 'S', 'O', 'g', 'g'}, /* simulateUnknownLength= */ false);
|
||||
try {
|
||||
@ -170,7 +170,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadGranuleOfLastPage() throws IOException, InterruptedException {
|
||||
public void readGranuleOfLastPage() throws IOException, InterruptedException {
|
||||
// This test stream has three headers with granule numbers 20000, 40000 and 60000.
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/three_headers");
|
||||
FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ false);
|
||||
@ -178,7 +178,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadGranuleOfLastPageAfterLastHeader() throws Exception {
|
||||
public void readGranuleOfLastPage_afterLastHeader_throwsException() throws Exception {
|
||||
FakeExtractorInput input =
|
||||
createInput(TestUtil.buildTestData(100, random), /* simulateUnknownLength= */ false);
|
||||
try {
|
||||
@ -190,7 +190,7 @@ public final class DefaultOggSeekerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadGranuleOfLastPageWithUnboundedLength() throws Exception {
|
||||
public void readGranuleOfLastPage_withUnboundedLength_throwsException() throws Exception {
|
||||
FakeExtractorInput input = createInput(new byte[0], /* simulateUnknownLength= */ true);
|
||||
try {
|
||||
assertReadGranuleOfLastPage(input, 60000);
|
||||
|
@ -33,58 +33,58 @@ public final class OggExtractorTest {
|
||||
private static final ExtractorFactory OGG_EXTRACTOR_FACTORY = OggExtractor::new;
|
||||
|
||||
@Test
|
||||
public void testOpus() throws Exception {
|
||||
public void opus() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(OGG_EXTRACTOR_FACTORY, "ogg/bear.opus");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFlac() throws Exception {
|
||||
public void flac() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(OGG_EXTRACTOR_FACTORY, "ogg/bear_flac.ogg");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFlacNoSeektable() throws Exception {
|
||||
public void flacNoSeektable() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(OGG_EXTRACTOR_FACTORY, "ogg/bear_flac_noseektable.ogg");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVorbis() throws Exception {
|
||||
public void vorbis() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(OGG_EXTRACTOR_FACTORY, "ogg/bear_vorbis.ogg");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSniffVorbis() throws Exception {
|
||||
public void sniffVorbis() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/vorbis_header");
|
||||
assertSniff(data, /* expectedResult= */ true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSniffFlac() throws Exception {
|
||||
public void sniffFlac() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/flac_header");
|
||||
assertSniff(data, /* expectedResult= */ true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSniffFailsOpusFile() throws Exception {
|
||||
public void sniffFailsOpusFile() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/opus_header");
|
||||
assertSniff(data, /* expectedResult= */ false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSniffFailsInvalidOggHeader() throws Exception {
|
||||
public void sniffFailsInvalidOggHeader() throws Exception {
|
||||
byte[] data =
|
||||
getByteArray(ApplicationProvider.getApplicationContext(), "ogg/invalid_ogg_header");
|
||||
assertSniff(data, /* expectedResult= */ false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSniffInvalidHeader() throws Exception {
|
||||
public void sniffInvalidHeader() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/invalid_header");
|
||||
assertSniff(data, /* expectedResult= */ false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSniffFailsEOF() throws Exception {
|
||||
public void sniffFailsEOF() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/eof_header");
|
||||
assertSniff(data, /* expectedResult= */ false);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public final class OggPacketTest {
|
||||
private final OggPacket oggPacket = new OggPacket();
|
||||
|
||||
@Test
|
||||
public void testReadPacketsWithEmptyPage() throws Exception {
|
||||
public void readPacketsWithEmptyPage() throws Exception {
|
||||
byte[] firstPacket = TestUtil.buildTestData(8, random);
|
||||
byte[] secondPacket = TestUtil.buildTestData(272, random);
|
||||
byte[] thirdPacket = TestUtil.buildTestData(256, random);
|
||||
@ -88,7 +88,7 @@ public final class OggPacketTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadPacketWithZeroSizeTerminator() throws Exception {
|
||||
public void readPacketWithZeroSizeTerminator() throws Exception {
|
||||
byte[] firstPacket = TestUtil.buildTestData(255, random);
|
||||
byte[] secondPacket = TestUtil.buildTestData(8, random);
|
||||
FakeExtractorInput input =
|
||||
@ -103,7 +103,7 @@ public final class OggPacketTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadContinuedPacketOverTwoPages() throws Exception {
|
||||
public void readContinuedPacketOverTwoPages() throws Exception {
|
||||
byte[] firstPacket = TestUtil.buildTestData(518);
|
||||
FakeExtractorInput input =
|
||||
createInput(
|
||||
@ -120,7 +120,7 @@ public final class OggPacketTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadContinuedPacketOverFourPages() throws Exception {
|
||||
public void readContinuedPacketOverFourPages() throws Exception {
|
||||
byte[] firstPacket = TestUtil.buildTestData(1028);
|
||||
FakeExtractorInput input =
|
||||
createInput(
|
||||
@ -137,7 +137,7 @@ public final class OggPacketTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadDiscardContinuedPacketAtStart() throws Exception {
|
||||
public void readDiscardContinuedPacketAtStart() throws Exception {
|
||||
byte[] pageBody = TestUtil.buildTestData(256 + 8);
|
||||
FakeExtractorInput input =
|
||||
createInput(
|
||||
@ -150,7 +150,7 @@ public final class OggPacketTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadZeroSizedPacketsAtEndOfStream() throws Exception {
|
||||
public void readZeroSizedPacketsAtEndOfStream() throws Exception {
|
||||
byte[] firstPacket = TestUtil.buildTestData(8, random);
|
||||
byte[] secondPacket = TestUtil.buildTestData(8, random);
|
||||
byte[] thirdPacket = TestUtil.buildTestData(8, random);
|
||||
@ -167,7 +167,7 @@ public final class OggPacketTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseRealFile() throws IOException, InterruptedException {
|
||||
public void parseRealFile() throws IOException, InterruptedException {
|
||||
byte[] data = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TEST_FILE);
|
||||
FakeExtractorInput input = new FakeExtractorInput.Builder().setData(data).build();
|
||||
int packetCounter = 0;
|
||||
|
@ -31,7 +31,7 @@ import org.junit.runner.RunWith;
|
||||
public final class OggPageHeaderTest {
|
||||
|
||||
@Test
|
||||
public void testPopulatePageHeader() throws Exception {
|
||||
public void populatePageHeader_success() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/page_header");
|
||||
|
||||
FakeExtractorInput input = createInput(data, /* simulateUnknownLength= */ true);
|
||||
@ -50,7 +50,8 @@ public final class OggPageHeaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPopulatePageHeaderQuietOnExceptionLessThan27Bytes() throws Exception {
|
||||
public void populatePageHeader_withLessThan27Bytes_returnFalseWithoutException()
|
||||
throws Exception {
|
||||
FakeExtractorInput input =
|
||||
createInput(TestUtil.createByteArray(2, 2), /* simulateUnknownLength= */ false);
|
||||
OggPageHeader header = new OggPageHeader();
|
||||
@ -58,7 +59,7 @@ public final class OggPageHeaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPopulatePageHeaderQuietOnExceptionNotOgg() throws Exception {
|
||||
public void populatePageHeader_withNotOgg_returnFalseWithoutException() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/page_header");
|
||||
// change from 'O' to 'o'
|
||||
data[0] = 'o';
|
||||
@ -68,7 +69,7 @@ public final class OggPageHeaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPopulatePageHeaderQuiteOnExceptionWrongRevision() throws Exception {
|
||||
public void populatePageHeader_withWrongRevision_returnFalseWithoutException() throws Exception {
|
||||
byte[] data = getByteArray(ApplicationProvider.getApplicationContext(), "ogg/page_header");
|
||||
// change revision from 0 to 1
|
||||
data[4] = 0x01;
|
||||
|
@ -36,7 +36,7 @@ import org.junit.runner.RunWith;
|
||||
public final class VorbisReaderTest {
|
||||
|
||||
@Test
|
||||
public void testReadBits() throws Exception {
|
||||
public void readBits_returnsSignificantBitsFromIndex() {
|
||||
assertThat(readBits((byte) 0x00, 2, 2)).isEqualTo(0);
|
||||
assertThat(readBits((byte) 0x02, 1, 1)).isEqualTo(1);
|
||||
assertThat(readBits((byte) 0xF0, 4, 4)).isEqualTo(15);
|
||||
@ -44,7 +44,7 @@ public final class VorbisReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAppendNumberOfSamples() throws Exception {
|
||||
public void appendNumberOfSamples() {
|
||||
ParsableByteArray buffer = new ParsableByteArray(4);
|
||||
buffer.setLimit(0);
|
||||
VorbisReader.appendNumberOfSamples(buffer, 0x01234567);
|
||||
@ -56,7 +56,8 @@ public final class VorbisReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadSetupHeadersWithIOExceptions() throws IOException, InterruptedException {
|
||||
public void readSetupHeaders_withIOExceptions_readSuccess()
|
||||
throws IOException, InterruptedException {
|
||||
// initial two pages of bytes which by spec contain the three Vorbis header packets:
|
||||
// identification, comment and setup header.
|
||||
byte[] data =
|
||||
|
@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
|
||||
public final class RawCcExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testRawCcSample() throws Exception {
|
||||
public void rawCcSample() throws Exception {
|
||||
Format format =
|
||||
new Format.Builder()
|
||||
.setSampleMimeType(MimeTypes.APPLICATION_CEA608)
|
||||
|
@ -25,12 +25,12 @@ import org.junit.runner.RunWith;
|
||||
public final class Ac3ExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testAc3Sample() throws Exception {
|
||||
public void ac3Sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Ac3Extractor::new, "ts/sample.ac3");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEAc3Sample() throws Exception {
|
||||
public void eAc3Sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Ac3Extractor::new, "ts/sample.eac3");
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import org.junit.runner.RunWith;
|
||||
public final class Ac4ExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testAc4Sample() throws Exception {
|
||||
public void ac4Sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(Ac4Extractor::new, "ts/sample.ac4");
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,7 @@ public final class AdtsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdtsExtractorReads_returnSeekableSeekMap()
|
||||
throws IOException, InterruptedException {
|
||||
public void adtsExtractorReads_returnSeekableSeekMap() throws IOException, InterruptedException {
|
||||
String fileName = TEST_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
expectedTrackOutput =
|
||||
@ -74,7 +73,7 @@ public final class AdtsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingToPositionInFile_extractsCorrectSample()
|
||||
public void seeking_handlesSeekingToPositionInFile_extractsCorrectSample()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = TEST_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -101,7 +100,7 @@ public final class AdtsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekToEoF_extractsLastSample()
|
||||
public void seeking_handlesSeekToEoF_extractsLastSample()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = TEST_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -128,7 +127,7 @@ public final class AdtsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingBackward_extractsCorrectSamples()
|
||||
public void seeking_handlesSeekingBackward_extractsCorrectSamples()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = TEST_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -157,7 +156,7 @@ public final class AdtsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesSeekingForward_extractsCorrectSamples()
|
||||
public void seeking_handlesSeekingForward_extractsCorrectSamples()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = TEST_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
@ -186,7 +185,7 @@ public final class AdtsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeeking_handlesRandomSeeks_extractsCorrectSamples()
|
||||
public void seeking_handlesRandomSeeks_extractsCorrectSamples()
|
||||
throws IOException, InterruptedException {
|
||||
String fileName = TEST_FILE;
|
||||
Uri fileUri = TestUtil.buildAssetUri(fileName);
|
||||
|
@ -25,12 +25,12 @@ import org.junit.runner.RunWith;
|
||||
public final class AdtsExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testSample() throws Exception {
|
||||
public void sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(AdtsExtractor::new, "ts/sample.adts");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSample_withSeeking() throws Exception {
|
||||
public void sample_withSeeking() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
() -> new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING),
|
||||
"ts/sample_cbs.adts");
|
||||
@ -38,7 +38,7 @@ public final class AdtsExtractorTest {
|
||||
|
||||
// https://github.com/google/ExoPlayer/issues/6700
|
||||
@Test
|
||||
public void testSample_withSeekingAndTruncatedFile() throws Exception {
|
||||
public void sample_withSeekingAndTruncatedFile() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
() -> new AdtsExtractor(/* flags= */ AdtsExtractor.FLAG_ENABLE_CONSTANT_BITRATE_SEEKING),
|
||||
"ts/sample_cbs_truncated.adts");
|
||||
|
@ -80,7 +80,7 @@ public class AdtsReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipToNextSample() throws Exception {
|
||||
public void skipToNextSample() throws Exception {
|
||||
for (int i = 1; i <= ID3_DATA_1.length + ID3_DATA_2.length; i++) {
|
||||
data.setPosition(i);
|
||||
feed();
|
||||
@ -91,7 +91,7 @@ public class AdtsReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSkipToNextSampleResetsState() throws Exception {
|
||||
public void skipToNextSampleResetsState() throws Exception {
|
||||
data =
|
||||
new ParsableByteArray(
|
||||
TestUtil.joinByteArrays(
|
||||
@ -118,45 +118,45 @@ public class AdtsReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoData() throws Exception {
|
||||
public void noData() throws Exception {
|
||||
feedLimited(0);
|
||||
assertSampleCounts(0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotEnoughDataForIdentifier() throws Exception {
|
||||
public void notEnoughDataForIdentifier() throws Exception {
|
||||
feedLimited(3 - 1);
|
||||
assertSampleCounts(0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotEnoughDataForHeader() throws Exception {
|
||||
public void notEnoughDataForHeader() throws Exception {
|
||||
feedLimited(10 - 1);
|
||||
assertSampleCounts(0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNotEnoughDataForWholeId3Packet() throws Exception {
|
||||
public void notEnoughDataForWholeId3Packet() throws Exception {
|
||||
feedLimited(ID3_DATA_1.length - 1);
|
||||
assertSampleCounts(0, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConsumeWholeId3Packet() throws Exception {
|
||||
public void consumeWholeId3Packet() throws Exception {
|
||||
feedLimited(ID3_DATA_1.length);
|
||||
assertSampleCounts(1, 0);
|
||||
id3Output.assertSample(0, ID3_DATA_1, 0, C.BUFFER_FLAG_KEY_FRAME, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiId3Packet() throws Exception {
|
||||
public void multiId3Packet() throws Exception {
|
||||
feedLimited(ID3_DATA_1.length + ID3_DATA_2.length - 1);
|
||||
assertSampleCounts(1, 0);
|
||||
id3Output.assertSample(0, ID3_DATA_1, 0, C.BUFFER_FLAG_KEY_FRAME, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiId3PacketConsumed() throws Exception {
|
||||
public void multiId3PacketConsumed() throws Exception {
|
||||
feedLimited(ID3_DATA_1.length + ID3_DATA_2.length);
|
||||
assertSampleCounts(2, 0);
|
||||
id3Output.assertSample(0, ID3_DATA_1, 0, C.BUFFER_FLAG_KEY_FRAME, null);
|
||||
@ -164,7 +164,7 @@ public class AdtsReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiPacketConsumed() throws Exception {
|
||||
public void multiPacketConsumed() throws Exception {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
data.setPosition(0);
|
||||
feed();
|
||||
@ -180,7 +180,7 @@ public class AdtsReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdtsDataOnly() throws ParserException {
|
||||
public void adtsDataOnly() throws ParserException {
|
||||
data.setPosition(ID3_DATA_1.length + ID3_DATA_2.length);
|
||||
feed();
|
||||
assertSampleCounts(0, 1);
|
||||
|
@ -42,12 +42,12 @@ public final class PsDurationReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDurationReadPending_returnFalseByDefault() {
|
||||
public void isDurationReadPending_returnFalseByDefault() {
|
||||
assertThat(tsDurationReader.isDurationReadFinished()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadDuration_returnsCorrectDuration() throws IOException, InterruptedException {
|
||||
public void readDuration_returnsCorrectDuration() throws IOException, InterruptedException {
|
||||
FakeExtractorInput input =
|
||||
new FakeExtractorInput.Builder()
|
||||
.setData(
|
||||
@ -66,7 +66,7 @@ public final class PsDurationReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadDuration_midStream_returnsCorrectDuration()
|
||||
public void readDuration_midStream_returnsCorrectDuration()
|
||||
throws IOException, InterruptedException {
|
||||
FakeExtractorInput input =
|
||||
new FakeExtractorInput.Builder()
|
||||
|
@ -74,7 +74,7 @@ public final class PsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPsExtractorReads_nonSeekTableFile_returnSeekableSeekMap()
|
||||
public void psExtractorReads_nonSeekTableFile_returnSeekableSeekMap()
|
||||
throws IOException, InterruptedException {
|
||||
PsExtractor extractor = new PsExtractor();
|
||||
|
||||
@ -86,7 +86,7 @@ public final class PsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekingToPositionInFile_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesSeekingToPositionInFile_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
PsExtractor extractor = new PsExtractor();
|
||||
|
||||
@ -103,7 +103,7 @@ public final class PsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekToEoF() throws IOException, InterruptedException {
|
||||
public void handlePendingSeek_handlesSeekToEoF() throws IOException, InterruptedException {
|
||||
PsExtractor extractor = new PsExtractor();
|
||||
|
||||
FakeExtractorOutput extractorOutput = new FakeExtractorOutput();
|
||||
@ -118,7 +118,7 @@ public final class PsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekingBackward_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesSeekingBackward_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
PsExtractor extractor = new PsExtractor();
|
||||
|
||||
@ -138,7 +138,7 @@ public final class PsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekingForward_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesSeekingForward_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
PsExtractor extractor = new PsExtractor();
|
||||
|
||||
@ -158,7 +158,7 @@ public final class PsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesRandomSeeks_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesRandomSeeks_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
PsExtractor extractor = new PsExtractor();
|
||||
|
||||
@ -178,7 +178,7 @@ public final class PsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesRandomSeeksAfterReadingFileOnce_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesRandomSeeksAfterReadingFileOnce_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
PsExtractor extractor = new PsExtractor();
|
||||
|
||||
|
@ -25,7 +25,7 @@ import org.junit.runner.RunWith;
|
||||
public final class PsExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testSample() throws Exception {
|
||||
public void sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(PsExtractor::new, "ts/sample.ps");
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public final class SectionReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleOnePacketSection() {
|
||||
public void singleOnePacketSection() {
|
||||
packetPayload[0] = 3;
|
||||
insertTableSection(4, (byte) 99, 3);
|
||||
reader.consume(new ParsableByteArray(packetPayload), FLAG_PAYLOAD_UNIT_START_INDICATOR);
|
||||
@ -59,7 +59,7 @@ public final class SectionReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHeaderSplitAcrossPackets() {
|
||||
public void headerSplitAcrossPackets() {
|
||||
packetPayload[0] = 3; // The first packet includes a pointer_field.
|
||||
insertTableSection(4, (byte) 100, 3); // This section header spreads across both packets.
|
||||
|
||||
@ -74,7 +74,7 @@ public final class SectionReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFiveSectionsInTwoPackets() {
|
||||
public void fiveSectionsInTwoPackets() {
|
||||
packetPayload[0] = 0; // The first packet includes a pointer_field.
|
||||
insertTableSection(1, (byte) 101, 10);
|
||||
insertTableSection(14, (byte) 102, 10);
|
||||
@ -94,7 +94,7 @@ public final class SectionReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLongSectionAcrossFourPackets() {
|
||||
public void longSectionAcrossFourPackets() {
|
||||
packetPayload[0] = 13; // The first packet includes a pointer_field.
|
||||
insertTableSection(1, (byte) 106, 10); // First section. Should be skipped.
|
||||
// Second section spread across four packets. Should be consumed.
|
||||
@ -124,7 +124,7 @@ public final class SectionReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSeek() {
|
||||
public void seek() {
|
||||
packetPayload[0] = 13; // The first packet includes a pointer_field.
|
||||
insertTableSection(1, (byte) 109, 10); // First section. Should be skipped.
|
||||
// Second section spread across four packets. Should be consumed.
|
||||
@ -156,7 +156,7 @@ public final class SectionReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCrcChecks() {
|
||||
public void crcChecks() {
|
||||
byte[] correctCrcPat = new byte[] {
|
||||
(byte) 0x0, (byte) 0x0, (byte) 0xb0, (byte) 0xd, (byte) 0x0, (byte) 0x1, (byte) 0xc1,
|
||||
(byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1, (byte) 0xe1, (byte) 0x0, (byte) 0xe8,
|
||||
|
@ -42,12 +42,12 @@ public final class TsDurationReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsDurationReadPending_returnFalseByDefault() {
|
||||
public void isDurationReadPending_returnFalseByDefault() {
|
||||
assertThat(tsDurationReader.isDurationReadFinished()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadDuration_returnsCorrectDuration() throws IOException, InterruptedException {
|
||||
public void readDuration_returnsCorrectDuration() throws IOException, InterruptedException {
|
||||
FakeExtractorInput input =
|
||||
new FakeExtractorInput.Builder()
|
||||
.setData(
|
||||
@ -71,7 +71,7 @@ public final class TsDurationReaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadDuration_midStream_returnsCorrectDuration()
|
||||
public void readDuration_midStream_returnsCorrectDuration()
|
||||
throws IOException, InterruptedException {
|
||||
FakeExtractorInput input =
|
||||
new FakeExtractorInput.Builder()
|
||||
|
@ -67,7 +67,7 @@ public final class TsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTsExtractorReads_nonSeekTableFile_returnSeekableSeekMap()
|
||||
public void tsExtractorReads_nonSeekTableFile_returnSeekableSeekMap()
|
||||
throws IOException, InterruptedException {
|
||||
Uri fileUri = TestUtil.buildAssetUri(TEST_FILE);
|
||||
TsExtractor extractor = new TsExtractor();
|
||||
@ -81,7 +81,7 @@ public final class TsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekingToPositionInFile_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesSeekingToPositionInFile_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
TsExtractor extractor = new TsExtractor();
|
||||
Uri fileUri = TestUtil.buildAssetUri(TEST_FILE);
|
||||
@ -101,7 +101,7 @@ public final class TsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekToEoF_extractsLastFrame()
|
||||
public void handlePendingSeek_handlesSeekToEoF_extractsLastFrame()
|
||||
throws IOException, InterruptedException {
|
||||
TsExtractor extractor = new TsExtractor();
|
||||
Uri fileUri = TestUtil.buildAssetUri(TEST_FILE);
|
||||
@ -122,7 +122,7 @@ public final class TsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekingBackward_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesSeekingBackward_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
TsExtractor extractor = new TsExtractor();
|
||||
Uri fileUri = TestUtil.buildAssetUri(TEST_FILE);
|
||||
@ -145,7 +145,7 @@ public final class TsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesSeekingForward_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesSeekingForward_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
TsExtractor extractor = new TsExtractor();
|
||||
Uri fileUri = TestUtil.buildAssetUri(TEST_FILE);
|
||||
@ -168,7 +168,7 @@ public final class TsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesRandomSeeks_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesRandomSeeks_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
TsExtractor extractor = new TsExtractor();
|
||||
Uri fileUri = TestUtil.buildAssetUri(TEST_FILE);
|
||||
@ -191,7 +191,7 @@ public final class TsExtractorSeekTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlePendingSeek_handlesRandomSeeksAfterReadingFileOnce_extractsCorrectFrame()
|
||||
public void handlePendingSeek_handlesRandomSeeksAfterReadingFileOnce_extractsCorrectFrame()
|
||||
throws IOException, InterruptedException {
|
||||
TsExtractor extractor = new TsExtractor();
|
||||
Uri fileUri = TestUtil.buildAssetUri(TEST_FILE);
|
||||
|
@ -44,38 +44,38 @@ import org.junit.runner.RunWith;
|
||||
public final class TsExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testSample() throws Exception {
|
||||
public void sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample.ts");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithScte35() throws Exception {
|
||||
public void testSampleScte35() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_scte35.ts");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithAit() throws Exception {
|
||||
public void withAit() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_ait.ts");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithAc4() throws Exception {
|
||||
public void sampleWithAc4() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_ac4.ts");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleWithEac3() throws Exception {
|
||||
public void sampleWithEac3() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(TsExtractor::new, "ts/sample_eac3.ts");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStreamWithJunkData() throws Exception {
|
||||
public void streamWithJunkData() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(
|
||||
TsExtractor::new, "ts/sample_with_junk", ApplicationProvider.getApplicationContext());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomPesReader() throws Exception {
|
||||
public void customPesReader() throws Exception {
|
||||
CustomTsPayloadReaderFactory factory = new CustomTsPayloadReaderFactory(true, false);
|
||||
TsExtractor tsExtractor =
|
||||
new TsExtractor(TsExtractor.MODE_MULTI_PMT, new TimestampAdjuster(0), factory);
|
||||
@ -111,7 +111,7 @@ public final class TsExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomInitialSectionReader() throws Exception {
|
||||
public void customInitialSectionReader() throws Exception {
|
||||
CustomTsPayloadReaderFactory factory = new CustomTsPayloadReaderFactory(false, true);
|
||||
TsExtractor tsExtractor =
|
||||
new TsExtractor(TsExtractor.MODE_MULTI_PMT, new TimestampAdjuster(0), factory);
|
||||
|
@ -25,12 +25,12 @@ import org.junit.runner.RunWith;
|
||||
public final class WavExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testSample() throws Exception {
|
||||
public void sample() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(WavExtractor::new, "wav/sample.wav");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSampleImaAdpcm() throws Exception {
|
||||
public void sampleImaAdpcm() throws Exception {
|
||||
ExtractorAsserts.assertBehavior(WavExtractor::new, "wav/sample_ima_adpcm.wav");
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateWithDefaultDownloaderFactory() {
|
||||
public void createWithDefaultDownloaderFactory() {
|
||||
DownloaderConstructorHelper constructorHelper =
|
||||
new DownloaderConstructorHelper(Mockito.mock(Cache.class), DummyDataSource.FACTORY);
|
||||
DownloaderFactory factory = new DefaultDownloaderFactory(constructorHelper);
|
||||
@ -114,7 +114,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCounterMethods() throws Exception {
|
||||
public void counterMethods() throws Exception {
|
||||
HlsDownloader downloader =
|
||||
getHlsDownloader(MASTER_PLAYLIST_URI, getKeys(MASTER_MEDIA_PLAYLIST_1_INDEX));
|
||||
downloader.download(progressListener);
|
||||
@ -123,7 +123,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadRepresentation() throws Exception {
|
||||
public void downloadRepresentation() throws Exception {
|
||||
HlsDownloader downloader =
|
||||
getHlsDownloader(MASTER_PLAYLIST_URI, getKeys(MASTER_MEDIA_PLAYLIST_1_INDEX));
|
||||
downloader.download(progressListener);
|
||||
@ -140,7 +140,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadMultipleRepresentations() throws Exception {
|
||||
public void downloadMultipleRepresentations() throws Exception {
|
||||
HlsDownloader downloader =
|
||||
getHlsDownloader(
|
||||
MASTER_PLAYLIST_URI,
|
||||
@ -151,7 +151,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadAllRepresentations() throws Exception {
|
||||
public void downloadAllRepresentations() throws Exception {
|
||||
// Add data for the rest of the playlists
|
||||
fakeDataSet
|
||||
.setData(MEDIA_PLAYLIST_0_URI, MEDIA_PLAYLIST_DATA)
|
||||
@ -170,7 +170,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemove() throws Exception {
|
||||
public void remove() throws Exception {
|
||||
HlsDownloader downloader =
|
||||
getHlsDownloader(
|
||||
MASTER_PLAYLIST_URI,
|
||||
@ -182,7 +182,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadMediaPlaylist() throws Exception {
|
||||
public void downloadMediaPlaylist() throws Exception {
|
||||
HlsDownloader downloader = getHlsDownloader(MEDIA_PLAYLIST_1_URI, getKeys());
|
||||
downloader.download(progressListener);
|
||||
|
||||
@ -197,7 +197,7 @@ public class HlsDownloaderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDownloadEncMediaPlaylist() throws Exception {
|
||||
public void downloadEncMediaPlaylist() throws Exception {
|
||||
fakeDataSet =
|
||||
new FakeDataSet()
|
||||
.setData(ENC_MEDIA_PLAYLIST_URI, ENC_MEDIA_PLAYLIST_DATA)
|
||||
|
@ -35,7 +35,7 @@ import java.util.List;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/** Test for {@link HlsMasterPlaylistParserTest}. */
|
||||
/** Test for {@link HlsMasterPlaylist}. */
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class HlsMasterPlaylistParserTest {
|
||||
|
||||
@ -195,7 +195,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
+ "GROUP-ID=\"sub1\",NAME=\"English\",URI=\"s1/en/prog_index.m3u8\"\n";
|
||||
|
||||
@Test
|
||||
public void testParseMasterPlaylist() throws IOException {
|
||||
public void parseMasterPlaylist_withSimple_success() throws IOException {
|
||||
HlsMasterPlaylist masterPlaylist = parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_SIMPLE);
|
||||
|
||||
List<HlsMasterPlaylist.Variant> variants = masterPlaylist.variants;
|
||||
@ -236,7 +236,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMasterPlaylistWithBandwdithAverage() throws IOException {
|
||||
public void parseMasterPlaylist_withAverageBandwidth_success() throws IOException {
|
||||
HlsMasterPlaylist masterPlaylist =
|
||||
parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_AVG_BANDWIDTH);
|
||||
|
||||
@ -247,7 +247,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaylistWithInvalidHeader() throws IOException {
|
||||
public void parseMasterPlaylist_withInvalidHeader_throwsException() throws IOException {
|
||||
try {
|
||||
parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_INVALID_HEADER);
|
||||
fail("Expected exception not thrown.");
|
||||
@ -257,7 +257,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaylistWithClosedCaption() throws IOException {
|
||||
public void parseMasterPlaylist_withClosedCaption_success() throws IOException {
|
||||
HlsMasterPlaylist playlist = parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_CC);
|
||||
assertThat(playlist.muxedCaptionFormats).hasSize(1);
|
||||
Format closedCaptionFormat = playlist.muxedCaptionFormats.get(0);
|
||||
@ -267,7 +267,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaylistWithChannelsAttribute() throws IOException {
|
||||
public void parseMasterPlaylist_withChannelsAttribute_success() throws IOException {
|
||||
HlsMasterPlaylist playlist =
|
||||
parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_CHANNELS_ATTRIBUTE);
|
||||
List<HlsMasterPlaylist.Rendition> audios = playlist.audios;
|
||||
@ -278,13 +278,13 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlaylistWithoutClosedCaptions() throws IOException {
|
||||
public void parseMasterPlaylist_withoutClosedCaption_success() throws IOException {
|
||||
HlsMasterPlaylist playlist = parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITHOUT_CC);
|
||||
assertThat(playlist.muxedCaptionFormats).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCodecPropagation() throws IOException {
|
||||
public void parseMasterPlaylist_withAudio_codecPropagated() throws IOException {
|
||||
HlsMasterPlaylist playlist = parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_AUDIO_MEDIA_TAG);
|
||||
|
||||
Format firstAudioFormat = playlist.audios.get(0).format;
|
||||
@ -297,7 +297,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAudioIdPropagation() throws IOException {
|
||||
public void parseMasterPlaylist_withAudio_audioIdPropagated() throws IOException {
|
||||
HlsMasterPlaylist playlist = parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_AUDIO_MEDIA_TAG);
|
||||
|
||||
Format firstAudioFormat = playlist.audios.get(0).format;
|
||||
@ -308,7 +308,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCCIdPropagation() throws IOException {
|
||||
public void parseMasterPlaylist_withCc_cCIdPropagated() throws IOException {
|
||||
HlsMasterPlaylist playlist = parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_CC);
|
||||
|
||||
Format firstTextFormat = playlist.muxedCaptionFormats.get(0);
|
||||
@ -316,7 +316,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubtitleIdPropagation() throws IOException {
|
||||
public void parseMasterPlaylist_withSubtitles_subtitlesIdPropagated() throws IOException {
|
||||
HlsMasterPlaylist playlist = parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_SUBTITLES);
|
||||
|
||||
Format firstTextFormat = playlist.subtitles.get(0).format;
|
||||
@ -324,7 +324,8 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIndependentSegments() throws IOException {
|
||||
public void parseMasterPlaylist_withIndependentSegments_hasNoIndenpendentSegments()
|
||||
throws IOException {
|
||||
HlsMasterPlaylist playlistWithIndependentSegments =
|
||||
parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_INDEPENDENT_SEGMENTS);
|
||||
assertThat(playlistWithIndependentSegments.hasIndependentSegments).isTrue();
|
||||
@ -335,7 +336,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVariableSubstitution() throws IOException {
|
||||
public void parseMasterPlaylist_withVariableSubstitution_success() throws IOException {
|
||||
HlsMasterPlaylist playlistWithSubstitutions =
|
||||
parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_VARIABLE_SUBSTITUTION);
|
||||
HlsMasterPlaylist.Variant variant = playlistWithSubstitutions.variants.get(0);
|
||||
@ -345,7 +346,7 @@ public class HlsMasterPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHlsMetadata() throws IOException {
|
||||
public void parseMasterPlaylist_withMatchingStreamInfUrls_success() throws IOException {
|
||||
HlsMasterPlaylist playlist =
|
||||
parseMasterPlaylist(PLAYLIST_URI, PLAYLIST_WITH_MATCHING_STREAM_INF_URLS);
|
||||
assertThat(playlist.variants).hasSize(4);
|
||||
|
@ -38,7 +38,7 @@ import org.junit.runner.RunWith;
|
||||
public class HlsMediaPlaylistParserTest {
|
||||
|
||||
@Test
|
||||
public void testParseMediaPlaylist() throws Exception {
|
||||
public void parseMediaPlaylist() throws Exception {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -149,7 +149,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSampleAesMethod() throws Exception {
|
||||
public void parseSampleAesMethod() throws Exception {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -178,7 +178,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSampleAesCencMethod() throws Exception {
|
||||
public void parseSampleAesCencMethod() throws Exception {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -202,7 +202,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSampleAesCtrMethod() throws Exception {
|
||||
public void parseSampleAesCtrMethod() throws Exception {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -226,7 +226,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleExtXKeysForSingleSegment() throws Exception {
|
||||
public void multipleExtXKeysForSingleSegment() throws Exception {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -303,7 +303,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGapTag() throws IOException {
|
||||
public void gapTag() throws IOException {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test2.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -338,7 +338,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMapTag() throws IOException {
|
||||
public void mapTag() throws IOException {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test3.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -368,7 +368,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncryptedMapTag() throws IOException {
|
||||
public void encryptedMapTag() throws IOException {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test3.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -399,7 +399,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncryptedMapTagWithNoIvFails() throws IOException {
|
||||
public void encryptedMapTagWithNoIvFails() throws IOException {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test3.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -423,7 +423,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMasterPlaylistAttributeInheritance() throws IOException {
|
||||
public void masterPlaylistAttributeInheritance() throws IOException {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test3.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -466,7 +466,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVariableSubstitution() throws IOException {
|
||||
public void variableSubstitution() throws IOException {
|
||||
Uri playlistUri = Uri.parse("https://example.com/substitution.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
@ -489,7 +489,7 @@ public class HlsMediaPlaylistParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInheritedVariableSubstitution() throws IOException {
|
||||
public void inheritedVariableSubstitution() throws IOException {
|
||||
Uri playlistUri = Uri.parse("https://example.com/test3.m3u8");
|
||||
String playlistString =
|
||||
"#EXTM3U\n"
|
||||
|
@ -32,7 +32,7 @@ public final class SsManifestParserTest {
|
||||
|
||||
/** Simple test to ensure the sample manifests parse without any exceptions being thrown. */
|
||||
@Test
|
||||
public void testParseSmoothStreamingManifest() throws IOException {
|
||||
public void parseSmoothStreamingManifest() throws IOException {
|
||||
SsManifestParser parser = new SsManifestParser();
|
||||
parser.parse(
|
||||
Uri.parse("https://example.com/test.ismc"),
|
||||
|
@ -37,7 +37,7 @@ import org.junit.runner.RunWith;
|
||||
public class SsManifestTest {
|
||||
|
||||
@Test
|
||||
public void testCopy() throws Exception {
|
||||
public void copy() throws Exception {
|
||||
Format[][] formats = newFormats(2, 3);
|
||||
SsManifest sourceManifest =
|
||||
createSsManifest(
|
||||
@ -58,7 +58,7 @@ public class SsManifestTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopyRemoveStreamElement() throws Exception {
|
||||
public void copyRemoveStreamElement() throws Exception {
|
||||
Format[][] formats = newFormats(2, 3);
|
||||
SsManifest sourceManifest =
|
||||
createSsManifest(
|
||||
|
@ -59,7 +59,7 @@ public class TouchTrackerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTap() {
|
||||
public void tap() {
|
||||
// Tap is a noop.
|
||||
swipe(tracker, 0, 0, 0, 0);
|
||||
assertThat(yaw).isWithin(EPSILON).of(0);
|
||||
@ -67,21 +67,21 @@ public class TouchTrackerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicYaw() {
|
||||
public void basicYaw() {
|
||||
swipe(tracker, 0, 0, SWIPE_PX, 0);
|
||||
assertThat(yaw).isWithin(EPSILON).of(-SWIPE_PX / PX_PER_DEGREES);
|
||||
assertThat(pitch).isWithin(EPSILON).of(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBigYaw() {
|
||||
public void bigYaw() {
|
||||
swipe(tracker, 0, 0, -10 * SWIPE_PX, 0);
|
||||
assertThat(yaw).isEqualTo(10 * SWIPE_PX / PX_PER_DEGREES);
|
||||
assertThat(pitch).isWithin(EPSILON).of(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testYawUnaffectedByPitch() {
|
||||
public void yawUnaffectedByPitch() {
|
||||
swipe(tracker, 0, 0, 0, SWIPE_PX);
|
||||
assertThat(yaw).isWithin(EPSILON).of(0);
|
||||
|
||||
@ -90,14 +90,14 @@ public class TouchTrackerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicPitch() {
|
||||
public void basicPitch() {
|
||||
swipe(tracker, 0, 0, 0, SWIPE_PX);
|
||||
assertThat(yaw).isWithin(EPSILON).of(0);
|
||||
assertThat(pitch).isWithin(EPSILON).of(SWIPE_PX / PX_PER_DEGREES);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPitchClipped() {
|
||||
public void pitchClipped() {
|
||||
// Big reverse pitch should be clipped.
|
||||
swipe(tracker, 0, 0, 0, -20 * SWIPE_PX);
|
||||
assertThat(yaw).isWithin(EPSILON).of(0);
|
||||
@ -110,7 +110,7 @@ public class TouchTrackerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRoll90() {
|
||||
public void withRoll90() {
|
||||
tracker.onOrientationChange(dummyMatrix, (float) Math.toRadians(90));
|
||||
|
||||
// Y-axis should now control yaw.
|
||||
@ -123,7 +123,7 @@ public class TouchTrackerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRoll180() {
|
||||
public void withRoll180() {
|
||||
tracker.onOrientationChange(dummyMatrix, (float) Math.toRadians(180));
|
||||
|
||||
// X-axis should now control reverse yaw.
|
||||
@ -136,7 +136,7 @@ public class TouchTrackerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRoll270() {
|
||||
public void withRoll270() {
|
||||
tracker.onOrientationChange(dummyMatrix, (float) Math.toRadians(270));
|
||||
|
||||
// Y-axis should now control reverse yaw.
|
||||
|
Loading…
x
Reference in New Issue
Block a user