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

Unified Diff: tools/usb_gadget/usb_descriptors_test.py

Issue 410813002: [usb_gadget p01] Functions for encoding HID descriptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed copyright text and added specification references. Created 6 years, 5 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
« no previous file with comments | « tools/usb_gadget/usb_descriptors.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/usb_gadget/usb_descriptors_test.py
diff --git a/tools/usb_gadget/usb_descriptors_test.py b/tools/usb_gadget/usb_descriptors_test.py
index 15b496460feaba84c38e224c691b4258e94a53cc..79f7d798530ab16957b5dc4e53b1ce540c08216c 100755
--- a/tools/usb_gadget/usb_descriptors_test.py
+++ b/tools/usb_gadget/usb_descriptors_test.py
@@ -5,6 +5,7 @@
import unittest
+import hid_constants
import usb_descriptors
@@ -195,15 +196,15 @@ class TestUsbDescriptors(unittest.TestCase):
def test_encode_hid_descriptor(self):
hid_desc = usb_descriptors.HidDescriptor()
- hid_desc.AddDescriptor(0x22, 0x80)
- hid_desc.AddDescriptor(0x23, 0x60)
+ hid_desc.AddDescriptor(hid_constants.DescriptorType.REPORT, 0x80)
+ hid_desc.AddDescriptor(hid_constants.DescriptorType.PHYSICAL, 0x60)
encoded_desc = '\x0C\x21\x11\x01\x00\x02\x22\x80\x00\x23\x60\x00'
self.assertEquals(hid_desc.Encode(), encoded_desc)
def test_print_hid_descriptor(self):
hid_desc = usb_descriptors.HidDescriptor()
- hid_desc.AddDescriptor(0x22, 0x80)
- hid_desc.AddDescriptor(0x23, 0x60)
+ hid_desc.AddDescriptor(hid_constants.DescriptorType.REPORT, 0x80)
+ hid_desc.AddDescriptor(hid_constants.DescriptorType.PHYSICAL, 0x60)
string = str(hid_desc)
self.assertIn('0x22', string)
self.assertIn('0x23', string)
« no previous file with comments | « tools/usb_gadget/usb_descriptors.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698