Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion shell/platform/windows/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ source_set("flutter_windows_source") {

public_configs = [ ":relative_angle_headers" ]

defines = [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]
defines = [
"FLUTTER_ENGINE_NO_PROTOTYPES",
"FLUTTER_ENGINE_USE_UIA",
]

public_deps = [
"//flutter/fml:string_conversion",
Expand Down Expand Up @@ -227,6 +230,8 @@ executable("flutter_windows_unittests") {

public_configs = [ "//flutter:config" ]

defines = [ "FLUTTER_ENGINE_USE_UIA" ]

deps = [
":flutter_windows_fixtures",
":flutter_windows_headers",
Expand Down
2 changes: 2 additions & 0 deletions shell/platform/windows/testing/mock_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class MockWindow : public Window {

MOCK_METHOD0(GetAxFragmentRootDelegate, ui::AXFragmentRootDelegateWin*());

MOCK_METHOD3(OnGetObject, LRESULT(UINT, WPARAM, LPARAM));

void CallOnImeComposition(UINT const message,
WPARAM const wparam,
LPARAM const lparam);
Expand Down
6 changes: 3 additions & 3 deletions shell/platform/windows/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ class Window : public KeyboardManager::WindowDelegate {
//
// The primary use of this function is to supply Windows with wrapped
// semantics objects for use by Windows accessibility.
LRESULT OnGetObject(UINT const message,
WPARAM const wparam,
LPARAM const lparam);
virtual LRESULT OnGetObject(UINT const message,
WPARAM const wparam,
LPARAM const lparam);

// Called when IME composing begins.
virtual void OnComposeBegin() = 0;
Expand Down
18 changes: 18 additions & 0 deletions shell/platform/windows/window_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,23 @@ TEST(MockWindow, UnknownPointerTypeSkipsDirectManipulation) {
window.InjectWindowMessage(DM_POINTERHITTEST, MAKEWPARAM(pointer_id, 0), 0);
}

// Test that the root UIA object is queried by WM_GETOBJECT.
TEST(MockWindow, GetObjectUia) {
MockWindow window;
bool uia_called = false;
ON_CALL(window, OnGetObject)
.WillByDefault(Invoke([&uia_called](UINT msg, WPARAM wpar, LPARAM lpar) {
#ifdef FLUTTER_ENGINE_USE_UIA
uia_called = true;
#endif // FLUTTER_ENGINE_USE_UIA
return static_cast<LRESULT>(0);
}));
EXPECT_CALL(window, OnGetObject).Times(1);

window.InjectWindowMessage(WM_GETOBJECT, 0, UiaRootObjectId);

EXPECT_TRUE(uia_called);
}

} // namespace testing
} // namespace flutter