blob: 6cecee0088aefc6c53d764962975481f6c9d5387 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/optional.h"
@protocol NSAccessibility;
namespace ui {
struct NSAXTreeProblemDetails {
enum ProblemType {
// |node_a| (the child node) is not a child of |node_b| (its parent).
// |node_a| (the child node) is a child of |node_b|, but |node_a|'s parent
// is |node_c| instead.
// |node_a| (a supplied root node) is non-nil but does not conform to
// NSAccessibility.
// |node_a| (the child node)'s parent |node_b| is non-nil but does not
// conform to NSAccessibility.
NSAXTreeProblemDetails(ProblemType type, id node_a, id node_b, id node_c);
ProblemType type;
// These aren't id<NSAccessibility> because some kinds of problem are caused
// by them not conforming to NSAccessibility.
id node_a;
id node_b;
id node_c;
std::string ToString();
// Validates the accessibility tree rooted at |root|. If at least one problem is
// found, returns an |AXTreeProblemDetails| as described above; if not, returns
// base::nullopt.
base::Optional<NSAXTreeProblemDetails> ValidateNSAXTree(
id<NSAccessibility> root,
size_t* nodes_visited);
// Prints the accessibility tree rooted at |root|. This function is useful for
// debugging failures of ValidateNSAXTree tests.
void PrintNSAXTree(id<NSAccessibility> root);
} // ui