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

Commit a3d4377

Browse files
authored
Remove timeouts from CountdownLatch.await in tests (#50930)
See https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#never-check-if-a-port-is-available-before-using-it-never-add-timeouts-and-other-race-conditions This may be contributing to flakiness in the Java/Scenario_app tests. We should just timeout when CI says it's taken too long - on a slow machine 5 or 10 seconds may not be enough time.
1 parent 9409b75 commit a3d4377

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

shell/platform/android/test/io/flutter/embedding/engine/renderer/FlutterRendererTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import io.flutter.embedding.engine.FlutterJNI;
2828
import io.flutter.view.TextureRegistry;
2929
import java.util.concurrent.CountDownLatch;
30-
import java.util.concurrent.TimeUnit;
3130
import java.util.concurrent.atomic.AtomicInteger;
3231
import org.junit.Before;
3332
import org.junit.Test;
@@ -263,8 +262,8 @@ public void run() {
263262
});
264263
fakeFinalizer.start();
265264
try {
266-
latch.await(5L, TimeUnit.SECONDS);
267-
} catch (Throwable e) {
265+
latch.await();
266+
} catch (InterruptedException e) {
268267
// do nothing
269268
}
270269
}

testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/ExternalTextureFlutterActivity.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ public void waitUntilFlutterRendered() {
9494
super.waitUntilFlutterRendered();
9595

9696
try {
97-
if (!firstFrameLatch.await(10, java.util.concurrent.TimeUnit.SECONDS)) {
98-
throw new RuntimeException("Timeout waiting for firstFrameLatch to signal");
99-
}
97+
firstFrameLatch.await();
10098
} catch (InterruptedException e) {
10199
throw new RuntimeException(e);
102100
}

0 commit comments

Comments
 (0)