| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/accessibility/browser_accessibility.h" | 9 #include "content/browser/accessibility/browser_accessibility.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 VLOG(1) << "Main frame accessibility tree:\n" | 101 VLOG(1) << "Main frame accessibility tree:\n" |
| 102 << main_frame_manager->SnapshotAXTreeForTesting().ToString(); | 102 << main_frame_manager->SnapshotAXTreeForTesting().ToString(); |
| 103 | 103 |
| 104 // Assert that we can walk from the main frame down into the child frame | 104 // Assert that we can walk from the main frame down into the child frame |
| 105 // directly, getting correct roles and data along the way. | 105 // directly, getting correct roles and data along the way. |
| 106 BrowserAccessibility* ax_root = main_frame_manager->GetRoot(); | 106 BrowserAccessibility* ax_root = main_frame_manager->GetRoot(); |
| 107 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_root->GetRole()); | 107 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_root->GetRole()); |
| 108 ASSERT_EQ(1U, ax_root->PlatformChildCount()); | 108 ASSERT_EQ(1U, ax_root->PlatformChildCount()); |
| 109 | 109 |
| 110 BrowserAccessibility* ax_group = ax_root->PlatformGetChild(0); | 110 BrowserAccessibility* ax_group = ax_root->PlatformGetChild(0); |
| 111 EXPECT_EQ(ui::AX_ROLE_GROUP, ax_group->GetRole()); | 111 EXPECT_EQ(ui::AX_ROLE_GENERIC_CONTAINER, ax_group->GetRole()); |
| 112 ASSERT_EQ(2U, ax_group->PlatformChildCount()); | 112 ASSERT_EQ(2U, ax_group->PlatformChildCount()); |
| 113 | 113 |
| 114 BrowserAccessibility* ax_iframe = ax_group->PlatformGetChild(0); | 114 BrowserAccessibility* ax_iframe = ax_group->PlatformGetChild(0); |
| 115 EXPECT_EQ(ui::AX_ROLE_IFRAME, ax_iframe->GetRole()); | 115 EXPECT_EQ(ui::AX_ROLE_IFRAME, ax_iframe->GetRole()); |
| 116 ASSERT_EQ(1U, ax_iframe->PlatformChildCount()); | 116 ASSERT_EQ(1U, ax_iframe->PlatformChildCount()); |
| 117 | 117 |
| 118 BrowserAccessibility* ax_child_frame_root = ax_iframe->PlatformGetChild(0); | 118 BrowserAccessibility* ax_child_frame_root = ax_iframe->PlatformGetChild(0); |
| 119 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_child_frame_root->GetRole()); | 119 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_child_frame_root->GetRole()); |
| 120 ASSERT_EQ(1U, ax_child_frame_root->PlatformChildCount()); | 120 ASSERT_EQ(1U, ax_child_frame_root->PlatformChildCount()); |
| 121 EXPECT_EQ("Title Of Awesomeness", | 121 EXPECT_EQ("Title Of Awesomeness", |
| 122 ax_child_frame_root->GetStringAttribute(ui::AX_ATTR_NAME)); | 122 ax_child_frame_root->GetStringAttribute(ui::AX_ATTR_NAME)); |
| 123 | 123 |
| 124 BrowserAccessibility* ax_child_frame_group = | 124 BrowserAccessibility* ax_child_frame_group = |
| 125 ax_child_frame_root->PlatformGetChild(0); | 125 ax_child_frame_root->PlatformGetChild(0); |
| 126 EXPECT_EQ(ui::AX_ROLE_GROUP, ax_child_frame_group->GetRole()); | 126 EXPECT_EQ(ui::AX_ROLE_GENERIC_CONTAINER, ax_child_frame_group->GetRole()); |
| 127 ASSERT_EQ(1U, ax_child_frame_group->PlatformChildCount()); | 127 ASSERT_EQ(1U, ax_child_frame_group->PlatformChildCount()); |
| 128 | 128 |
| 129 BrowserAccessibility* ax_child_frame_static_text = | 129 BrowserAccessibility* ax_child_frame_static_text = |
| 130 ax_child_frame_group->PlatformGetChild(0); | 130 ax_child_frame_group->PlatformGetChild(0); |
| 131 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); | 131 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); |
| 132 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); | 132 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); |
| 133 | 133 |
| 134 // Last, check that the parent of the child frame root is correct. | 134 // Last, check that the parent of the child frame root is correct. |
| 135 EXPECT_EQ(ax_child_frame_root->PlatformGetParent(), ax_iframe); | 135 EXPECT_EQ(ax_child_frame_root->PlatformGetParent(), ax_iframe); |
| 136 } | 136 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 159 // Load second cross-site page into iframe and wait for text from that | 159 // Load second cross-site page into iframe and wait for text from that |
| 160 // page to appear in the accessibility tree. If this succeeds and doesn't | 160 // page to appear in the accessibility tree. If this succeeds and doesn't |
| 161 // time out, the test passes. | 161 // time out, the test passes. |
| 162 LoadCrossSitePageIntoFrame(child, "/title2.html", "bar.com"); | 162 LoadCrossSitePageIntoFrame(child, "/title2.html", "bar.com"); |
| 163 WaitForAccessibilityTreeToContainNodeWithName( | 163 WaitForAccessibilityTreeToContainNodeWithName( |
| 164 shell()->web_contents(), | 164 shell()->web_contents(), |
| 165 "Title Of Awesomeness"); | 165 "Title Of Awesomeness"); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace content | 168 } // namespace content |
| OLD | NEW |