flutter/dev/manual_tests/windows/runner
Loïc Sharma ce61eda70c
[Windows] Ensure window is shown (#127046)
## Background

The Windows runner has a race at startup:

1. **Platform thread**: creates a hidden window
2. **Platform thread**: launches the Flutter engine
3. **UI/Raster threads**: renders the first frame
4. **Platform thread**: Registers a callback to show the window once the next frame has been rendered.

Steps 3 and 4 happen in parallel and it is possible for step 3 to complete before step 4 starts. In this scenario, the next frame callback is never called and the window is never shown.

As a result the `windows_startup_test`'s test, which [verifies that the "show window" callback is called](1f09a8662d/dev/integration_tests/windows_startup_test/windows/runner/flutter_window.cpp (L60-L64)), can flake if the first frame is rendered before the show window callback has been registered.

## Solution

This change makes the runner schedule a frame after it registers the next frame callback. If step 3 hasn't completed yet, this no-ops as a frame is already scheduled. If step 3 has already completed, a new frame will be rendered, which will call the next frame callback and show the window.

Part of https://github.com/flutter/flutter/issues/119415

See this thread for alternatives that were considered: https://github.com/flutter/engine/pull/42061#issuecomment-1550080722
2023-05-19 22:25:55 +00:00
..
resources Update platform shims in dev/manual_tests (#94616) 2022-01-07 12:16:24 -08:00
CMakeLists.txt [Windows] Use dark title bar on dark system theme (#111042) 2022-09-09 22:23:59 +00:00
flutter_window.cpp [Windows] Ensure window is shown (#127046) 2023-05-19 22:25:55 +00:00
flutter_window.h Update platform shims in dev/manual_tests (#94616) 2022-01-07 12:16:24 -08:00
main.cpp [Windows] Hide app until first frame is drawn (#109816) 2022-08-30 14:26:21 +00:00
resource.h Update platform shims in dev/manual_tests (#94616) 2022-01-07 12:16:24 -08:00
runner.exe.manifest Update Windows manifest to declare Windows 11 (#104768) 2022-05-26 17:40:07 -07:00
Runner.rc [Windows] Flow version information to the build output (#106145) 2022-06-27 10:45:56 -07:00
utils.cpp Avoid null terminating characters in strings from Utf8FromUtf16() (#109729) 2023-02-13 19:22:37 +01:00
utils.h Add Windows desktop files for manual tests (#77228) 2021-03-04 19:02:46 -08:00
win32_window.cpp Fix typos (#121171) 2023-02-23 19:43:21 +00:00
win32_window.h Fix typos (#121171) 2023-02-23 19:43:21 +00:00