| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // CursorDelegateEvdev: | 49 // CursorDelegateEvdev: |
| 50 void MoveCursorTo(gfx::AcceleratedWidget widget, | 50 void MoveCursorTo(gfx::AcceleratedWidget widget, |
| 51 const gfx::PointF& location) override { | 51 const gfx::PointF& location) override { |
| 52 cursor_location_ = location; | 52 cursor_location_ = location; |
| 53 } | 53 } |
| 54 void MoveCursor(const gfx::Vector2dF& delta) override { | 54 void MoveCursor(const gfx::Vector2dF& delta) override { |
| 55 cursor_location_ = gfx::PointF(delta.x(), delta.y()); | 55 cursor_location_ = gfx::PointF(delta.x(), delta.y()); |
| 56 } | 56 } |
| 57 bool IsCursorVisible() override { return 1; } | 57 bool IsCursorVisible() override { return 1; } |
| 58 gfx::PointF location() override { return cursor_location_; } | 58 gfx::PointF GetLocation() override { return cursor_location_; } |
| 59 gfx::PointF GetRootLocation() override { return cursor_location_; } |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 // The location of the mock cursor. | 62 // The location of the mock cursor. |
| 62 gfx::PointF cursor_location_; | 63 gfx::PointF cursor_location_; |
| 63 | 64 |
| 64 DISALLOW_COPY_AND_ASSIGN(MockCursorEvdev); | 65 DISALLOW_COPY_AND_ASSIGN(MockCursorEvdev); |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 } // namespace ui | 68 } // namespace ui |
| 68 | 69 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 436 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 436 }; | 437 }; |
| 437 | 438 |
| 438 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 439 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
| 439 EXPECT_EQ(1u, size()); | 440 EXPECT_EQ(1u, size()); |
| 440 | 441 |
| 441 ui::MouseEvent* event; | 442 ui::MouseEvent* event; |
| 442 | 443 |
| 443 event = dispatched_mouse_event(0); | 444 event = dispatched_mouse_event(0); |
| 444 EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type()); | 445 EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type()); |
| 445 EXPECT_EQ(cursor()->location(), gfx::PointF(4, 2)); | 446 EXPECT_EQ(cursor()->GetLocation(), gfx::PointF(4, 2)); |
| 446 } | 447 } |
| 447 | 448 |
| 448 TEST_F(EventConverterEvdevImplTest, UnmappedKeyPress) { | 449 TEST_F(EventConverterEvdevImplTest, UnmappedKeyPress) { |
| 449 ui::MockEventConverterEvdevImpl* dev = device(); | 450 ui::MockEventConverterEvdevImpl* dev = device(); |
| 450 | 451 |
| 451 struct input_event mock_kernel_queue[] = { | 452 struct input_event mock_kernel_queue[] = { |
| 452 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, | 453 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, |
| 453 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 454 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 454 | 455 |
| 455 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, | 456 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, |
| 456 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 457 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 457 }; | 458 }; |
| 458 | 459 |
| 459 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 460 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
| 460 EXPECT_EQ(0u, size()); | 461 EXPECT_EQ(0u, size()); |
| 461 } | 462 } |
| OLD | NEW |