[Windows] Reduce log level of unsupported accessibility event message (flutter/engine#51024)

https://github.com/flutter/engine/pull/50975 made the Windows embedder a bit more defensive on accessibility event messages and introduced an error if it received an event it does not support. This change reduces that error to a warning as it can be triggered by hovering over the counter app's `+` button.

Fixes https://github.com/flutter/flutter/issues/144274

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Loïc Sharma
2024-02-27 16:45:30 -08:00
committed by GitHub
parent f0f77d3764
commit 9da5ed5312
2 changed files with 10 additions and 2 deletions

View File

@@ -63,8 +63,8 @@ void HandleMessage(AccessibilityPlugin* plugin, const EncodableValue& message) {
plugin->Announce(*message);
} else {
FML_LOG(ERROR) << "Accessibility message type '" << *type
<< "' is not supported.";
FML_LOG(WARNING) << "Accessibility message type '" << *type
<< "' is not supported.";
}
}

View File

@@ -4,6 +4,7 @@
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
#include "flutter/fml/logging.h"
#include "flutter/fml/macros.h"
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
@@ -716,6 +717,8 @@ TEST_F(FlutterWindowsEngineTest, AccessibilityAnnouncementHeadless) {
// Verify the engine does not crash if it receives an accessibility event
// it does not support yet.
TEST_F(FlutterWindowsEngineTest, AccessibilityTooltip) {
fml::testing::LogCapture log_capture;
auto& context = GetContext();
WindowsConfigBuilder builder{context};
builder.SetDartEntrypoint("sendAccessibilityTooltipEvent");
@@ -736,6 +739,11 @@ TEST_F(FlutterWindowsEngineTest, AccessibilityTooltip) {
while (!done) {
windows_engine->task_runner()->ProcessTasks();
}
// Verify no error was logged.
// Regression test for:
// https://github.com/flutter/flutter/issues/144274
EXPECT_EQ(log_capture.str().find("tooltip"), std::string::npos);
}
class MockWindowsLifecycleManager : public WindowsLifecycleManager {