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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 GURL::Replacements replace_host; | 73 GURL::Replacements replace_host; |
74 std::string foo_com("foo.com"); | 74 std::string foo_com("foo.com"); |
75 | 75 |
76 // Load cross-site page into iframe. | 76 // Load cross-site page into iframe. |
77 GURL cross_site_url(test_server()->GetURL("files/title2.html")); | 77 GURL cross_site_url(test_server()->GetURL("files/title2.html")); |
78 replace_host.SetHostStr(foo_com); | 78 replace_host.SetHostStr(foo_com); |
79 cross_site_url = cross_site_url.ReplaceComponents(replace_host); | 79 cross_site_url = cross_site_url.ReplaceComponents(replace_host); |
80 NavigateFrameToURL(root->child_at(0), cross_site_url); | 80 NavigateFrameToURL(root->child_at(0), cross_site_url); |
81 | 81 |
82 // Ensure that we have created a new process for the subframe. | 82 // Ensure that we have created a new process for the subframe. |
83 ASSERT_EQ(2U, root->child_count()); | 83 ASSERT_EQ(1U, root->child_count()); |
84 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); | 84 SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
85 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); | 85 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
86 | 86 |
87 // Wait until the accessibility tree from both the main frame and | 87 // Wait until the accessibility tree from both the main frame and |
88 // cross-process iframe load. | 88 // cross-process iframe load. |
89 RenderFrameHostImpl* child_frame = static_cast<RenderFrameHostImpl*>( | 89 RenderFrameHostImpl* child_frame = static_cast<RenderFrameHostImpl*>( |
90 child->current_frame_host()); | 90 child->current_frame_host()); |
91 AccessibilityNotificationWaiter child_frame_accessibility_waiter( | 91 AccessibilityNotificationWaiter child_frame_accessibility_waiter( |
92 child_frame, ui::AX_EVENT_NONE); | 92 child_frame, ui::AX_EVENT_NONE); |
93 main_frame_accessibility_waiter.WaitForNotification(); | 93 main_frame_accessibility_waiter.WaitForNotification(); |
(...skipping 12 matching lines...) Expand all Loading... |
106 << child_frame_manager->SnapshotAXTreeForTesting().ToString(); | 106 << child_frame_manager->SnapshotAXTreeForTesting().ToString(); |
107 | 107 |
108 // Assert that we can walk from the main frame down into the child frame | 108 // Assert that we can walk from the main frame down into the child frame |
109 // directly, getting correct roles and data along the way. | 109 // directly, getting correct roles and data along the way. |
110 BrowserAccessibility* ax_root = main_frame_manager->GetRoot(); | 110 BrowserAccessibility* ax_root = main_frame_manager->GetRoot(); |
111 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_root->GetRole()); | 111 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_root->GetRole()); |
112 ASSERT_EQ(1U, ax_root->PlatformChildCount()); | 112 ASSERT_EQ(1U, ax_root->PlatformChildCount()); |
113 | 113 |
114 BrowserAccessibility* ax_group = ax_root->PlatformGetChild(0); | 114 BrowserAccessibility* ax_group = ax_root->PlatformGetChild(0); |
115 ASSERT_EQ(ui::AX_ROLE_GROUP, ax_group->GetRole()); | 115 ASSERT_EQ(ui::AX_ROLE_GROUP, ax_group->GetRole()); |
116 ASSERT_EQ(2U, ax_group->PlatformChildCount()); | 116 ASSERT_EQ(1U, ax_group->PlatformChildCount()); |
117 | 117 |
118 BrowserAccessibility* ax_iframe = ax_group->PlatformGetChild(0); | 118 BrowserAccessibility* ax_iframe = ax_group->PlatformGetChild(0); |
119 ASSERT_EQ(ui::AX_ROLE_IFRAME, ax_iframe->GetRole()); | 119 ASSERT_EQ(ui::AX_ROLE_IFRAME, ax_iframe->GetRole()); |
120 ASSERT_EQ(1U, ax_iframe->PlatformChildCount()); | 120 ASSERT_EQ(1U, ax_iframe->PlatformChildCount()); |
121 | 121 |
122 BrowserAccessibility* ax_scroll_area = ax_iframe->PlatformGetChild(0); | 122 BrowserAccessibility* ax_scroll_area = ax_iframe->PlatformGetChild(0); |
123 ASSERT_EQ(ui::AX_ROLE_SCROLL_AREA, ax_scroll_area->GetRole()); | 123 ASSERT_EQ(ui::AX_ROLE_SCROLL_AREA, ax_scroll_area->GetRole()); |
124 ASSERT_EQ(1U, ax_scroll_area->PlatformChildCount()); | 124 ASSERT_EQ(1U, ax_scroll_area->PlatformChildCount()); |
125 | 125 |
126 BrowserAccessibility* ax_child_frame_root = | 126 BrowserAccessibility* ax_child_frame_root = |
(...skipping 10 matching lines...) Expand all Loading... |
137 BrowserAccessibility* ax_child_frame_static_text = | 137 BrowserAccessibility* ax_child_frame_static_text = |
138 ax_child_frame_group->PlatformGetChild(0); | 138 ax_child_frame_group->PlatformGetChild(0); |
139 ASSERT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); | 139 ASSERT_EQ(ui::AX_ROLE_STATIC_TEXT, ax_child_frame_static_text->GetRole()); |
140 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); | 140 ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); |
141 | 141 |
142 // Last, check that the parent of the child frame root is correct. | 142 // Last, check that the parent of the child frame root is correct. |
143 ASSERT_EQ(ax_child_frame_root->GetParent(), ax_scroll_area); | 143 ASSERT_EQ(ax_child_frame_root->GetParent(), ax_scroll_area); |
144 } | 144 } |
145 | 145 |
146 } // namespace content | 146 } // namespace content |
OLD | NEW |