Unverified Commit bafa03e5 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] Remove mocking and simplify Dart target tests (#50688)

parent 8872d1d8
......@@ -241,7 +241,8 @@ class PackageUriMapper {
}
}
List<String> _buildModeOptions(BuildMode mode) {
/// List the preconfigured build options for a given build mode.
List<String> buildModeOptions(BuildMode mode) {
switch (mode) {
case BuildMode.debug:
return <String>[
......@@ -316,7 +317,7 @@ class KernelCompiler {
'-Ddart.developer.causal_async_stacks=${buildMode == BuildMode.debug}',
for (final Object dartDefine in dartDefines)
'-D$dartDefine',
..._buildModeOptions(buildMode),
...buildModeOptions(buildMode),
if (trackWidgetCreation) '--track-widget-creation',
if (!linkPlatformKernelIn) '--no-link-platform',
if (aot) ...<String>[
......@@ -357,14 +358,9 @@ class KernelCompiler {
];
globals.printTrace(command.join(' '));
final Process server = await globals.processManager
.start(command)
.catchError((dynamic error, StackTrace stack) {
globals.printError('Failed to start frontend server $error, $stack');
});
final Process server = await globals.processManager.start(command);
final StdoutHandler _stdoutHandler = StdoutHandler();
server.stderr
.transform<String>(utf8.decoder)
.listen(globals.printError);
......@@ -678,7 +674,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
'--packages',
packagesPath,
],
..._buildModeOptions(buildMode),
...buildModeOptions(buildMode),
if (trackWidgetCreation) '--track-widget-creation',
if (fileSystemRoots != null)
for (final String root in fileSystemRoots) ...<String>[
......
......@@ -202,6 +202,11 @@ abstract class FakeProcessManager implements ProcessManager {
/// This is a no-op on [FakeProcessManager.any].
void addCommand(FakeCommand command);
/// Whether this fake has more [FakeCommand]s that are expected to run.
///
/// This is always `true` for [FakeProcessManager.any].
bool get hasRemainingExpectations;
@protected
FakeCommand findCommand(List<String> command, String workingDirectory, Map<String, String> environment);
......@@ -299,6 +304,9 @@ class _FakeAnyProcessManager extends FakeProcessManager {
@override
void addCommand(FakeCommand command) { }
@override
bool get hasRemainingExpectations => true;
}
class _SequenceProcessManager extends FakeProcessManager {
......@@ -325,4 +333,7 @@ class _SequenceProcessManager extends FakeProcessManager {
void addCommand(FakeCommand command) {
_commands.add(command);
}
@override
bool get hasRemainingExpectations => _commands.isNotEmpty;
}
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