From 9cb2047139cd78c2ff078cae15aef4ba529e51c5 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Tue, 29 Oct 2019 21:36:19 -0700 Subject: [PATCH] Make Spinner test case use mockStopwatch (#43761) --- .../flutter_tools/test/general.shard/base/logger_test.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/flutter_tools/test/general.shard/base/logger_test.dart b/packages/flutter_tools/test/general.shard/base/logger_test.dart index 9c80e51b0c..4f90fb176f 100644 --- a/packages/flutter_tools/test/general.shard/base/logger_test.dart +++ b/packages/flutter_tools/test/general.shard/base/logger_test.dart @@ -90,6 +90,7 @@ void main() { void doWhileAsync(FakeAsync time, bool doThis()) { do { + mockStopwatch.elapsed += const Duration(milliseconds: 1); time.elapse(const Duration(milliseconds: 1)); } while (doThis()); } @@ -97,6 +98,7 @@ void main() { for (String testOs in testPlatforms) { testUsingContext('AnsiSpinner works for $testOs (1)', () async { bool done = false; + mockStopwatch = FakeStopwatch(); FakeAsync().run((FakeAsync time) { final AnsiSpinner ansiSpinner = AnsiSpinner( timeout: const Duration(hours: 10), @@ -129,6 +131,7 @@ void main() { }, overrides: { Platform: () => FakePlatform(operatingSystem: testOs), Stdio: () => mockStdio, + Stopwatch: () => mockStopwatch, }); testUsingContext('AnsiSpinner works for $testOs (2)', () async {