Revert "Clean up some flutter_tools tests and roll dependencies (#33163)" (#33206)

This commit is contained in:
Jonah Williams
2019-05-22 12:20:02 -07:00
committed by GitHub
parent a6f1c095dc
commit a30ffb60ad
46 changed files with 173 additions and 189 deletions

View File

@@ -95,7 +95,7 @@ void main() {
}
for (String testOs in testPlatforms) {
testUsingContext('AnsiSpinner works for $testOs (1)', () async {
testUsingContext('AnsiSpinner works for $testOs', () async {
bool done = false;
FakeAsync().run((FakeAsync time) {
final AnsiSpinner ansiSpinner = AnsiSpinner(
@@ -131,18 +131,21 @@ void main() {
Stdio: () => mockStdio,
});
testUsingContext('AnsiSpinner works for $testOs (2)', () async {
testUsingContext('AnsiSpinner works for $testOs', () async {
bool done = false;
mockStopwatch = FakeStopwatch();
FakeAsync().run((FakeAsync time) {
// We pad the time here so that we have a little slack in terms of the first part of this test
// taking longer to run than we'd like, since we are forced to start the timer before the actual
// stopwatch that we're trying to test. This is an unfortunate possible race condition. If this
// turns out to be flaky, we will need to find another solution.
final Future<void> tenMillisecondsLater = Future<void>.delayed(const Duration(milliseconds: 15));
await FakeAsync().run((FakeAsync time) async {
final AnsiSpinner ansiSpinner = AnsiSpinner(
timeout: const Duration(seconds: 2),
timeout: const Duration(milliseconds: 10),
)..start();
mockStopwatch.elapsed = const Duration(seconds: 1);
doWhileAsync(time, () => ansiSpinner.ticks < 10); // one second
expect(ansiSpinner.seemsSlow, isFalse);
expect(outputStdout().join('\n'), isNot(contains('This is taking an unexpectedly long time.')));
mockStopwatch.elapsed = const Duration(seconds: 3);
await tenMillisecondsLater;
doWhileAsync(time, () => ansiSpinner.ticks < 30); // three seconds
expect(ansiSpinner.seemsSlow, isTrue);
// Check the 2nd line to verify there's a newline before the warning
@@ -155,7 +158,6 @@ void main() {
}, overrides: <Type, Generator>{
Platform: () => FakePlatform(operatingSystem: testOs),
Stdio: () => mockStdio,
Stopwatch: () => mockStopwatch,
});
testUsingContext('Stdout startProgress on colored terminal for $testOs', () async {