Revert "Assert that runApp is called in the same zone as binding.ensureInitialized (#117113)" (#122830)
Revert "Assert that runApp is called in the same zone as binding.ensureInitialized"
This commit is contained in:
@@ -5,9 +5,7 @@
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:isolate' as isolate;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:vm_service/vm_service.dart';
|
||||
import 'package:vm_service/vm_service_io.dart';
|
||||
@@ -54,29 +52,3 @@ Future<void> runFrame(VoidCallback callback) {
|
||||
callback();
|
||||
return result;
|
||||
}
|
||||
|
||||
// This binding skips the zones tests. These tests were written before we
|
||||
// verified zones properly, and they have been legacied-in to avoid having
|
||||
// to refactor them.
|
||||
//
|
||||
// When creating new tests, avoid relying on this class.
|
||||
class ZoneIgnoringTestBinding extends WidgetsFlutterBinding {
|
||||
@override
|
||||
void initInstances() {
|
||||
super.initInstances();
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
@override
|
||||
bool debugCheckZone(String entryPoint) { return true; }
|
||||
|
||||
static ZoneIgnoringTestBinding get instance => BindingBase.checkInstance(_instance);
|
||||
static ZoneIgnoringTestBinding? _instance;
|
||||
|
||||
static ZoneIgnoringTestBinding ensureInitialized() {
|
||||
if (ZoneIgnoringTestBinding._instance == null) {
|
||||
ZoneIgnoringTestBinding();
|
||||
}
|
||||
return ZoneIgnoringTestBinding.instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ import 'package:vm_service/vm_service.dart';
|
||||
import 'package:vm_service/vm_service_io.dart';
|
||||
|
||||
void main() {
|
||||
LiveTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
late VmService vmService;
|
||||
late LiveTestWidgetsFlutterBinding binding;
|
||||
setUpAll(() async {
|
||||
@@ -29,7 +27,7 @@ void main() {
|
||||
await vmService.streamListen(EventStreams.kExtension);
|
||||
|
||||
// Initialize bindings
|
||||
binding = LiveTestWidgetsFlutterBinding.instance;
|
||||
binding = LiveTestWidgetsFlutterBinding();
|
||||
binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive;
|
||||
binding.attachRootWidget(const SizedBox.expand());
|
||||
expect(binding.framesEnabled, true);
|
||||
|
||||
@@ -16,7 +16,7 @@ final Set<String> interestingLabels = <String>{
|
||||
};
|
||||
|
||||
void main() {
|
||||
ZoneIgnoringTestBinding.ensureInitialized();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
initTimelineTests();
|
||||
test('Children of MultiChildRenderObjectElement show up in tracing', () async {
|
||||
// We don't have expectations around the first frame because there's a race around
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'common.dart';
|
||||
|
||||
void main() {
|
||||
ZoneIgnoringTestBinding.ensureInitialized();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
initTimelineTests();
|
||||
test('Widgets with updated keys produce well formed timelines', () async {
|
||||
await runFrame(() { runApp(const TestRoot()); });
|
||||
|
||||
@@ -58,7 +58,7 @@ class TestRootState extends State<TestRoot> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
ZoneIgnoringTestBinding.ensureInitialized();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
initTimelineTests();
|
||||
test('Timeline', () async {
|
||||
// We don't have expectations around the first frame because there's a race around
|
||||
|
||||
Reference in New Issue
Block a user