Revert "Implement frameData for TestWindow (#105537)" (#107171)
This reverts commit 21841d7e3576ac2ac40dbdca6a3cd03cbdbf90ff.
diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart
index 9f2f391..238af86 100644
--- a/packages/flutter_test/lib/src/binding.dart
+++ b/packages/flutter_test/lib/src/binding.dart
@@ -157,12 +157,6 @@
}
@override
- void handleBeginFrame(Duration? rawTimeStamp) {
- _window.incrementFrameNumber();
- super.handleBeginFrame(rawTimeStamp);
- }
-
- @override
TestWindow get window => _window;
final TestWindow _window;
@@ -1054,6 +1048,7 @@
}
_phase = newPhase;
if (hasScheduledFrame) {
+ addTime(const Duration(milliseconds: 500));
_currentFakeAsync!.flushMicrotasks();
handleBeginFrame(Duration(
milliseconds: _clock!.now().millisecondsSinceEpoch,
@@ -1098,6 +1093,8 @@
),
);
+ addTime(additionalTime);
+
return realAsyncZone.run<Future<T?>>(() async {
_pendingAsyncTasks = Completer<void>();
T? result;
diff --git a/packages/flutter_test/lib/src/window.dart b/packages/flutter_test/lib/src/window.dart
index c8cc714..e82bc80 100644
--- a/packages/flutter_test/lib/src/window.dart
+++ b/packages/flutter_test/lib/src/window.dart
@@ -59,14 +59,6 @@
}) : _window = window,
platformDispatcher = TestPlatformDispatcher(platformDispatcher: window.platformDispatcher);
-
- int _frameNumber = 0;
- /// Indicates that the test binding has pumped a frame.
- void incrementFrameNumber() {
- _frameNumber += 1;
- platformDispatcher.frameData = _TestFrameData(_frameNumber);
- }
-
/// The [dart:ui.SingletonFlutterWindow] that is wrapped by this [TestWindow].
final ui.SingletonFlutterWindow _window;
@@ -499,9 +491,6 @@
platformDispatcher.onPlatformMessage = callback;
}
- @override
- ui.FrameData get frameData => platformDispatcher.frameData;
-
/// Delete any test value properties that have been set on this [TestWindow]
/// as well as its [platformDispatcher].
///
@@ -516,7 +505,6 @@
clearDisplayFeaturesTestValue();
clearPhysicalSizeTestValue();
clearViewInsetsTestValue();
- _frameNumber = 0;
platformDispatcher.clearAllTestValues();
}
@@ -894,7 +882,6 @@
clearLocalesTestValue();
clearSemanticsEnabledTestValue();
clearTextScaleFactorTestValue();
- frameData = const _TestFrameData(0);
}
@override
@@ -927,7 +914,7 @@
ui.PlatformConfiguration get configuration => _platformDispatcher.configuration;
@override
- ui.FrameData frameData = const _TestFrameData(0);
+ ui.FrameData get frameData => _platformDispatcher.frameData;
@override
ByteData? getPersistentIsolateData() => _platformDispatcher.getPersistentIsolateData();
@@ -943,10 +930,3 @@
return null;
}
}
-
-class _TestFrameData implements ui.FrameData {
- const _TestFrameData(this.frameNumber);
-
- @override
- final int frameNumber;
-}
diff --git a/packages/flutter_test/test/bindings_test.dart b/packages/flutter_test/test/bindings_test.dart
index 7816cda..c5a4b92 100644
--- a/packages/flutter_test/test/bindings_test.dart
+++ b/packages/flutter_test/test/bindings_test.dart
@@ -33,35 +33,6 @@
});
});
- test('frameNumber', () async {
- binding.window.clearAllTestValues();
- expect(binding.window.frameData.frameNumber, 0);
- await binding.runTest(() async {
- // runTest pumps a frame.
- expect(binding.window.frameData.frameNumber, 1);
-
- // Scheduling should not pump
- binding.scheduleFrame();
- expect(binding.window.frameData.frameNumber, 1);
- binding.handleBeginFrame(null);
- expect(binding.window.frameData.frameNumber, 2);
- binding.handleDrawFrame();
- expect(binding.window.frameData.frameNumber, 2);
-
- // Pump with no scheduled frame.
- await binding.pump();
- expect(binding.window.frameData.frameNumber, 2);
-
- // Schedule and pump, similar to handleBeginFrame.
- binding.scheduleFrame();
- await binding.pump();
- expect(binding.window.frameData.frameNumber, 3);
- }, () {});
- binding.postTest();
- binding.window.clearAllTestValues();
- expect(binding.window.frameData.frameNumber, 0);
- });
-
// The next three tests must run in order -- first using `test`, then `testWidgets`, then `test` again.
int order = 0;