OLD | NEW |
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 "ui/events/test/events_test_utils_x11.h" | 5 #include "ui/events/test/events_test_utils_x11.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <X11/extensions/XI2.h> | 8 #include <X11/extensions/XI2.h> |
9 #include <X11/keysym.h> | 9 #include <X11/keysym.h> |
10 #include <X11/X.h> | 10 #include <X11/X.h> |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 DeviceDataManagerX11::DT_TOUCH_RAW_TIMESTAMP) { | 287 DeviceDataManagerX11::DT_TOUCH_RAW_TIMESTAMP) { |
288 SetUpValuators(valuators); | 288 SetUpValuators(valuators); |
289 return; | 289 return; |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 // No timestamp was specified. Use |ui::EventTimeForNow()|. | 293 // No timestamp was specified. Use |ui::EventTimeForNow()|. |
294 std::vector<Valuator> valuators_with_time = valuators; | 294 std::vector<Valuator> valuators_with_time = valuators; |
295 valuators_with_time.push_back( | 295 valuators_with_time.push_back( |
296 Valuator(DeviceDataManagerX11::DT_TOUCH_RAW_TIMESTAMP, | 296 Valuator(DeviceDataManagerX11::DT_TOUCH_RAW_TIMESTAMP, |
297 (ui::EventTimeForNow()).InMicroseconds())); | 297 (ui::EventTimeForNow() - base::TimeTicks()).InMicroseconds())); |
298 SetUpValuators(valuators_with_time); | 298 SetUpValuators(valuators_with_time); |
299 } | 299 } |
300 | 300 |
301 void ScopedXI2Event::SetUpValuators(const std::vector<Valuator>& valuators) { | 301 void ScopedXI2Event::SetUpValuators(const std::vector<Valuator>& valuators) { |
302 CHECK(event_.get()); | 302 CHECK(event_.get()); |
303 CHECK_EQ(GenericEvent, event_->type); | 303 CHECK_EQ(GenericEvent, event_->type); |
304 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(event_->xcookie.data); | 304 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(event_->xcookie.data); |
305 InitValuatorsForXIDeviceEvent(xiev); | 305 InitValuatorsForXIDeviceEvent(xiev); |
306 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | 306 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
307 for (size_t i = 0; i < valuators.size(); ++i) { | 307 for (size_t i = 0; i < valuators.size(); ++i) { |
(...skipping 20 matching lines...) Expand all Loading... |
328 } | 328 } |
329 | 329 |
330 void SetUpPointerDevicesForTest(const std::vector<int>& devices) { | 330 void SetUpPointerDevicesForTest(const std::vector<int>& devices) { |
331 TouchFactory::GetInstance()->SetPointerDeviceForTest(devices); | 331 TouchFactory::GetInstance()->SetPointerDeviceForTest(devices); |
332 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); | 332 ui::DeviceDataManagerX11* manager = ui::DeviceDataManagerX11::GetInstance(); |
333 manager->SetDeviceListForTest(std::vector<int>(), std::vector<int>(), | 333 manager->SetDeviceListForTest(std::vector<int>(), std::vector<int>(), |
334 devices); | 334 devices); |
335 } | 335 } |
336 | 336 |
337 } // namespace ui | 337 } // namespace ui |
OLD | NEW |