Commit 75fe71ce authored by Ian Prest's avatar Ian Prest Committed by Commit Bot

UIA: Fix focus-event filter for event tests

Many of the UIA event tests are exhibiting a low-level of flakiness (too
low to be disabled, but high enough to be noisy).  These are mostly
related to spurious focus events.

It was determined that the logic that attempted to filter out focus
events outside the frame was faulty; it was testing the "automation id",
which is not necessarily unique.  This has been changed to the "runtime
id", which *is* unique.

Bug: 928949
Change-Id: I4e1c6f820f42c796f909513b9de5bb03a711eb4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1804382Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Ian Prest <iapres@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#696938}
parent cef68993
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_bstr.h" #include "base/win/scoped_bstr.h"
#include "base/win/scoped_com_initializer.h" #include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_safearray.h"
#include "base/win/scoped_variant.h" #include "base/win/scoped_variant.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h" #include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h"
...@@ -301,14 +302,14 @@ AccessibilityEventRecorderUia::Thread::EventHandler::HandleFocusChangedEvent( ...@@ -301,14 +302,14 @@ AccessibilityEventRecorderUia::Thread::EventHandler::HandleFocusChangedEvent(
if (!owner_) if (!owner_)
return S_OK; return S_OK;
base::win::ScopedBstr id; base::win::ScopedSafearray id;
sender->get_CurrentAutomationId(id.Receive()); sender->GetRuntimeId(id.Receive());
base::win::ScopedVariant id_variant(id, id.Length()); base::win::ScopedVariant id_variant(id.Release());
Microsoft::WRL::ComPtr<IUIAutomationElement> element_found; Microsoft::WRL::ComPtr<IUIAutomationElement> element_found;
Microsoft::WRL::ComPtr<IUIAutomationCondition> condition; Microsoft::WRL::ComPtr<IUIAutomationCondition> condition;
owner_->uia_->CreatePropertyCondition(UIA_AutomationIdPropertyId, id_variant, owner_->uia_->CreatePropertyCondition(UIA_RuntimeIdPropertyId, id_variant,
&condition); &condition);
CHECK(condition); CHECK(condition);
root_->FindFirst(TreeScope::TreeScope_Subtree, condition.Get(), root_->FindFirst(TreeScope::TreeScope_Subtree, condition.Get(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment