From 48bb3c0bc910e7b9c17907e411ae4a729ef8cf8e Mon Sep 17 00:00:00 2001 From: Victoria Ashworth Date: Wed, 19 Apr 2023 14:59:11 -0500 Subject: [PATCH] Use term wireless instead of network (#124232) Rename variables, update comments, etc from `network` to `wireless` to keep it more uniform. Also, move non-overriden messages related to device selection into the file they're used. Part 7 in breakdown of https://github.com/flutter/flutter/pull/121262. --- .../lib/src/base/user_messages.dart | 9 ---- .../lib/src/commands/attach.dart | 12 ++--- .../flutter_tools/lib/src/commands/drive.dart | 10 ++-- .../flutter_tools/lib/src/commands/run.dart | 8 +-- .../flutter_tools/lib/src/ios/devices.dart | 4 +- .../flutter_tools/lib/src/mdns_discovery.dart | 54 ++++++++++--------- .../lib/src/runner/target_devices.dart | 35 +++++++----- .../commands.shard/hermetic/attach_test.dart | 6 +-- .../commands.shard/hermetic/drive_test.dart | 12 ++--- .../commands.shard/hermetic/run_test.dart | 10 ++-- .../ios/ios_device_start_prebuilt_test.dart | 10 ++-- .../general.shard/mdns_discovery_test.dart | 22 ++++---- 12 files changed, 98 insertions(+), 94 deletions(-) diff --git a/packages/flutter_tools/lib/src/base/user_messages.dart b/packages/flutter_tools/lib/src/base/user_messages.dart index 122392056a..2a5847c53c 100644 --- a/packages/flutter_tools/lib/src/base/user_messages.dart +++ b/packages/flutter_tools/lib/src/base/user_messages.dart @@ -263,24 +263,15 @@ class UserMessages { String get flutterNoDevelopmentDevice => "Unable to locate a development device; please run 'flutter doctor' " 'for information about installing additional components.'; - String flutterNoMatchingDevice(String deviceId) => 'No supported devices found with name or id ' - "matching '$deviceId'."; - String get flutterNoDevicesFound => 'No devices found.'; String get flutterNoSupportedDevices => 'No supported devices connected.'; String flutterMissPlatformProjects(List unsupportedDevicesType) => 'If you would like your app to run on ${unsupportedDevicesType.join(' or ')}, consider running `flutter create .` to generate projects for these platforms.'; - String get flutterFoundButUnsupportedDevices => 'The following devices were found, but are not supported by this project:'; - String flutterFoundSpecifiedDevices(int count, String deviceId) => - 'Found $count devices with name or id matching $deviceId:'; - String flutterChooseDevice(int option, String name, String deviceId) => '[$option]: $name ($deviceId)'; - String get flutterChooseOne => 'Please choose one (or "q" to quit)'; String get flutterSpecifyDeviceWithAllOption => 'More than one device connected; please specify a device with ' "the '-d ' flag, or use '-d all' to act on all devices."; String get flutterSpecifyDevice => 'More than one device connected; please specify a device with ' "the '-d ' flag."; - String get flutterNoConnectedDevices => 'No connected devices.'; String get flutterNoPubspec => 'Error: No pubspec.yaml file found.\n' 'This command should be run from the root of your Flutter project.'; diff --git a/packages/flutter_tools/lib/src/commands/attach.dart b/packages/flutter_tools/lib/src/commands/attach.dart index a61ca00e9e..7e9fba2992 100644 --- a/packages/flutter_tools/lib/src/commands/attach.dart +++ b/packages/flutter_tools/lib/src/commands/attach.dart @@ -227,7 +227,7 @@ known, it can be explicitly provided to attach via the command-line, e.g. debugPort; // Allow --ipv6 for iOS devices even if --debug-port and --debug-url - // are unknown + // are unknown. if (!_isIOSDevice(targetDevice) && debugPort == null && debugUri == null && @@ -298,9 +298,9 @@ known, it can be explicitly provided to attach via the command-line, e.g. final String ipv6Loopback = InternetAddress.loopbackIPv6.address; final String ipv4Loopback = InternetAddress.loopbackIPv4.address; final String hostname = usesIpv6 ? ipv6Loopback : ipv4Loopback; - final bool isNetworkDevice = (device is IOSDevice) && device.isWirelesslyConnected; + final bool isWirelessIOSDevice = (device is IOSDevice) && device.isWirelesslyConnected; - if ((debugPort == null && debugUri == null) || isNetworkDevice) { + if ((debugPort == null && debugUri == null) || isWirelessIOSDevice) { if (device is FuchsiaDevice) { final String? module = stringArg('module'); if (module == null) { @@ -323,10 +323,10 @@ known, it can be explicitly provided to attach via the command-line, e.g. // Protocol Discovery relies on logging. On iOS earlier than 13, logging is gathered using syslog. // syslog is not available for iOS 13+. For iOS 13+, Protocol Discovery gathers logs from the VMService. // Since we don't have access to the VMService yet, Protocol Discovery cannot be used for iOS 13+. - // Also, network devices must be found using mDNS and cannot use Protocol Discovery. + // Also, wireless devices must be found using mDNS and cannot use Protocol Discovery. final bool compatibleWithProtocolDiscovery = (device is IOSDevice) && device.majorSdkVersion < IOSDeviceLogReader.minimumUniversalLoggingSdkVersion && - !isNetworkDevice; + !isWirelessIOSDevice; _logger.printStatus('Waiting for a connection from Flutter on ${device.name}...'); final Status discoveryStatus = _logger.startSpinner( @@ -357,7 +357,7 @@ known, it can be explicitly provided to attach via the command-line, e.g. appId, device, usesIpv6: usesIpv6, - isNetworkDevice: isNetworkDevice, + useDeviceIPAsHost: isWirelessIOSDevice, deviceVmservicePort: devicePort, ); diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart index dd71170b54..022414ff73 100644 --- a/packages/flutter_tools/lib/src/commands/drive.dart +++ b/packages/flutter_tools/lib/src/commands/drive.dart @@ -201,16 +201,16 @@ class DriveCommand extends RunCommandBase { ); } - // Network devices need `publish-port` to be enabled because it requires mDNS. - // If the flag wasn't provided as an actual argument and it's a network device, + // Wireless iOS devices need `publish-port` to be enabled because it requires mDNS. + // If the flag wasn't provided as an actual argument and it's a wireless device, // change it to be enabled. @override Future get disablePortPublication async { final ArgResults? localArgResults = argResults; final Device? device = await targetedDevice; - final bool isNetworkDevice = device is IOSDevice && device.isWirelesslyConnected; - if (isNetworkDevice && localArgResults != null && !localArgResults.wasParsed('publish-port')) { - _logger.printTrace('Network device is being used. Changing `publish-port` to be enabled.'); + final bool isWirelessIOSDevice = device is IOSDevice && device.isWirelesslyConnected; + if (isWirelessIOSDevice && localArgResults != null && !localArgResults.wasParsed('publish-port')) { + _logger.printTrace('A wireless iOS device is being used. Changing `publish-port` to be enabled.'); return false; } return !boolArg('publish-port'); diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart index 99d8a89694..1cc7c3c828 100644 --- a/packages/flutter_tools/lib/src/commands/run.dart +++ b/packages/flutter_tools/lib/src/commands/run.dart @@ -427,7 +427,7 @@ class RunCommand extends RunCommandBase { bool isEmulator; bool anyAndroidDevices = false; bool anyIOSDevices = false; - bool anyIOSNetworkDevices = false; + bool anyWirelessIOSDevices = false; if (devices == null || devices!.isEmpty) { deviceType = 'none'; @@ -439,7 +439,7 @@ class RunCommand extends RunCommandBase { anyAndroidDevices = platform == TargetPlatform.android; anyIOSDevices = platform == TargetPlatform.ios; if (device is IOSDevice && device.isWirelesslyConnected) { - anyIOSNetworkDevices = true; + anyWirelessIOSDevices = true; } deviceType = getNameForTargetPlatform(platform); deviceOsVersion = await device.sdkNameAndVersion; @@ -453,7 +453,7 @@ class RunCommand extends RunCommandBase { anyAndroidDevices = anyAndroidDevices || (platform == TargetPlatform.android); anyIOSDevices = anyIOSDevices || (platform == TargetPlatform.ios); if (device is IOSDevice && device.isWirelesslyConnected) { - anyIOSNetworkDevices = true; + anyWirelessIOSDevices = true; } if (anyAndroidDevices && anyIOSDevices) { break; @@ -463,7 +463,7 @@ class RunCommand extends RunCommandBase { String? iOSInterfaceType; if (anyIOSDevices) { - iOSInterfaceType = anyIOSNetworkDevices ? 'wireless' : 'usb'; + iOSInterfaceType = anyWirelessIOSDevices ? 'wireless' : 'usb'; } String? androidEmbeddingVersion; diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart index ff0364f43f..a1f1ad7100 100644 --- a/packages/flutter_tools/lib/src/ios/devices.dart +++ b/packages/flutter_tools/lib/src/ios/devices.dart @@ -496,7 +496,7 @@ class IOSDevice extends Device { deviceLogReader.debuggerStream = iosDeployDebugger; } } - // Don't port foward if debugging with a network device. + // Don't port foward if debugging with a wireless device. vmServiceDiscovery = ProtocolDiscovery.vmService( deviceLogReader, portForwarder: isWirelesslyConnected ? null : portForwarder, @@ -576,7 +576,7 @@ class IOSDevice extends Device { this, usesIpv6: ipv6, deviceVmservicePort: serviceURL.port, - isNetworkDevice: true, + useDeviceIPAsHost: true, ); mDNSLookupTimer.cancel(); diff --git a/packages/flutter_tools/lib/src/mdns_discovery.dart b/packages/flutter_tools/lib/src/mdns_discovery.dart index d4e8ed8b4a..82196118af 100644 --- a/packages/flutter_tools/lib/src/mdns_discovery.dart +++ b/packages/flutter_tools/lib/src/mdns_discovery.dart @@ -57,7 +57,7 @@ class MDnsVmServiceDiscovery { /// The [deviceVmservicePort] parameter may be used to specify which port /// to find. /// - /// The [isNetworkDevice] parameter flags whether to get the device IP + /// The [useDeviceIPAsHost] parameter flags whether to get the device IP /// and the [ipv6] parameter flags whether to get an iPv6 address /// (otherwise it will get iPv4). /// @@ -80,7 +80,7 @@ class MDnsVmServiceDiscovery { String? applicationId, int? deviceVmservicePort, bool ipv6 = false, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, Duration timeout = const Duration(minutes: 10), }) async { // Poll for 5 seconds to see if there are already services running. @@ -93,7 +93,7 @@ class MDnsVmServiceDiscovery { applicationId: applicationId, deviceVmservicePort: deviceVmservicePort, ipv6: ipv6, - isNetworkDevice: isNetworkDevice, + useDeviceIPAsHost: useDeviceIPAsHost, timeout: const Duration(seconds: 5), ); if (results.isEmpty) { @@ -102,7 +102,7 @@ class MDnsVmServiceDiscovery { applicationId: applicationId, deviceVmservicePort: deviceVmservicePort, ipv6: ipv6, - isNetworkDevice: isNetworkDevice, + useDeviceIPAsHost: useDeviceIPAsHost, timeout: timeout, ); } else if (results.length > 1) { @@ -134,7 +134,7 @@ class MDnsVmServiceDiscovery { /// if multiple flutter apps are running on different devices, it will /// only match with the device running the desired app. /// - /// The [isNetworkDevice] parameter flags whether to get the device IP + /// The [useDeviceIPAsHost] parameter flags whether to get the device IP /// and the [ipv6] parameter flags whether to get an iPv6 address /// (otherwise it will get iPv4). /// @@ -148,7 +148,7 @@ class MDnsVmServiceDiscovery { required String applicationId, required int deviceVmservicePort, bool ipv6 = false, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, Duration timeout = const Duration(minutes: 10), }) async { // Query for a specific application and device port. @@ -157,7 +157,7 @@ class MDnsVmServiceDiscovery { applicationId: applicationId, deviceVmservicePort: deviceVmservicePort, ipv6: ipv6, - isNetworkDevice: isNetworkDevice, + useDeviceIPAsHost: useDeviceIPAsHost, timeout: timeout, ); } @@ -171,7 +171,7 @@ class MDnsVmServiceDiscovery { String? applicationId, int? deviceVmservicePort, bool ipv6 = false, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, Duration timeout = const Duration(minutes: 10), }) async { final List results = await _pollingVmService( @@ -179,7 +179,7 @@ class MDnsVmServiceDiscovery { applicationId: applicationId, deviceVmservicePort: deviceVmservicePort, ipv6: ipv6, - isNetworkDevice: isNetworkDevice, + useDeviceIPAsHost: useDeviceIPAsHost, timeout: timeout, quitOnFind: true, ); @@ -194,7 +194,7 @@ class MDnsVmServiceDiscovery { String? applicationId, int? deviceVmservicePort, bool ipv6 = false, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, required Duration timeout, bool quitOnFind = false, }) async { @@ -263,9 +263,9 @@ class MDnsVmServiceDiscovery { continue; } - // Get the IP address of the service if using a network device. + // Get the IP address of the device if using the IP as the host. InternetAddress? ipAddress; - if (isNetworkDevice) { + if (useDeviceIPAsHost) { List ipAddresses = await client .lookup( ipv6 @@ -351,6 +351,9 @@ class MDnsVmServiceDiscovery { /// Gets Dart VM Service Uri for `flutter attach`. /// Executes an mDNS query and waits until a Dart VM Service is found. /// + /// When [useDeviceIPAsHost] is true, it will use the device's IP as the + /// host and will not forward the port. + /// /// Differs from `getVMServiceUriForLaunch` because it can search for any available Dart VM Service. /// Since [applicationId] and [deviceVmservicePort] are optional, it can either look for any service /// or a specific service matching [applicationId]/[deviceVmservicePort]. @@ -361,14 +364,14 @@ class MDnsVmServiceDiscovery { bool usesIpv6 = false, int? hostVmservicePort, int? deviceVmservicePort, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, Duration timeout = const Duration(minutes: 10), }) async { final MDnsVmServiceDiscoveryResult? result = await queryForAttach( applicationId: applicationId, deviceVmservicePort: deviceVmservicePort, ipv6: usesIpv6, - isNetworkDevice: isNetworkDevice, + useDeviceIPAsHost: useDeviceIPAsHost, timeout: timeout, ); return _handleResult( @@ -378,13 +381,16 @@ class MDnsVmServiceDiscovery { deviceVmservicePort: deviceVmservicePort, hostVmservicePort: hostVmservicePort, usesIpv6: usesIpv6, - isNetworkDevice: isNetworkDevice + useDeviceIPAsHost: useDeviceIPAsHost ); } /// Gets Dart VM Service Uri for `flutter run`. /// Executes an mDNS query and waits until the Dart VM Service service is found. /// + /// When [useDeviceIPAsHost] is true, it will use the device's IP as the + /// host and will not forward the port. + /// /// Differs from `getVMServiceUriForAttach` because it only searches for a specific service. /// This is enforced by [applicationId] and [deviceVmservicePort] being required. Future getVMServiceUriForLaunch( @@ -393,14 +399,14 @@ class MDnsVmServiceDiscovery { bool usesIpv6 = false, int? hostVmservicePort, required int deviceVmservicePort, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, Duration timeout = const Duration(minutes: 10), }) async { final MDnsVmServiceDiscoveryResult? result = await queryForLaunch( applicationId: applicationId, deviceVmservicePort: deviceVmservicePort, ipv6: usesIpv6, - isNetworkDevice: isNetworkDevice, + useDeviceIPAsHost: useDeviceIPAsHost, timeout: timeout, ); return _handleResult( @@ -410,7 +416,7 @@ class MDnsVmServiceDiscovery { deviceVmservicePort: deviceVmservicePort, hostVmservicePort: hostVmservicePort, usesIpv6: usesIpv6, - isNetworkDevice: isNetworkDevice + useDeviceIPAsHost: useDeviceIPAsHost ); } @@ -421,7 +427,7 @@ class MDnsVmServiceDiscovery { int? deviceVmservicePort, int? hostVmservicePort, bool usesIpv6 = false, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, }) async { if (result == null) { await _checkForIPv4LinkLocal(device); @@ -430,7 +436,7 @@ class MDnsVmServiceDiscovery { final String host; final InternetAddress? ipAddress = result.ipAddress; - if (isNetworkDevice && ipAddress != null) { + if (useDeviceIPAsHost && ipAddress != null) { host = ipAddress.address; } else { host = usesIpv6 @@ -443,7 +449,7 @@ class MDnsVmServiceDiscovery { result.port, hostVmservicePort, result.authCode, - isNetworkDevice, + useDeviceIPAsHost, ); } @@ -529,7 +535,7 @@ Future buildVMServiceUri( int devicePort, [ int? hostVmservicePort, String? authCode, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, ]) async { String path = '/'; if (authCode != null) { @@ -543,8 +549,8 @@ Future buildVMServiceUri( hostVmservicePort ??= 0; final int? actualHostPort; - if (isNetworkDevice) { - // When debugging with a network device, port forwarding is not required + if (useDeviceIPAsHost) { + // When using the device's IP as the host, port forwarding is not required // so just use the device's port. actualHostPort = devicePort; } else { diff --git a/packages/flutter_tools/lib/src/runner/target_devices.dart b/packages/flutter_tools/lib/src/runner/target_devices.dart index 2c7a646670..9984dc5dec 100644 --- a/packages/flutter_tools/lib/src/runner/target_devices.dart +++ b/packages/flutter_tools/lib/src/runner/target_devices.dart @@ -14,13 +14,21 @@ import '../globals.dart' as globals; import '../ios/devices.dart'; const String _checkingForWirelessDevicesMessage = 'Checking for wireless devices...'; +const String _chooseOneMessage = 'Please choose one (or "q" to quit)'; const String _connectedDevicesMessage = 'Connected devices:'; -const String _noAttachedCheckForWireless = 'No devices found yet. Checking for wireless devices...'; +const String _foundButUnsupportedDevicesMessage = 'The following devices were found, but are not supported by this project:'; +const String _noAttachedCheckForWirelessMessage = 'No devices found yet. Checking for wireless devices...'; +const String _noDevicesFoundMessage = 'No devices found.'; const String _noWirelessDevicesFoundMessage = 'No wireless devices were found.'; const String _wirelesslyConnectedDevicesMessage = 'Wirelessly connected devices:'; -String _foundMultipleSpecifiedDevices(String deviceId) => +String _chooseDeviceOptionMessage(int option, String name, String deviceId) => '[$option]: $name ($deviceId)'; +String _foundMultipleSpecifiedDevicesMessage(String deviceId) => 'Found multiple devices with name or id matching $deviceId:'; +String _foundSpecifiedDevicesMessage(int count, String deviceId) => + 'Found $count devices with name or id matching $deviceId:'; +String _noMatchingDeviceMessage(String deviceId) => 'No supported devices found with name or id ' + "matching '$deviceId'."; /// This class handles functionality of finding and selecting target devices. /// @@ -193,7 +201,7 @@ class TargetDevices { if (_deviceManager.hasSpecifiedDeviceId) { _logger.printStatus( - userMessages.flutterNoMatchingDevice(_deviceManager.specifiedDeviceId!), + _noMatchingDeviceMessage(_deviceManager.specifiedDeviceId!), ); if (unsupportedDevices.isNotEmpty) { _logger.printStatus(''); @@ -204,7 +212,7 @@ class TargetDevices { } _logger.printStatus(_deviceManager.hasSpecifiedAllDevices - ? userMessages.flutterNoDevicesFound + ? _noDevicesFoundMessage : userMessages.flutterNoSupportedDevices); await _printUnsupportedDevice(unsupportedDevices); return null; @@ -248,7 +256,7 @@ class TargetDevices { List supportedWirelessDevices = wirelessDevices; if (_deviceManager.hasSpecifiedDeviceId) { final int allDeviceLength = supportedAttachedDevices.length + supportedWirelessDevices.length; - _logger.printStatus(userMessages.flutterFoundSpecifiedDevices( + _logger.printStatus(_foundSpecifiedDevicesMessage( allDeviceLength, _deviceManager.specifiedDeviceId!, )); @@ -288,7 +296,7 @@ class TargetDevices { final List allDevices = attachedDevices + wirelessDevices; if (_deviceManager.hasSpecifiedDeviceId) { - _logger.printStatus(userMessages.flutterFoundSpecifiedDevices( + _logger.printStatus(_foundSpecifiedDevicesMessage( allDevices.length, _deviceManager.specifiedDeviceId!, )); @@ -318,7 +326,7 @@ class TargetDevices { if (unsupportedDevices.isNotEmpty) { final StringBuffer result = StringBuffer(); result.writeln(); - result.writeln(userMessages.flutterFoundButUnsupportedDevices); + result.writeln(_foundButUnsupportedDevicesMessage); result.writeAll( (await Device.descriptions(unsupportedDevices)) .map((String desc) => desc) @@ -345,7 +353,7 @@ class TargetDevices { void _displayDeviceOptions(List devices) { int count = 1; for (final Device device in devices) { - _logger.printStatus(userMessages.flutterChooseDevice(count, device.name, device.id)); + _logger.printStatus(_chooseDeviceOptionMessage(count, device.name, device.id)); count++; } } @@ -356,7 +364,7 @@ class TargetDevices { [ for (int i = 0; i < deviceCount; i++) '${i + 1}', 'q', 'Q'], displayAcceptedCharacters: false, logger: _logger, - prompt: userMessages.flutterChooseOne, + prompt: _chooseOneMessage, ); return result; } @@ -526,7 +534,7 @@ class TargetDevicesWithExtendedWirelessDeviceDiscovery extends TargetDevices { Future> futureWirelessDevices, ) async { if (_includeAttachedDevices) { - _logger.printStatus(_noAttachedCheckForWireless); + _logger.printStatus(_noAttachedCheckForWirelessMessage); } else { _logger.printStatus(_checkingForWirelessDevicesMessage); } @@ -613,7 +621,7 @@ class TargetDevicesWithExtendedWirelessDeviceDiscovery extends TargetDevices { _logger.printStatus(_connectedDevicesMessage); } else if (_deviceManager.hasSpecifiedDeviceId) { // Multiple devices were found with part of the name/id provided. - _logger.printStatus(_foundMultipleSpecifiedDevices( + _logger.printStatus(_foundMultipleSpecifiedDevicesMessage( _deviceManager.specifiedDeviceId!, )); } @@ -660,7 +668,7 @@ class TargetDevicesWithExtendedWirelessDeviceDiscovery extends TargetDevices { deviceSelection.devices = allDevices; // Reprint device option prompt. _logger.printStatus( - '${userMessages.flutterChooseOne}: ', + '$_chooseOneMessage: ', emphasis: true, newline: false, ); @@ -758,11 +766,10 @@ class TargetDeviceSelection { @visibleForTesting Future readUserInput() async { final RegExp pattern = RegExp(r'\d+$|q', caseSensitive: false); - final String prompt = userMessages.flutterChooseOne; String? choice; globals.terminal.singleCharMode = true; while (choice == null || choice.length > 1 || !pattern.hasMatch(choice)) { - _logger.printStatus(prompt, emphasis: true, newline: false); + _logger.printStatus(_chooseOneMessage, emphasis: true, newline: false); // prompt ends with ': ' _logger.printStatus(': ', emphasis: true, newline: false); choice = (await globals.terminal.keystrokes.first).trim(); diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart index b85dd74d1f..9a3f6b1f2d 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -235,7 +235,7 @@ void main() { ), }); - testUsingContext('succeeds with iOS device with mDNS network device', () async { + testUsingContext('succeeds with iOS device with mDNS wireless device', () async { final FakeIOSDevice device = FakeIOSDevice( logReader: fakeLogReader, portForwarder: portForwarder, @@ -307,7 +307,7 @@ void main() { ), }); - testUsingContext('succeeds with iOS device with mDNS network device with debug-port', () async { + testUsingContext('succeeds with iOS device with mDNS wireless device with debug-port', () async { final FakeIOSDevice device = FakeIOSDevice( logReader: fakeLogReader, portForwarder: portForwarder, @@ -383,7 +383,7 @@ void main() { ), }); - testUsingContext('succeeds with iOS device with mDNS network device with debug-url', () async { + testUsingContext('succeeds with iOS device with mDNS wireless device with debug-url', () async { final FakeIOSDevice device = FakeIOSDevice( logReader: fakeLogReader, portForwarder: portForwarder, diff --git a/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart index 9d1250389f..32c0bccf06 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/drive_test.dart @@ -409,7 +409,7 @@ void main() { ProcessManager: () => FakeProcessManager.any(), }); - testUsingContext('Port publication not disabled for network device', () async { + testUsingContext('Port publication not disabled for wireless device', () async { final DriveCommand command = DriveCommand( fileSystem: fileSystem, logger: logger, @@ -421,9 +421,9 @@ void main() { fileSystem.file('test_driver/main_test.dart').createSync(recursive: true); fileSystem.file('pubspec.yaml').createSync(); - final Device networkDevice = FakeIosDevice() + final Device wirelessDevice = FakeIosDevice() ..connectionInterface = DeviceConnectionInterface.wireless; - fakeDeviceManager.wirelessDevices = [networkDevice]; + fakeDeviceManager.wirelessDevices = [wirelessDevice]; await expectLater(() => createTestCommandRunner(command).run([ 'drive', @@ -467,7 +467,7 @@ void main() { DeviceManager: () => fakeDeviceManager, }); - testUsingContext('Port publication does not default to enabled for network device if flag manually added', () async { + testUsingContext('Port publication does not default to enabled for wireless device if flag manually added', () async { final DriveCommand command = DriveCommand( fileSystem: fileSystem, logger: logger, @@ -479,9 +479,9 @@ void main() { fileSystem.file('test_driver/main_test.dart').createSync(recursive: true); fileSystem.file('pubspec.yaml').createSync(); - final Device networkDevice = FakeIosDevice() + final Device wirelessDevice = FakeIosDevice() ..connectionInterface = DeviceConnectionInterface.wireless; - fakeDeviceManager.wirelessDevices = [networkDevice]; + fakeDeviceManager.wirelessDevices = [wirelessDevice]; await expectLater(() => createTestCommandRunner(command).run([ 'drive', diff --git a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart index afe7c50404..2adb5c2353 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart @@ -228,7 +228,7 @@ void main() { expect( testLogger.statusText, - containsIgnoringWhitespace(userMessages.flutterNoSupportedDevices), + containsIgnoringWhitespace('No supported devices connected.'), ); }, overrides: { DeviceManager: () => testDeviceManager, @@ -404,11 +404,11 @@ void main() { expect( testLogger.statusText, - containsIgnoringWhitespace(userMessages.flutterNoSupportedDevices), + containsIgnoringWhitespace('No supported devices connected.'), ); expect( testLogger.statusText, - containsIgnoringWhitespace(userMessages.flutterFoundButUnsupportedDevices), + containsIgnoringWhitespace('The following devices were found, but are not supported by this project:'), ); expect( testLogger.statusText, @@ -831,7 +831,7 @@ void main() { ProcessManager: () => FakeProcessManager.any(), }); - testUsingContext('with only iOS network device', () async { + testUsingContext('with only iOS wireless device', () async { final List devices = [ FakeIOSDevice( connectionInterface: DeviceConnectionInterface.wireless, @@ -875,7 +875,7 @@ void main() { ProcessManager: () => FakeProcessManager.any(), }); - testUsingContext('with both iOS usb and network devices', () async { + testUsingContext('with both iOS usb and wireless devices', () async { final List devices = [ FakeIOSDevice( connectionInterface: DeviceConnectionInterface.wireless, diff --git a/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart b/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart index e78acdf188..c3e7116c5f 100644 --- a/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart +++ b/packages/flutter_tools/test/general.shard/ios/ios_device_start_prebuilt_test.dart @@ -68,7 +68,7 @@ const FakeCommand kLaunchDebugCommand = FakeCommand(command: [ FakeCommand attachDebuggerCommand({ IOSink? stdin, Completer? completer, - bool isNetworkDevice = false, + bool isWirelessDevice = false, }) { return FakeCommand( command: [ @@ -82,9 +82,9 @@ FakeCommand attachDebuggerCommand({ '--bundle', '/', '--debug', - if (!isNetworkDevice) '--no-wifi', + if (!isWirelessDevice) '--no-wifi', '--args', - if (isNetworkDevice) + if (isWirelessDevice) '--enable-dart-profiling --enable-checked-mode --verify-entry-points --vm-service-host=0.0.0.0' else '--enable-dart-profiling --enable-checked-mode --verify-entry-points', @@ -244,7 +244,7 @@ void main() { final CompleterIOSink stdin = CompleterIOSink(); final Completer completer = Completer(); final FakeProcessManager processManager = FakeProcessManager.list([ - attachDebuggerCommand(stdin: stdin, completer: completer, isNetworkDevice: true), + attachDebuggerCommand(stdin: stdin, completer: completer, isWirelessDevice: true), ]); final IOSDevice device = setUpIOSDevice( processManager: processManager, @@ -620,7 +620,7 @@ class FakeMDnsVmServiceDiscovery extends Fake implements MDnsVmServiceDiscovery bool usesIpv6 = false, int? hostVmservicePort, required int deviceVmservicePort, - bool isNetworkDevice = false, + bool useDeviceIPAsHost = false, Duration timeout = Duration.zero, }) async { return Uri.tryParse('http://0.0.0.0:1234'); diff --git a/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart b/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart index 6d9a10f82b..b0f6085387 100644 --- a/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart +++ b/packages/flutter_tools/test/general.shard/mdns_discovery_test.dart @@ -335,7 +335,7 @@ void main() { expect(uri.toString(), 'http://127.0.0.1:123/'); }); - testWithoutContext('Get network device IP (iPv4)', () async { + testWithoutContext('Get wireless device IP (iPv4)', () async { final MDnsClient client = FakeMDnsClient( [ PtrResourceRecord('foo', future, domainName: 'bar'), @@ -367,12 +367,12 @@ void main() { final Uri? uri = await portDiscovery.getVMServiceUriForAttach( 'bar', device, - isNetworkDevice: true, + useDeviceIPAsHost: true, ); expect(uri.toString(), 'http://111.111.111.111:1234/xyz/'); }); - testWithoutContext('Get network device IP (iPv6)', () async { + testWithoutContext('Get wireless device IP (iPv6)', () async { final MDnsClient client = FakeMDnsClient( [ PtrResourceRecord('foo', future, domainName: 'bar'), @@ -404,7 +404,7 @@ void main() { final Uri? uri = await portDiscovery.getVMServiceUriForAttach( 'bar', device, - isNetworkDevice: true, + useDeviceIPAsHost: true, ); expect(uri.toString(), 'http://[1111:1111:1111:1111:1111:1111:1111:1111]:1234/xyz/'); }); @@ -557,7 +557,7 @@ void main() { expect(uri.toString(), 'http://127.0.0.1:123/'); }); - testWithoutContext('Get network device IP (iPv4)', () async { + testWithoutContext('Get wireless device IP (iPv4)', () async { final MDnsClient client = FakeMDnsClient( [ PtrResourceRecord('foo', future, domainName: 'bar'), @@ -588,13 +588,13 @@ void main() { final Uri? uri = await portDiscovery.getVMServiceUriForLaunch( 'bar', device, - isNetworkDevice: true, + useDeviceIPAsHost: true, deviceVmservicePort: 1234, ); expect(uri.toString(), 'http://111.111.111.111:1234/xyz/'); }); - testWithoutContext('Get network device IP (iPv6)', () async { + testWithoutContext('Get wireless device IP (iPv6)', () async { final MDnsClient client = FakeMDnsClient( [ PtrResourceRecord('foo', future, domainName: 'bar'), @@ -625,7 +625,7 @@ void main() { final Uri? uri = await portDiscovery.getVMServiceUriForLaunch( 'bar', device, - isNetworkDevice: true, + useDeviceIPAsHost: true, deviceVmservicePort: 1234, ); expect(uri.toString(), 'http://[1111:1111:1111:1111:1111:1111:1111:1111]:1234/xyz/'); @@ -755,7 +755,7 @@ void main() { final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService( client, applicationId: 'srv-foo', - isNetworkDevice: true, + useDeviceIPAsHost: true, ); expect(result?.domainName, 'srv-foo'); expect(result?.port, 111); @@ -792,7 +792,7 @@ void main() { final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService( client, applicationId: 'srv-foo', - isNetworkDevice: true, + useDeviceIPAsHost: true, ); expect(result?.domainName, 'srv-foo'); expect(result?.port, 111); @@ -829,7 +829,7 @@ void main() { final MDnsVmServiceDiscoveryResult? result = await portDiscovery.firstMatchingVmService( client, applicationId: 'srv-foo', - isNetworkDevice: true, + useDeviceIPAsHost: true, ); expect(result?.domainName, 'srv-foo'); expect(result?.port, 111);