Repository: flutter
Issue: Assets not available in web tests (`flutter test --platform chrome`)
Labels: a: tests,tool,a: assets,has reproducible steps,team-tool,found in release: 3.24,found in release: 3.27

### Steps to reproduce

1. Create a blank flutter project. Place any image at `assets/whatever.png` and add it in your pubspec assets.
2. Run the test code provided in the "Code sample" section:
    - `flutter test` succeeds
    - `flutter test --platform chrome` times out

### Expected results

Without `--platform chrome`:
```console
ahann@Adils-Mac-mini example % flutter test test/asset_bundle_test.dart                  
00:01 +2: All tests passed!
```

### Actual results

With `--platform chrome`:
```console
ahann@Adils-Mac-mini example % flutter test test/asset_bundle_test.dart --platform chrome
01:01 +0 -1: precache AssetImage [E]                                                                                                                 
  TimeoutException after 0:01:00.000000: Test timed out after 1 minutes.
  packages/test_api/src/backend/declarer.dart.js 766:36                    <fn>
  dart-sdk/lib/async/zone.dart 1391:47                                     _rootRun
  dart-sdk/lib/async/zone.dart 1301:19                                     run
  packages/test_api/src/backend/declarer.dart.js 764:12                    [_handleError]
  packages/test_api/src/backend/declarer.dart.js 741:29                    <fn>
  dart-sdk/lib/async/zone.dart 1399:13                                     _rootRun
  dart-sdk/lib/async/zone.dart 1301:19                                     run
  packages/test_api/src/backend/declarer.dart.js 740:48                    <fn>
  dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11  internalCallback
  

To run this test again: /Volumes/m2/ExternUsers/ahann/Documents/Sources/flutter/bin/cache/dart-sdk/bin/dart test test/asset_bundle_test.dart -p chrome --plain-name 'precache AssetImage'
02:01 +0 -2: load asset manually [E]                                                                                                                 
  TimeoutException after 0:01:00.000000: Test timed out after 1 minutes.
  packages/test_api/src/backend/declarer.dart.js 766:36                    <fn>
  dart-sdk/lib/async/zone.dart 1391:47                                     _rootRun
  dart-sdk/lib/async/zone.dart 1301:19                                     run
  packages/test_api/src/backend/declarer.dart.js 764:12                    [_handleError]
  packages/test_api/src/backend/declarer.dart.js 741:29                    <fn>
  dart-sdk/lib/async/zone.dart 1399:13                                     _rootRun
  dart-sdk/lib/async/zone.dart 1301:19                                     run
  packages/test_api/src/backend/declarer.dart.js 740:48                    <fn>
  dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11  internalCallback
  

To run this test again: /Volumes/m2/ExternUsers/ahann/Documents/Sources/flutter/bin/cache/dart-sdk/bin/dart test test/asset_bundle_test.dart -p chrome --plain-name 'load asset manually'
02:01 +0 -2: Some tests failed.
```

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  testWidgets('precache AssetImage', (tester) async {
    const imageProvider = AssetImage('assets/whatever.png');
    await tester.pumpWidget(const Image(
      image: imageProvider,
    ));

    final BuildContext context = tester.element(find.byType(Image));

    await expectLater(
      tester.runAsync(() => precacheImage(imageProvider, context)),
      completes,
    );
  }, timeout: const Timeout(Duration(minutes: 1)));

  test('load asset manually', () async {
    await expectLater(rootBundle.load('assets/whatever.png'), completes);
  }, timeout: const Timeout(Duration(minutes: 1)));
}
```

</details>


### Screenshots or Video

_No response_

### Logs

See above

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
ahann@Adils-Mac-mini example % flutter doctor -v
[✓] Flutter (Channel stable, 3.24.5, on macOS 15.1.1 24B2091 darwin-arm64, locale en-GB)
    • Flutter version 3.24.5 on channel stable at /Volumes/m2/ExternUsers/ahann/Documents/Sources/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision dec2ee5c1f (3 weeks ago), 2024-11-13 11:13:06 -0800
    • Engine revision a18df97ca5
    • Dart version 3.5.4
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Volumes/m2/ExternUsers/ahann/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)

[✓] VS Code (version 1.95.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (5 available)
    • Adil’s iPhone (mobile)          • 00008101-001A54CE1E51003A            • ios            • iOS 18.1.1 22B91
    • iPhone 16 Plus (mobile)         • A4AA4E6A-327B-4D18-B084-13FEB7A62F84 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-1
      (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 15.1.1 24B2091 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 15.1.1 24B2091 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 131.0.6778.109

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>