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

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

Issue 273423004: Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "content/browser/accessibility/accessibility_tree_formatter.h" 17 #include "content/browser/accessibility/accessibility_tree_formatter.h"
18 #include "content/browser/accessibility/browser_accessibility.h" 18 #include "content/browser/accessibility/browser_accessibility.h"
19 #include "content/browser/accessibility/browser_accessibility_manager.h" 19 #include "content/browser/accessibility/browser_accessibility_manager.h"
20 #include "content/browser/renderer_host/render_view_host_impl.h" 20 #include "content/browser/web_contents/web_contents_impl.h"
21 #include "content/browser/renderer_host/render_widget_host_view_base.h"
22 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/content_paths.h" 22 #include "content/public/common/content_paths.h"
24 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
25 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
26 #include "content/public/test/content_browser_test.h" 25 #include "content/public/test/content_browser_test.h"
27 #include "content/public/test/content_browser_test_utils.h" 26 #include "content/public/test/content_browser_test_utils.h"
28 #include "content/shell/browser/shell.h" 27 #include "content/shell/browser/shell.h"
29 #include "content/test/accessibility_browser_test_utils.h" 28 #include "content/test/accessibility_browser_test_utils.h"
30 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
31 30
(...skipping 20 matching lines...) Expand all
52 "<body>" 51 "<body>"
53 "<a href='#'>" 52 "<a href='#'>"
54 "This is some text in a link" 53 "This is some text in a link"
55 "</a>" 54 "</a>"
56 "</body></html>"; 55 "</body></html>";
57 GURL url(url_str); 56 GURL url(url_str);
58 NavigateToURL(shell(), url); 57 NavigateToURL(shell(), url);
59 waiter.WaitForNotification(); 58 waiter.WaitForNotification();
60 59
61 // Get the BrowserAccessibilityManager. 60 // Get the BrowserAccessibilityManager.
62 RenderWidgetHostViewBase* host_view = static_cast<RenderWidgetHostViewBase*>( 61 WebContentsImpl* web_contents =
63 shell()->web_contents()->GetRenderWidgetHostView()); 62 static_cast<WebContentsImpl*>(shell()->web_contents());
64 BrowserAccessibilityManager* manager = 63 BrowserAccessibilityManager* manager =
65 host_view->GetBrowserAccessibilityManager(); 64 web_contents->GetRootBrowserAccessibilityManager();
66 65
67 // Send a hit test request, and wait for the hover event in response. 66 // Send a hit test request, and wait for the hover event in response.
68 AccessibilityNotificationWaiter hover_waiter( 67 AccessibilityNotificationWaiter hover_waiter(
69 shell(), AccessibilityModeComplete, 68 shell(), AccessibilityModeComplete,
70 ui::AX_EVENT_HOVER); 69 ui::AX_EVENT_HOVER);
71 manager->delegate()->AccessibilityHitTest(gfx::Point(-1, -1)); 70 manager->delegate()->AccessibilityHitTest(gfx::Point(-1, -1));
72 hover_waiter.WaitForNotification(); 71 hover_waiter.WaitForNotification();
73 72
74 // Assert that the hover event was fired on the root of the tree. 73 // Assert that the hover event was fired on the root of the tree.
75 int hover_target_id = hover_waiter.event_target_id(); 74 int hover_target_id = hover_waiter.event_target_id();
76 BrowserAccessibility* hovered_node = manager->GetFromID(hover_target_id); 75 BrowserAccessibility* hovered_node = manager->GetFromID(hover_target_id);
77 ASSERT_TRUE(hovered_node != NULL); 76 ASSERT_TRUE(hovered_node != NULL);
78 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, hovered_node->GetRole()); 77 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, hovered_node->GetRole());
79 } 78 }
80 79
81 } // namespace content 80 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_ui.cc ('k') | content/browser/accessibility/browser_accessibility_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698