chromium/content/browser/accessibility/accessibility_auralinux_browsertest.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <atk/atk.h>
#include <dlfcn.h>

#include <string>
#include <vector>

#include "base/functional/callback_helpers.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/version.h"
#include "build/build_config.h"
#include "content/browser/accessibility/accessibility_browsertest.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/test/accessibility_notification_waiter.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "ui/accessibility/platform/ax_platform_node_auralinux.h"
#include "ui/accessibility/platform/browser_accessibility.h"

// TODO(crbug.com/40248581): Remove this again.
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

namespace content {

namespace {

const char16_t kBullet[2] =;
const std::u16string kString16Bullet =;

AtkObject* FindAtkObjectParentFrame(AtkObject* atk_object) {}

static bool IsAtkObjectFocused(AtkObject* object) {}

static bool IsAtkObjectEditable(AtkObject* object) {}

}  // namespace

class AccessibilityAuraLinuxBrowserTest : public AccessibilityBrowserTest {};

void AccessibilityAuraLinuxBrowserTest::CheckTextAtOffset(
    AtkText* text_object,
    int offset,
    AtkTextBoundary boundary_type,
    int expected_start_offset,
    int expected_end_offset,
    const char* expected_text) {}

AtkText* AccessibilityAuraLinuxBrowserTest::SetUpInputField() {}

AtkText* AccessibilityAuraLinuxBrowserTest::SetUpTextareaField() {}

AtkText* AccessibilityAuraLinuxBrowserTest::SetUpSampleParagraph() {}

AtkText* AccessibilityAuraLinuxBrowserTest::GetSampleParagraph() {}

AtkText* AccessibilityAuraLinuxBrowserTest::GetScrollableInputField() {}

AtkText* AccessibilityAuraLinuxBrowserTest::FindNode(const AtkRole role) {}

AtkText* AccessibilityAuraLinuxBrowserTest::FindNode(AtkObject* root,
                                                     const AtkRole role) const {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       AuraLinuxBrowserAccessibleParent) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestTextAtOffsetWithBoundaryCharacterAndEmbeddedObject) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestMultilingualTextAtOffsetWithBoundaryCharacter) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestTextAtOffsetWithBoundaryLine) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestMultiLineTextAtOffsetWithBoundaryLine) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestBlankLineTextAtOffsetWithBoundaryLine) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestParagraphTextAtOffsetWithBoundaryLine) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       DISABLED_TestParagraphTextAtOffsetWithBoundarySentence) {}

#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 30, 0)
#define ATK_230
#endif

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestCharacterExtentsWithInvalidArguments) {}

AtkCoordType kCoordinateTypes[] =;

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestCharacterExtentsInEditable) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestCharacterExtentsInScrollableEditable) {}

void AccessibilityAuraLinuxBrowserTest::
    TestCharacterExtentsInScrollableInput() {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestCharacterExtentsInScrollableInputField) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestCharacterExtentsInScrollableInputTypeSearchField) {}

#if defined(ATK_230)
ScrollToPointFunc;
ScrollToFunc;

// TODO(crbug.com/40866728): Enable this test.
IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       DISABLED_TestScrollToPoint) {}

// TODO(crbug.com/40866728): Enable this test.
IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       DISABLED_TestScrollTo) {}
#endif  //  defined(ATK_230)

#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 32, 0)
ScrollSubstringToFunc;
ScrollSubstringToFunc g_scroll_substring_to =;

NO_SANITIZE("cfi-icall")
gboolean ScrollSubstringTo(AtkText* text,
                           gint start_offset,
                           gint end_offset,
                           AtkScrollType type) {}

// TODO(crbug.com/40866728): Enable this test.
IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       DISABLED_TestScrollSubstringTo) {}

ScrollSubstringToPointFunc;
ScrollSubstringToPointFunc g_scroll_substring_to_point =;

NO_SANITIZE("cfi-icall")
gboolean ScrollSubstringToPoint(AtkText* text,
                                gint start_offset,
                                gint end_offset,
                                AtkCoordType coord_type,
                                gint x,
                                gint y) {}

// TODO(crbug.com/40866728): Enable this test.
IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       DISABLED_TestScrollSubstringToPoint) {}
#endif  //  defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 32, 0)

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
// Flaky on crbug.com/1026149
#define MAYBE_TestSetSelection
#else
#define MAYBE_TestSetSelection
#endif
IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       MAYBE_TestSetSelection) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       SetSelectionWithIgnoredObjects) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, TestAtkTextListItem) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestTextSelectionChangedDuplicateSignals) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestTextSelectionAcrossElements) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       SetCaretInTextWithGeneratedContent) {}

// TODO(crbug.com/41469621): This flakes on linux.
IN_PROC_BROWSER_TEST_F(
    AccessibilityAuraLinuxBrowserTest,
    DISABLED_TestSetCaretSetsSequentialFocusNavigationStartingPoint) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       SelectionTriggersReparentingOnSelectionStart) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       SelectionTriggersAnchorDeletionOnSelectionStart) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       SelectionTriggersFocusDeletionOnSelectionStart) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       SelectionTriggersReparentingOnFocus) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestFocusInputTextFields) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestTextEventsInStaticText) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TextAttributesInInputWithAriaHidden) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestFindInPageEvents) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestOffsetsOfSelectionAll) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       UniqueIdIsStableAfterRoleChange) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       UniqueIdIsStableAfterLayoutObjectReplacement) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestGetIndexInParent) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       HitTestOnAncestorOfWebRoot) {}

// Tests if it does not DCHECK when textarea has a placeholder break element.
IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestGetTextContainerFromTextArea) {}

IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest,
                       TestCaretMovedInNumberInput) {}

}  // namespace content