| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 void ClearDispatchedEvents() { | 135 void ClearDispatchedEvents() { |
| 136 dispatched_events_.clear(); | 136 dispatched_events_.clear(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void DestroyDevice() { device_.reset(); } | 139 void DestroyDevice() { device_.reset(); } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 void DispatchEventForTest(ui::Event* event) { | 142 void DispatchEventForTest(ui::Event* event) { |
| 143 scoped_ptr<ui::Event> cloned_event = ui::Event::Clone(*event); | 143 scoped_ptr<ui::Event> cloned_event = ui::Event::Clone(*event); |
| 144 dispatched_events_.push_back(cloned_event.release()); | 144 dispatched_events_.push_back(cloned_event.Pass()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 base::MessageLoopForUI ui_loop_; | 147 base::MessageLoopForUI ui_loop_; |
| 148 | 148 |
| 149 scoped_ptr<ui::MockCursorEvdev> cursor_; | 149 scoped_ptr<ui::MockCursorEvdev> cursor_; |
| 150 scoped_ptr<ui::DeviceManager> device_manager_; | 150 scoped_ptr<ui::DeviceManager> device_manager_; |
| 151 scoped_ptr<ui::EventFactoryEvdev> event_factory_; | 151 scoped_ptr<ui::EventFactoryEvdev> event_factory_; |
| 152 scoped_ptr<ui::DeviceEventDispatcherEvdev> dispatcher_; | 152 scoped_ptr<ui::DeviceEventDispatcherEvdev> dispatcher_; |
| 153 scoped_ptr<ui::MockEventConverterEvdevImpl> device_; | 153 scoped_ptr<ui::MockEventConverterEvdevImpl> device_; |
| 154 | 154 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 dev->SetAllowedKeys(allowed_keys.Pass()); | 632 dev->SetAllowedKeys(allowed_keys.Pass()); |
| 633 ASSERT_EQ(1u, size()); | 633 ASSERT_EQ(1u, size()); |
| 634 event = dispatched_event(0); | 634 event = dispatched_event(0); |
| 635 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type()); | 635 EXPECT_EQ(ui::ET_KEY_RELEASED, event->type()); |
| 636 | 636 |
| 637 // The real key release should be dropped, whenever it comes. | 637 // The real key release should be dropped, whenever it comes. |
| 638 ClearDispatchedEvents(); | 638 ClearDispatchedEvents(); |
| 639 dev->ProcessEvents(key_release, arraysize(key_release)); | 639 dev->ProcessEvents(key_release, arraysize(key_release)); |
| 640 ASSERT_EQ(0u, size()); | 640 ASSERT_EQ(0u, size()); |
| 641 } | 641 } |
| OLD | NEW |