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

Unified Diff: ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc

Issue 2639043002: Fix double-close in EventConverterEvdevImpl (Closed)
Patch Set: remove base::debug::Alias Created 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
index 3b0ed674cf25cd248e5a54eb61733ac5967c1a96..c8b24a916d99b05b9d53e06c97e075fb7d32d032 100644
--- a/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev_unittest.cc
@@ -80,7 +80,7 @@ struct GenericEventParams {
class MockTouchEventConverterEvdev : public TouchEventConverterEvdev {
public:
- MockTouchEventConverterEvdev(int fd,
+ MockTouchEventConverterEvdev(ScopedInputDevice fd,
base::FilePath path,
const EventDeviceInfo& devinfo,
DeviceEventDispatcherEvdev* dispatcher);
@@ -158,15 +158,11 @@ class MockDeviceEventDispatcherEvdev : public DeviceEventDispatcherEvdev {
};
MockTouchEventConverterEvdev::MockTouchEventConverterEvdev(
- int fd,
+ ScopedInputDevice fd,
base::FilePath path,
const EventDeviceInfo& devinfo,
DeviceEventDispatcherEvdev* dispatcher)
- : TouchEventConverterEvdev(fd,
- path,
- 1,
- devinfo,
- dispatcher) {
+ : TouchEventConverterEvdev(std::move(fd), path, 1, devinfo, dispatcher) {
int fds[2];
if (pipe(fds))
@@ -211,8 +207,8 @@ class TouchEventConverterEvdevTest : public testing::Test {
int evdev_io[2];
if (pipe(evdev_io))
PLOG(FATAL) << "failed pipe";
- events_in_ = evdev_io[0];
- events_out_ = evdev_io[1];
+ ScopedInputDevice events_in(evdev_io[0]);
+ events_out_.reset(evdev_io[1]);
// Device creation happens on a worker thread since it may involve blocking
// operations. Simulate that by creating it before creating a UI message
@@ -222,7 +218,7 @@ class TouchEventConverterEvdevTest : public testing::Test {
base::Bind(&TouchEventConverterEvdevTest::DispatchCallback,
base::Unretained(this))));
device_.reset(new ui::MockTouchEventConverterEvdev(
- events_in_, base::FilePath(kTestDevicePath), devinfo,
+ std::move(events_in), base::FilePath(kTestDevicePath), devinfo,
dispatcher_.get()));
loop_ = new base::MessageLoopForUI;
@@ -264,8 +260,7 @@ class TouchEventConverterEvdevTest : public testing::Test {
std::unique_ptr<ui::MockTouchEventConverterEvdev> device_;
std::unique_ptr<ui::MockDeviceEventDispatcherEvdev> dispatcher_;
- int events_out_;
- int events_in_;
+ ScopedInputDevice events_out_;
void DispatchCallback(const GenericEventParams& params) {
dispatched_events_.push_back(params);

Powered by Google App Engine
This is Rietveld 408576698