Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: content/browser/accessibility/touch_accessibility_aura_browsertest.cc

Issue 2785793002: Fix TouchExplorationInCrossSiteIframe flakiness with OOPIFs enabled (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
10 #include "content/public/test/content_browser_test.h" 11 #include "content/public/test/content_browser_test.h"
11 #include "content/public/test/content_browser_test_utils.h" 12 #include "content/public/test/content_browser_test_utils.h"
12 #include "content/shell/browser/shell.h" 13 #include "content/shell/browser/shell.h"
13 #include "content/test/accessibility_browser_test_utils.h" 14 #include "content/test/accessibility_browser_test_utils.h"
15 #include "content/test/content_browser_test_utils_internal.h"
14 #include "net/dns/mock_host_resolver.h" 16 #include "net/dns/mock_host_resolver.h"
15 #include "net/test/embedded_test_server/embedded_test_server.h" 17 #include "net/test/embedded_test_server/embedded_test_server.h"
16 #include "ui/accessibility/ax_node_data.h" 18 #include "ui/accessibility/ax_node_data.h"
17 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
18 #include "ui/aura/window_tree_host.h" 20 #include "ui/aura/window_tree_host.h"
19 #include "ui/events/event.h" 21 #include "ui/events/event.h"
20 #include "ui/events/event_sink.h" 22 #include "ui/events/event_sink.h"
21 #include "ui/events/event_utils.h" 23 #include "ui/events/event_utils.h"
22 24
23 namespace content { 25 namespace content {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 161
160 // Get the BrowserAccessibilityManager for the first child frame. 162 // Get the BrowserAccessibilityManager for the first child frame.
161 RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>( 163 RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>(
162 shell()->web_contents()->GetMainFrame()); 164 shell()->web_contents()->GetMainFrame());
163 RenderFrameHostImpl* child_frame = 165 RenderFrameHostImpl* child_frame =
164 main_frame->frame_tree_node()->child_at(0)->current_frame_host(); 166 main_frame->frame_tree_node()->child_at(0)->current_frame_host();
165 BrowserAccessibilityManager* child_manager = 167 BrowserAccessibilityManager* child_manager =
166 child_frame->GetOrCreateBrowserAccessibilityManager(); 168 child_frame->GetOrCreateBrowserAccessibilityManager();
167 ASSERT_NE(nullptr, child_manager); 169 ASSERT_NE(nullptr, child_manager);
168 170
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
173 // renderer process.
174 if (main_frame->GetView() != child_frame->GetView()) {
175 SurfaceHitTestReadyNotifier notifier(
176 static_cast<RenderWidgetHostViewChildFrame*>(child_frame->GetView()));
177 notifier.WaitForSurfaceReady();
178 }
179
169 // Send a touch exploration event to the button in the first iframe. 180 // Send a touch exploration event to the button in the first iframe.
170 // A touch exploration event is just a mouse move event with 181 // A touch exploration event is just a mouse move event with
171 // the ui::EF_TOUCH_ACCESSIBILITY flag set. 182 // the ui::EF_TOUCH_ACCESSIBILITY flag set.
172 AccessibilityNotificationWaiter waiter( 183 AccessibilityNotificationWaiter waiter(
173 child_frame, ui::AX_EVENT_HOVER); 184 child_frame, ui::AX_EVENT_HOVER);
174 SendTouchExplorationEvent(50, 350); 185 SendTouchExplorationEvent(50, 350);
175 waiter.WaitForNotification(); 186 waiter.WaitForNotification();
176 int target_id = waiter.event_target_id(); 187 int target_id = waiter.event_target_id();
177 BrowserAccessibility* hit = child_manager->GetFromID(target_id); 188 BrowserAccessibility* hit = child_manager->GetFromID(target_id);
178 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit->GetData().role); 189 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit->GetData().role);
179 std::string text = hit->GetData().GetStringAttribute(ui::AX_ATTR_NAME); 190 std::string text = hit->GetData().GetStringAttribute(ui::AX_ATTR_NAME);
180 EXPECT_EQ("Ordinary Button", text); 191 EXPECT_EQ("Ordinary Button", text);
181 } 192 }
182 193
183 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698