diff --git a/packages/flutter_tools/lib/src/web/bootstrap.dart b/packages/flutter_tools/lib/src/web/bootstrap.dart index 475ec393b04..4aa27f00272 100644 --- a/packages/flutter_tools/lib/src/web/bootstrap.dart +++ b/packages/flutter_tools/lib/src/web/bootstrap.dart @@ -193,7 +193,7 @@ String generateTestEntrypoint({ Future main() async { ui.debugEmulateFlutterTesterEnvironment = true; await ui.webOnlyInitializePlatform(); - webGoldenComparator = DefaultWebGoldenComparator(Uri.parse('$absolutePath')); + webGoldenComparator = DefaultWebGoldenComparator(Uri.parse('${Uri.file(absolutePath)}')); (ui.window as dynamic).debugOverrideDevicePixelRatio(3.0); (ui.window as dynamic).webOnlyDebugPhysicalSizeOverride = const ui.Size(2400, 1800); diff --git a/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart b/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart index afc55c915c6..a8881a48bc2 100644 --- a/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart +++ b/packages/flutter_tools/test/general.shard/web/bootstrap_test.dart @@ -102,4 +102,15 @@ test('generateBootstrapScript includes loading indicator', () { expect(result, contains('test_config.testExecutable')); }); + + test('generateTestEntrypoint embeds urls correctly', () { + final String result = generateTestEntrypoint( + relativeTestPath: 'relative_path.dart', + absolutePath: '/test/absolute_path.dart', + testConfigPath: null, + languageVersion: LanguageVersion(2, 8), + ); + + expect(result, contains("Uri.parse('file:///test/absolute_path.dart')")); + }); }