[flutter_tool] Use a timeout for xcode showBuildSettings (#39280)

This commit is contained in:
Zachary Anderson
2019-08-28 10:03:53 -07:00
committed by GitHub
parent ce3c467292
commit b7c714e84c
11 changed files with 289 additions and 52 deletions

View File

@@ -335,6 +335,15 @@ class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter {
return <String, String>{};
}
@override
Future<Map<String, String>> getBuildSettingsAsync(
String projectPath,
String target, {
Duration timeout = const Duration(minutes: 1),
}) async {
return <String, String>{};
}
@override
void cleanWorkspace(String workspacePath, String scheme) {
}

View File

@@ -182,6 +182,26 @@ class MockProcessManager extends Mock implements ProcessManager {
}
}
/// A function that generates a process factory that gives processes that fail
/// a given number of times before succeeding. The returned processes will
/// fail after a delay if one is supplied.
ProcessFactory flakyProcessFactory(int flakes, {Duration delay}) {
int flakesLeft = flakes;
return (List<String> command) {
if (flakesLeft == 0) {
return MockProcess(exitCode: Future<int>.value(0));
}
flakesLeft = flakesLeft - 1;
Future<int> exitFuture;
if (delay == null) {
exitFuture = Future<int>.value(-9);
} else {
exitFuture = Future<int>.delayed(delay, () => Future<int>.value(-9));
}
return MockProcess(exitCode: exitFuture);
};
}
/// A process that exits successfully with no output and ignores all input.
class MockProcess extends Mock implements Process {
MockProcess({