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> |
| 11 #include <memory> |
11 #include <numeric> | 12 #include <numeric> |
12 #include <queue> | 13 #include <queue> |
13 #include <set> | 14 #include <set> |
14 #include <string> | 15 #include <string> |
15 #include <utility> | 16 #include <utility> |
16 #include <vector> | 17 #include <vector> |
17 | 18 |
18 #include "base/bind.h" | 19 #include "base/bind.h" |
19 #include "base/macros.h" | 20 #include "base/macros.h" |
20 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 ASSERT_EQ(packets.size(), packet_lengths.size()); | 418 ASSERT_EQ(packets.size(), packet_lengths.size()); |
418 for (size_t i = 0; i < packets.size(); ++i) { | 419 for (size_t i = 0; i < packets.size(); ++i) { |
419 EXPECT_EQ(packets[i].length, packet_lengths[i]) | 420 EXPECT_EQ(packets[i].length, packet_lengths[i]) |
420 << "Packet lengths differ at index: " << i; | 421 << "Packet lengths differ at index: " << i; |
421 } | 422 } |
422 mock_outbound_packets_.pop(); | 423 mock_outbound_packets_.pop(); |
423 | 424 |
424 callback.Run(buffer, packets); | 425 callback.Run(buffer, packets); |
425 } | 426 } |
426 | 427 |
427 scoped_ptr<base::MessageLoop> message_loop_; | 428 std::unique_ptr<base::MessageLoop> message_loop_; |
428 scoped_refptr<MockUsbDevice> mock_device_; | 429 scoped_refptr<MockUsbDevice> mock_device_; |
429 scoped_refptr<MockUsbDeviceHandle> mock_handle_; | 430 scoped_refptr<MockUsbDeviceHandle> mock_handle_; |
430 bool is_device_open_; | 431 bool is_device_open_; |
431 bool allow_reset_; | 432 bool allow_reset_; |
432 | 433 |
433 std::map<uint8_t, UsbConfigDescriptor> mock_configs_; | 434 std::map<uint8_t, UsbConfigDescriptor> mock_configs_; |
434 uint8_t current_config_; | 435 uint8_t current_config_; |
435 | 436 |
436 std::queue<std::vector<uint8_t>> mock_inbound_data_; | 437 std::queue<std::vector<uint8_t>> mock_inbound_data_; |
437 std::queue<std::vector<uint8_t>> mock_outbound_data_; | 438 std::queue<std::vector<uint8_t>> mock_outbound_data_; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, | 908 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, |
908 expected_transferred_lengths, loop.QuitClosure())); | 909 expected_transferred_lengths, loop.QuitClosure())); |
909 loop.Run(); | 910 loop.Run(); |
910 } | 911 } |
911 | 912 |
912 EXPECT_CALL(mock_handle(), Close()); | 913 EXPECT_CALL(mock_handle(), Close()); |
913 } | 914 } |
914 | 915 |
915 } // namespace usb | 916 } // namespace usb |
916 } // namespace device | 917 } // namespace device |
OLD | NEW |