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

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

Issue 407493002: Revert of Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/web_contents/web_contents_impl.h" 20 #include "content/browser/renderer_host/render_view_host_impl.h"
21 #include "content/browser/renderer_host/render_widget_host_view_base.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/content_paths.h" 23 #include "content/public/common/content_paths.h"
23 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
24 #include "content/public/common/url_constants.h" 25 #include "content/public/common/url_constants.h"
25 #include "content/public/test/content_browser_test.h" 26 #include "content/public/test/content_browser_test.h"
26 #include "content/public/test/content_browser_test_utils.h" 27 #include "content/public/test/content_browser_test_utils.h"
27 #include "content/shell/browser/shell.h" 28 #include "content/shell/browser/shell.h"
28 #include "content/test/accessibility_browser_test_utils.h" 29 #include "content/test/accessibility_browser_test_utils.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 31
(...skipping 20 matching lines...) Expand all
51 "<body>" 52 "<body>"
52 "<a href='#'>" 53 "<a href='#'>"
53 "This is some text in a link" 54 "This is some text in a link"
54 "</a>" 55 "</a>"
55 "</body></html>"; 56 "</body></html>";
56 GURL url(url_str); 57 GURL url(url_str);
57 NavigateToURL(shell(), url); 58 NavigateToURL(shell(), url);
58 waiter.WaitForNotification(); 59 waiter.WaitForNotification();
59 60
60 // Get the BrowserAccessibilityManager. 61 // Get the BrowserAccessibilityManager.
61 WebContentsImpl* web_contents = 62 RenderWidgetHostViewBase* host_view = static_cast<RenderWidgetHostViewBase*>(
62 static_cast<WebContentsImpl*>(shell()->web_contents()); 63 shell()->web_contents()->GetRenderWidgetHostView());
63 BrowserAccessibilityManager* manager = 64 BrowserAccessibilityManager* manager =
64 web_contents->GetRootBrowserAccessibilityManager(); 65 host_view->GetBrowserAccessibilityManager();
65 66
66 // Send a hit test request, and wait for the hover event in response. 67 // Send a hit test request, and wait for the hover event in response.
67 AccessibilityNotificationWaiter hover_waiter( 68 AccessibilityNotificationWaiter hover_waiter(
68 shell(), AccessibilityModeComplete, 69 shell(), AccessibilityModeComplete,
69 ui::AX_EVENT_HOVER); 70 ui::AX_EVENT_HOVER);
70 manager->delegate()->AccessibilityHitTest(gfx::Point(-1, -1)); 71 manager->delegate()->AccessibilityHitTest(gfx::Point(-1, -1));
71 hover_waiter.WaitForNotification(); 72 hover_waiter.WaitForNotification();
72 73
73 // Assert that the hover event was fired on the root of the tree. 74 // Assert that the hover event was fired on the root of the tree.
74 int hover_target_id = hover_waiter.event_target_id(); 75 int hover_target_id = hover_waiter.event_target_id();
75 BrowserAccessibility* hovered_node = manager->GetFromID(hover_target_id); 76 BrowserAccessibility* hovered_node = manager->GetFromID(hover_target_id);
76 ASSERT_TRUE(hovered_node != NULL); 77 ASSERT_TRUE(hovered_node != NULL);
77 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, hovered_node->GetRole()); 78 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, hovered_node->GetRole());
78 } 79 }
79 80
80 } // namespace content 81 } // 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