Migrates flutter windows test to impeller#188188
Conversation
97e7fe8 to
a8a8f54
Compare
a8a8f54 to
790e4cc
Compare
There was a problem hiding this comment.
Code Review
This pull request updates several Windows platform unit tests to use DefaultImpeller instead of DisabledImpeller, adds an egl_config() getter to the EGL Manager class, and introduces a mock EGL manager (ViewTestEGLManager) with mocked embedder API functions in the view unit tests. Feedback recommends removing unused parameter names in the mock lambdas to prevent compiler warnings, and removing a redundant semicolon after the egl_config() definition to align with the C++ style guide.
| modifier.embedder_api().Run = MOCK_ENGINE_PROC( | ||
| Run, ([](size_t version, const FlutterRendererConfig* config, | ||
| const FlutterProjectArgs* args, void* user_data, | ||
| FLUTTER_API_SYMBOL(FlutterEngine) * engine) { | ||
| *engine = | ||
| reinterpret_cast<FLUTTER_API_SYMBOL(FlutterEngine)>(0x12345678); | ||
| return kSuccess; | ||
| })); | ||
|
|
||
| modifier.embedder_api().Shutdown = MOCK_ENGINE_PROC( | ||
| Shutdown, | ||
| ([](FLUTTER_API_SYMBOL(FlutterEngine) engine) { return kSuccess; })); | ||
|
|
||
| modifier.embedder_api().UpdateLocales = MOCK_ENGINE_PROC( | ||
| UpdateLocales, ([](FLUTTER_API_SYMBOL(FlutterEngine) engine, | ||
| const FlutterLocale** locales, | ||
| size_t locales_count) { return kSuccess; })); | ||
|
|
||
| modifier.embedder_api().UpdateAccessibilityFeatures = MOCK_ENGINE_PROC( | ||
| UpdateAccessibilityFeatures, | ||
| ([](FLUTTER_API_SYMBOL(FlutterEngine) engine, | ||
| FlutterAccessibilityFeature flags) { return kSuccess; })); | ||
|
|
||
| modifier.embedder_api().PostRenderThreadTask = MOCK_ENGINE_PROC( | ||
| PostRenderThreadTask, ([](auto engine, auto callback, auto context) { | ||
| callback(context); | ||
| return kSuccess; | ||
| })); |
There was a problem hiding this comment.
Several parameters in these mock lambdas are unused (e.g., version, config, args, user_data, engine, locales, locales_count, flags). In strict compilation environments (such as Flutter's CI with -Werror and -Wunused-parameter), this can trigger compiler warnings or errors. Omitting the parameter names for unused arguments avoids these warnings.
modifier.embedder_api().Run = MOCK_ENGINE_PROC(
Run, ([](size_t,
const FlutterRendererConfig*,
const FlutterProjectArgs*,
void*,
FLUTTER_API_SYMBOL(FlutterEngine)* engine) {
*engine =
reinterpret_cast<FLUTTER_API_SYMBOL(FlutterEngine)>(0x12345678);
return kSuccess;
}));
modifier.embedder_api().Shutdown = MOCK_ENGINE_PROC(
Shutdown,
([](FLUTTER_API_SYMBOL(FlutterEngine)) { return kSuccess; }));
modifier.embedder_api().UpdateLocales = MOCK_ENGINE_PROC(
UpdateLocales, ([](FLUTTER_API_SYMBOL(FlutterEngine),
const FlutterLocale**,
size_t) { return kSuccess; }));
modifier.embedder_api().UpdateAccessibilityFeatures = MOCK_ENGINE_PROC(
UpdateAccessibilityFeatures,
([](FLUTTER_API_SYMBOL(FlutterEngine),
FlutterAccessibilityFeature) { return kSuccess; }));
modifier.embedder_api().PostRenderThreadTask = MOCK_ENGINE_PROC(
PostRenderThreadTask, ([](auto, auto callback, auto context) {
callback(context);
return kSuccess;
}));| EGLDisplay egl_display() const { return display_; }; | ||
|
|
||
| // Gets the |EGLConfig|. | ||
| EGLConfig egl_config() const { return config_; }; |
There was a problem hiding this comment.
The semicolon after the member function definition is redundant and can be removed to adhere to standard C++ and style guidelines.
| EGLConfig egl_config() const { return config_; }; | |
| EGLConfig egl_config() const { return config_; } |
References
- C++ code should follow the Google C++ Style Guide, which discourages redundant semicolons after function definitions. (link)
|
autosubmit label was removed for flutter/flutter/188188, because - The status or check suite Linux linux_web_engine_tests has failed. Please fix the issues identified (or deflake) before re-applying this label. |
fixes flutter#188173 This works by mocking out the egl manager so a real renderer is not required. I don't think these tests were intended to be integration tests, they are in a file called _unittests.cc. In the history of this pr I did move them over to use SwiftShader, which is possible. I instead opted them to use a mocked egl manager which is 100x faster. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
fixes #188173
This works by mocking out the egl manager so a real renderer is not required. I don't think these tests were intended to be integration tests, they are in a file called _unittests.cc.
In the history of this pr I did move them over to use SwiftShader, which is possible. I instead opted them to use a mocked egl manager which is 100x faster.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.