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 <linux/input.h> | 5 #include <linux/input.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 return static_cast<ui::KeyEvent*>(ev); | 121 return static_cast<ui::KeyEvent*>(ev); |
122 } | 122 } |
123 ui::MouseEvent* dispatched_mouse_event(unsigned index) { | 123 ui::MouseEvent* dispatched_mouse_event(unsigned index) { |
124 DCHECK_GT(dispatched_events_.size(), index); | 124 DCHECK_GT(dispatched_events_.size(), index); |
125 ui::Event* ev = dispatched_events_[index]; | 125 ui::Event* ev = dispatched_events_[index]; |
126 DCHECK(ev->IsMouseEvent()); | 126 DCHECK(ev->IsMouseEvent()); |
127 return static_cast<ui::MouseEvent*>(ev); | 127 return static_cast<ui::MouseEvent*>(ev); |
128 } | 128 } |
129 | 129 |
130 private: | 130 private: |
131 void DispatchEventForTest(scoped_ptr<ui::Event> event) { | 131 void DispatchEventForTest(ui::Event* event) { |
132 dispatched_events_.push_back(event.release()); | 132 scoped_ptr<ui::Event> cloned_event = ui::Event::Clone(*event); |
| 133 dispatched_events_.push_back(cloned_event.release()); |
133 } | 134 } |
134 | 135 |
135 base::MessageLoopForUI ui_loop_; | 136 base::MessageLoopForUI ui_loop_; |
136 | 137 |
137 scoped_ptr<ui::MockCursorEvdev> cursor_; | 138 scoped_ptr<ui::MockCursorEvdev> cursor_; |
138 scoped_ptr<ui::DeviceManager> device_manager_; | 139 scoped_ptr<ui::DeviceManager> device_manager_; |
139 scoped_ptr<ui::EventFactoryEvdev> event_factory_; | 140 scoped_ptr<ui::EventFactoryEvdev> event_factory_; |
140 scoped_ptr<ui::DeviceEventDispatcherEvdev> dispatcher_; | 141 scoped_ptr<ui::DeviceEventDispatcherEvdev> dispatcher_; |
141 scoped_ptr<ui::MockEventConverterEvdevImpl> device_; | 142 scoped_ptr<ui::MockEventConverterEvdevImpl> device_; |
142 | 143 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, | 449 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, |
449 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 450 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
450 | 451 |
451 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, | 452 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, |
452 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 453 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
453 }; | 454 }; |
454 | 455 |
455 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 456 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
456 EXPECT_EQ(0u, size()); | 457 EXPECT_EQ(0u, size()); |
457 } | 458 } |
OLD | NEW |