Index: content/browser/accessibility/site_per_process_accessibility_browsertest.cc |
diff --git a/content/browser/accessibility/site_per_process_accessibility_browsertest.cc b/content/browser/accessibility/site_per_process_accessibility_browsertest.cc |
index bf9c189a202c3e799a298c35aaa38893cbc5d8fd..4dc6906cac1b5a1cd2f2480ce0b20c570e4668f9 100644 |
--- a/content/browser/accessibility/site_per_process_accessibility_browsertest.cc |
+++ b/content/browser/accessibility/site_per_process_accessibility_browsertest.cc |
@@ -58,10 +58,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, |
// Enable full accessibility for all current and future WebContents. |
BrowserAccessibilityState::GetInstance()->EnableAccessibility(); |
- AccessibilityNotificationWaiter main_frame_accessibility_waiter( |
- shell(), AccessibilityModeComplete, |
- ui::AX_EVENT_LOAD_COMPLETE); |
- |
host_resolver()->AddRule("*", "127.0.0.1"); |
ASSERT_TRUE(test_server()->Start()); |
GURL main_url(test_server()->GetURL("files/site_per_process_main.html")); |
@@ -78,6 +74,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, |
NavigateFrameToURL(child, http_url); |
// Load cross-site page into iframe. |
+ RenderFrameHostImpl* child_rfh = |
+ child->render_manager()->current_frame_host(); |
GURL::Replacements replace_host; |
GURL cross_site_url(test_server()->GetURL("files/title2.html")); |
replace_host.SetHostStr("foo.com"); |
@@ -89,9 +87,15 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, |
SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance(); |
EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance); |
- // Wait for the accessibility tree from the main frame to load. |
- // Because we created the AccessibilityNotificationWaiter before accessibility |
- // was enabled, we're guaranteed to get a LOAD_COMPLETE event. |
+ // Wait until the iframe completes the swap. |
+ RenderFrameHostDeletedObserver rfhdo(child_rfh); |
+ rfhdo.WaitUntilDeleted(); |
+ |
+ // Waits for the event that modifies the iframe in the accessibility tree. |
+ // This event is sent immediatelly after the swap. |
+ AccessibilityNotificationWaiter main_frame_accessibility_waiter( |
dmazzoni
2015/05/28 19:12:10
Be careful about constructing the waiter too late.
lfg
2015/05/29 19:23:29
That's why I had the RFHostDeletedObserver right a
dmazzoni
2015/05/29 19:37:23
Yes, but I believe it's possible that the accessib
|
+ shell(), AccessibilityModeComplete, |
+ ui::AX_EVENT_CHILDREN_CHANGED); |
main_frame_accessibility_waiter.WaitForNotification(); |
RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>( |
@@ -130,16 +134,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, |
EXPECT_EQ(ui::AX_ROLE_GROUP, ax_group->GetRole()); |
ASSERT_EQ(2U, ax_group->PlatformChildCount()); |
- BrowserAccessibility* ax_iframe = ax_group->PlatformGetChild(0); |
- EXPECT_EQ(ui::AX_ROLE_IFRAME, ax_iframe->GetRole()); |
dmazzoni
2015/05/28 19:12:10
We definitely want the IFRAME element to be in the
lfg
2015/05/29 19:23:29
Done.
|
- ASSERT_EQ(1U, ax_iframe->PlatformChildCount()); |
- |
- BrowserAccessibility* ax_scroll_area = ax_iframe->PlatformGetChild(0); |
- EXPECT_EQ(ui::AX_ROLE_SCROLL_AREA, ax_scroll_area->GetRole()); |
dmazzoni
2015/05/28 19:12:10
I'm okay with losing the scroll area. I'm actually
lfg
2015/05/29 19:23:29
Acknowledged.
|
- ASSERT_EQ(1U, ax_scroll_area->PlatformChildCount()); |
- |
BrowserAccessibility* ax_child_frame_root = |
- ax_scroll_area->PlatformGetChild(0); |
+ ax_group->PlatformGetChild(0); |
EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, ax_child_frame_root->GetRole()); |
ASSERT_EQ(1U, ax_child_frame_root->PlatformChildCount()); |
EXPECT_EQ("Title Of Awesomeness", |
@@ -156,7 +152,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessAccessibilityBrowserTest, |
ASSERT_EQ(0U, ax_child_frame_static_text->PlatformChildCount()); |
// Last, check that the parent of the child frame root is correct. |
- EXPECT_EQ(ax_child_frame_root->GetParent(), ax_scroll_area); |
+ EXPECT_EQ(ax_child_frame_root->GetParent(), ax_group); |
} |
} // namespace content |