Skip to content

Commit d237915

Browse files
Renamed class to CpuArchTest
1 parent 90d320d commit d237915

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed

FFmpegAndroid/src/androidTest/java/com/github/hiteshsondhi88/libffmpeg/CheckFFmpegAssets.java

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.github.hiteshsondhi88.libffmpeg;
2+
3+
import android.content.res.AssetManager;
4+
import android.text.TextUtils;
5+
6+
import com.github.hiteshsondhi88.libffmpeg.utils.AssertionHelper;
7+
8+
import java.io.IOException;
9+
import java.io.InputStream;
10+
11+
import static org.assertj.core.api.Assertions.assertThat;
12+
13+
public class CpuArchTest extends CommonInstrumentationTestCase {
14+
15+
public void testFFmpegAssetsWithSha1Sum() {
16+
testFFmpegAsset(CpuArch.ARMv7, "armeabi-v7a/ffmpeg");
17+
testFFmpegAsset(CpuArch.ARMv7_NEON, "armeabi-v7a-neon/ffmpeg");
18+
testFFmpegAsset(CpuArch.x86, "x86/ffmpeg");
19+
}
20+
21+
private void testFFmpegAsset(CpuArch cpuArch, String assetsPath) {
22+
AssetManager assetMgr = getInstrumentation().getContext().getResources().getAssets();
23+
InputStream is = null;
24+
try {
25+
is = assetMgr.open(assetsPath);
26+
String assetSha1Sum = FileUtils.SHA1(is);
27+
assertThat(!TextUtils.isEmpty(cpuArch.getSha1())
28+
&& !TextUtils.isEmpty(assetSha1Sum)
29+
&& cpuArch.getSha1().equals(assetSha1Sum)).isTrue();
30+
} catch (IOException e) {
31+
Log.e(e);
32+
AssertionHelper.assertError("error validating ffmpeg asset "+assetsPath);
33+
} finally {
34+
Util.close(is);
35+
}
36+
37+
}
38+
39+
}

0 commit comments

Comments
 (0)