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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void ReadNow() { | 51 void ReadNow() { |
52 OnFileCanReadWithoutBlocking(read_pipe_); | 52 OnFileCanReadWithoutBlocking(read_pipe_); |
53 base::RunLoop().RunUntilIdle(); | 53 base::RunLoop().RunUntilIdle(); |
54 } | 54 } |
55 | 55 |
56 void DispatchCallback(Event* event) { | 56 void DispatchCallback(Event* event) { |
57 dispatched_events_.push_back( | 57 dispatched_events_.push_back( |
58 new TouchEvent(*static_cast<TouchEvent*>(event))); | 58 new TouchEvent(*static_cast<TouchEvent*>(event))); |
59 } | 59 } |
60 | 60 |
61 bool Reinitialize() OVERRIDE { return true; } | 61 virtual bool Reinitialize() OVERRIDE { return true; } |
62 | 62 |
63 private: | 63 private: |
64 int read_pipe_; | 64 int read_pipe_; |
65 int write_pipe_; | 65 int write_pipe_; |
66 | 66 |
67 ScopedVector<TouchEvent> dispatched_events_; | 67 ScopedVector<TouchEvent> dispatched_events_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(MockTouchEventConverterEvdev); | 69 DISALLOW_COPY_AND_ASSIGN(MockTouchEventConverterEvdev); |
70 }; | 70 }; |
71 | 71 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 472 |
473 struct input_event mock_kernel_queue_move1[] = { | 473 struct input_event mock_kernel_queue_move1[] = { |
474 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0} | 474 {{0, 0}, EV_ABS, ABS_MT_POSITION_X, 40}, {{0, 0}, EV_SYN, SYN_REPORT, 0} |
475 }; | 475 }; |
476 | 476 |
477 // Verify that it re-syncs after a SYN_REPORT. | 477 // Verify that it re-syncs after a SYN_REPORT. |
478 dev->ConfigureReadMock(mock_kernel_queue_move1, 2, 0); | 478 dev->ConfigureReadMock(mock_kernel_queue_move1, 2, 0); |
479 dev->ReadNow(); | 479 dev->ReadNow(); |
480 EXPECT_EQ(2u, dev->size()); | 480 EXPECT_EQ(2u, dev->size()); |
481 } | 481 } |
OLD | NEW |