OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ozone/evdev/event_device_test_util.h" | 5 #include "ui/events/ozone/evdev/event_device_test_util.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "ui/events/ozone/evdev/event_device_info.h" | 12 #include "ui/events/ozone/evdev/event_device_info.h" |
13 #include "ui/events/ozone/evdev/event_device_util.h" | 13 #include "ui/events/ozone/evdev/event_device_util.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // This test requres 64 bit groups in bitmask inputs (merge them if 32-bit). | 19 // This test requres 64 bit groups in bitmask inputs (merge them if 32-bit). |
20 const int kTestDataWordSize = 64; | 20 const int kTestDataWordSize = 64; |
21 | 21 |
22 #define EVDEV_BITS_TO_GROUPS(x) \ | 22 #define EVDEV_BITS_TO_GROUPS(x) \ |
23 (((x) + kTestDataWordSize - 1) / kTestDataWordSize) | 23 (((x) + kTestDataWordSize - 1) / kTestDataWordSize) |
24 | 24 |
25 std::string SerializeBitfield(unsigned long* bitmap, int max) { | 25 std::string SerializeBitfield(unsigned long* bitmap, int max) { |
26 std::string ret; | 26 std::string ret; |
27 | 27 |
28 for (int i = EVDEV_BITS_TO_GROUPS(max) - 1; i >= 0; i--) { | 28 for (int i = EVDEV_BITS_TO_GROUPS(max) - 1; i >= 0; i--) { |
29 if (bitmap[i] || ret.size()) { | 29 if (bitmap[i] || ret.size()) { |
30 base::StringAppendF(&ret, "%" PRIx64, bitmap[i]); | 30 base::StringAppendF(&ret, "%lx", bitmap[i]); |
31 | 31 |
32 if (i > 0) | 32 if (i > 0) |
33 ret += " "; | 33 ret += " "; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 if (ret.length() == 0) | 37 if (ret.length() == 0) |
38 ret = "0"; | 38 ret = "0"; |
39 | 39 |
40 return ret; | 40 return ret; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (code == ABS_MT_TRACKING_ID) | 444 if (code == ABS_MT_TRACKING_ID) |
445 devinfo->SetAbsMtSlots(code, minus_one_slots); | 445 devinfo->SetAbsMtSlots(code, minus_one_slots); |
446 else | 446 else |
447 devinfo->SetAbsMtSlots(code, zero_slots); | 447 devinfo->SetAbsMtSlots(code, zero_slots); |
448 } | 448 } |
449 | 449 |
450 return true; | 450 return true; |
451 } | 451 } |
452 | 452 |
453 } // namespace ui | 453 } // namespace ui |
OLD | NEW |