Unverified Commit e1702a96 authored by pdblasi-google's avatar pdblasi-google Committed by GitHub

Removes deprecated APIs from v2.6 in `binding.dart` and `widget_tester.dart` (#129663)

Removes deprecated APIs from v2.6 in `binding.dart` and `widget_tester.dart`

Resolves #129654
parent 0b44577f
...@@ -124,7 +124,7 @@ class MatchesGoldenFile extends AsyncMatcher { ...@@ -124,7 +124,7 @@ class MatchesGoldenFile extends AsyncMatcher {
image.dispose(); image.dispose();
} }
} }
}, additionalTime: const Duration(minutes: 1)); });
} }
@override @override
......
...@@ -77,7 +77,7 @@ class MatchesGoldenFile extends AsyncMatcher { ...@@ -77,7 +77,7 @@ class MatchesGoldenFile extends AsyncMatcher {
} on TestFailure catch (ex) { } on TestFailure catch (ex) {
return ex.message; return ex.message;
} }
}, additionalTime: const Duration(seconds: 22)); });
_renderElement(view, _findRepaintBoundary(e)); _renderElement(view, _findRepaintBoundary(e));
return result; return result;
} }
......
...@@ -310,19 +310,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase ...@@ -310,19 +310,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
@protected @protected
bool get registerTestTextInput => true; bool get registerTestTextInput => true;
/// This method has no effect.
///
/// This method was previously used to change the timeout of the test. However,
/// in practice having short timeouts was found to be nothing but trouble,
/// primarily being a cause flakes rather than helping debug tests.
///
/// For this reason, this method has been deprecated.
@Deprecated(
'This method has no effect. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
void addTime(Duration duration) { }
/// Delay for `duration` of time. /// Delay for `duration` of time.
/// ///
/// In the automated test environment ([AutomatedTestWidgetsFlutterBinding], /// In the automated test environment ([AutomatedTestWidgetsFlutterBinding],
...@@ -465,17 +452,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase ...@@ -465,17 +452,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
/// are required to wait for the returned future to complete before calling /// are required to wait for the returned future to complete before calling
/// this method again. Attempts to do otherwise will result in a /// this method again. Attempts to do otherwise will result in a
/// [TestFailure] error being thrown. /// [TestFailure] error being thrown.
/// Future<T?> runAsync<T>(Future<T> Function() callback);
/// The `additionalTime` argument was previously used with
/// [AutomatedTestWidgetsFlutterBinding.addTime] but now has no effect.
Future<T?> runAsync<T>(
Future<T> Function() callback, {
@Deprecated(
'This parameter has no effect. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration additionalTime = const Duration(milliseconds: 1000),
});
/// Artificially calls dispatchLocalesChanged on the Widget binding, /// Artificially calls dispatchLocalesChanged on the Widget binding,
/// then flushes microtasks. /// then flushes microtasks.
...@@ -779,11 +756,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase ...@@ -779,11 +756,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
Future<void> Function() testBody, Future<void> Function() testBody,
VoidCallback invariantTester, { VoidCallback invariantTester, {
String description = '', String description = '',
@Deprecated(
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration? timeout,
}); });
/// This is called during test execution before and after the body has been /// This is called during test execution before and after the body has been
...@@ -1253,7 +1225,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ...@@ -1253,7 +1225,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
} }
_phase = newPhase; _phase = newPhase;
if (hasScheduledFrame) { if (hasScheduledFrame) {
addTime(const Duration(milliseconds: 500));
_currentFakeAsync!.flushMicrotasks(); _currentFakeAsync!.flushMicrotasks();
handleBeginFrame(Duration( handleBeginFrame(Duration(
milliseconds: _clock!.now().millisecondsSinceEpoch, milliseconds: _clock!.now().millisecondsSinceEpoch,
...@@ -1267,10 +1238,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ...@@ -1267,10 +1238,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
} }
@override @override
Future<T?> runAsync<T>( Future<T?> runAsync<T>(Future<T> Function() callback) {
Future<T> Function() callback, {
Duration additionalTime = const Duration(milliseconds: 1000),
}) {
assert(() { assert(() {
if (_pendingAsyncTasks == null) { if (_pendingAsyncTasks == null) {
return true; return true;
...@@ -1297,8 +1265,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ...@@ -1297,8 +1265,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
), ),
); );
addTime(additionalTime);
return realAsyncZone.run<Future<T?>>(() { return realAsyncZone.run<Future<T?>>(() {
final Completer<T?> result = Completer<T?>(); final Completer<T?> result = Completer<T?>();
_pendingAsyncTasks = Completer<void>(); _pendingAsyncTasks = Completer<void>();
...@@ -1452,11 +1418,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ...@@ -1452,11 +1418,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
Future<void> Function() testBody, Future<void> Function() testBody,
VoidCallback invariantTester, { VoidCallback invariantTester, {
String description = '', String description = '',
@Deprecated(
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration? timeout,
}) { }) {
assert(!inTest); assert(!inTest);
assert(_currentFakeAsync == null); assert(_currentFakeAsync == null);
...@@ -1961,10 +1922,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ...@@ -1961,10 +1922,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
} }
@override @override
Future<T?> runAsync<T>( Future<T?> runAsync<T>(Future<T> Function() callback) async {
Future<T> Function() callback, {
Duration additionalTime = const Duration(milliseconds: 1000),
}) async {
assert(() { assert(() {
if (!_runningAsyncTasks) { if (!_runningAsyncTasks) {
return true; return true;
...@@ -1998,11 +1956,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ...@@ -1998,11 +1956,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
Future<void> Function() testBody, Future<void> Function() testBody,
VoidCallback invariantTester, { VoidCallback invariantTester, {
String description = '', String description = '',
@Deprecated(
'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration? timeout,
}) { }) {
assert(!inTest); assert(!inTest);
_inTest = true; _inTest = true;
......
...@@ -2054,7 +2054,7 @@ class _MatchesReferenceImage extends AsyncMatcher { ...@@ -2054,7 +2054,7 @@ class _MatchesReferenceImage extends AsyncMatcher {
Uint8List.view(referenceBytes.buffer), Uint8List.view(referenceBytes.buffer),
); );
return countDifferentPixels == 0 ? null : 'does not match on $countDifferentPixels pixels'; return countDifferentPixels == 0 ? null : 'does not match on $countDifferentPixels pixels';
}, additionalTime: const Duration(minutes: 1)); });
} }
@override @override
......
...@@ -93,9 +93,7 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) { ...@@ -93,9 +93,7 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) {
/// `test` package. If set, it should be relatively large (minutes). It defaults /// `test` package. If set, it should be relatively large (minutes). It defaults
/// to ten minutes for tests run by `flutter test`, and is unlimited for tests /// to ten minutes for tests run by `flutter test`, and is unlimited for tests
/// run by `flutter run`; specifically, it defaults to /// run by `flutter run`; specifically, it defaults to
/// [TestWidgetsFlutterBinding.defaultTestTimeout]. (The `initialTimeout` /// [TestWidgetsFlutterBinding.defaultTestTimeout].
/// parameter has no effect. It was previously used with
/// [TestWidgetsFlutterBinding.addTime] but that feature was removed.)
/// ///
/// If the `semanticsEnabled` parameter is set to `true`, /// If the `semanticsEnabled` parameter is set to `true`,
/// [WidgetTester.ensureSemantics] will have been called before the tester is /// [WidgetTester.ensureSemantics] will have been called before the tester is
...@@ -115,11 +113,6 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) { ...@@ -115,11 +113,6 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) {
/// If the [tags] are passed, they declare user-defined tags that are implemented by /// If the [tags] are passed, they declare user-defined tags that are implemented by
/// the `test` package. /// the `test` package.
/// ///
/// See also:
///
/// * [AutomatedTestWidgetsFlutterBinding.addTime] to learn more about
/// timeout and how to manually increase timeouts.
///
/// ## Sample code /// ## Sample code
/// ///
/// ```dart /// ```dart
...@@ -135,11 +128,6 @@ void testWidgets( ...@@ -135,11 +128,6 @@ void testWidgets(
WidgetTesterCallback callback, { WidgetTesterCallback callback, {
bool? skip, bool? skip,
test_package.Timeout? timeout, test_package.Timeout? timeout,
@Deprecated(
'This parameter has no effect. Use `timeout` instead. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration? initialTimeout,
bool semanticsEnabled = true, bool semanticsEnabled = true,
TestVariant<Object?> variant = const DefaultTestVariant(), TestVariant<Object?> variant = const DefaultTestVariant(),
dynamic tags, dynamic tags,
...@@ -182,7 +170,6 @@ void testWidgets( ...@@ -182,7 +170,6 @@ void testWidgets(
}, },
tester._endOfTestVerifications, tester._endOfTestVerifications,
description: combinedDescription, description: combinedDescription,
timeout: initialTimeout,
); );
}, },
skip: skip, skip: skip,
...@@ -826,8 +813,12 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker ...@@ -826,8 +813,12 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
/// your widget tree, then await that future inside [callback]. /// your widget tree, then await that future inside [callback].
Future<T?> runAsync<T>( Future<T?> runAsync<T>(
Future<T> Function() callback, { Future<T> Function() callback, {
@Deprecated(
'This is no longer supported and has no effect. '
'This feature was deprecated after v3.12.0-1.1.pre.'
)
Duration additionalTime = const Duration(milliseconds: 1000), Duration additionalTime = const Duration(milliseconds: 1000),
}) => binding.runAsync<T?>(callback, additionalTime: additionalTime); }) => binding.runAsync<T?>(callback);
/// Whether there are any transient callbacks scheduled. /// Whether there are any transient callbacks scheduled.
/// ///
......
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