| 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 "content/browser/accessibility/browser_accessibility.h" | 7 #include "content/browser/accessibility/browser_accessibility.h" |
| 8 #include "content/browser/accessibility/browser_accessibility_manager.h" | 8 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 9 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 9 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 10 #include "content/browser/frame_host/cross_process_frame_connector.h" | 10 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 GURL::Replacements replace_host; | 79 GURL::Replacements replace_host; |
| 80 std::string foo_com("foo.com"); | 80 std::string foo_com("foo.com"); |
| 81 | 81 |
| 82 // Load cross-site page into iframe. | 82 // Load cross-site page into iframe. |
| 83 GURL cross_site_url(test_server()->GetURL("files/title2.html")); | 83 GURL cross_site_url(test_server()->GetURL("files/title2.html")); |
| 84 replace_host.SetHostStr(foo_com); | 84 replace_host.SetHostStr(foo_com); |
| 85 cross_site_url = cross_site_url.ReplaceComponents(replace_host); | 85 cross_site_url = cross_site_url.ReplaceComponents(replace_host); |
| 86 NavigateFrameToURL(root->child_at(0), cross_site_url); | 86 NavigateFrameToURL(root->child_at(0), cross_site_url); |
| 87 | 87 |
| 88 // Ensure that we have created a new process for the subframe. | 88 // Ensure that we have created a new process for the subframe. |
| 89 ASSERT_EQ(1U, root->child_count()); | 89 ASSERT_EQ(2U, root->child_count()); |
| 90 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); | 90 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
| 91 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); | 91 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
| 92 | 92 |
| 93 // Wait until the accessibility tree from both the main frame and | 93 // Wait until the accessibility tree from both the main frame and |
| 94 // cross-process iframe load. | 94 // cross-process iframe load. |
| 95 RenderFrameHostImpl* child_frame = static_cast<RenderFrameHostImpl*>( | 95 RenderFrameHostImpl* child_frame = static_cast<RenderFrameHostImpl*>( |
| 96 child->current_frame_host()); | 96 child->current_frame_host()); |
| 97 AccessibilityNotificationWaiter child_frame_accessibility_waiter( | 97 AccessibilityNotificationWaiter child_frame_accessibility_waiter( |
| 98 child_frame, ui::AX_EVENT_NONE); | 98 child_frame, ui::AX_EVENT_NONE); |
| 99 main_frame_accessibility_waiter.WaitForNotification(); | 99 main_frame_accessibility_waiter.WaitForNotification(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 112 << child_frame_manager->SnapshotAXTreeForTesting().ToString(); | 112 << child_frame_manager->SnapshotAXTreeForTesting().ToString(); |
| 113 | 113 |
| 114 // Assert that we can walk from the main frame down into the child frame | 114 // Assert that we can walk from the main frame down into the child frame |
| 115 // directly, getting correct roles and data along the way. | 115 // directly, getting correct roles and data along the way. |
| 116 BrowserAccessibility* ax_root = main_frame_manager->GetRoot(); | 116 BrowserAccessibility* ax_root = main_frame_manager->GetRoot(); |
| 117 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_root->GetRole()); | 117 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_root->GetRole()); |
| 118 ASSERT_EQ(1U, ax_root->PlatformChildCount()); | 118 ASSERT_EQ(1U, ax_root->PlatformChildCount()); |
| 119 | 119 |
| 120 BrowserAccessibility* ax_group = ax_root->PlatformGetChild(0); | 120 BrowserAccessibility* ax_group = ax_root->PlatformGetChild(0); |
| 121 ASSERT_EQ(ui::AX_ROLE_GROUP, ax_group->GetRole()); | 121 ASSERT_EQ(ui::AX_ROLE_GROUP, ax_group->GetRole()); |
| 122 ASSERT_EQ(1U, ax_group->PlatformChildCount()); | 122 ASSERT_EQ(2U, ax_group->PlatformChildCount()); |
| 123 | 123 |
| 124 BrowserAccessibility* ax_iframe = ax_group->PlatformGetChild(0); | 124 BrowserAccessibility* ax_iframe = ax_group->PlatformGetChild(0); |
| 125 ASSERT_EQ(ui::AX_ROLE_IFRAME, ax_iframe->GetRole()); | 125 ASSERT_EQ(ui::AX_ROLE_IFRAME, ax_iframe->GetRole()); |
| 126 ASSERT_EQ(1U, ax_iframe->PlatformChildCount()); | 126 ASSERT_EQ(1U, ax_iframe->PlatformChildCount()); |
| 127 | 127 |
| 128 BrowserAccessibility* ax_scroll_area = ax_iframe->PlatformGetChild(0); | 128 BrowserAccessibility* ax_scroll_area = ax_iframe->PlatformGetChild(0); |
| 129 ASSERT_EQ(ui::AX_ROLE_SCROLL_AREA, ax_scroll_area->GetRole()); | 129 ASSERT_EQ(ui::AX_ROLE_SCROLL_AREA, ax_scroll_area->GetRole()); |
| 130 ASSERT_EQ(1U, ax_scroll_area->PlatformChildCount()); | 130 ASSERT_EQ(1U, ax_scroll_area->PlatformChildCount()); |
| 131 | 131 |
| 132 BrowserAccessibility* ax_child_frame_root = | 132 BrowserAccessibility* ax_child_frame_root = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 143 BrowserAccessibility* ax_child_frame_static_text = | 143 BrowserAccessibility* ax_child_frame_static_text = |
| 144 ax_child_frame_group->PlatformGetChild(0); | 144 ax_child_frame_group->PlatformGetChild(0); |
| 145 ASSERT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); | 145 ASSERT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); |
| 146 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); | 146 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); |
| 147 | 147 |
| 148 // Last, check that the parent of the child frame root is correct. | 148 // Last, check that the parent of the child frame root is correct. |
| 149 ASSERT_EQ(ax_child_frame_root->GetParent(), ax_scroll_area); | 149 ASSERT_EQ(ax_child_frame_root->GetParent(), ax_scroll_area); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace content | 152 } // namespace content |
| OLD | NEW |