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

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: Fix build dependencies 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
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(
Paweł Hajdan Jr. 2016/03/29 20:35:20 Is there a possibility for a race when the focus c
dmazzoni 2016/03/29 20:37:24 Good question - the focus change also only happens
+ 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),

Powered by Google App Engine
This is Rietveld 408576698