Unverified Commit 9cb20471 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Make Spinner test case use mockStopwatch (#43761)

parent 50da3bd0
...@@ -90,6 +90,7 @@ void main() { ...@@ -90,6 +90,7 @@ void main() {
void doWhileAsync(FakeAsync time, bool doThis()) { void doWhileAsync(FakeAsync time, bool doThis()) {
do { do {
mockStopwatch.elapsed += const Duration(milliseconds: 1);
time.elapse(const Duration(milliseconds: 1)); time.elapse(const Duration(milliseconds: 1));
} while (doThis()); } while (doThis());
} }
...@@ -97,6 +98,7 @@ void main() { ...@@ -97,6 +98,7 @@ void main() {
for (String testOs in testPlatforms) { for (String testOs in testPlatforms) {
testUsingContext('AnsiSpinner works for $testOs (1)', () async { testUsingContext('AnsiSpinner works for $testOs (1)', () async {
bool done = false; bool done = false;
mockStopwatch = FakeStopwatch();
FakeAsync().run((FakeAsync time) { FakeAsync().run((FakeAsync time) {
final AnsiSpinner ansiSpinner = AnsiSpinner( final AnsiSpinner ansiSpinner = AnsiSpinner(
timeout: const Duration(hours: 10), timeout: const Duration(hours: 10),
...@@ -129,6 +131,7 @@ void main() { ...@@ -129,6 +131,7 @@ void main() {
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => FakePlatform(operatingSystem: testOs), Platform: () => FakePlatform(operatingSystem: testOs),
Stdio: () => mockStdio, Stdio: () => mockStdio,
Stopwatch: () => mockStopwatch,
}); });
testUsingContext('AnsiSpinner works for $testOs (2)', () async { testUsingContext('AnsiSpinner works for $testOs (2)', () async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment