| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 5 #include <sstream> | 8 #include <sstream> |
| 6 | 9 |
| 10 #include "base/macros.h" |
| 7 #include "device/hid/hid_report_descriptor.h" | 11 #include "device/hid/hid_report_descriptor.h" |
| 8 #include "device/hid/test_report_descriptors.h" | 12 #include "device/hid/test_report_descriptors.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 15 |
| 12 using namespace testing; | 16 using namespace testing; |
| 13 | 17 |
| 14 namespace device { | 18 namespace device { |
| 15 | 19 |
| 16 class HidReportDescriptorTest : public testing::Test { | 20 class HidReportDescriptorTest : public testing::Test { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 27 public: | 31 public: |
| 28 void ValidateDetails( | 32 void ValidateDetails( |
| 29 const std::vector<HidCollectionInfo>& expected_collections, | 33 const std::vector<HidCollectionInfo>& expected_collections, |
| 30 const bool expected_has_report_id, | 34 const bool expected_has_report_id, |
| 31 const size_t expected_max_input_report_size, | 35 const size_t expected_max_input_report_size, |
| 32 const size_t expected_max_output_report_size, | 36 const size_t expected_max_output_report_size, |
| 33 const size_t expected_max_feature_report_size, | 37 const size_t expected_max_feature_report_size, |
| 34 const uint8_t* bytes, | 38 const uint8_t* bytes, |
| 35 size_t size) { | 39 size_t size) { |
| 36 descriptor_ = | 40 descriptor_ = |
| 37 new HidReportDescriptor(std::vector<uint8>(bytes, bytes + size)); | 41 new HidReportDescriptor(std::vector<uint8_t>(bytes, bytes + size)); |
| 38 | 42 |
| 39 std::vector<HidCollectionInfo> actual_collections; | 43 std::vector<HidCollectionInfo> actual_collections; |
| 40 bool actual_has_report_id; | 44 bool actual_has_report_id; |
| 41 size_t actual_max_input_report_size; | 45 size_t actual_max_input_report_size; |
| 42 size_t actual_max_output_report_size; | 46 size_t actual_max_output_report_size; |
| 43 size_t actual_max_feature_report_size; | 47 size_t actual_max_feature_report_size; |
| 44 descriptor_->GetDetails(&actual_collections, | 48 descriptor_->GetDetails(&actual_collections, |
| 45 &actual_has_report_id, | 49 &actual_has_report_id, |
| 46 &actual_max_input_report_size, | 50 &actual_max_input_report_size, |
| 47 &actual_max_output_report_size, | 51 &actual_max_output_report_size, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 hidpp_dj.report_ids.insert(0x21); | 140 hidpp_dj.report_ids.insert(0x21); |
| 137 | 141 |
| 138 HidCollectionInfo expected[] = {hidpp_short, hidpp_long, hidpp_dj}; | 142 HidCollectionInfo expected[] = {hidpp_short, hidpp_long, hidpp_dj}; |
| 139 ValidateDetails( | 143 ValidateDetails( |
| 140 std::vector<HidCollectionInfo>(expected, expected + arraysize(expected)), | 144 std::vector<HidCollectionInfo>(expected, expected + arraysize(expected)), |
| 141 true, 31, 31, 0, kLogitechUnifyingReceiver, | 145 true, 31, 31, 0, kLogitechUnifyingReceiver, |
| 142 kLogitechUnifyingReceiverSize); | 146 kLogitechUnifyingReceiverSize); |
| 143 } | 147 } |
| 144 | 148 |
| 145 } // namespace device | 149 } // namespace device |
| OLD | NEW |