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

Side by Side Diff: chrome/browser/chromeos/ui/accessibility_focus_ring_controller_unittest.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "ash/test/ash_test_base.h" 6 #include "ash/test/ash_test_base.h"
7 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h" 7 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h"
8 #include "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h" 8 #include "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h"
9 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" 9 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 TEST_F(AccessibilityFocusRingControllerTest, CursorWorksOnMultipleDisplays) { 136 TEST_F(AccessibilityFocusRingControllerTest, CursorWorksOnMultipleDisplays) {
137 UpdateDisplay("400x400,500x500"); 137 UpdateDisplay("400x400,500x500");
138 aura::Window::Windows root_windows = 138 aura::Window::Windows root_windows =
139 ash::Shell::GetInstance()->GetAllRootWindows(); 139 ash::Shell::GetInstance()->GetAllRootWindows();
140 ASSERT_EQ(2u, root_windows.size()); 140 ASSERT_EQ(2u, root_windows.size());
141 141
142 AccessibilityHighlightManager highlight_manager; 142 AccessibilityHighlightManager highlight_manager;
143 highlight_manager.HighlightCursor(true); 143 highlight_manager.HighlightCursor(true);
144 gfx::Point location(90, 90); 144 gfx::Point location(90, 90);
145 ui::MouseEvent event0(ui::ET_MOUSE_MOVED, location, location, 145 ui::MouseEvent event0(
146 ui::EventTimeForNow(), 0, 0); 146 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), 0, 0,
147 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
147 ui::Event::DispatcherApi event_mod(&event0); 148 ui::Event::DispatcherApi event_mod(&event0);
148 event_mod.set_target(root_windows[0]); 149 event_mod.set_target(root_windows[0]);
149 highlight_manager.OnMouseEvent(&event0); 150 highlight_manager.OnMouseEvent(&event0);
150 151
151 AccessibilityFocusRingController* controller = 152 AccessibilityFocusRingController* controller =
152 AccessibilityFocusRingController::GetInstance(); 153 AccessibilityFocusRingController::GetInstance();
153 AccessibilityCursorRingLayer* cursor_layer = controller->cursor_layer_.get(); 154 AccessibilityCursorRingLayer* cursor_layer = controller->cursor_layer_.get();
154 EXPECT_EQ(root_windows[0], cursor_layer->root_window()); 155 EXPECT_EQ(root_windows[0], cursor_layer->root_window());
155 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().x() - location.x()), 156 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().x() - location.x()),
156 50); 157 50);
157 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().y() - location.y()), 158 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().y() - location.y()),
158 50); 159 50);
159 160
160 ui::MouseEvent event1(ui::ET_MOUSE_MOVED, location, location, 161 ui::MouseEvent event1(
161 ui::EventTimeForNow(), 0, 0); 162 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), 0, 0,
163 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
162 ui::Event::DispatcherApi event_mod1(&event1); 164 ui::Event::DispatcherApi event_mod1(&event1);
163 event_mod1.set_target(root_windows[1]); 165 event_mod1.set_target(root_windows[1]);
164 highlight_manager.OnMouseEvent(&event1); 166 highlight_manager.OnMouseEvent(&event1);
165 167
166 cursor_layer = controller->cursor_layer_.get(); 168 cursor_layer = controller->cursor_layer_.get();
167 EXPECT_EQ(root_windows[1], cursor_layer->root_window()); 169 EXPECT_EQ(root_windows[1], cursor_layer->root_window());
168 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().x() - location.x()), 170 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().x() - location.x()),
169 50); 171 50);
170 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().y() - location.y()), 172 EXPECT_LT(abs(cursor_layer->layer()->GetTargetBounds().y() - location.y()),
171 50); 173 50);
172 } 174 }
173 175
174 } // namespace chromeos 176 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698