OLD | NEW |
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 <errno.h> | 5 #include <errno.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <linux/input.h> | 7 #include <linux/input.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 unsigned size() { return dispatched_events_.size(); } | 212 unsigned size() { return dispatched_events_.size(); } |
213 ui::MouseEvent* dispatched_event(unsigned index) { | 213 ui::MouseEvent* dispatched_event(unsigned index) { |
214 DCHECK_GT(dispatched_events_.size(), index); | 214 DCHECK_GT(dispatched_events_.size(), index); |
215 ui::Event* ev = dispatched_events_[index]; | 215 ui::Event* ev = dispatched_events_[index]; |
216 DCHECK(ev->IsMouseEvent()); | 216 DCHECK(ev->IsMouseEvent()); |
217 return static_cast<ui::MouseEvent*>(ev); | 217 return static_cast<ui::MouseEvent*>(ev); |
218 } | 218 } |
219 | 219 |
220 void DispatchEventForTest(ui::Event* event) { | 220 void DispatchEventForTest(ui::Event* event) { |
221 scoped_ptr<ui::Event> cloned_event = ui::Event::Clone(*event); | 221 scoped_ptr<ui::Event> cloned_event = ui::Event::Clone(*event); |
222 dispatched_events_.push_back(cloned_event.release()); | 222 dispatched_events_.push_back(cloned_event.Pass()); |
223 } | 223 } |
224 | 224 |
225 private: | 225 private: |
226 scoped_ptr<ui::MockTabletCursorEvdev> cursor_; | 226 scoped_ptr<ui::MockTabletCursorEvdev> cursor_; |
227 scoped_ptr<ui::DeviceManager> device_manager_; | 227 scoped_ptr<ui::DeviceManager> device_manager_; |
228 scoped_ptr<ui::EventFactoryEvdev> event_factory_; | 228 scoped_ptr<ui::EventFactoryEvdev> event_factory_; |
229 scoped_ptr<ui::DeviceEventDispatcherEvdev> dispatcher_; | 229 scoped_ptr<ui::DeviceEventDispatcherEvdev> dispatcher_; |
230 | 230 |
231 ScopedVector<ui::Event> dispatched_events_; | 231 ScopedVector<ui::Event> dispatched_events_; |
232 | 232 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 489 |
490 struct input_event mock_kernel_queue[] = { | 490 struct input_event mock_kernel_queue[] = { |
491 {{0, 0}, EV_ABS, ABS_X, 0}, | 491 {{0, 0}, EV_ABS, ABS_X, 0}, |
492 {{0, 0}, EV_ABS, ABS_Y, 0}, | 492 {{0, 0}, EV_ABS, ABS_Y, 0}, |
493 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 493 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
494 }; | 494 }; |
495 | 495 |
496 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 496 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
497 EXPECT_EQ(0u, size()); | 497 EXPECT_EQ(0u, size()); |
498 } | 498 } |
OLD | NEW |