| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 440 |
| 441 std::set<uint8_t> claimed_interfaces_; | 441 std::set<uint8_t> claimed_interfaces_; |
| 442 | 442 |
| 443 FakePermissionProvider permission_provider_; | 443 FakePermissionProvider permission_provider_; |
| 444 | 444 |
| 445 DISALLOW_COPY_AND_ASSIGN(USBDeviceImplTest); | 445 DISALLOW_COPY_AND_ASSIGN(USBDeviceImplTest); |
| 446 }; | 446 }; |
| 447 | 447 |
| 448 } // namespace | 448 } // namespace |
| 449 | 449 |
| 450 TEST_F(USBDeviceImplTest, Disconnect) { |
| 451 DevicePtr device = GetMockDeviceProxy(); |
| 452 |
| 453 base::RunLoop loop; |
| 454 device.set_connection_error_handler(loop.QuitClosure()); |
| 455 mock_device().NotifyDeviceRemoved(); |
| 456 loop.Run(); |
| 457 } |
| 458 |
| 450 TEST_F(USBDeviceImplTest, Open) { | 459 TEST_F(USBDeviceImplTest, Open) { |
| 451 DevicePtr device = GetMockDeviceProxy(); | 460 DevicePtr device = GetMockDeviceProxy(); |
| 452 | 461 |
| 453 EXPECT_FALSE(is_device_open()); | 462 EXPECT_FALSE(is_device_open()); |
| 454 | 463 |
| 455 EXPECT_CALL(mock_device(), Open(_)); | 464 EXPECT_CALL(mock_device(), Open(_)); |
| 456 | 465 |
| 457 { | 466 { |
| 458 base::RunLoop loop; | 467 base::RunLoop loop; |
| 459 device->Open(base::Bind(&ExpectOpenAndThen, OpenDeviceError::OK, | 468 device->Open(base::Bind(&ExpectOpenAndThen, OpenDeviceError::OK, |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, | 899 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, |
| 891 expected_transferred_lengths, loop.QuitClosure())); | 900 expected_transferred_lengths, loop.QuitClosure())); |
| 892 loop.Run(); | 901 loop.Run(); |
| 893 } | 902 } |
| 894 | 903 |
| 895 EXPECT_CALL(mock_handle(), Close()); | 904 EXPECT_CALL(mock_handle(), Close()); |
| 896 } | 905 } |
| 897 | 906 |
| 898 } // namespace usb | 907 } // namespace usb |
| 899 } // namespace device | 908 } // namespace device |
| OLD | NEW |