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

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

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "content/browser/accessibility/browser_accessibility.h" 7 #include "content/browser/accessibility/browser_accessibility.h"
8 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "content/public/test/browser_test_utils.h" 9 #include "content/public/test/browser_test_utils.h"
10 #include "content/public/test/content_browser_test.h" 10 #include "content/public/test/content_browser_test.h"
(...skipping 29 matching lines...) Expand all
40 NavigateToURL(shell(), url); 40 NavigateToURL(shell(), url);
41 waiter.WaitForNotification(); 41 waiter.WaitForNotification();
42 } 42 }
43 43
44 void SendTouchExplorationEvent(int x, int y) { 44 void SendTouchExplorationEvent(int x, int y) {
45 aura::Window* window = shell()->web_contents()->GetContentNativeView(); 45 aura::Window* window = shell()->web_contents()->GetContentNativeView();
46 ui::EventSink* sink = window->GetHost()->event_sink(); 46 ui::EventSink* sink = window->GetHost()->event_sink();
47 gfx::Rect bounds = window->GetBoundsInRootWindow(); 47 gfx::Rect bounds = window->GetBoundsInRootWindow();
48 gfx::Point location(bounds.x() + x, bounds.y() + y); 48 gfx::Point location(bounds.x() + x, bounds.y() + y);
49 int flags = ui::EF_TOUCH_ACCESSIBILITY; 49 int flags = ui::EF_TOUCH_ACCESSIBILITY;
50 std::unique_ptr<ui::Event> mouse_move_event( 50 std::unique_ptr<ui::Event> mouse_move_event(new ui::MouseEvent(
51 new ui::MouseEvent(ui::ET_MOUSE_MOVED, location, location, 51 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), flags, 0,
52 ui::EventTimeForNow(), flags, 0)); 52 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)));
53 ignore_result(sink->OnEventFromSource(mouse_move_event.get())); 53 ignore_result(sink->OnEventFromSource(mouse_move_event.get()));
54 } 54 }
55 55
56 DISALLOW_COPY_AND_ASSIGN(TouchAccessibilityBrowserTest); 56 DISALLOW_COPY_AND_ASSIGN(TouchAccessibilityBrowserTest);
57 }; 57 };
58 58
59 IN_PROC_BROWSER_TEST_F(TouchAccessibilityBrowserTest, 59 IN_PROC_BROWSER_TEST_F(TouchAccessibilityBrowserTest,
60 TouchExplorationSendsHoverEvents) { 60 TouchExplorationSendsHoverEvents) {
61 // Create HTML with a 7 x 5 table, each exactly 50 x 50 pixels. 61 // Create HTML with a 7 x 5 table, each exactly 50 x 50 pixels.
62 std::string html_url = 62 std::string html_url =
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 SendTouchExplorationEvent(50, 350); 174 SendTouchExplorationEvent(50, 350);
175 waiter.WaitForNotification(); 175 waiter.WaitForNotification();
176 int target_id = waiter.event_target_id(); 176 int target_id = waiter.event_target_id();
177 BrowserAccessibility* hit = child_manager->GetFromID(target_id); 177 BrowserAccessibility* hit = child_manager->GetFromID(target_id);
178 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit->GetData().role); 178 EXPECT_EQ(ui::AX_ROLE_BUTTON, hit->GetData().role);
179 std::string text = hit->GetData().GetStringAttribute(ui::AX_ATTR_NAME); 179 std::string text = hit->GetData().GetStringAttribute(ui::AX_ATTR_NAME);
180 EXPECT_EQ("Ordinary Button", text); 180 EXPECT_EQ("Ordinary Button", text);
181 } 181 }
182 182
183 } // namespace content 183 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698