Skip to content

Commit

Permalink
Enable OptimizeAccessibilityUiThreadWork by default.
Browse files Browse the repository at this point in the history
Experiment results are very positive. Proceed to launch.

Bug: 1352616
Change-Id: I5ba50d2ed4c3eb7d394cea7e941a926f5be6675f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4150112
Reviewed-by: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1091521}
  • Loading branch information
yfriedman authored and Chromium LUCI CQ committed Jan 11, 2023
1 parent 105aaa8 commit a7c555c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,48 +351,24 @@ TEST_F(BrowserAccessibilityAndroidTest, TestGetTextContent) {
BrowserAccessibilityManager::Create(
MakeAXTreeUpdateForTesting(root, container_para, text1, text2, text3),
test_browser_accessibility_delegate_.get()));
{
base::test::ScopedFeatureList features;
features.InitAndEnableFeature(features::kOptimizeAccessibilityUiThreadWork);

BrowserAccessibility* container_obj = manager->GetFromID(11);
// Default caller gets full text.
EXPECT_EQ(u"1Foo2Bar3Baz", container_obj->GetTextContentUTF16());

BrowserAccessibilityAndroid* node =
static_cast<BrowserAccessibilityAndroid*>(container_obj);
// No predicate returns all text.
EXPECT_EQ(u"1Foo2Bar3Baz",
node->GetSubstringTextContentUTF16(absl::nullopt));
// Non-empty predicate terminates after one text node.
EXPECT_EQ(u"1Foo", node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::NonEmptyPredicate()));
// Length of 5 not satisfied by one node.
EXPECT_EQ(u"1Foo2Bar", node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::LengthAtLeast(5)));
// Length of 10 not satisfied by two nodes.
EXPECT_EQ(u"1Foo2Bar3Baz",
node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::LengthAtLeast(10)));
}
{
// With experiment disabled, predicate checks are disabled.
BrowserAccessibility* container_obj = manager->GetFromID(11);
// Default caller gets full text.
EXPECT_EQ(u"1Foo2Bar3Baz", container_obj->GetTextContentUTF16());

BrowserAccessibilityAndroid* node =
static_cast<BrowserAccessibilityAndroid*>(container_obj);
EXPECT_EQ(u"1Foo2Bar3Baz",
node->GetSubstringTextContentUTF16(absl::nullopt));
EXPECT_EQ(u"1Foo2Bar3Baz",
node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::NonEmptyPredicate()));
EXPECT_EQ(u"1Foo2Bar3Baz",
node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::LengthAtLeast(5)));
}

BrowserAccessibility* container_obj = manager->GetFromID(11);
// Default caller gets full text.
EXPECT_EQ(u"1Foo2Bar3Baz", container_obj->GetTextContentUTF16());

BrowserAccessibilityAndroid* node =
static_cast<BrowserAccessibilityAndroid*>(container_obj);
// No predicate returns all text.
EXPECT_EQ(u"1Foo2Bar3Baz", node->GetSubstringTextContentUTF16(absl::nullopt));
// Non-empty predicate terminates after one text node.
EXPECT_EQ(u"1Foo", node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::NonEmptyPredicate()));
// Length of 5 not satisfied by one node.
EXPECT_EQ(u"1Foo2Bar", node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::LengthAtLeast(5)));
// Length of 10 not satisfied by two nodes.
EXPECT_EQ(u"1Foo2Bar3Baz",
node->GetSubstringTextContentUTF16(
BrowserAccessibilityAndroid::LengthAtLeast(10)));
manager.reset();
}

Expand Down
2 changes: 1 addition & 1 deletion ui/accessibility/accessibility_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ bool IsComputeAXModeEnabled() {

BASE_FEATURE(kOptimizeAccessibilityUiThreadWork,
"OptimizeAccessibilityUiThreadWork",
base::FEATURE_DISABLED_BY_DEFAULT);
base::FEATURE_ENABLED_BY_DEFAULT);

bool IsOptimizeAccessibilityUiThreadWorkEnabled() {
return base::FeatureList::IsEnabled(
Expand Down

0 comments on commit a7c555c

Please sign in to comment.