| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 } // namespace | 453 } // namespace |
| 454 | 454 |
| 455 TEST_F(USBDeviceImplTest, Open) { | 455 TEST_F(USBDeviceImplTest, Open) { |
| 456 DevicePtr device = GetMockDeviceProxy(); | 456 DevicePtr device = GetMockDeviceProxy(); |
| 457 | 457 |
| 458 EXPECT_FALSE(is_device_open()); | 458 EXPECT_FALSE(is_device_open()); |
| 459 | 459 |
| 460 EXPECT_CALL(mock_device(), Open(_)); | 460 EXPECT_CALL(mock_device(), Open(_)); |
| 461 | 461 |
| 462 base::RunLoop loop; | 462 { |
| 463 device->Open( | 463 base::RunLoop loop; |
| 464 base::Bind(&ExpectOpenAndThen, OpenDeviceError::OK, loop.QuitClosure())); | 464 device->Open(base::Bind(&ExpectOpenAndThen, OpenDeviceError::OK, |
| 465 loop.Run(); | 465 loop.QuitClosure())); |
| 466 loop.Run(); |
| 467 } |
| 468 |
| 469 { |
| 470 base::RunLoop loop; |
| 471 device->Open(base::Bind(&ExpectOpenAndThen, OpenDeviceError::ALREADY_OPEN, |
| 472 loop.QuitClosure())); |
| 473 loop.Run(); |
| 474 } |
| 466 | 475 |
| 467 EXPECT_CALL(mock_handle(), Close()); | 476 EXPECT_CALL(mock_handle(), Close()); |
| 468 } | 477 } |
| 469 | 478 |
| 470 TEST_F(USBDeviceImplTest, Close) { | 479 TEST_F(USBDeviceImplTest, Close) { |
| 471 DevicePtr device = GetMockDeviceProxy(); | 480 DevicePtr device = GetMockDeviceProxy(); |
| 472 | 481 |
| 473 EXPECT_FALSE(is_device_open()); | 482 EXPECT_FALSE(is_device_open()); |
| 474 | 483 |
| 475 EXPECT_CALL(mock_device(), Open(_)); | 484 EXPECT_CALL(mock_device(), Open(_)); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, | 895 base::Bind(&ExpectPacketsInAndThen, fake_inbound_data, |
| 887 expected_transferred_lengths, loop.QuitClosure())); | 896 expected_transferred_lengths, loop.QuitClosure())); |
| 888 loop.Run(); | 897 loop.Run(); |
| 889 } | 898 } |
| 890 | 899 |
| 891 EXPECT_CALL(mock_handle(), Close()); | 900 EXPECT_CALL(mock_handle(), Close()); |
| 892 } | 901 } |
| 893 | 902 |
| 894 } // namespace usb | 903 } // namespace usb |
| 895 } // namespace device | 904 } // namespace device |
| OLD | NEW |