mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Pull files from the device cache after a MH test concludes.
PiperOrigin-RevId: 412251020
This commit is contained in:
parent
be0b2b8c8c
commit
3cc64ae2df
1 changed files with 18 additions and 22 deletions
|
|
@ -83,30 +83,26 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||||
|
|
||||||
Uri uri = Uri.parse(uriString);
|
Uri uri = Uri.parse(uriString);
|
||||||
File externalCacheFile = createExternalCacheFile(context, /* filePrefix= */ testId);
|
File externalCacheFile = createExternalCacheFile(context, /* filePrefix= */ testId);
|
||||||
try {
|
InstrumentationRegistry.getInstrumentation()
|
||||||
InstrumentationRegistry.getInstrumentation()
|
.runOnMainSync(
|
||||||
.runOnMainSync(
|
() -> {
|
||||||
() -> {
|
try {
|
||||||
try {
|
testTransformer.startTransformation(
|
||||||
testTransformer.startTransformation(
|
MediaItem.fromUri(uri), externalCacheFile.getAbsolutePath());
|
||||||
MediaItem.fromUri(uri), externalCacheFile.getAbsolutePath());
|
} catch (IOException e) {
|
||||||
} catch (IOException e) {
|
exceptionReference.set(e);
|
||||||
exceptionReference.set(e);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
assertWithMessage("Transformer timed out after " + timeoutSeconds + " seconds.")
|
assertWithMessage("Transformer timed out after " + timeoutSeconds + " seconds.")
|
||||||
.that(countDownLatch.await(timeoutSeconds, SECONDS))
|
.that(countDownLatch.await(timeoutSeconds, SECONDS))
|
||||||
.isTrue();
|
.isTrue();
|
||||||
@Nullable Exception exception = exceptionReference.get();
|
@Nullable Exception exception = exceptionReference.get();
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
throw exception;
|
throw exception;
|
||||||
}
|
|
||||||
long outputSizeBytes = externalCacheFile.length();
|
|
||||||
return new TransformationResult(outputSizeBytes);
|
|
||||||
} finally {
|
|
||||||
externalCacheFile.delete();
|
|
||||||
}
|
}
|
||||||
|
long outputSizeBytes = externalCacheFile.length();
|
||||||
|
return new TransformationResult(outputSizeBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File createExternalCacheFile(Context context, String filePrefix)
|
private static File createExternalCacheFile(Context context, String filePrefix)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue