diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java index 4022a0ccc1..0e12bc31dd 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeExtractorOutput.java @@ -32,9 +32,11 @@ import java.io.PrintWriter; public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpable { /** - * If true, makes {@link #assertOutput(Context, String)} method write dump result to {@code - * /sdcard/Android/data/apk_package/ + dumpfile} file instead of comparing it with an existing - * file. + * If true, makes {@link #assertOutput(Context, String)} method write the output to the dump file, + * rather than validating that the output matches what the dump file already contains. + * + *

Enabling this option works when tests are run in Android Studio. It may not work when the + * tests are run in another environment. */ private static final boolean WRITE_DUMP = false; @@ -107,8 +109,8 @@ public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpab String actual = new Dumper().add(this).toString(); if (WRITE_DUMP) { - File directory = context.getExternalFilesDir(null); - File file = new File(directory, dumpFile); + File file = new File(System.getProperty("user.dir"), "src/test/assets"); + file = new File(file, dumpFile); file.getParentFile().mkdirs(); PrintWriter out = new PrintWriter(file); out.print(actual);