Fixed leak and removed no-shuffle tag in scheduler_test.dart (#88423)
Co-authored-by: Alexander Dahlberg <alexander.dahlberg@sigma.se>
This PR fixed the problem that has prevented scheduler_test.dart being shuffled. Part of #85160.
One test schedules a task, but events are locked so the scheduled task does not execute and this messes up other tests.
This PR adds a teardown that executes the scheduled task after the test, when events are unlocked.
diff --git a/packages/flutter/test/scheduler/scheduler_test.dart b/packages/flutter/test/scheduler/scheduler_test.dart
index 914c6c0..f76cad5 100644
--- a/packages/flutter/test/scheduler/scheduler_test.dart
+++ b/packages/flutter/test/scheduler/scheduler_test.dart
@@ -2,12 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// TODO(gspencergoog): Remove this tag once this test's state leaks/test
-// dependencies have been fixed.
-// https://github.com/flutter/flutter/issues/85160
-// Fails with "flutter test --test-randomize-ordering-seed=123"
-@Tags(<String>['no-shuffle'])
-
import 'dart:async';
import 'dart:ui' show window;
@@ -140,6 +134,10 @@
for (final VoidCallback timer in timerQueueTasks) {
timer();
}
+
+ // As events are locked, make scheduleTask execute after the test or it
+ // will execute during following tests and risk failure.
+ addTearDown(() => scheduler.handleEventLoopCallback());
});
test('Flutter.Frame event fired', () async {