| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/accessibility/browser_accessibility.h" | 8 #include "content/browser/accessibility/browser_accessibility.h" |
| 9 #include "content/browser/accessibility/browser_accessibility_manager.h" | 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 class SitePerProcessAccessibilityBrowserTest | 35 class SitePerProcessAccessibilityBrowserTest |
| 36 : public SitePerProcessBrowserTest { | 36 : public SitePerProcessBrowserTest { |
| 37 public: | 37 public: |
| 38 SitePerProcessAccessibilityBrowserTest() {} | 38 SitePerProcessAccessibilityBrowserTest() {} |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 bool AccessibilityTreeContainsDocTitle( | 41 bool AccessibilityTreeContainsDocTitle( |
| 42 BrowserAccessibility* node, | 42 BrowserAccessibility* node, |
| 43 const std::string& title) { | 43 const std::string& title) { |
| 44 if (node->GetStringAttribute(ui::AX_ATTR_DOC_TITLE) == title) | 44 if (node->GetStringAttribute(ui::AX_ATTR_NAME) == title) |
| 45 return true; | 45 return true; |
| 46 for (unsigned i = 0; i < node->PlatformChildCount(); i++) { | 46 for (unsigned i = 0; i < node->PlatformChildCount(); i++) { |
| 47 if (AccessibilityTreeContainsDocTitle(node->PlatformGetChild(i), title)) | 47 if (AccessibilityTreeContainsDocTitle(node->PlatformGetChild(i), title)) |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Utility function to determine if an accessibility tree has finished loading | 53 // Utility function to determine if an accessibility tree has finished loading |
| 54 // or if the tree represents a page that hasn't finished loading yet. | 54 // or if the tree represents a page that hasn't finished loading yet. |
| 55 bool AccessibilityTreeIsLoaded(BrowserAccessibilityManager* manager) { | 55 bool AccessibilityTreeIsLoaded(BrowserAccessibilityManager* manager) { |
| 56 BrowserAccessibility* root = manager->GetRoot(); | 56 return (manager->GetTreeData().loading_progress == 1.0 && |
| 57 return (root->GetFloatAttribute(ui::AX_ATTR_DOC_LOADING_PROGRESS) == 1.0 && | 57 manager->GetTreeData().url != url::kAboutBlankURL); |
| 58 root->GetStringAttribute(ui::AX_ATTR_DOC_URL) != url::kAboutBlankURL); | |
| 59 } | 58 } |
| 60 | 59 |
| 61 // Times out on Android, not clear if it's an actual bug or just slow. | 60 // Times out on Android, not clear if it's an actual bug or just slow. |
| 62 #if defined(OS_ANDROID) | 61 #if defined(OS_ANDROID) |
| 63 #define MAYBE_CrossSiteIframeAccessibility DISABLED_CrossSiteIframeAccessibility | 62 #define MAYBE_CrossSiteIframeAccessibility DISABLED_CrossSiteIframeAccessibility |
| 64 #else | 63 #else |
| 65 #define MAYBE_CrossSiteIframeAccessibility CrossSiteIframeAccessibility | 64 #define MAYBE_CrossSiteIframeAccessibility CrossSiteIframeAccessibility |
| 66 #endif | 65 #endif |
| 67 IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, | 66 IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, |
| 68 MAYBE_CrossSiteIframeAccessibility) { | 67 MAYBE_CrossSiteIframeAccessibility) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 BrowserAccessibility* ax_child_frame_static_text = | 146 BrowserAccessibility* ax_child_frame_static_text = |
| 148 ax_child_frame_group->PlatformGetChild(0); | 147 ax_child_frame_group->PlatformGetChild(0); |
| 149 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); | 148 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); |
| 150 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); | 149 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); |
| 151 | 150 |
| 152 // Last, check that the parent of the child frame root is correct. | 151 // Last, check that the parent of the child frame root is correct. |
| 153 EXPECT_EQ(ax_child_frame_root->GetParent(), ax_iframe); | 152 EXPECT_EQ(ax_child_frame_root->GetParent(), ax_iframe); |
| 154 } | 153 } |
| 155 | 154 |
| 156 } // namespace content | 155 } // namespace content |
| OLD | NEW |