diff options
author | dmazzoni <dmazzoni@chromium.org> | 2015-08-06 18:02:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-07 01:03:09 +0000 |
commit | 1efe8793da85ee6e25185175047c077adfe8e55c (patch) | |
tree | 3da8b088c3c997fca1d8b4e652819f8db1e415d9 /content/browser/accessibility/site_per_process_accessibility_browsertest.cc | |
parent | f54108dd9aa8b43982c206442664cb325cd792d7 (diff) | |
download | chromium_src-1efe8793da85ee6e25185175047c077adfe8e55c.zip chromium_src-1efe8793da85ee6e25185175047c077adfe8e55c.tar.gz chromium_src-1efe8793da85ee6e25185175047c077adfe8e55c.tar.bz2 |
Get rid of FrameAccessibility using AXTreeIDs
Depends on:
https://codereview.chromium.org/1257093005/
Instead of keeping track of the relationship between
frames in FrameAccessibility, create a subclass of
AXNodeData that's only allowed to be used within
the content module, and once an AX tree is received
in the browser process, convert routing IDs to
global AXTreeIDs that can be stored AXNodeData.
BUG=368298
Review URL: https://codereview.chromium.org/1267663002
Cr-Commit-Position: refs/heads/master@{#342251}
Diffstat (limited to 'content/browser/accessibility/site_per_process_accessibility_browsertest.cc')
-rw-r--r-- | content/browser/accessibility/site_per_process_accessibility_browsertest.cc | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/content/browser/accessibility/site_per_process_accessibility_browsertest.cc b/content/browser/accessibility/site_per_process_accessibility_browsertest.cc index 75abf1a..192b11c 100644 --- a/content/browser/accessibility/site_per_process_accessibility_browsertest.cc +++ b/content/browser/accessibility/site_per_process_accessibility_browsertest.cc @@ -38,6 +38,18 @@ class SitePerProcessAccessibilityBrowserTest SitePerProcessAccessibilityBrowserTest() {} }; +bool AccessibilityTreeContainsDocTitle( + BrowserAccessibility* node, + const std::string& title) { + if (node->GetStringAttribute(ui::AX_ATTR_DOC_TITLE) == title) + return true; + for (unsigned i = 0; i < node->PlatformChildCount(); i++) { + if (AccessibilityTreeContainsDocTitle(node->PlatformGetChild(i), title)) + return true; + } + return false; +} + // Utility function to determine if an accessibility tree has finished loading // or if the tree represents a page that hasn't finished loading yet. bool AccessibilityTreeIsLoaded(BrowserAccessibilityManager* manager) { @@ -96,25 +108,16 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, main_frame->browser_accessibility_manager(); VLOG(1) << "Main frame accessibility tree:\n" << main_frame_manager->SnapshotAXTreeForTesting().ToString(); - EXPECT_TRUE(AccessibilityTreeIsLoaded(main_frame_manager)); - // Next, wait for the accessibility tree from the cross-process iframe - // to load. Since accessibility was enabled at the time this frame was - // created, we need to check to see if it's already loaded first, and - // only create an AccessibilityNotificationWaiter if it's not. RenderFrameHostImpl* child_frame = static_cast<RenderFrameHostImpl*>( child->current_frame_host()); - BrowserAccessibilityManager* child_frame_manager = - child_frame->browser_accessibility_manager(); - if (!AccessibilityTreeIsLoaded(child_frame_manager)) { - VLOG(1) << "Child frame accessibility tree is not loaded, waiting..."; - AccessibilityNotificationWaiter child_frame_accessibility_waiter( - child_frame, ui::AX_EVENT_LOAD_COMPLETE); - child_frame_accessibility_waiter.WaitForNotification(); + while (!AccessibilityTreeContainsDocTitle(main_frame_manager->GetRoot(), + "Title Of Awesomeness")) { + AccessibilityNotificationWaiter accessibility_waiter(main_frame, + ui::AX_EVENT_NONE); + accessibility_waiter.ListenToAdditionalFrame(child_frame); + accessibility_waiter.WaitForNotification(); } - EXPECT_TRUE(AccessibilityTreeIsLoaded(child_frame_manager)); - VLOG(1) << "Child frame accessibility tree:\n" - << child_frame_manager->SnapshotAXTreeForTesting().ToString(); // Assert that we can walk from the main frame down into the child frame // directly, getting correct roles and data along the way. |