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

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

Issue 290633002: Implement Android accessible hit testing using an IPC to the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@better_logging_2
Patch Set: Remove unused function Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <set>
6 #include <string>
7 #include <vector>
8
9 #include "base/command_line.h"
10 #include "base/file_util.h"
11 #include "base/logging.h"
12 #include "base/path_service.h"
13 #include "base/strings/string16.h"
14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h"
17 #include "content/browser/accessibility/accessibility_tree_formatter.h"
18 #include "content/browser/accessibility/browser_accessibility.h"
19 #include "content/browser/accessibility/browser_accessibility_manager.h"
20 #include "content/browser/renderer_host/render_view_host_impl.h"
21 #include "content/browser/renderer_host/render_widget_host_view_base.h"
22 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/content_paths.h"
24 #include "content/public/common/content_switches.h"
25 #include "content/public/common/url_constants.h"
26 #include "content/public/test/content_browser_test.h"
27 #include "content/public/test/content_browser_test_utils.h"
28 #include "content/shell/browser/shell.h"
29 #include "content/test/accessibility_browser_test_utils.h"
30 #include "testing/gtest/include/gtest/gtest.h"
31
32 namespace content {
33
34 class AndroidHitTestingBrowserTest : public ContentBrowserTest {
35 public:
36 AndroidHitTestingBrowserTest() {}
37 virtual ~AndroidHitTestingBrowserTest() {}
38 };
39
40 IN_PROC_BROWSER_TEST_F(AndroidHitTestingBrowserTest,
41 HitTestOutsideDocumentBoundsReturnsRoot) {
42 NavigateToURL(shell(), GURL(kAboutBlankURL));
43
44 // Load the page.
45 AccessibilityNotificationWaiter waiter(
46 shell(), AccessibilityModeComplete,
47 ui::AX_EVENT_LOAD_COMPLETE);
48 const char url_str[] =
49 "data:text/html,"
50 "<!doctype html>"
51 "<html><head><title>Accessibility Test</title></head>"
52 "<body>"
53 "<a href='#'>"
54 "This is some text in a link"
55 "</a>"
56 "</body></html>";
57 GURL url(url_str);
58 NavigateToURL(shell(), url);
59 waiter.WaitForNotification();
60
61 // Get the BrowserAccessibilityManager.
62 RenderWidgetHostViewBase* host_view = static_cast<RenderWidgetHostViewBase*>(
63 shell()->web_contents()->GetRenderWidgetHostView());
64 BrowserAccessibilityManager* manager =
65 host_view->GetBrowserAccessibilityManager();
66
67 // Send a hit test request, and wait for the hover event in response.
68 AccessibilityNotificationWaiter hover_waiter(
69 shell(), AccessibilityModeComplete,
70 ui::AX_EVENT_HOVER);
71 manager->delegate()->AccessibilityHitTest(gfx::Point(-1, -1));
72 hover_waiter.WaitForNotification();
73
74 // Assert that the hover event was fired on the root of the tree.
75 int hover_target_id = hover_waiter.event_target_id();
76 BrowserAccessibility* hovered_node = manager->GetFromID(hover_target_id);
77 ASSERT_TRUE(hovered_node != NULL);
78 ASSERT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, hovered_node->GetRole());
79 }
80
81 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698