Skip to content

Commit

Permalink
M110: Ensure changes from slider set value action are serialized
Browse files Browse the repository at this point in the history
(cherry picked from commit c003c3a)

Fixed: 1403047
Change-Id: I78f79e275c600b97f3e056ee785c9378b5df7407
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4158011
Reviewed-by: Mark Schillaci <mschillaci@google.com>
Commit-Queue: Mark Schillaci <mschillaci@google.com>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1091936}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4167889
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5481@{#317}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
aleventhal authored and Chromium LUCI CQ committed Jan 14, 2023
1 parent 0c6afad commit a5114cb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,48 @@ class BlinkAXActionTargetTest : public RenderAccessibilityImplTest {
base::test::ScopedFeatureList feature_list_;
};

TEST_F(BlinkAXActionTargetTest, TestSetRangeValue) {
constexpr char html[] = R"HTML(
<body>
<input type=range min=1 value=2 max=3 step=1>
</body>
)HTML";
LoadHTMLAndRefreshAccessibilityTree(html);

WebDocument document = GetMainFrame()->GetDocument();
WebAXObject root_obj = WebAXObject::FromWebDocument(document);
WebAXObject html_elem = root_obj.ChildAt(0);
WebAXObject body = html_elem.ChildAt(0);
WebAXObject input_range = body.ChildAt(0);

float value = 0.0f;
EXPECT_TRUE(input_range.ValueForRange(&value));
EXPECT_EQ(2.0f, value);
std::unique_ptr<ui::AXActionTarget> input_range_action_target =
AXActionTargetFactory::CreateFromNodeId(document, nullptr,
input_range.AxID());
EXPECT_EQ(ui::AXActionTarget::Type::kBlink,
input_range_action_target->GetType());

std::string value_to_set("1.0");
{
ui::AXActionData action_data;
action_data.action = ax::mojom::Action::kSetValue;
action_data.value = value_to_set;
EXPECT_TRUE(input_range.PerformAction(action_data));
}
EXPECT_TRUE(input_range.ValueForRange(&value));
EXPECT_EQ(1.0f, value);

SendPendingAccessibilityEvents();
EXPECT_EQ(1, CountAccessibilityNodesSentToBrowser());
{
// Make sure it's the input range object that was updated.
ui::AXTreeUpdate update = GetLastAccUpdate();
EXPECT_EQ(input_range.AxID(), update.nodes[0].id);
}
}

TEST_F(BlinkAXActionTargetTest, TestMethods) {
// Exercise the methods on BlinkAXActionTarget to ensure they have the
// expected effects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool AXSlider::OnNativeSetValueAction(const String& value) {
return false;

// Ensure the AX node is updated.
AXObjectCache().MarkAXObjectDirty(this);
AXObjectCache().HandleValueChanged(GetNode());

return true;
}
Expand Down

0 comments on commit a5114cb

Please sign in to comment.