#include "content/browser/accessibility/dump_accessibility_browsertest_base.h"
#include <set>
#include <string>
#include <vector>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/escape.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_command_line.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/public/browser/ax_inspect_factory.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_paths.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/accessibility_notification_waiter.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/test/content_browser_test_utils_internal.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/ax_node.h"
#include "ui/accessibility/ax_role_properties.h"
#include "ui/accessibility/platform/browser_accessibility.h"
#include "ui/accessibility/platform/browser_accessibility_manager.h"
#include "ui/base/ui_base_features.h"
#if BUILDFLAG(IS_ANDROID)
#include "ui/accessibility/android/accessibility_state.h"
#endif
namespace content {
namespace {
bool SkipUrlMatch(const std::vector<std::string>& skip_urls,
const std::string& url) { … }
bool ShouldHaveChildTree(const ui::AXNode& node,
const std::vector<std::string>& skip_urls) { … }
class AXTreeChangeWaiter : public ui::AXTreeObserver { … };
void WaitForChildTrees(const ui::AXNode& node,
const std::vector<std::string>& skip_urls) { … }
bool IsLoadedDocWithUrl(const ui::BrowserAccessibility* node,
const std::string& url) { … }
unsigned SearchLoadedDocsWithUrlInAccessibilityTree(
const ui::BrowserAccessibility* node,
const std::string& url,
unsigned num_expected) { … }
}
AXPropertyFilter;
AXTreeFormatter;
DumpAccessibilityTestBase::DumpAccessibilityTestBase()
: … { … }
DumpAccessibilityTestBase::~DumpAccessibilityTestBase() { … }
void DumpAccessibilityTestBase::SetUpCommandLine(
base::CommandLine* command_line) { … }
void DumpAccessibilityTestBase::SetUpOnMainThread() { … }
void DumpAccessibilityTestBase::SetUp() { … }
void DumpAccessibilityTestBase::TearDown() { … }
void DumpAccessibilityTestBase::SignalRunTestOnMainThread(int) { … }
void DumpAccessibilityTestBase::ChooseFeatures(
std::vector<base::test::FeatureRef>* enabled_features,
std::vector<base::test::FeatureRef>* disabled_features) { … }
std::string DumpAccessibilityTestBase::DumpTreeAsString() const { … }
std::string
DumpAccessibilityTestBase::DumpUnfilteredAccessibilityTreeAsString() { … }
void DumpAccessibilityTestBase::RunTest(
ui::AXMode mode,
const base::FilePath file_path,
const char* file_dir,
const base::FilePath::StringType& expectations_qualifier) { … }
void DumpAccessibilityTestBase::RunTest(
const base::FilePath file_path,
const char* file_dir,
const base::FilePath::StringType& expectations_qualifier) { … }
void DumpAccessibilityTestBase::WaitForEndOfTest(ui::AXMode mode) const { … }
void DumpAccessibilityTestBase::PerformAndWaitForDefaultActions(
ui::AXMode mode) { … }
void DumpAccessibilityTestBase::WaitForExpectedText(ui::AXMode mode) { … }
void DumpAccessibilityTestBase::WaitForFinalTreeContents(ui::AXMode mode) { … }
void DumpAccessibilityTestBase::RunTestForPlatform(
ui::AXMode mode,
const base::FilePath file_path,
const char* file_dir,
const base::FilePath::StringType& expectations_qualifier) { … }
std::map<std::string, unsigned> DumpAccessibilityTestBase::CollectAllFrameUrls(
const std::vector<std::string>& skip_urls) { … }
void DumpAccessibilityTestBase::WaitForAllFramesLoaded(ui::AXMode mode) { … }
ui::BrowserAccessibility* DumpAccessibilityTestBase::FindNode(
const std::string& name,
ui::BrowserAccessibility* search_root) const { … }
ui::BrowserAccessibilityManager* DumpAccessibilityTestBase::GetManager() const { … }
WebContentsImpl* DumpAccessibilityTestBase::GetWebContents() const { … }
std::unique_ptr<AXTreeFormatter> DumpAccessibilityTestBase::CreateFormatter()
const { … }
std::pair<EvalJsResult, std::vector<std::string>>
DumpAccessibilityTestBase::CaptureEvents(InvokeAction invoke_action,
ui::AXMode mode) { … }
ui::BrowserAccessibility* DumpAccessibilityTestBase::FindNodeInSubtree(
ui::BrowserAccessibility& node,
const std::string& name) const { … }
ui::BrowserAccessibility* DumpAccessibilityTestBase::FindNodeByStringAttribute(
const ax::mojom::StringAttribute attr,
const std::string& value) const { … }
ui::BrowserAccessibility*
DumpAccessibilityTestBase::FindNodeByStringAttributeInSubtree(
ui::BrowserAccessibility& node,
const ax::mojom::StringAttribute attr,
const std::string& value) const { … }
void DumpAccessibilityTestBase::UseHttpsTestServer() { … }
}