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

Unified Diff: content/public/test/browser_test_utils.cc

Issue 1815933002: Fix WebView accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename set_browser_plugin_embedder_ax_tree_id Created 4 years, 9 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
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_utils.cc
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index eb4ec5b1afe1bb774a2fe716879ae2b7679264ab..fac8957dbfd8e28c7518cbcb49e8401e6c04cdec 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -21,6 +21,9 @@
#include "base/test/test_timeouts.h"
#include "base/values.h"
#include "build/build_config.h"
+#include "content/browser/accessibility/accessibility_mode_helper.h"
+#include "content/browser/accessibility/browser_accessibility.h"
+#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/browser/web_contents/web_contents_view.h"
@@ -875,6 +878,31 @@ bool WaitForRenderFrameReady(RenderFrameHost* rfh) {
return result == "pageLoadComplete";
}
+void EnableAccessibilityForWebContents(WebContents* web_contents) {
+ WebContentsImpl* web_contents_impl =
+ static_cast<WebContentsImpl*>(web_contents);
+ web_contents_impl->SetAccessibilityMode(AccessibilityModeComplete);
+}
+
+void WaitForAccessibilityFocusChange() {
+ scoped_refptr<content::MessageLoopRunner> loop_runner(
+ new content::MessageLoopRunner);
+ BrowserAccessibilityManager::SetFocusChangeCallbackForTesting(
+ loop_runner->QuitClosure());
+ loop_runner->Run();
+}
+
+ui::AXNodeData GetFocusedAccessibilityNodeInfo(WebContents* web_contents) {
+ WebContentsImpl* web_contents_impl =
+ static_cast<WebContentsImpl*>(web_contents);
+ BrowserAccessibilityManager* manager =
+ web_contents_impl->GetRootBrowserAccessibilityManager();
+ if (!manager)
+ return ui::AXNodeData();
+ BrowserAccessibility* focused_node = manager->GetFocus();
+ return focused_node->GetData();
+}
+
TitleWatcher::TitleWatcher(WebContents* web_contents,
const base::string16& expected_title)
: WebContentsObserver(web_contents),
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698