Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: ui/events/ozone/evdev/touch_event_converter_unittest.cc

Issue 135563004: Nukes MessageLoop::Dispatcher (2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_pump_dispatcher.h"
15 #include "base/posix/eintr_wrapper.h" 15 #include "base/posix/eintr_wrapper.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/events/event.h" 19 #include "ui/events/event.h"
20 #include "ui/events/ozone/evdev/touch_event_converter.h" 20 #include "ui/events/ozone/evdev/touch_event_converter.h"
21 21
22 namespace { 22 namespace {
23 23
24 static int SetNonBlocking(int fd) { 24 static int SetNonBlocking(int fd) {
25 int flags = fcntl(fd, F_GETFL, 0); 25 int flags = fcntl(fd, F_GETFL, 0);
26 if (flags == -1) 26 if (flags == -1)
27 flags = 0; 27 flags = 0;
28 return fcntl(fd, F_SETFL, flags | O_NONBLOCK); 28 return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 namespace ui { 33 namespace ui {
34 34
35 class MockTouchEventConverterEvdev : public TouchEventConverterEvdev, 35 class MockTouchEventConverterEvdev : public TouchEventConverterEvdev,
36 public base::MessageLoop::Dispatcher { 36 public base::MessagePumpDispatcher {
37 public: 37 public:
38 MockTouchEventConverterEvdev(int a, int b); 38 MockTouchEventConverterEvdev(int a, int b);
39 virtual ~MockTouchEventConverterEvdev() {}; 39 virtual ~MockTouchEventConverterEvdev() {};
40 40
41 void ConfigureReadMock(struct input_event* queue, 41 void ConfigureReadMock(struct input_event* queue,
42 long read_this_many, 42 long read_this_many,
43 long queue_index); 43 long queue_index);
44 44
45 unsigned size() { return dispatched_events_.size(); } 45 unsigned size() { return dispatched_events_.size(); }
46 TouchEvent* event(unsigned index) { return dispatched_events_[index]; } 46 TouchEvent* event(unsigned index) { return dispatched_events_[index]; }
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 ev1 = dev->event(8); 389 ev1 = dev->event(8);
390 390
391 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev1->type()); 391 EXPECT_EQ(ui::ET_TOUCH_RELEASED, ev1->type());
392 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1->time_stamp()); 392 EXPECT_EQ(base::TimeDelta::FromMicroseconds(0), ev1->time_stamp());
393 EXPECT_EQ(38, ev1->x()); 393 EXPECT_EQ(38, ev1->x());
394 EXPECT_EQ(102, ev1->y()); 394 EXPECT_EQ(102, ev1->y());
395 EXPECT_EQ(1, ev1->touch_id()); 395 EXPECT_EQ(1, ev1->touch_id());
396 EXPECT_FLOAT_EQ(.5f, ev1->force()); 396 EXPECT_FLOAT_EQ(.5f, ev1->force());
397 EXPECT_FLOAT_EQ(0.f, ev1->rotation_angle()); 397 EXPECT_FLOAT_EQ(0.f, ev1->rotation_angle());
398 } 398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698