#include "ui/views/accessibility/ax_virtual_view.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/platform/ax_platform_for_test.h"
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/accessibility/platform/ax_platform_node_delegate.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/accessibility/view_ax_platform_node_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/test/views_test_base.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
#if BUILDFLAG(IS_WIN)
#include "ui/views/win/hwnd_util.h"
#endif
namespace views::test {
namespace {
class TestButton : public Button { … };
BEGIN_METADATA(…)
}
class AXVirtualViewTest : public ViewsTestBase { … };
TEST_F(AXVirtualViewTest, AccessibilityRoleAndName) { … }
TEST_F(AXVirtualViewTest, FocusableAndEnabledState) { … }
TEST_F(AXVirtualViewTest, VirtualLabelIsChildOfButton) { … }
TEST_F(AXVirtualViewTest, VirtualViewsPruned) { … }
TEST_F(AXVirtualViewTest, RemoveFromParentView) { … }
#if defined(USE_AURA)
TEST_F(AXVirtualViewTest, MultipleCaches) { … }
#endif
TEST_F(AXVirtualViewTest, AddingAndRemovingVirtualChildren) { … }
TEST_F(AXVirtualViewTest, ReorderingVirtualChildren) { … }
TEST_F(AXVirtualViewTest, ContainsVirtualChild) { … }
TEST_F(AXVirtualViewTest, GetIndexOfVirtualChild) { … }
TEST_F(AXVirtualViewTest, InvisibleVirtualViews) { … }
TEST_F(AXVirtualViewTest, OverrideFocus) { … }
TEST_F(AXVirtualViewTest, TreeNavigation) { … }
TEST_F(AXVirtualViewTest, TreeNavigationWithIgnoredVirtualViews) { … }
TEST_F(AXVirtualViewTest, HitTesting) { … }
#if BUILDFLAG(IS_WIN)
TEST_F(AXVirtualViewTest, GetTargetForEvents) {
EXPECT_EQ(button_, virtual_label_->GetOwnerView());
EXPECT_NE(nullptr, HWNDForView(virtual_label_->GetOwnerView()));
EXPECT_EQ(HWNDForView(button_),
virtual_label_->GetTargetForNativeAccessibilityEvent());
}
#endif
}