| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 MoveCursorTo(const gfx::PointF& location) override { | 54 void MoveCursorTo(const gfx::PointF& location) override { |
| 55 cursor_location_ = location; | 55 cursor_location_ = location; |
| 56 } | 56 } |
| 57 void MoveCursor(const gfx::Vector2dF& delta) override { | 57 void MoveCursor(const gfx::Vector2dF& delta) override { |
| 58 cursor_location_ = gfx::PointF(delta.x(), delta.y()); | 58 cursor_location_ = gfx::PointF(delta.x(), delta.y()); |
| 59 } | 59 } |
| 60 gfx::PointF GetLocation() override { return cursor_location_; } |
| 61 gfx::PointF GetRootLocation() override { return cursor_location_; } |
| 60 bool IsCursorVisible() override { return 1; } | 62 bool IsCursorVisible() override { return 1; } |
| 61 gfx::Rect GetCursorDisplayBounds() override { | 63 gfx::Rect GetCursorDisplayBounds() override { |
| 62 NOTIMPLEMENTED(); | 64 NOTIMPLEMENTED(); |
| 63 return gfx::Rect(); | 65 return gfx::Rect(); |
| 64 } | 66 } |
| 65 gfx::PointF location() override { return cursor_location_; } | |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 // The location of the mock cursor. | 69 // The location of the mock cursor. |
| 69 gfx::PointF cursor_location_; | 70 gfx::PointF cursor_location_; |
| 70 | 71 |
| 71 DISALLOW_COPY_AND_ASSIGN(MockCursorEvdev); | 72 DISALLOW_COPY_AND_ASSIGN(MockCursorEvdev); |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 } // namespace ui | 75 } // namespace ui |
| 75 | 76 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 443 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 443 }; | 444 }; |
| 444 | 445 |
| 445 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 446 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
| 446 EXPECT_EQ(1u, size()); | 447 EXPECT_EQ(1u, size()); |
| 447 | 448 |
| 448 ui::MouseEvent* event; | 449 ui::MouseEvent* event; |
| 449 | 450 |
| 450 event = dispatched_mouse_event(0); | 451 event = dispatched_mouse_event(0); |
| 451 EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type()); | 452 EXPECT_EQ(ui::ET_MOUSE_MOVED, event->type()); |
| 452 EXPECT_EQ(cursor()->location(), gfx::PointF(4, 2)); | 453 EXPECT_EQ(cursor()->GetLocation(), gfx::PointF(4, 2)); |
| 453 } | 454 } |
| 454 | 455 |
| 455 TEST_F(EventConverterEvdevImplTest, UnmappedKeyPress) { | 456 TEST_F(EventConverterEvdevImplTest, UnmappedKeyPress) { |
| 456 ui::MockEventConverterEvdevImpl* dev = device(); | 457 ui::MockEventConverterEvdevImpl* dev = device(); |
| 457 | 458 |
| 458 struct input_event mock_kernel_queue[] = { | 459 struct input_event mock_kernel_queue[] = { |
| 459 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, | 460 {{0, 0}, EV_KEY, BTN_TOUCH, 1}, |
| 460 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 461 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 461 | 462 |
| 462 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, | 463 {{0, 0}, EV_KEY, BTN_TOUCH, 0}, |
| 463 {{0, 0}, EV_SYN, SYN_REPORT, 0}, | 464 {{0, 0}, EV_SYN, SYN_REPORT, 0}, |
| 464 }; | 465 }; |
| 465 | 466 |
| 466 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); | 467 dev->ProcessEvents(mock_kernel_queue, arraysize(mock_kernel_queue)); |
| 467 EXPECT_EQ(0u, size()); | 468 EXPECT_EQ(0u, size()); |
| 468 } | 469 } |
| OLD | NEW |