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

Unified Diff: content/browser/accessibility/accessibility_test_utils.cc

Issue 2009283002: Fix touch accessibility events in WebViews and iframes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable cross-site test temporarily Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/accessibility_test_utils.cc
diff --git a/content/browser/accessibility/accessibility_test_utils.cc b/content/browser/accessibility/accessibility_test_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f818731b4a6b2ba256e1807fd0dd63cf3145e84c
--- /dev/null
+++ b/content/browser/accessibility/accessibility_test_utils.cc
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/accessibility/accessibility_test_utils.h"
+
+#include "content/browser/accessibility/browser_accessibility.h"
+#include "content/browser/accessibility/browser_accessibility_manager.h"
+#include "content/browser/frame_host/frame_tree.h"
+#include "content/browser/frame_host/render_frame_host_impl.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/test/accessibility_browser_test_utils.h"
+
+namespace content {
+
+bool AccessibilityTreeContainsNodeWithName(BrowserAccessibility* node,
+ const std::string& name) {
+ if (node->GetStringAttribute(ui::AX_ATTR_NAME) == name)
+ return true;
+ for (unsigned i = 0; i < node->PlatformChildCount(); i++) {
+ if (AccessibilityTreeContainsNodeWithName(node->PlatformGetChild(i), name))
+ return true;
+ }
+ return false;
+}
+
+void WaitForAccessibilityTreeToContainNodeWithName(WebContents* web_contents,
+ const std::string& name) {
+ WebContentsImpl* web_contents_impl = static_cast<WebContentsImpl*>(
+ web_contents);
+ RenderFrameHostImpl* main_frame = static_cast<RenderFrameHostImpl*>(
+ web_contents_impl->GetMainFrame());
+ BrowserAccessibilityManager* main_frame_manager =
+ main_frame->browser_accessibility_manager();
+ FrameTree* frame_tree = web_contents_impl->GetFrameTree();
+ while (!AccessibilityTreeContainsNodeWithName(
+ main_frame_manager->GetRoot(), name)) {
+ AccessibilityNotificationWaiter accessibility_waiter(main_frame,
+ ui::AX_EVENT_NONE);
+ for (FrameTreeNode* node : frame_tree->Nodes())
+ accessibility_waiter.ListenToAdditionalFrame(
+ node->current_frame_host());
+
+ accessibility_waiter.WaitForNotification();
+ }
+}
+
+} // namespace
« no previous file with comments | « content/browser/accessibility/accessibility_test_utils.h ('k') | content/browser/accessibility/hit_testing_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698