Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 1381802

Browse files
[camera] Attempt to fix flaky new Android test (#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 0609adb commit 1381802

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)