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

Side by Side Diff: device/usb/usb_descriptors_unittest.cc

Issue 2689323006: Read USB device configurations from index 0. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « device/usb/usb_descriptors.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "device/usb/usb_descriptors.h" 5 #include "device/usb/usb_descriptors.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 TEST_F(UsbDescriptorsTest, ReadDescriptors) { 218 TEST_F(UsbDescriptorsTest, ReadDescriptors) {
219 scoped_refptr<MockUsbDeviceHandle> device_handle( 219 scoped_refptr<MockUsbDeviceHandle> device_handle(
220 new MockUsbDeviceHandle(nullptr)); 220 new MockUsbDeviceHandle(nullptr));
221 EXPECT_CALL(*device_handle, 221 EXPECT_CALL(*device_handle,
222 ControlTransfer(USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD, 222 ControlTransfer(USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD,
223 UsbDeviceHandle::DEVICE, 0x06, 0x0100, 0x0000, _, 223 UsbDeviceHandle::DEVICE, 0x06, 0x0100, 0x0000, _,
224 _, _, _)) 224 _, _, _))
225 .WillOnce(InvokeCallback(kDeviceDescriptor, sizeof(kDeviceDescriptor))); 225 .WillOnce(InvokeCallback(kDeviceDescriptor, sizeof(kDeviceDescriptor)));
226 EXPECT_CALL(*device_handle, 226 EXPECT_CALL(*device_handle,
227 ControlTransfer(USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD, 227 ControlTransfer(USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD,
228 UsbDeviceHandle::DEVICE, 0x06, 0x0200, 0x0000, _,
229 _, _, _))
230 .Times(2)
231 .WillRepeatedly(
232 InvokeCallback(kConfig1Descriptor, sizeof(kConfig1Descriptor)));
233 EXPECT_CALL(*device_handle,
234 ControlTransfer(USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD,
228 UsbDeviceHandle::DEVICE, 0x06, 0x0201, 0x0000, _, 235 UsbDeviceHandle::DEVICE, 0x06, 0x0201, 0x0000, _,
229 _, _, _)) 236 _, _, _))
230 .Times(2) 237 .Times(2)
231 .WillRepeatedly( 238 .WillRepeatedly(
232 InvokeCallback(kConfig1Descriptor, sizeof(kConfig1Descriptor)));
233 EXPECT_CALL(*device_handle,
234 ControlTransfer(USB_DIRECTION_INBOUND, UsbDeviceHandle::STANDARD,
235 UsbDeviceHandle::DEVICE, 0x06, 0x0202, 0x0000, _,
236 _, _, _))
237 .Times(2)
238 .WillRepeatedly(
239 InvokeCallback(kConfig2Descriptor, sizeof(kConfig2Descriptor))); 239 InvokeCallback(kConfig2Descriptor, sizeof(kConfig2Descriptor)));
240 240
241 ReadUsbDescriptors(device_handle, base::Bind(&OnReadDescriptors)); 241 ReadUsbDescriptors(device_handle, base::Bind(&OnReadDescriptors));
242 } 242 }
243 243
244 TEST_F(UsbDescriptorsTest, NoInterfaceAssociations) { 244 TEST_F(UsbDescriptorsTest, NoInterfaceAssociations) {
245 UsbConfigDescriptor config(1, false, false, 0); 245 UsbConfigDescriptor config(1, false, false, 0);
246 config.interfaces.emplace_back(0, 0, 255, 255, 255); 246 config.interfaces.emplace_back(0, 0, 255, 255, 255);
247 config.interfaces.emplace_back(0, 1, 255, 255, 255); 247 config.interfaces.emplace_back(0, 1, 255, 255, 255);
248 config.interfaces.emplace_back(1, 0, 255, 255, 255); 248 config.interfaces.emplace_back(1, 0, 255, 255, 255);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 _, _, _)) 429 _, _, _))
430 .WillOnce(InvokeCallback(kStringDescriptor3, sizeof(kStringDescriptor3))); 430 .WillOnce(InvokeCallback(kStringDescriptor3, sizeof(kStringDescriptor3)));
431 431
432 ReadUsbStringDescriptors(device_handle, std::move(string_map), 432 ReadUsbStringDescriptors(device_handle, std::move(string_map),
433 base::Bind(&ExpectStringDescriptors)); 433 base::Bind(&ExpectStringDescriptors));
434 } 434 }
435 435
436 } // namespace 436 } // namespace
437 437
438 } // namespace device 438 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_descriptors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698