From 3fa355c97d52f904cf1f522455a1d9845bd15e7a Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 25 May 2022 12:48:17 -0700 Subject: [PATCH] Remove dead code in tools tests (#104567) --- .../commands.shard/hermetic/attach_test.dart | 123 ------------------ .../hermetic/custom_devices_test.dart | 7 - .../commands.shard/hermetic/doctor_test.dart | 6 - .../commands.shard/hermetic/run_test.dart | 8 -- .../general.shard/android/gradle_test.dart | 10 -- .../general.shard/base/file_system_test.dart | 1 - .../build_system/targets/android_test.dart | 2 - .../targets/icon_tree_shaker_test.dart | 2 - .../build_system/targets/windows_test.dart | 6 - .../test/general.shard/cache_test.dart | 13 -- .../test/general.shard/daemon_test.dart | 29 ----- .../drive/drive_service_test.dart | 30 ----- .../general.shard/flutter_platform_test.dart | 14 -- .../fuchsia/fuchsia_device_start_test.dart | 12 -- .../fuchsia/fuchsia_device_test.dart | 20 --- .../generate_localizations_test.dart | 5 - .../test/general.shard/hot_test.dart | 34 ----- .../integration_test_device_test.dart | 12 -- .../general.shard/macos/cocoapods_test.dart | 3 - .../macos/macos_project_migration_test.dart | 17 --- .../resident_devtools_handler_test.dart | 15 --- .../general.shard/terminal_handler_test.dart | 15 --- .../test/general.shard/vmservice_test.dart | 33 ----- .../general.shard/windows/plugins_test.dart | 14 -- .../debug_adapter/test_support.dart | 1 - .../test/integration.shard/test_utils.dart | 9 -- packages/flutter_tools/test/src/context.dart | 3 - .../test/src/custom_devices_common.dart | 8 -- packages/flutter_tools/test/src/fakes.dart | 58 --------- 29 files changed, 510 deletions(-) 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 d4f96a5bfbc..0674a277287 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -5,7 +5,6 @@ // @dart = 2.8 import 'dart:async'; -import 'dart:io'; import 'package:file/memory.dart'; import 'package:flutter_tools/src/android/android_device.dart'; @@ -36,28 +35,8 @@ import 'package:vm_service/vm_service.dart' as vm_service; import '../../src/common.dart'; import '../../src/context.dart'; import '../../src/fake_devices.dart'; -import '../../src/fake_vm_services.dart'; import '../../src/test_flutter_command_runner.dart'; -final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate( - id: '1', - pauseEvent: vm_service.Event( - kind: vm_service.EventKind.kResume, - timestamp: 0 - ), - breakpoints: [], - exceptionPauseMode: null, - isolateFlags: [], - libraries: [], - livePorts: 0, - name: 'test', - number: '1', - pauseOnExit: false, - runnable: true, - startTime: 0, - isSystemIsolate: false, -); - void main() { tearDown(() { MacOSDesignedForIPadDevices.allowDiscovery = false; @@ -688,108 +667,6 @@ Future expectLoggerInterruptEndsTask(Future task, StreamLogger logge ); } -VMServiceConnector getFakeVmServiceFactory({ - @required Completer vmServiceDoneCompleter, -}) { - assert(vmServiceDoneCompleter != null); - - return ( - Uri httpUri, { - ReloadSources reloadSources, - Restart restart, - CompileExpression compileExpression, - GetSkSLMethod getSkSLMethod, - PrintStructuredErrorLogMethod printStructuredErrorLogMethod, - CompressionOptions compression, - Device device, - Logger logger, - }) async { - final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost( - requests: [ - FakeVmServiceRequest( - method: kListViewsMethod, - args: null, - jsonResponse: { - 'views': [ - { - 'id': '1', - 'isolate': fakeUnpausedIsolate.toJson(), - }, - ], - }, - ), - FakeVmServiceRequest( - method: 'getVM', - args: null, - jsonResponse: vm_service.VM.parse({}) - .toJson(), - ), - FakeVmServiceRequest( - method: '_createDevFS', - args: { - 'fsName': globals.fs.currentDirectory.absolute.path, - }, - jsonResponse: { - 'uri': globals.fs.currentDirectory.absolute.path, - }, - ), - FakeVmServiceRequest( - method: kListViewsMethod, - args: null, - jsonResponse: { - 'views': [ - { - 'id': '1', - 'isolate': fakeUnpausedIsolate.toJson(), - }, - ], - }, - ), - ], - ); - return fakeVmServiceHost.vmService; - }; -} - -class TestHotRunnerFactory extends HotRunnerFactory { - HotRunner _runner; - - @override - HotRunner build( - List devices, { - String target, - DebuggingOptions debuggingOptions, - bool benchmarkMode = false, - File applicationBinary, - bool hostIsIde = false, - String projectRootPath, - String packagesFilePath, - String dillOutputPath, - bool stayResident = true, - bool ipv6 = false, - FlutterProject flutterProject, - }) { - _runner ??= HotRunner( - devices, - target: target, - debuggingOptions: debuggingOptions, - benchmarkMode: benchmarkMode, - applicationBinary: applicationBinary, - hostIsIde: hostIsIde, - projectRootPath: projectRootPath, - dillOutputPath: dillOutputPath, - stayResident: stayResident, - ipv6: ipv6, - ); - return _runner; - } - - Future exitApp() async { - assert(_runner != null); - await _runner.exit(); - } -} - class FakeDartDevelopmentService extends Fake implements DartDevelopmentService { @override Future get done => noopCompleter.future; diff --git a/packages/flutter_tools/test/commands.shard/hermetic/custom_devices_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/custom_devices_test.dart index 28da7611602..29d93c9832e 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/custom_devices_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/custom_devices_test.dart @@ -163,13 +163,6 @@ const String defaultConfigLinux2 = r''' } '''; -final Platform linuxPlatform = FakePlatform( - environment: { - 'FLUTTER_ROOT': linuxFlutterRoot, - 'HOME': '/', - } -); - final Platform windowsPlatform = FakePlatform( operatingSystem: 'windows', environment: { diff --git a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart index eef216acc74..4bc1f0b269d 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart @@ -19,7 +19,6 @@ import 'package:flutter_tools/src/android/android_studio_validator.dart'; import 'package:flutter_tools/src/android/android_workflow.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/base/terminal.dart'; import 'package:flutter_tools/src/base/user_messages.dart'; import 'package:flutter_tools/src/build_info.dart'; @@ -42,11 +41,6 @@ import '../../src/context.dart'; import '../../src/fakes.dart'; import '../../src/test_flutter_command_runner.dart'; -final Platform macPlatform = FakePlatform( - operatingSystem: 'macos', - environment: {'HOME': '/foo/bar'} -); - void main() { FakeFlutterVersion flutterVersion; BufferLogger logger; 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 1a65c4928cf..e5d6fe22d50 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/run_test.dart @@ -801,14 +801,6 @@ class FakeAndroidSdk extends Fake implements AndroidSdk { String get adbPath => 'adb'; } -class TestRunCommand extends RunCommand { - @override - // ignore: must_call_super - Future validateCommand() async { - devices = await globals.deviceManager.getDevices(); - } -} - // Unfortunately Device, despite not being immutable, has an `operator ==`. // Until we fix that, we have to also ignore related lints here. // ignore: avoid_implementing_value_types diff --git a/packages/flutter_tools/test/general.shard/android/gradle_test.dart b/packages/flutter_tools/test/general.shard/android/gradle_test.dart index 75b1e6cb083..3114249cd0d 100644 --- a/packages/flutter_tools/test/general.shard/android/gradle_test.dart +++ b/packages/flutter_tools/test/general.shard/android/gradle_test.dart @@ -17,7 +17,6 @@ import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/project.dart'; -import 'package:test/fake.dart'; import '../../src/common.dart'; import '../../src/context.dart'; @@ -704,12 +703,3 @@ flutter: // TODO(zanderso): This is an integration test and should be moved to the integration shard. }, skip: true); // https://github.com/flutter/flutter/issues/87922 } - -class FakeGradleUtils extends GradleUtils { - @override - String getExecutable(FlutterProject project) { - return 'gradlew'; - } -} - -class FakeAndroidSdk extends Fake implements AndroidSdk { } diff --git a/packages/flutter_tools/test/general.shard/base/file_system_test.dart b/packages/flutter_tools/test/general.shard/base/file_system_test.dart index 0e1235a6ebd..4848e881da9 100644 --- a/packages/flutter_tools/test/general.shard/base/file_system_test.dart +++ b/packages/flutter_tools/test/general.shard/base/file_system_test.dart @@ -183,4 +183,3 @@ class FakeProcessSignal extends Fake implements io.ProcessSignal { @override Stream watch() => controller.stream; } -class FakeFile extends Fake implements File { } diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart index d5b87328065..cebedb3f650 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/android_test.dart @@ -10,7 +10,6 @@ import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/deferred_component.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/depfile.dart'; @@ -21,7 +20,6 @@ import '../../../src/common.dart'; import '../../../src/context.dart'; import '../../../src/fake_process_manager.dart'; -final Platform platform = FakePlatform(); void main() { FakeProcessManager processManager; FileSystem fileSystem; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart index 4eab81ff440..ce0d1a8a6e7 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/icon_tree_shaker_test.dart @@ -6,7 +6,6 @@ import 'package:file/memory.dart'; import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/targets/icon_tree_shaker.dart'; @@ -16,7 +15,6 @@ import '../../../src/common.dart'; import '../../../src/fake_process_manager.dart'; import '../../../src/fakes.dart'; -final Platform kNoAnsiPlatform = FakePlatform(); const List _kTtfHeaderBytes = [0, 1, 0, 0, 0, 15, 0, 128, 0, 3, 0, 112]; const String inputPath = '/input/fonts/MaterialIcons-Regular.otf'; diff --git a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart index e3f09feb551..c9c28559caa 100644 --- a/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart +++ b/packages/flutter_tools/test/general.shard/build_system/targets/windows_test.dart @@ -9,7 +9,6 @@ import 'package:file_testing/file_testing.dart'; import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/depfile.dart'; @@ -20,11 +19,6 @@ import 'package:flutter_tools/src/convert.dart'; import '../../../src/common.dart'; import '../../../src/context.dart'; -final Platform kWindowsPlatform = FakePlatform( - operatingSystem: 'windows', - environment: {}, -); - void main() { testWithoutContext('UnpackWindows copies files to the correct windows/ cache directory', () async { final Artifacts artifacts = Artifacts.test(); diff --git a/packages/flutter_tools/test/general.shard/cache_test.dart b/packages/flutter_tools/test/general.shard/cache_test.dart index 9de6f614c20..473552687b7 100644 --- a/packages/flutter_tools/test/general.shard/cache_test.dart +++ b/packages/flutter_tools/test/general.shard/cache_test.dart @@ -1062,19 +1062,6 @@ class FakeSimpleArtifact extends CachedArtifact { Future updateInner(ArtifactUpdater artifactUpdater, FileSystem fileSystem, OperatingSystemUtils operatingSystemUtils) async { } } -class FakeDownloadedArtifact extends CachedArtifact { - FakeDownloadedArtifact(this.downloadedFile, Cache cache) : super( - 'fake', - cache, - DevelopmentArtifact.universal, - ); - - final File downloadedFile; - - @override - Future updateInner(ArtifactUpdater artifactUpdater, FileSystem fileSystem, OperatingSystemUtils operatingSystemUtils) async { } -} - class FakeSecondaryCachedArtifact extends Fake implements CachedArtifact { bool upToDate = false; bool didUpdate = false; diff --git a/packages/flutter_tools/test/general.shard/daemon_test.dart b/packages/flutter_tools/test/general.shard/daemon_test.dart index f3985be42e6..b70633525bf 100644 --- a/packages/flutter_tools/test/general.shard/daemon_test.dart +++ b/packages/flutter_tools/test/general.shard/daemon_test.dart @@ -3,13 +3,10 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:typed_data'; -import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/daemon.dart'; -import 'package:test/fake.dart'; import '../src/common.dart'; @@ -388,29 +385,3 @@ Future> _readAllBinaries(Stream inp } return outputs; } - -class FakeSocket extends Fake implements Socket { - bool closeCalled = false; - final StreamController controller = StreamController(); - final List writtenObjects = []; - - @override - StreamSubscription listen( - void Function(Uint8List event)? onData, { - Function? onError, - void Function()? onDone, - bool? cancelOnError, - }) { - return controller.stream.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError); - } - - @override - void write(Object? object) { - writtenObjects.add(object); - } - - @override - Future close() async { - closeCalled = true; - } -} diff --git a/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart b/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart index a10344e5c46..c9e2cabbd86 100644 --- a/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart +++ b/packages/flutter_tools/test/general.shard/drive/drive_service_test.dart @@ -55,36 +55,6 @@ final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate( isolateFlags: [], ); -final vm_service.Isolate fakePausedIsolate = vm_service.Isolate( - id: '1', - pauseEvent: vm_service.Event( - kind: vm_service.EventKind.kPauseException, - timestamp: 0 - ), - breakpoints: [ - vm_service.Breakpoint( - breakpointNumber: 123, - id: 'test-breakpoint', - location: vm_service.SourceLocation( - tokenPos: 0, - script: vm_service.ScriptRef(id: 'test-script', uri: 'foo.dart'), - ), - enabled: true, - resolved: true, - ), - ], - exceptionPauseMode: null, - libraries: [], - livePorts: 0, - name: 'test', - number: '1', - pauseOnExit: false, - runnable: true, - startTime: 0, - isSystemIsolate: false, - isolateFlags: [], -); - final vm_service.VM fakeVM = vm_service.VM( isolates: [fakeUnpausedIsolate], pid: 1, diff --git a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart index cfd2d1c3b09..b0a5674d48b 100644 --- a/packages/flutter_tools/test/general.shard/flutter_platform_test.dart +++ b/packages/flutter_tools/test/general.shard/flutter_platform_test.dart @@ -121,17 +121,3 @@ void main() { } class FakeSuitePlatform extends Fake implements SuitePlatform { } - -// A FlutterPlatform with enough fields set to load and start a test. -class TestFlutterPlatform extends FlutterPlatform { - TestFlutterPlatform() : super( - shellPath: '/', - debuggingOptions: DebuggingOptions.enabled( - const BuildInfo( - BuildMode.debug, - '', - treeShakeIcons: false, - ), - ), - ); -} diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart index f87718c4b5f..228aba1e0cf 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_start_test.dart @@ -9,7 +9,6 @@ import 'dart:convert'; import 'package:file/memory.dart'; import 'package:flutter_tools/src/artifacts.dart'; -import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/os.dart'; @@ -734,17 +733,6 @@ class FakeFuchsiaKernelCompiler implements FuchsiaKernelCompiler { } } -class FailingKernelCompiler implements FuchsiaKernelCompiler { - @override - Future build({ - @required FuchsiaProject fuchsiaProject, - @required String target, // E.g., lib/main.dart - BuildInfo buildInfo = BuildInfo.debug, - }) async { - throwToolExit('Build process failed'); - } -} - class FakeFuchsiaFfx implements FuchsiaFfx { @override Future> list({Duration timeout}) async { diff --git a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart index 8a4361d171c..d761b9e561b 100644 --- a/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart +++ b/packages/flutter_tools/test/general.shard/fuchsia/fuchsia_device_test.dart @@ -876,26 +876,6 @@ class FakePortForwarder extends Fake implements DevicePortForwarder { } } -class FuchsiaDeviceWithFakeDiscovery extends FuchsiaDevice { - FuchsiaDeviceWithFakeDiscovery(String id, {String name}) : super(id, name: name); - - @override - FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(String isolateName) { - return FakeFuchsiaIsolateDiscoveryProtocol(); - } - - @override - Future get targetPlatform async => TargetPlatform.fuchsia_arm64; -} - -class FakeFuchsiaIsolateDiscoveryProtocol implements FuchsiaIsolateDiscoveryProtocol { - @override - FutureOr get uri => Uri.parse('http://[::1]:37'); - - @override - void dispose() {} -} - class FakeFuchsiaFfx implements FuchsiaFfx { @override Future> list({Duration timeout}) async { diff --git a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart index 69fb901d9b1..692a198751e 100644 --- a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart +++ b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart @@ -39,11 +39,6 @@ const String singleEsMessageArbFileString = ''' { "title": "Título" }'''; -const String twoEsMessageArbFileString = ''' -{ - "title": "Título", - "subtitle": "Subtitular" -}'''; const String singleZhMessageArbFileString = ''' { "title": "标题" diff --git a/packages/flutter_tools/test/general.shard/hot_test.dart b/packages/flutter_tools/test/general.shard/hot_test.dart index be33212b343..f51cabfbba1 100644 --- a/packages/flutter_tools/test/general.shard/hot_test.dart +++ b/packages/flutter_tools/test/general.shard/hot_test.dart @@ -27,42 +27,8 @@ import 'package:vm_service/vm_service.dart' as vm_service; import '../src/common.dart'; import '../src/context.dart'; -import '../src/fake_vm_services.dart'; import '../src/fakes.dart'; -final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate( - id: '1', - pauseEvent: vm_service.Event( - kind: vm_service.EventKind.kResume, - timestamp: 0 - ), - breakpoints: [], - exceptionPauseMode: null, - libraries: [], - livePorts: 0, - name: 'test', - number: '1', - pauseOnExit: false, - runnable: true, - startTime: 0, - isSystemIsolate: false, - isolateFlags: [], -); - -final FlutterView fakeFlutterView = FlutterView( - id: 'a', - uiIsolate: fakeUnpausedIsolate, -); - -final FakeVmServiceRequest listViews = FakeVmServiceRequest( - method: kListViewsMethod, - jsonResponse: { - 'views': [ - fakeFlutterView.toJson(), - ], - }, -); - void main() { group('validateReloadReport', () { testUsingContext('invalid', () async { diff --git a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart index 9fb63e625d4..f886c5ca328 100644 --- a/packages/flutter_tools/test/general.shard/integration_test_device_test.dart +++ b/packages/flutter_tools/test/general.shard/integration_test_device_test.dart @@ -21,18 +21,6 @@ import '../src/context.dart'; import '../src/fake_devices.dart'; import '../src/fake_vm_services.dart'; -final Map vm = { - 'isolates': [ - { - 'type': '@Isolate', - 'fixedId': true, - 'id': 'isolates/242098474', - 'name': 'main.dart:main()', - 'number': 242098474, - }, - ], -}; - final vm_service.Isolate isolate = vm_service.Isolate( id: '1', pauseEvent: vm_service.Event( diff --git a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart index e0016b8366d..1f2b90cacb1 100644 --- a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart @@ -6,7 +6,6 @@ import 'package:file/file.dart'; import 'package:file/memory.dart'; -import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/platform.dart'; import 'package:flutter_tools/src/build_info.dart'; @@ -22,8 +21,6 @@ import '../../src/common.dart'; import '../../src/context.dart'; import '../../src/fake_process_manager.dart'; -typedef InvokeProcess = Future Function(); - void main() { FileSystem fileSystem; FakeProcessManager fakeProcessManager; diff --git a/packages/flutter_tools/test/general.shard/macos/macos_project_migration_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_project_migration_test.dart index 175c864756b..380508f389a 100644 --- a/packages/flutter_tools/test/general.shard/macos/macos_project_migration_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/macos_project_migration_test.dart @@ -5,7 +5,6 @@ import 'package:file/file.dart'; import 'package:file/memory.dart'; import 'package:flutter_tools/src/base/logger.dart'; -import 'package:flutter_tools/src/base/project_migrator.dart'; import 'package:flutter_tools/src/macos/migrations/remove_macos_framework_link_and_embedding_migration.dart'; import 'package:flutter_tools/src/reporting/reporting.dart'; import 'package:flutter_tools/src/xcode_project.dart'; @@ -159,19 +158,3 @@ class FakeMacOSProject extends Fake implements MacOSProject { @override File xcodeProjectInfoFile = MemoryFileSystem.test().file('xcodeProjectInfoFile'); } - -class FakeMacOSMigrator extends ProjectMigrator { - FakeMacOSMigrator({required this.succeeds}) : super(BufferLogger.test()); - - final bool succeeds; - - @override - bool migrate() { - return succeeds; - } - - @override - String migrateLine(String line) { - return line; - } -} diff --git a/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart b/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart index 95c90749117..ddadcab37dc 100644 --- a/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart @@ -48,21 +48,6 @@ final vm_service.Isolate isolate = vm_service.Isolate( extensionRPCs: ['ext.flutter.connectedVmServiceUri'], ); -final vm_service.VM fakeVM = vm_service.VM( - isolates: [isolate], - pid: 1, - hostCPU: '', - isolateGroups: [], - targetCPU: '', - startTime: 0, - name: 'dart', - architectureBits: 64, - operatingSystem: '', - version: '', - systemIsolateGroups: [], - systemIsolates: [], -); - final FakeVmServiceRequest listViews = FakeVmServiceRequest( method: kListViewsMethod, jsonResponse: { diff --git a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart index b821ec8ab43..fbf366d1708 100644 --- a/packages/flutter_tools/test/general.shard/terminal_handler_test.dart +++ b/packages/flutter_tools/test/general.shard/terminal_handler_test.dart @@ -52,21 +52,6 @@ final vm_service.Isolate fakeUnpausedIsolate = vm_service.Isolate( isolateFlags: [], ); -final vm_service.VM fakeVM = vm_service.VM( - isolates: [fakeUnpausedIsolate], - pid: 1, - hostCPU: '', - isolateGroups: [], - targetCPU: '', - startTime: 0, - name: 'dart', - architectureBits: 64, - operatingSystem: '', - version: '', - systemIsolateGroups: [], - systemIsolates: [], -); - final FlutterView fakeFlutterView = FlutterView( id: 'a', uiIsolate: fakeUnpausedIsolate, diff --git a/packages/flutter_tools/test/general.shard/vmservice_test.dart b/packages/flutter_tools/test/general.shard/vmservice_test.dart index 8aa408b71c1..a73d2b4e543 100644 --- a/packages/flutter_tools/test/general.shard/vmservice_test.dart +++ b/packages/flutter_tools/test/general.shard/vmservice_test.dart @@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart' as io; import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/device.dart'; -import 'package:flutter_tools/src/version.dart'; import 'package:flutter_tools/src/vmservice.dart'; import 'package:test/fake.dart'; import 'package:vm_service/vm_service.dart' as vm_service; @@ -20,31 +19,6 @@ import '../src/common.dart'; import '../src/context.dart' hide testLogger; import '../src/fake_vm_services.dart'; -final Map vm = { - 'type': 'VM', - 'name': 'vm', - 'architectureBits': 64, - 'targetCPU': 'x64', - 'hostCPU': ' Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz', - 'version': '2.1.0-dev.7.1.flutter-45f9462398 (Fri Oct 19 19:27:56 2018 +0000) on "linux_x64"', - '_profilerMode': 'Dart', - '_nativeZoneMemoryUsage': 0, - 'pid': 103707, - 'startTime': 1540426121876, - '_embedder': 'Flutter', - '_maxRSS': 312614912, - '_currentRSS': 33091584, - 'isolates': [ - { - 'type': '@Isolate', - 'fixedId': true, - 'id': 'isolates/242098474', - 'name': 'main.dart:main()', - 'number': 242098474, - }, - ], -}; - const String kExtensionName = 'ext.flutter.test.interestingExtension'; final vm_service.Isolate isolate = vm_service.Isolate( @@ -87,8 +61,6 @@ final FakeVmServiceRequest listViewsRequest = FakeVmServiceRequest( }, ); -typedef ServiceCallback = Future> Function(Map); - void main() { testWithoutContext('VmService registers reloadSources', () async { Future reloadSources(String isolateId, { bool pause, bool force}) async {} @@ -880,11 +852,6 @@ class MockVMService extends Fake implements vm_service.VmService { // ignore: avoid_implementing_value_types class FakeDevice extends Fake implements Device { } -class FakeFlutterVersion extends Fake implements FlutterVersion { - @override - Map toJson() => const {'Fake': 'Version'}; -} - /// A [WebSocketConnector] that always throws an [io.SocketException]. Future failingWebSocketConnector( String url, { diff --git a/packages/flutter_tools/test/general.shard/windows/plugins_test.dart b/packages/flutter_tools/test/general.shard/windows/plugins_test.dart index 78497d60b22..3dc27806d49 100644 --- a/packages/flutter_tools/test/general.shard/windows/plugins_test.dart +++ b/packages/flutter_tools/test/general.shard/windows/plugins_test.dart @@ -16,20 +16,6 @@ import '../../src/common.dart'; const TemplateRenderer renderer = MustacheTemplateRenderer(); -const String kPluginDependencies = r''' -{ - "info":"This is a generated file; do not edit or check into version control.", - "plugins":{ - "windows":[ - { - "name":"example","path":"C:\\\\example\\\\", - "dependencies":[] - } - ] - } -} -'''; - void main() { testWithoutContext('Win32 injects Win32 plugins', () async { diff --git a/packages/flutter_tools/test/integration.shard/debug_adapter/test_support.dart b/packages/flutter_tools/test/integration.shard/debug_adapter/test_support.dart index 9cafabfdd9d..35147c6dfc9 100644 --- a/packages/flutter_tools/test/integration.shard/debug_adapter/test_support.dart +++ b/packages/flutter_tools/test/integration.shard/debug_adapter/test_support.dart @@ -31,7 +31,6 @@ final bool useInProcessDap = Platform.environment['DAP_TEST_INTERNAL'] == 'true' /// Service traffic (wrapped in a custom 'dart.log' event). final bool verboseLogging = Platform.environment['DAP_TEST_VERBOSE'] == 'true'; -const String startOfErrorOutputMarker = '══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════'; const String endOfErrorOutputMarker = '════════════════════════════════════════════════════════════════════════════════════════════════════'; /// Expects the lines in [actual] to match the relevant matcher in [expected], diff --git a/packages/flutter_tools/test/integration.shard/test_utils.dart b/packages/flutter_tools/test/integration.shard/test_utils.dart index 94bb3f4f2a1..e3c1d5a52f1 100644 --- a/packages/flutter_tools/test/integration.shard/test_utils.dart +++ b/packages/flutter_tools/test/integration.shard/test_utils.dart @@ -54,15 +54,6 @@ test:${fileSystem.path.join(fileSystem.currentDirectory.path, 'lib')}/ '''); } -void writePubspec(String folder) { - writeFile(fileSystem.path.join(folder, 'pubspec.yaml'), ''' -name: test -dependencies: - flutter: - sdk: flutter -'''); -} - Future getPackages(String folder) async { final List command = [ fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'), diff --git a/packages/flutter_tools/test/src/context.dart b/packages/flutter_tools/test/src/context.dart index e451e11aa8c..0cf2b575414 100644 --- a/packages/flutter_tools/test/src/context.dart +++ b/packages/flutter_tools/test/src/context.dart @@ -51,9 +51,6 @@ export 'fake_process_manager.dart' show ProcessManager, FakeProcessManager, Fake BufferLogger get testLogger => context.get() as BufferLogger; FakeDeviceManager get testDeviceManager => context.get() as FakeDeviceManager; -FakeDoctor get testDoctor => context.get() as FakeDoctor; - -typedef ContextInitializer = void Function(AppContext testContext); @isTest void testUsingContext( diff --git a/packages/flutter_tools/test/src/custom_devices_common.dart b/packages/flutter_tools/test/src/custom_devices_common.dart index 4dcb19e5fb3..cc182915c63 100644 --- a/packages/flutter_tools/test/src/custom_devices_common.dart +++ b/packages/flutter_tools/test/src/custom_devices_common.dart @@ -38,14 +38,6 @@ final CustomDeviceConfig testConfig = CustomDeviceConfig( forwardPortSuccessRegex: RegExp('testforwardportsuccess') ); -const String testConfigPingSuccessOutput = 'testpingsuccess\n'; -const String testConfigForwardPortSuccessOutput = 'testforwardportsuccess\n'; -final CustomDeviceConfig disabledTestConfig = testConfig.copyWith(enabled: false); -final CustomDeviceConfig testConfigNonForwarding = testConfig.copyWith( - explicitForwardPortCommand: true, - explicitForwardPortSuccessRegex: true, -); - const Map testConfigJson = { 'id': 'testid', 'label': 'testlabel', diff --git a/packages/flutter_tools/test/src/fakes.dart b/packages/flutter_tools/test/src/fakes.dart index 0d520fc7923..9939f2f6a97 100644 --- a/packages/flutter_tools/test/src/fakes.dart +++ b/packages/flutter_tools/test/src/fakes.dart @@ -68,51 +68,6 @@ class FakeProcess implements Process { } } -/// A process that prompts the user to proceed, then asynchronously writes -/// some lines to stdout before it exits. -class PromptingProcess implements Process { - PromptingProcess({ - bool stdinError = false, - }) : _stdin = CompleterIOSink(throwOnAdd: stdinError); - - Future showPrompt(String prompt, List outputLines) async { - try { - _stdoutController.add(utf8.encode(prompt)); - final List bytesOnStdin = await _stdin.future; - // Echo stdin to stdout. - _stdoutController.add(bytesOnStdin); - if (bytesOnStdin.isNotEmpty && bytesOnStdin[0] == utf8.encode('y')[0]) { - for (final String line in outputLines) { - _stdoutController.add(utf8.encode('$line\n')); - } - } - } finally { - await _stdoutController.close(); - } - } - - final StreamController> _stdoutController = StreamController>(); - final CompleterIOSink _stdin; - - @override - Stream> get stdout => _stdoutController.stream; - - @override - Stream> get stderr => const Stream>.empty(); - - @override - IOSink get stdin => _stdin; - - @override - Future get exitCode async { - await _stdoutController.done; - return 0; - } - - @override - dynamic noSuchMethod(Invocation invocation) => null; -} - /// An IOSink that completes a future with the first line written to it. class CompleterIOSink extends MemoryIOSink { CompleterIOSink({ @@ -480,19 +435,6 @@ class TestFeatureFlags implements FeatureFlags { } } -class FakeStatusLogger extends DelegatingLogger { - FakeStatusLogger(super.delegate); - - late Status status; - - @override - Status startProgress(String message, { - String? progressId, - bool multilineOutput = false, - int progressIndicatorPadding = kDefaultStatusPadding, - }) => status; -} - class FakeOperatingSystemUtils extends Fake implements OperatingSystemUtils { FakeOperatingSystemUtils({this.hostPlatform = HostPlatform.linux_x64});