Unverified Commit 50190d28 authored by Keerti Parthasarathy's avatar Keerti Parthasarathy Committed by GitHub

Do not encode the server port in the test file (#15535)

* Do not encode the server port in the test file

* revert formatting

* add back ignore

* add a default value to serverPort

* address comments
parent c640b191
......@@ -293,6 +293,7 @@ class _FlutterPlatform extends PlatformPlugin {
startPaused: startPaused,
bundlePath: _getBundlePath(finalizers, ourTestCount),
observatoryPort: explicitObservatoryPort,
serverPort: server.port,
);
subprocessActive = true;
finalizers.add(() async {
......@@ -511,7 +512,7 @@ class _FlutterPlatform extends PlatformPlugin {
listenerFile.createSync();
listenerFile.writeAsStringSync(_generateTestMain(
testUrl: fs.path.toUri(fs.path.absolute(testPath)).toString(),
encodedWebsocketUrl: Uri.encodeComponent(_getWebSocketUrl(server))
encodedWebsocketUrl: Uri.encodeComponent(_getWebSocketUrl()),
));
return listenerFile.path;
}
......@@ -550,10 +551,10 @@ class _FlutterPlatform extends PlatformPlugin {
return tempBundleDirectory.path;
}
String _getWebSocketUrl(HttpServer server) {
String _getWebSocketUrl() {
return host.type == InternetAddressType.IP_V4
? 'ws://${host.address}:${server.port}'
: 'ws://[${host.address}]:${server.port}';
? 'ws://${host.address}'
: 'ws://[${host.address}]';
}
String _generateTestMain({
......@@ -576,7 +577,8 @@ import '$testUrl' as test;
void main() {
print('$_kStartTimeoutTimerMessage');
String server = Uri.decodeComponent('$encodedWebsocketUrl');
String serverPort = Platform.environment['SERVER_PORT'];
String server = Uri.decodeComponent('$encodedWebsocketUrl:\$serverPort');
StreamChannel channel = serializeSuite(() {
catchIsolateErrors();
return test.main;
......@@ -621,6 +623,7 @@ void main() {
bool enableObservatory: false,
bool startPaused: false,
int observatoryPort,
int serverPort,
}) {
assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
assert(!startPaused || enableObservatory);
......@@ -660,6 +663,7 @@ void main() {
final Map<String, String> environment = <String, String>{
'FLUTTER_TEST': 'true',
'FONTCONFIG_FILE': _fontConfigFile.path,
'SERVER_PORT': serverPort.toString(),
};
return processManager.start(command, environment: environment);
}
......
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