Commit e0ba014b authored by Jacobo Aragunde Pérez's avatar Jacobo Aragunde Pérez Committed by Commit Bot

Set AtSpiReady expected value for every test properly.

When tests are grouped in batches, the AtSpiReady state of the single-
-instance class AtkUtilAuraLinux may already have been changed and
affect the next test expectations. For that reason, we must change it
back to its default state when test ends.

This was making the TestAtkPopupWindowActive work some times, when it
should have been failing after a13d2391.
Now, we explicitly set AtSpiReady to true as part of the test body and
we can re-enable the test.

Bug: 1131867
Change-Id: I617914611ab7509b6bc3e1928baa61fb33b643ca
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429023
Commit-Queue: Jacobo Aragunde Pérez <jaragunde@igalia.com>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814164}
parent 2f663899
......@@ -13,6 +13,26 @@
#include "ui/accessibility/platform/ax_platform_node_unittest.h"
#include "ui/accessibility/platform/test_ax_node_wrapper.h"
namespace {
// ATK window activated event will be held until AT-SPI bridge is ready. For
// those tests using this event, we work that around by faking the state of the
// AT-SPI bridge. Creating an instance of this class will set it to true during
// the test and set it back to its default state when the test ends, so it
// doesn't affect other tests run in the same batch.
class ScopedAtSpiReady final {
public:
explicit ScopedAtSpiReady() {
ui::AtkUtilAuraLinux::GetInstance()->SetAtSpiReady(true);
}
~ScopedAtSpiReady() {
ui::AtkUtilAuraLinux::GetInstance()->SetAtSpiReady(false);
}
};
} // namespace
namespace ui {
class AXPlatformNodeAuraLinuxTest : public AXPlatformNodeTest {
......@@ -1587,6 +1607,8 @@ class ActivationTester {
//
//
TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkWindowActive) {
ScopedAtSpiReady enable_at_spi;
AXNodeData root;
root.id = 1;
root.role = ax::mojom::Role::kWindow;
......@@ -1621,10 +1643,6 @@ TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkWindowActive) {
}),
&saw_active_focus_state_change);
// ATK window activated event will be held until AT-SPI bridge is ready. We
// work that around by faking its state.
ui::AtkUtilAuraLinux::GetInstance()->SetAtSpiReady(true);
{
ActivationTester tester(root_atk_object);
EXPECT_FALSE(tester.IsActivatedInStateSet());
......@@ -1712,6 +1730,10 @@ TEST_F(AXPlatformNodeAuraLinuxTest, TestPostponedAtkWindowActive) {
EXPECT_FALSE(tester.saw_deactivate_);
}
// Set AtSpiReady state back to its default state, so it doesn't affect other
// tests run in the same batch.
atk_util->SetAtSpiReady(false);
g_object_unref(root_atk_object);
}
......@@ -1815,7 +1837,9 @@ TEST_F(AXPlatformNodeAuraLinuxTest, TestFocusTriggersAtkWindowActive) {
g_object_unref(root_atk_object);
}
TEST_F(AXPlatformNodeAuraLinuxTest, DISABLED_TestAtkPopupWindowActive) {
TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkPopupWindowActive) {
ScopedAtSpiReady enable_at_spi;
AXNodeData root;
root.id = 1;
root.role = ax::mojom::Role::kApplication;
......
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