| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
| 7 #include "content/browser/accessibility/browser_accessibility.h" | 7 #include "content/browser/accessibility/browser_accessibility.h" |
| 8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 shell()->web_contents()->GetMainFrame()); | 164 shell()->web_contents()->GetMainFrame()); |
| 165 RenderFrameHostImpl* child_frame = | 165 RenderFrameHostImpl* child_frame = |
| 166 main_frame->frame_tree_node()->child_at(0)->current_frame_host(); | 166 main_frame->frame_tree_node()->child_at(0)->current_frame_host(); |
| 167 BrowserAccessibilityManager* child_manager = | 167 BrowserAccessibilityManager* child_manager = |
| 168 child_frame->GetOrCreateBrowserAccessibilityManager(); | 168 child_frame->GetOrCreateBrowserAccessibilityManager(); |
| 169 ASSERT_NE(nullptr, child_manager); | 169 ASSERT_NE(nullptr, child_manager); |
| 170 | 170 |
| 171 // If OOPIFs are enabled, wait until compositor frames are all properly | 171 // If OOPIFs are enabled, wait until compositor frames are all properly |
| 172 // displayed, otherwise the touch event will not get sent to the correct | 172 // displayed, otherwise the touch event will not get sent to the correct |
| 173 // renderer process. | 173 // renderer process. |
| 174 if (main_frame->GetView() != child_frame->GetView()) { | 174 WaitForChildFrameSurfaceReady(child_frame); |
| 175 SurfaceHitTestReadyNotifier notifier( | |
| 176 static_cast<RenderWidgetHostViewChildFrame*>(child_frame->GetView())); | |
| 177 notifier.WaitForSurfaceReady(); | |
| 178 } | |
| 179 | 175 |
| 180 // Send a touch exploration event to the button in the first iframe. | 176 // Send a touch exploration event to the button in the first iframe. |
| 181 // A touch exploration event is just a mouse move event with | 177 // A touch exploration event is just a mouse move event with |
| 182 // the ui::EF_TOUCH_ACCESSIBILITY flag set. | 178 // the ui::EF_TOUCH_ACCESSIBILITY flag set. |
| 183 AccessibilityNotificationWaiter waiter( | 179 AccessibilityNotificationWaiter waiter( |
| 184 child_frame, ui::AX_EVENT_HOVER); | 180 child_frame, ui::AX_EVENT_HOVER); |
| 185 SendTouchExplorationEvent(50, 350); | 181 SendTouchExplorationEvent(50, 350); |
| 186 waiter.WaitForNotification(); | 182 waiter.WaitForNotification(); |
| 187 int target_id = waiter.event_target_id(); | 183 int target_id = waiter.event_target_id(); |
| 188 BrowserAccessibility* hit = child_manager->GetFromID(target_id); | 184 BrowserAccessibility* hit = child_manager->GetFromID(target_id); |
| 189 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit->GetData().role); | 185 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit->GetData().role); |
| 190 std::string text = hit->GetData().GetStringAttribute(ui::AX_ATTR_NAME); | 186 std::string text = hit->GetData().GetStringAttribute(ui::AX_ATTR_NAME); |
| 191 EXPECT_EQ("Ordinary Button", text); | 187 EXPECT_EQ("Ordinary Button", text); |
| 192 } | 188 } |
| 193 | 189 |
| 194 } // namespace content | 190 } // namespace content |
| OLD | NEW |