[flutter_tools] refactor the IOSDevicePortForwarder and move tests out of devices_test.dart (#52772)

Updates the IOSDevicePortForwarder to no longer depend on context, or on an IOSDevice instance. Instead, it receives all necessary configuration through the constructor.

Moves the IOSDevicePortForwarder to a separate file.
This commit is contained in:
Jonah Williams
2020-03-17 17:58:05 -07:00
committed by GitHub
parent 6884086e5c
commit 90d6169678
4 changed files with 121 additions and 72 deletions

View File

@@ -30,9 +30,7 @@ class FakeCommand {
this.completer,
}) : assert(command != null),
assert(duration != null),
assert(exitCode != null),
assert(stdout != null),
assert(stderr != null);
assert(exitCode != null);
/// The exact commands that must be matched for this [FakeCommand] to be
/// considered correct.
@@ -139,8 +137,12 @@ class _FakeProcess implements Process {
}
return _exitCode;
}),
stderr = Stream<List<int>>.value(utf8.encode(_stderr)),
stdout = Stream<List<int>>.value(utf8.encode(_stdout));
stderr = _stderr == null
? const Stream<List<int>>.empty()
: Stream<List<int>>.value(utf8.encode(_stderr)),
stdout = _stdout == null
? const Stream<List<int>>.empty()
: Stream<List<int>>.value(utf8.encode(_stdout));
final int _exitCode;