Repository navigation
[flutter_tools] Migrate general.shard Android, asset, and build tests off globals - #196125
Conversation
… off globals Migrate Android, asset bundle, build system, DAP, localization, iOS, resident runner, and plugin unit tests in `test/general.shard/` off ambient `globals.*` lookups to explicit `ToolContext` and constructor dependency injection. Part of flutter#47161
…build tests with explicit DI Replace remaining `DelegatingToolContext` and `testUsingContext` usages in `test/general.shard/` Android, application package, asset bundle, build system, and plugin unit tests with `FakeToolContext` and `testWithoutContext`. Part of flutter#47161
Convert migrated Android, application package, asset bundle, build system, localization, and iOS simulator unit tests in `test/general.shard/` that no longer require ambient context from `testUsingContext` to `testWithoutContext`, replace `context.get` and `testLogger` lookups with explicit local test instances, and preserve Windows `.bat` coverage in `android_gradle_builder_test.dart`. Part of flutter#47161
There was a problem hiding this comment.
Code Review
This pull request refactors multiple unit tests within the flutter_tools package to remove dependencies on global variables and context-based testing. It replaces testUsingContext with testWithoutContext and explicitly injects local test doubles like MemoryFileSystem.test(), BufferLogger.test(), and FakePlatform(). The review feedback identifies two tests in plugins_test.dart where the ErrorHandlingFileSystem is instantiated with a default Linux platform while using a Windows file system style, suggesting that the platform should be updated to match the file system style.
…ingFileSystem Pass `FakePlatform(operatingSystem: 'windows')` to `ErrorHandlingFileSystem` in the two Windows symlink tests in `packages/flutter_tools/test/general.shard/plugins_test.dart` so the wrapper platform matches the underlying `FileSystemStyle.windows` delegate.
…eral-android-assets-build
|
autosubmit label was removed for flutter/flutter/196125, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…eral-android-assets-build
…s_test After merging master, validatePubspecForPlugin defaults its fileSystem parameter to LocalFileSystem.test rather than reading globals.fs. Pass the test group's MemoryFileSystem explicitly in 'validatePubspecForPlugin works' and run it with testWithoutContext.
flutter/flutter@b98afb5...9c427b5 2026-11-12 [email protected] Roll Skia from d67d0f22e3ec to 9aa2513a4ac9 (2 revisions) (flutter/flutter#196429) 2026-11-12 [email protected] [flutter_tools] Move CpuArch to flutter_tools_core and define HostPlatform by osName and cpuArch (flutter/flutter#195841) 2026-11-12 [email protected] Roll Skia from 23e7e63789b8 to d67d0f22e3ec (2 revisions) (flutter/flutter#196424) 2026-11-12 [email protected] Uber compactify (flutter/flutter#196392) 2026-11-12 [email protected] Roll Skia from 3d7e335da165 to 23e7e63789b8 (12 revisions) (flutter/flutter#196422) 2026-11-12 [email protected] Roll Dart SDK from 13af329ea4f2 to e5add7a25b32 (1 revision) (flutter/flutter#196413) 2026-11-12 [email protected] Don't terminate the shared EGL display when an engine is disposed (flutter/flutter#194520) 2026-11-11 [email protected] Adds manifest flag to turn on SDFs for Android. (flutter/flutter#196056) 2026-11-11 [email protected] Remove bringup from Linux_pixel_7pro integration_ui_keyboard_inset_jump (flutter/flutter#196334) 2026-11-11 [email protected] Uses system default locale for text rendering when preferred locale isn't supported (flutter/flutter#195997) 2026-11-11 [email protected] [android]: prewarms shaders when the context is created (flutter/flutter#196069) 2026-11-11 [email protected] iOS: Recomposite platform views only if their parameters change (flutter/flutter#196287) 2026-11-11 [email protected] [flutter_tools] Forward encoding in ErrorHandlingFile.readAsStringSync (flutter/flutter#196136) 2026-11-11 [email protected] Roll Skia from b89c24bbab8c to 3d7e335da165 (8 revisions) (flutter/flutter#196390) 2026-11-11 [email protected] Add Flutter Gardener instructions on how to disable a test (flutter/flutter#196312) 2026-11-11 [email protected] [Impeller] Enable malioc analysis for framebuffer_blend shaders (flutter/flutter#196343) 2026-11-11 [email protected] [flutter_tools] Migrate general.shard Android, asset, and build tests off globals (flutter/flutter#196125) 2026-11-11 [email protected] Roll Dart SDK from 8f15c4ca2d41 to 13af329ea4f2 (1 revision) (flutter/flutter#196386) 2026-11-11 [email protected] [Impeller] Do not clamp the local coverage limit to the root render target (flutter/flutter#195860) 2026-11-11 [email protected] [Impeller] Use separate uniform buffers on VMware SVGA3D (flutter/flutter#196022) 2026-11-11 [email protected] [flutter_tools] Introduce AndroidSdkProvider for lazy native_assets SDK lookup (flutter/flutter#196122) 2026-11-11 [email protected] Moves linux to ThinLTO. (flutter/flutter#196314) 2026-11-11 [email protected] [flutter_tools] Migrate bin/fuchsia_tester.dart off globals and runInContext (flutter/flutter#196074) 2026-11-11 [email protected] Changes the tolerances for frame_rate_main_test.dart. (flutter/flutter#196304) 2026-11-11 [email protected] Roll Packages from 08faf64 to 653628e (16 revisions) (flutter/flutter#196381) 2026-11-11 [email protected] Allow SliverCrossAxisGroup children to lay out with zero cross-axis extent instead of asserting (flutter/flutter#191287) 2026-11-11 [email protected] Roll Skia from cc4c54f752ba to b89c24bbab8c (4 revisions) (flutter/flutter#196375) 2026-11-11 [email protected] [Linux] Fix layer offset when compositing with glBlitFramebuffer (flutter/flutter#196189) 2026-11-11 [email protected] [flutter_tools] Inject CrashReportSender into SwiftPM migration (flutter/flutter#196315) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
The branch was rebased onto master (774b051), which dropped its nine merges of master. Those merges held the conflict resolutions and the regenerated lock files and converter output, and the conflicts of the replayed commits were resolved in favour of the replayed commit. So the commits below this one are not expected to build on this base. This commit restores what the merges held. Its tree is the tree of a merge of the same master into the branch as it was before the rebase, and that tree was checked: gn_to_bazel's tests (284) and --check, check_build_configs.sh, check_generated_bazel_files.sh, bazel_ci_test.py (23), engine_build_configs (84), bazel_tools (46), buildifier, tools/gn_test.py (7), the analyzer over flutter_tools and the ten tool test files the branch touches (324 tests); Bazel analysis of ci_host_debug, of host_release_test and of //:tool_tests //:dart_tests. In it: - deps.lock.bzl and pub.lock.bzl for master's DEPS and pubspec.lock, and the converter's output: builds.json, configs.bazelrc, ci/builders/BUILD.bazel and six generated BUILD.bazel files. - dev/bots/BUILD.bazel and packages/flutter_tools/BUILD.bazel for the durations file upstream renamed to tool_test_durations.json. - The builder files without `--no-goma`, which tools/gn no longer accepts (flutter#196212), and without mac_unopt.json, which upstream removed (flutter#196027). - Upstream's side of hunks both sides had changed: dev/bots (run_command.dart, test.dart and their tests), tools/gn_test.py (test_thin_lto), shell/platform/darwin/ios/BUILD.gn, and the tool's android_gradle_builder_test.dart in its form after flutter#196125.
Migrate Android, application package, asset bundle, build system, DAP, localization, iOS, resident runner, and plugin unit tests in
test/general.shard/off ambientglobals.*,DelegatingToolContext, andtestUsingContexttoFakeToolContext,testWithoutContext, and explicit constructor dependency injection.Part of #47161