Remove race conditions involving finding available ports (#18698)
This is an attempt to reland #18488 with less breakage on macOS.
This commit is contained in:
@@ -12,7 +12,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/os.dart';
|
||||
import 'package:flutter_tools/src/base/port_scanner.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/context_runner.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
@@ -77,7 +76,6 @@ void testUsingContext(String description, dynamic testMethod(), {
|
||||
},
|
||||
Logger: () => new BufferLogger(),
|
||||
OperatingSystemUtils: () => new MockOperatingSystemUtils(),
|
||||
PortScanner: () => new MockPortScanner(),
|
||||
SimControl: () => new MockSimControl(),
|
||||
Usage: () => new MockUsage(),
|
||||
XcodeProjectInterpreter: () => new MockXcodeProjectInterpreter(),
|
||||
@@ -127,16 +125,6 @@ void _printBufferedErrors(AppContext testContext) {
|
||||
}
|
||||
}
|
||||
|
||||
class MockPortScanner extends PortScanner {
|
||||
static int _nextAvailablePort = 12345;
|
||||
|
||||
@override
|
||||
Future<bool> isPortAvailable(int port) async => true;
|
||||
|
||||
@override
|
||||
Future<int> findAvailablePort() async => _nextAvailablePort++;
|
||||
}
|
||||
|
||||
class MockDeviceManager implements DeviceManager {
|
||||
List<Device> devices = <Device>[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user