mirror of
https://github.com/androidx/media.git
synced 2025-05-15 11:39:56 +08:00
Make it easier to update extractor test dump files
PiperOrigin-RevId: 285407744
This commit is contained in:
parent
2c467f79bd
commit
b7b3a15855
@ -32,9 +32,11 @@ import java.io.PrintWriter;
|
|||||||
public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpable {
|
public final class FakeExtractorOutput implements ExtractorOutput, Dumper.Dumpable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, makes {@link #assertOutput(Context, String)} method write dump result to {@code
|
* If true, makes {@link #assertOutput(Context, String)} method write the output to the dump file,
|
||||||
* /sdcard/Android/data/apk_package/ + dumpfile} file instead of comparing it with an existing
|
* rather than validating that the output matches what the dump file already contains.
|
||||||
* file.
|
*
|
||||||
|
* <p>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;
|
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();
|
String actual = new Dumper().add(this).toString();
|
||||||
|
|
||||||
if (WRITE_DUMP) {
|
if (WRITE_DUMP) {
|
||||||
File directory = context.getExternalFilesDir(null);
|
File file = new File(System.getProperty("user.dir"), "src/test/assets");
|
||||||
File file = new File(directory, dumpFile);
|
file = new File(file, dumpFile);
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
PrintWriter out = new PrintWriter(file);
|
PrintWriter out = new PrintWriter(file);
|
||||||
out.print(actual);
|
out.print(actual);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user