Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests which don't specify explicit URI #265

Merged
merged 6 commits into from
Sep 18, 2024

Conversation

temcguir
Copy link
Collaborator

When running JCA without an explicit intent mode, the files are
saved to MediaStore. This installs a watch on the MediaStore to
delete any files that are created during tests.

 When running JCA without an explicit intent mode, the files are
 saved to MediaStore. This installs a watch on the MediaStore to
 delete any files that are created during tests.
 Video capture seems to be saving a 3gp file without the filename
 specified. Remove the "JCA" prefix check for now in order to
 ensure this file gets deleted in tests.
}
put(displayName, outputUri)
}
cursor.moveToNext()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just making sure, this cursor doesn't need to be closed right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cursor is automatically closed by virtue of accessing it via a use {} block (on line 69).

mediaUri = mediaUri,
instrumentation = instrumentation,
filePrefix = filePrefix
).take(expectedNumFiles)
Copy link
Collaborator

@davidjiagoogle davidjiagoogle Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble understanding this line. The observer sends all changed files upon and they are put into the entries. What does ".take(expectedNumFiles)" do?

It seems it has to do with runScenarioTest() succeeding, but how?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flow.take will transform the flow into another flow that only contains expectedNumFiles elements. This means the flow will complete once the expected number of files has been received, and execution will continue past the collect block. When the number of files produced is less than expectedNumFiles, the collect block will suspend while waiting for the next result.

@temcguir temcguir merged commit dd7059a into main Sep 18, 2024
6 checks passed
@temcguir temcguir deleted the temcguir/fix_mediastore_tests branch September 18, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants