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

Side by Side Diff: device/usb/mojo/device_impl_unittest.cc

Issue 1874313002: Convert device to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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/mojo/device_impl.cc ('k') | device/usb/mojo/device_manager_impl.h » ('j') | 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/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
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
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
OLDNEW
« no previous file with comments | « device/usb/mojo/device_impl.cc ('k') | device/usb/mojo/device_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698