Skip to content

Commit 1046577

Browse files
stuartmorgan-gmauricioluz
authored andcommitted
[camera] Attempt to fix flaky new Android test (flutter#6831)
The recently added "recording with image stream" test is very flaky, often throwing on `stop`. This is a speculative fix for that flake based on the documentation of `stop` indicating that it will throw if nothing has been recorded.
1 parent aba4029 commit 1046577

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/camera/camera_android/example/integration_test/camera_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,10 @@ void main() {
277277

278278
expect(controller.value.isStreamingImages, true);
279279

280-
sleep(const Duration(milliseconds: 500));
280+
// Stopping recording before anything is recorded will throw, per
281+
// https://developer.android.com/reference/android/media/MediaRecorder.html#stop()
282+
// so delay long enough to ensure that some data is recorded.
283+
await Future<void>.delayed(const Duration(seconds: 2));
281284

282285
await controller.stopVideoRecording();
283286
await controller.dispose();

0 commit comments

Comments
 (0)