Set DDS port to requested observatory port for test (#66607)
* Set DDS port to requested observatory port for test * Add test for DDS and observatory ports * Use FakePlatform instead of mock, fix spacing * Use FakeProcessManager instead of mock * Fix analyze issue * Make completer private and add fn for future
This commit is contained in:
@@ -464,7 +464,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
enableObservatory: enableObservatory,
|
||||
startPaused: startPaused,
|
||||
disableServiceAuthCodes: disableServiceAuthCodes,
|
||||
observatoryPort: explicitObservatoryPort,
|
||||
observatoryPort: disableDds ? explicitObservatoryPort : 0,
|
||||
serverPort: server.port,
|
||||
);
|
||||
subprocessActive = true;
|
||||
@@ -495,6 +495,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
// Pipe stdout and stderr from the subprocess to our printStatus console.
|
||||
// We also keep track of what observatory port the engine used, if any.
|
||||
Uri processObservatoryUri;
|
||||
final Uri ddsServiceUri = getDdsServiceUri();
|
||||
_pipeStandardStreamsToConsole(
|
||||
process,
|
||||
reportObservatoryUri: (Uri detectedUri) async {
|
||||
@@ -504,6 +505,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
if (!disableDds) {
|
||||
final DartDevelopmentService dds = await DartDevelopmentService.startDartDevelopmentService(
|
||||
detectedUri,
|
||||
serviceUri: ddsServiceUri,
|
||||
enableAuthCodes: !disableServiceAuthCodes,
|
||||
ipv6: host.type == InternetAddressType.IPv6,
|
||||
);
|
||||
@@ -904,6 +906,19 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
return 'Shell subprocess crashed with unexpected exit code $exitCode $when.';
|
||||
}
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
@protected
|
||||
Uri getDdsServiceUri() {
|
||||
return Uri(
|
||||
scheme: 'http',
|
||||
host: (host.type == InternetAddressType.IPv6 ?
|
||||
InternetAddress.loopbackIPv6 :
|
||||
InternetAddress.loopbackIPv4
|
||||
).host,
|
||||
port: explicitObservatoryPort ?? 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// The [_shellProcessClosed] future can't have errors thrown on it because it
|
||||
|
||||
Reference in New Issue
Block a user