diff options
author | reillyg@chromium.org <reillyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-28 22:01:26 +0000 |
---|---|---|
committer | reillyg@chromium.org <reillyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-28 22:01:26 +0000 |
commit | 054293034c1e79f6ee7ff5b11e6a35673d7f38a3 (patch) | |
tree | 8f1a63690fbcdb0396c25c57d9de79d04a3853f8 /device/hid/hid_report_descriptor_unittest.cc | |
parent | 3e65977489925662657d91d334d6e9d1b520c60a (diff) | |
download | chromium_src-054293034c1e79f6ee7ff5b11e6a35673d7f38a3.zip chromium_src-054293034c1e79f6ee7ff5b11e6a35673d7f38a3.tar.gz chromium_src-054293034c1e79f6ee7ff5b11e6a35673d7f38a3.tar.bz2 |
hid: Remove size from receive APIs and return report ID separately.
The size parameter is unnecessary when calling chrome.hid.receive and
chrome.hid.receiveFeatureReport because, since the caller does not know
which report ID will be returned, it should always be set to the maximum
input or feature report size provided by the device. The size of the
report ID is now not included in the maximum report sizes for the device
since it no longer effects buffer size.
In addition increase consistency by always providing the report ID to
the chrome.hid.receive callback instead of including it as the first
byte of the data buffer only if it is non-zero.
BUG=
Review URL: https://codereview.chromium.org/413913003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/hid/hid_report_descriptor_unittest.cc')
-rw-r--r-- | device/hid/hid_report_descriptor_unittest.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/device/hid/hid_report_descriptor_unittest.cc b/device/hid/hid_report_descriptor_unittest.cc index 619e682..0cce2e6 100644 --- a/device/hid/hid_report_descriptor_unittest.cc +++ b/device/hid/hid_report_descriptor_unittest.cc @@ -297,6 +297,7 @@ class HidReportDescriptorTest : public testing::Test { public: void ValidateDetails( const std::vector<HidCollectionInfo>& expected_collections, + const bool expected_has_report_id, const int expected_max_input_report_size, const int expected_max_output_report_size, const int expected_max_feature_report_size, @@ -305,10 +306,12 @@ class HidReportDescriptorTest : public testing::Test { descriptor_ = new HidReportDescriptor(bytes, size); std::vector<HidCollectionInfo> actual_collections; + bool actual_has_report_id; int actual_max_input_report_size; int actual_max_output_report_size; int actual_max_feature_report_size; descriptor_->GetDetails(&actual_collections, + &actual_has_report_id, &actual_max_input_report_size, &actual_max_output_report_size, &actual_max_feature_report_size); @@ -335,6 +338,7 @@ class HidReportDescriptorTest : public testing::Test { actual_collections_iter++; } + ASSERT_EQ(expected_has_report_id, actual_has_report_id); ASSERT_EQ(expected_max_input_report_size, actual_max_input_report_size); ASSERT_EQ(expected_max_output_report_size, actual_max_output_report_size); ASSERT_EQ(expected_max_feature_report_size, actual_max_feature_report_size); @@ -353,7 +357,8 @@ TEST_F(HidReportDescriptorTest, ValidateDetails_Digitizer) { HidCollectionInfo expected[] = {digitizer}; ValidateDetails(std::vector<HidCollectionInfo>( expected, expected + ARRAYSIZE_UNSAFE(expected)), - 7, + true, + 6, 0, 0, kDigitizer, @@ -366,6 +371,7 @@ TEST_F(HidReportDescriptorTest, ValidateDetails_Keyboard) { HidCollectionInfo expected[] = {keyboard}; ValidateDetails(std::vector<HidCollectionInfo>( expected, expected + ARRAYSIZE_UNSAFE(expected)), + false, 8, 1, 0, @@ -384,9 +390,10 @@ TEST_F(HidReportDescriptorTest, ValidateDetails_Monitor) { HidCollectionInfo expected[] = {monitor}; ValidateDetails(std::vector<HidCollectionInfo>( expected, expected + ARRAYSIZE_UNSAFE(expected)), + true, 0, 0, - 244, + 243, kMonitor, sizeof(kMonitor)); } @@ -397,6 +404,7 @@ TEST_F(HidReportDescriptorTest, ValidateDetails_Mouse) { HidCollectionInfo expected[] = {mouse}; ValidateDetails(std::vector<HidCollectionInfo>( expected, expected + ARRAYSIZE_UNSAFE(expected)), + false, 3, 0, 0, @@ -419,8 +427,9 @@ TEST_F(HidReportDescriptorTest, ValidateDetails_LogitechUnifyingReceiver) { HidCollectionInfo expected[] = {hidpp_short, hidpp_long, hidpp_dj}; ValidateDetails(std::vector<HidCollectionInfo>( expected, expected + ARRAYSIZE_UNSAFE(expected)), - 32, - 32, + true, + 31, + 31, 0, kLogitechUnifyingReceiver, sizeof(kLogitechUnifyingReceiver)); |