OLD | NEW |
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/mojo/device_impl.h" | 5 #include "device/usb/mojo/device_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 return proxy; | 206 return proxy; |
207 } | 207 } |
208 | 208 |
209 DevicePtr GetMockDeviceProxy() { | 209 DevicePtr GetMockDeviceProxy() { |
210 return GetMockDeviceProxy(0x1234, 0x5678, "ACME", "Frobinator", "ABCDEF"); | 210 return GetMockDeviceProxy(0x1234, 0x5678, "ACME", "Frobinator", "ABCDEF"); |
211 } | 211 } |
212 | 212 |
213 void AddMockConfig(const ConfigBuilder& builder) { | 213 void AddMockConfig(const ConfigBuilder& builder) { |
214 const UsbConfigDescriptor& config = builder.config(); | 214 const UsbConfigDescriptor& config = builder.config(); |
215 DCHECK(!ContainsKey(mock_configs_, config.configuration_value)); | 215 DCHECK(!base::ContainsKey(mock_configs_, config.configuration_value)); |
216 mock_configs_.insert(std::make_pair(config.configuration_value, config)); | 216 mock_configs_.insert(std::make_pair(config.configuration_value, config)); |
217 mock_device_->AddMockConfig(config); | 217 mock_device_->AddMockConfig(config); |
218 } | 218 } |
219 | 219 |
220 void AddMockInboundData(const std::vector<uint8_t>& data) { | 220 void AddMockInboundData(const std::vector<uint8_t>& data) { |
221 mock_inbound_data_.push(data); | 221 mock_inbound_data_.push(data); |
222 } | 222 } |
223 | 223 |
224 void AddMockInboundPackets( | 224 void AddMockInboundPackets( |
225 const std::vector<uint8_t>& data, | 225 const std::vector<uint8_t>& data, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 callback.Run(true); | 270 callback.Run(true); |
271 return; | 271 return; |
272 } | 272 } |
273 } | 273 } |
274 } | 274 } |
275 callback.Run(false); | 275 callback.Run(false); |
276 } | 276 } |
277 | 277 |
278 void ReleaseInterface(uint8_t interface_number, | 278 void ReleaseInterface(uint8_t interface_number, |
279 const UsbDeviceHandle::ResultCallback& callback) { | 279 const UsbDeviceHandle::ResultCallback& callback) { |
280 if (ContainsKey(claimed_interfaces_, interface_number)) { | 280 if (base::ContainsKey(claimed_interfaces_, interface_number)) { |
281 claimed_interfaces_.erase(interface_number); | 281 claimed_interfaces_.erase(interface_number); |
282 callback.Run(true); | 282 callback.Run(true); |
283 } else { | 283 } else { |
284 callback.Run(false); | 284 callback.Run(false); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 void SetInterfaceAlternateSetting( | 288 void SetInterfaceAlternateSetting( |
289 uint8_t interface_number, | 289 uint8_t interface_number, |
290 uint8_t alternate_setting, | 290 uint8_t alternate_setting, |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, | 889 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, |
890 expected_transferred_lengths, loop.QuitClosure())); | 890 expected_transferred_lengths, loop.QuitClosure())); |
891 loop.Run(); | 891 loop.Run(); |
892 } | 892 } |
893 | 893 |
894 EXPECT_CALL(mock_handle(), Close()); | 894 EXPECT_CALL(mock_handle(), Close()); |
895 } | 895 } |
896 | 896 |
897 } // namespace usb | 897 } // namespace usb |
898 } // namespace device | 898 } // namespace device |
OLD | NEW |