Thanks to visit codestin.com
Credit goes to github.com

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

[video_player] Fix a flaky test #4611

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/video_player/video_player/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Fixes integration tests.
* Updates Android compileSdkVersion to 31.
* Fixes a flaky integration test.

## 2.2.7

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,13 @@ void main() {
await networkController.setVolume(0);
final Completer<void> started = Completer();
final Completer<void> ended = Completer();
bool startedBuffering = false;
bool endedBuffering = false;
networkController.addListener(() {
if (networkController.value.isBuffering && !startedBuffering) {
startedBuffering = true;
if (!started.isCompleted && networkController.value.isBuffering) {
started.complete();
}
if (startedBuffering &&
if (started.isCompleted &&
!networkController.value.isBuffering &&
!endedBuffering) {
endedBuffering = true;
!ended.isCompleted) {
ended.complete();
}
});
Expand All @@ -72,11 +68,8 @@ void main() {
expect(networkController.value.position,
(Duration position) => position > const Duration(seconds: 0));

await started;
expect(startedBuffering, true);

await ended;
expect(endedBuffering, true);
await expectLater(started.future, completes);
await expectLater(ended.future, completes);
},
skip: !(kIsWeb || defaultTargetPlatform == TargetPlatform.android),
);
Expand Down