diff options
author | reillyg <reillyg@chromium.org> | 2016-02-11 17:38:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-12 01:39:46 +0000 |
commit | 54128082613544e4fa1fb2f0d6a367dea635c173 (patch) | |
tree | 9f4397351d773cbbbd66fef0ee5911497c64fec5 /extensions/browser/api | |
parent | 0f8742a11a2ac76833ae1dc4dcdaa14086fbcf44 (diff) | |
download | chromium_src-54128082613544e4fa1fb2f0d6a367dea635c173.zip chromium_src-54128082613544e4fa1fb2f0d6a367dea635c173.tar.gz chromium_src-54128082613544e4fa1fb2f0d6a367dea635c173.tar.bz2 |
Construct USB descriptors over explicit values.
Instead of specifying a bunch of arbitrary defaults and then updating
them in the code building the structure. This makes them friendly to use
with C++11's emplace_back() method.
BUG=None
Review URL: https://codereview.chromium.org/1468423003
Cr-Commit-Position: refs/heads/master@{#375081}
Diffstat (limited to 'extensions/browser/api')
-rw-r--r-- | extensions/browser/api/usb/usb_apitest.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/extensions/browser/api/usb/usb_apitest.cc b/extensions/browser/api/usb/usb_apitest.cc index 30601a9..887ae21 100644 --- a/extensions/browser/api/usb/usb_apitest.cc +++ b/extensions/browser/api/usb/usb_apitest.cc @@ -127,11 +127,8 @@ class UsbApiTest : public ShellApiTest { device_client_.reset(new MockDeviceClient()); std::vector<UsbConfigDescriptor> configs; - UsbConfigDescriptor config; - config.configuration_value = 1; - configs.push_back(config); - config.configuration_value = 2; - configs.push_back(config); + configs.emplace_back(1, false, false, 0); + configs.emplace_back(2, false, false, 0); mock_device_ = new MockUsbDevice(0, 0, "Test Manufacturer", "Test Device", "ABC123", configs); @@ -168,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(UsbApiTest, ResetDevice) { } IN_PROC_BROWSER_TEST_F(UsbApiTest, SetConfiguration) { - UsbConfigDescriptor config_descriptor; + UsbConfigDescriptor config_descriptor(1, false, false, 0); EXPECT_CALL(*mock_device_handle_.get(), SetConfiguration(1, _)) .WillOnce(InvokeCallback<1>(true)); EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(1); @@ -179,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(UsbApiTest, SetConfiguration) { } IN_PROC_BROWSER_TEST_F(UsbApiTest, ListInterfaces) { - UsbConfigDescriptor config_descriptor; + UsbConfigDescriptor config_descriptor(1, false, false, 0); EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(1); EXPECT_CALL(*mock_device_.get(), GetActiveConfiguration()) .WillOnce(Return(&config_descriptor)); |