Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2054b290
authored
Nov 25, 2021
by
samrobinson
Committed by
tonihei
Dec 02, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Pull files from the device cache after a test concludes.
PiperOrigin-RevId: 412251020
parent
96506285
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
libraries/transformer/src/androidTest/java/androidx/media3/transformer/AndroidTestUtil.java
libraries/transformer/src/androidTest/java/androidx/media3/transformer/AndroidTestUtil.java
View file @
2054b290
...
...
@@ -83,30 +83,26 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
Uri
uri
=
Uri
.
parse
(
uriString
);
File
externalCacheFile
=
createExternalCacheFile
(
context
,
/* filePrefix= */
testId
);
try
{
InstrumentationRegistry
.
getInstrumentation
()
.
runOnMainSync
(
()
->
{
try
{
testTransformer
.
startTransformation
(
MediaItem
.
fromUri
(
uri
),
externalCacheFile
.
getAbsolutePath
());
}
catch
(
IOException
e
)
{
exceptionReference
.
set
(
e
);
}
});
InstrumentationRegistry
.
getInstrumentation
()
.
runOnMainSync
(
()
->
{
try
{
testTransformer
.
startTransformation
(
MediaItem
.
fromUri
(
uri
),
externalCacheFile
.
getAbsolutePath
());
}
catch
(
IOException
e
)
{
exceptionReference
.
set
(
e
);
}
});
assertWithMessage
(
"Transformer timed out after "
+
timeoutSeconds
+
" seconds."
)
.
that
(
countDownLatch
.
await
(
timeoutSeconds
,
SECONDS
))
.
isTrue
();
@Nullable
Exception
exception
=
exceptionReference
.
get
();
if
(
exception
!=
null
)
{
throw
exception
;
}
long
outputSizeBytes
=
externalCacheFile
.
length
();
return
new
TransformationResult
(
outputSizeBytes
);
}
finally
{
externalCacheFile
.
delete
();
assertWithMessage
(
"Transformer timed out after "
+
timeoutSeconds
+
" seconds."
)
.
that
(
countDownLatch
.
await
(
timeoutSeconds
,
SECONDS
))
.
isTrue
();
@Nullable
Exception
exception
=
exceptionReference
.
get
();
if
(
exception
!=
null
)
{
throw
exception
;
}
long
outputSizeBytes
=
externalCacheFile
.
length
();
return
new
TransformationResult
(
outputSizeBytes
);
}
private
static
File
createExternalCacheFile
(
Context
context
,
String
filePrefix
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment