#include "ui/accessibility/platform/inspect/ax_inspect_test_helper.h"
#include <string>
#include <vector>
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/accessibility_switches.h"
#include "ui/accessibility/platform/inspect/ax_api_type.h"
#include "ui/accessibility/platform/inspect/ax_inspect_scenario.h"
#include "ui/base/buildflags.h"
#if BUILDFLAG(USE_ATK)
extern "C" {
#include <atk/atk.h>
}
#endif
#if BUILDFLAG(IS_MAC)
#include "base/mac/mac_util.h"
#endif
namespace ui {
FilePath;
namespace {
constexpr char kCommentToken = …;
constexpr char kMarkSkipFile[] = …;
constexpr char kSignalDiff[] = …;
constexpr char kMarkEndOfFile[] = …;
InitializeFeatureList;
struct TypeInfo { … };
constexpr TypeInfo kTypeInfos[] = …;
const TypeInfo::Mapping* TypeMapping(const std::string& type) { … }
#if BUILDFLAG(USE_ATK)
bool is_atk_version_supported() { … }
#endif
}
AXInspectTestHelper::AXInspectTestHelper(AXApiType::Type type)
: … { … }
AXInspectTestHelper::AXInspectTestHelper(const char* expectation_type)
: … { … }
base::FilePath AXInspectTestHelper::GetExpectationFilePath(
const base::FilePath& test_file_path,
const base::FilePath::StringType& expectations_qualifier) { … }
void AXInspectTestHelper::InitializeFeatureList() { … }
void AXInspectTestHelper::ResetFeatureList() { … }
AXInspectScenario AXInspectTestHelper::ParseScenario(
const std::vector<std::string>& lines,
const std::vector<AXPropertyFilter>& default_filters) { … }
std::optional<AXInspectScenario> AXInspectTestHelper::ParseScenario(
const base::FilePath& scenario_path,
const std::vector<AXPropertyFilter>& default_filters) { … }
std::vector<AXApiType::Type> AXInspectTestHelper::TreeTestPasses() { … }
std::vector<AXApiType::Type> AXInspectTestHelper::EventTestPasses() { … }
std::optional<std::vector<std::string>>
AXInspectTestHelper::LoadExpectationFile(const base::FilePath& expected_file) { … }
bool AXInspectTestHelper::ValidateAgainstExpectation(
const base::FilePath& test_file_path,
const base::FilePath& expected_file,
const std::vector<std::string>& actual_lines,
const std::vector<std::string>& expected_lines) { … }
FilePath::StringType AXInspectTestHelper::GetExpectedFileSuffix(
const base::FilePath::StringType& expectations_qualifier) const { … }
FilePath::StringType AXInspectTestHelper::GetVersionSpecificExpectedFileSuffix(
const base::FilePath::StringType& expectations_qualifier) const { … }
std::vector<int> AXInspectTestHelper::DiffLines(
const std::vector<std::string>& expected_lines,
const std::vector<std::string>& actual_lines) { … }
}