From 2b14e993a7bcc0b4b1fc5c7ca6dc5395b6d70b5d Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 25 May 2022 10:23:10 -0700 Subject: [PATCH] Cleanup random dead test code (#104568) --- packages/flutter_driver/test/common.dart | 8 +----- .../test/flutter_goldens_test.dart | 18 ------------- .../flutter_test/test/widget_tester_test.dart | 25 ------------------- .../test/common.dart | 10 -------- .../test/fuchsia_remote_connection_test.dart | 3 +-- .../test/src/common/network_test.dart | 2 +- .../test/src/dart/dart_vm_test.dart | 3 +-- .../src/runners/ssh_command_runner_test.dart | 2 +- 8 files changed, 5 insertions(+), 66 deletions(-) delete mode 100644 packages/fuchsia_remote_debug_protocol/test/common.dart diff --git a/packages/flutter_driver/test/common.dart b/packages/flutter_driver/test/common.dart index 85b6fb9714..6566fd8ff3 100644 --- a/packages/flutter_driver/test/common.dart +++ b/packages/flutter_driver/test/common.dart @@ -8,10 +8,7 @@ import 'package:flutter_driver/src/common/error.dart'; import 'package:test_api/test_api.dart'; // ignore: deprecated_member_use export 'package:test_api/fake.dart'; // ignore: deprecated_member_use -export 'package:test_api/test_api.dart' hide isInstanceOf; // ignore: deprecated_member_use - -/// A matcher that compares the type of the actual value to the type argument T. -TypeMatcher isInstanceOf() => isA(); +export 'package:test_api/test_api.dart'; // ignore: deprecated_member_use void tryToDelete(Directory directory) { // This should not be necessary, but it turns out that @@ -26,6 +23,3 @@ void tryToDelete(Directory directory) { /// Matcher for functions that throw [DriverError]. final Matcher throwsDriverError = throwsA(isA()); - -/// Matcher for functions that throw [AssertionError]. -final Matcher throwsAssertionError = throwsA(isA()); diff --git a/packages/flutter_goldens/test/flutter_goldens_test.dart b/packages/flutter_goldens/test/flutter_goldens_test.dart index e3ab17fdc7..941b34bf60 100644 --- a/packages/flutter_goldens/test/flutter_goldens_test.dart +++ b/packages/flutter_goldens/test/flutter_goldens_test.dart @@ -4,7 +4,6 @@ // See also dev/automated_tests/flutter_test/flutter_gold_test.dart -import 'dart:async'; import 'dart:convert'; import 'dart:io' hide Directory; import 'dart:typed_data'; @@ -1090,23 +1089,6 @@ class FakeHttpClientRequest extends Fake implements HttpClientRequest { } } -class FakeHttpClientResponse extends Fake implements HttpClientResponse { - FakeHttpClientResponse(this.response); - - final List response; - - @override - StreamSubscription> listen( - void Function(List event)? onData, { - Function? onError, - void Function()? onDone, - bool? cancelOnError, - }) { - return Stream>.fromFuture(Future>.value(response)) - .listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError); - } -} - class FakeHttpImageResponse extends Fake implements HttpClientResponse { FakeHttpImageResponse(this.response); diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart index c10992fbdc..efaec2bbf4 100644 --- a/packages/flutter_test/test/widget_tester_test.dart +++ b/packages/flutter_test/test/widget_tester_test.dart @@ -782,31 +782,6 @@ class FakeMatcher extends AsyncMatcher { Description describe(Description description) => description.add('--fake--'); } -class _SingleTickerTest extends StatefulWidget { - const _SingleTickerTest(); - - @override - _SingleTickerTestState createState() => _SingleTickerTestState(); -} - -class _SingleTickerTestState extends State<_SingleTickerTest> with SingleTickerProviderStateMixin { - late AnimationController controller; - - @override - void initState() { - super.initState(); - controller = AnimationController( - vsync: this, - duration: const Duration(seconds: 100), - ) ; - } - - @override - Widget build(BuildContext context) { - return Container(); - } -} - class _AlwaysAnimating extends StatefulWidget { const _AlwaysAnimating({ required this.onPaint, diff --git a/packages/fuchsia_remote_debug_protocol/test/common.dart b/packages/fuchsia_remote_debug_protocol/test/common.dart deleted file mode 100644 index e60806e72e..0000000000 --- a/packages/fuchsia_remote_debug_protocol/test/common.dart +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2014 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:test/test.dart'; - -export 'package:test/test.dart' hide isInstanceOf; - -/// A matcher that compares the type of the actual value to the type argument T. -TypeMatcher isInstanceOf() => isA(); diff --git a/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart b/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart index 957111c95f..f67013e93d 100644 --- a/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/fuchsia_remote_connection_test.dart @@ -4,10 +4,9 @@ import 'package:fuchsia_remote_debug_protocol/fuchsia_remote_debug_protocol.dart'; import 'package:test/fake.dart'; +import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart' as vms; -import 'common.dart'; - void main() { group('FuchsiaRemoteConnection.connect', () { late List forwardedPorts; diff --git a/packages/fuchsia_remote_debug_protocol/test/src/common/network_test.dart b/packages/fuchsia_remote_debug_protocol/test/src/common/network_test.dart index 46477c57c2..bb75c7206f 100644 --- a/packages/fuchsia_remote_debug_protocol/test/src/common/network_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/src/common/network_test.dart @@ -4,7 +4,7 @@ import 'package:fuchsia_remote_debug_protocol/src/common/network.dart'; -import '../../common.dart'; +import 'package:test/test.dart'; void main() { final List ipv4Addresses = ['127.0.0.1', '8.8.8.8']; diff --git a/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart b/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart index 24ea869dbe..0b49bd5c58 100644 --- a/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/src/dart/dart_vm_test.dart @@ -6,10 +6,9 @@ import 'dart:async'; import 'package:fuchsia_remote_debug_protocol/src/dart/dart_vm.dart'; import 'package:test/fake.dart'; +import 'package:test/test.dart'; import 'package:vm_service/vm_service.dart' as vms; -import '../../common.dart'; - void main() { group('DartVm.connect', () { tearDown(() { diff --git a/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart b/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart index c8de26ecee..01cf993037 100644 --- a/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart +++ b/packages/fuchsia_remote_debug_protocol/test/src/runners/ssh_command_runner_test.dart @@ -9,7 +9,7 @@ import 'package:fuchsia_remote_debug_protocol/src/runners/ssh_command_runner.dar import 'package:process/process.dart'; import 'package:test/fake.dart'; -import '../../common.dart'; +import 'package:test/test.dart'; void main() { group('SshCommandRunner.constructors', () {