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

Side by Side Diff: ui/events/test/event_generator.cc

Issue 2287403002: Create MouseWheelEvent directly instead of through MouseEvent. (Closed)
Patch Set: test Created 4 years, 3 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 | « ui/events/event_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/events/test/event_generator.h" 5 #include "ui/events/test/event_generator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void EventGenerator::PressRightButton() { 159 void EventGenerator::PressRightButton() {
160 PressButton(ui::EF_RIGHT_MOUSE_BUTTON); 160 PressButton(ui::EF_RIGHT_MOUSE_BUTTON);
161 } 161 }
162 162
163 void EventGenerator::ReleaseRightButton() { 163 void EventGenerator::ReleaseRightButton() {
164 ReleaseButton(ui::EF_RIGHT_MOUSE_BUTTON); 164 ReleaseButton(ui::EF_RIGHT_MOUSE_BUTTON);
165 } 165 }
166 166
167 void EventGenerator::MoveMouseWheel(int delta_x, int delta_y) { 167 void EventGenerator::MoveMouseWheel(int delta_x, int delta_y) {
168 gfx::Point location = GetLocationInCurrentRoot(); 168 gfx::Point location = GetLocationInCurrentRoot();
169 ui::MouseEvent mouseev(ui::ET_MOUSEWHEEL, location, location, 169 ui::MouseWheelEvent wheelev(gfx::Vector2d(delta_x, delta_y), location,
170 ui::EventTimeForNow(), flags_, 0); 170 location, ui::EventTimeForNow(), flags_, 0);
171 ui::MouseWheelEvent wheelev(mouseev, delta_x, delta_y);
172 Dispatch(&wheelev); 171 Dispatch(&wheelev);
173 } 172 }
174 173
175 void EventGenerator::SendMouseEnter() { 174 void EventGenerator::SendMouseEnter() {
176 gfx::Point enter_location(current_location_); 175 gfx::Point enter_location(current_location_);
177 delegate()->ConvertPointToTarget(current_target_, &enter_location); 176 delegate()->ConvertPointToTarget(current_target_, &enter_location);
178 ui::MouseEvent mouseev(ui::ET_MOUSE_ENTERED, enter_location, enter_location, 177 ui::MouseEvent mouseev(ui::ET_MOUSE_ENTERED, enter_location, enter_location,
179 ui::EventTimeForNow(), flags_, 0); 178 ui::EventTimeForNow(), flags_, 0);
180 Dispatch(&mouseev); 179 Dispatch(&mouseev);
181 } 180 }
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 return default_delegate; 691 return default_delegate;
693 } 692 }
694 693
695 EventGeneratorDelegate* EventGenerator::delegate() { 694 EventGeneratorDelegate* EventGenerator::delegate() {
696 return const_cast<EventGeneratorDelegate*>( 695 return const_cast<EventGeneratorDelegate*>(
697 const_cast<const EventGenerator*>(this)->delegate()); 696 const_cast<const EventGenerator*>(this)->delegate());
698 } 697 }
699 698
700 } // namespace test 699 } // namespace test
701 } // namespace ui 700 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698