From 83b9e99cfbb8be5215514d7fa21191961b4a620d Mon Sep 17 00:00:00 2001 From: Alexander Dahlberg Date: Mon, 23 Aug 2021 19:03:21 +0200 Subject: [PATCH] Fixed leak and removed no-shuffle tag in scheduler_test.dart (#88423) Co-authored-by: Alexander Dahlberg 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. --- packages/flutter/test/scheduler/scheduler_test.dart | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/flutter/test/scheduler/scheduler_test.dart b/packages/flutter/test/scheduler/scheduler_test.dart index 914c6c0e9b..f76cad5e31 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(['no-shuffle']) - import 'dart:async'; import 'dart:ui' show window; @@ -140,6 +134,10 @@ void main() { 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 {