| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_TEST_UTILS_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_TEST_UTILS_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 namespace content { |
| 11 |
| 12 class BrowserAccessibility; |
| 13 class WebContents; |
| 14 |
| 15 // Search recursively through the accessibility tree rooted at |node| |
| 16 // and return true if any descendant (including in child frames) has |
| 17 // a name (ui::AX_ATTR_NAME) that matches |name| exactly. |
| 18 bool AccessibilityTreeContainsNodeWithName(BrowserAccessibility* node, |
| 19 const std::string& name); |
| 20 |
| 21 // This is intended to be a robust way to assert that the accessibility |
| 22 // tree eventually gets into the correct state, without worrying about |
| 23 // the exact ordering of events received while getting there. |
| 24 // |
| 25 // Searches the accessibility tree to see if any node's accessible name |
| 26 // is equal to the given name. If not, sets up a notification waiter |
| 27 // that listens for any accessibility event in any frame, and checks again |
| 28 // after each event. Keeps looping until the text is found (or the |
| 29 // test times out). |
| 30 void WaitForAccessibilityTreeToContainNodeWithName(WebContents* web_contents, |
| 31 const std::string& name); |
| 32 |
| 33 } // namespace content |
| 34 |
| 35 #endif // CONTENT_BROWSER_ACCESSIBILITY_ACCESSIBILITY_TEST_UTILS_H_ |
| OLD | NEW |