diff --git a/engine/src/flutter/lib/web_ui/lib/src/ui/test_embedding.dart b/engine/src/flutter/lib/web_ui/lib/src/ui/test_embedding.dart index d8a6c2f8cf..3e70d91954 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/ui/test_embedding.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/ui/test_embedding.dart @@ -19,7 +19,6 @@ Future ensureTestPlatformInitializedThenRunTest(dynamic Function() body return _testPlatformInitializedFuture!.then((_) => body()); } -// TODO(yjbanov): can we make this late non-null? See https://github.com/dart-lang/sdk/issues/42214 Future? _platformInitializedFuture; Future webOnlyInitializeTestDomRenderer({double devicePixelRatio = 3.0}) { @@ -35,14 +34,10 @@ Future webOnlyInitializeTestDomRenderer({double devicePixelRatio = 3.0}) { engine.scheduleFrameCallback = () {}; debugEmulateFlutterTesterEnvironment = true; + // Initialize platform once and reuse across all tests. if (_platformInitializedFuture != null) { return _platformInitializedFuture!; } - - // Only load the Ahem font once and await the same future in all tests. return _platformInitializedFuture = - webOnlyInitializePlatform(assetManager: engine.WebOnlyMockAssetManager()) - .timeout(const Duration(seconds: 2), onTimeout: () async { - throw Exception('Timed out loading Ahem font.'); - }); + webOnlyInitializePlatform(assetManager: engine.WebOnlyMockAssetManager()); }