From d71400d28023ef36e8ac049113c688fec4bc0240 Mon Sep 17 00:00:00 2001 From: eguven Date: Thu, 21 Sep 2017 03:42:48 -0700 Subject: [PATCH] Add DashDownloadActionTest ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=169522830 --- library/dash/build.gradle | 5 ++++ .../dash/manifest/RepresentationKey.java | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/library/dash/build.gradle b/library/dash/build.gradle index 48e9b9b97e2..99441a28496 100644 --- a/library/dash/build.gradle +++ b/library/dash/build.gradle @@ -39,6 +39,11 @@ dependencies { androidTestCompile 'com.google.dexmaker:dexmaker:' + dexmakerVersion androidTestCompile 'com.google.dexmaker:dexmaker-mockito:' + dexmakerVersion androidTestCompile 'org.mockito:mockito-core:' + mockitoVersion + testCompile project(modulePrefix + 'testutils') + testCompile 'com.google.truth:truth:' + truthVersion + testCompile 'junit:junit:' + junitVersion + testCompile 'org.mockito:mockito-core:' + mockitoVersion + testCompile 'org.robolectric:robolectric:' + robolectricVersion } ext { diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/RepresentationKey.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/RepresentationKey.java index cf17a081d72..4ce1d067009 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/RepresentationKey.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/RepresentationKey.java @@ -80,4 +80,27 @@ public int compareTo(@NonNull RepresentationKey o) { return result; } + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + RepresentationKey that = (RepresentationKey) o; + return periodIndex == that.periodIndex + && adaptationSetIndex == that.adaptationSetIndex + && representationIndex == that.representationIndex; + } + + @Override + public int hashCode() { + int result = periodIndex; + result = 31 * result + adaptationSetIndex; + result = 31 * result + representationIndex; + return result; + } + }