Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d6bca2a

Browse files
authored
[Windows] Reduce log level of unsupported accessibility event message (#51024)
#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 flutter/flutter#144274 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent 8fa1141 commit d6bca2a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

shell/platform/windows/accessibility_plugin.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ void HandleMessage(AccessibilityPlugin* plugin, const EncodableValue& message) {
6363

6464
plugin->Announce(*message);
6565
} else {
66-
FML_LOG(ERROR) << "Accessibility message type '" << *type
67-
<< "' is not supported.";
66+
FML_LOG(WARNING) << "Accessibility message type '" << *type
67+
<< "' is not supported.";
6868
}
6969
}
7070

shell/platform/windows/flutter_windows_engine_unittests.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
66

7+
#include "flutter/fml/logging.h"
78
#include "flutter/fml/macros.h"
89
#include "flutter/shell/platform/embedder/embedder.h"
910
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h"
@@ -716,6 +717,8 @@ TEST_F(FlutterWindowsEngineTest, AccessibilityAnnouncementHeadless) {
716717
// Verify the engine does not crash if it receives an accessibility event
717718
// it does not support yet.
718719
TEST_F(FlutterWindowsEngineTest, AccessibilityTooltip) {
720+
fml::testing::LogCapture log_capture;
721+
719722
auto& context = GetContext();
720723
WindowsConfigBuilder builder{context};
721724
builder.SetDartEntrypoint("sendAccessibilityTooltipEvent");
@@ -736,6 +739,11 @@ TEST_F(FlutterWindowsEngineTest, AccessibilityTooltip) {
736739
while (!done) {
737740
windows_engine->task_runner()->ProcessTasks();
738741
}
742+
743+
// Verify no error was logged.
744+
// Regression test for:
745+
// https://github.com/flutter/flutter/issues/144274
746+
EXPECT_EQ(log_capture.str().find("tooltip"), std::string::npos);
739747
}
740748

741749
class MockWindowsLifecycleManager : public WindowsLifecycleManager {

0 commit comments

Comments
 (0)