| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "components/usb_service/usb_service.h" | 7 #include "components/usb_service/usb_service.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/test/test_utils.h" | 9 #include "content/public/test/test_utils.h" |
| 10 #include "extensions/browser/api/usb/usb_api.h" | 10 #include "extensions/browser/api/usb/usb_api.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const unsigned int packets, | 83 const unsigned int packets, |
| 84 const unsigned int packet_length, | 84 const unsigned int packet_length, |
| 85 const unsigned int timeout, | 85 const unsigned int timeout, |
| 86 const UsbTransferCallback& callback)); | 86 const UsbTransferCallback& callback)); |
| 87 | 87 |
| 88 MOCK_METHOD0(ResetDevice, bool()); | 88 MOCK_METHOD0(ResetDevice, bool()); |
| 89 MOCK_METHOD1(ClaimInterface, bool(const int interface_number)); | 89 MOCK_METHOD1(ClaimInterface, bool(const int interface_number)); |
| 90 MOCK_METHOD1(ReleaseInterface, bool(const int interface_number)); | 90 MOCK_METHOD1(ReleaseInterface, bool(const int interface_number)); |
| 91 MOCK_METHOD2(SetInterfaceAlternateSetting, | 91 MOCK_METHOD2(SetInterfaceAlternateSetting, |
| 92 bool(const int interface_number, const int alternate_setting)); | 92 bool(const int interface_number, const int alternate_setting)); |
| 93 MOCK_METHOD1(GetManufacturer, bool(base::string16* manufacturer)); |
| 94 MOCK_METHOD1(GetProduct, bool(base::string16* product)); |
| 93 MOCK_METHOD1(GetSerial, bool(base::string16* serial)); | 95 MOCK_METHOD1(GetSerial, bool(base::string16* serial)); |
| 94 | 96 |
| 95 virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE { | 97 virtual scoped_refptr<UsbDevice> GetDevice() const OVERRIDE { |
| 96 return device_; | 98 return device_; |
| 97 } | 99 } |
| 98 | 100 |
| 99 void set_device(UsbDevice* device) { device_ = device; } | 101 void set_device(UsbDevice* device) { device_ = device; } |
| 100 | 102 |
| 101 protected: | 103 protected: |
| 102 UsbDevice* device_; | 104 UsbDevice* device_; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 .WillOnce( | 284 .WillOnce( |
| 283 InvokeUsbTransferCallback<5>(usb_service::USB_TRANSFER_TIMEOUT)); | 285 InvokeUsbTransferCallback<5>(usb_service::USB_TRANSFER_TIMEOUT)); |
| 284 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); | 286 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); |
| 285 ASSERT_TRUE(RunExtensionTest("usb/transfer_failure")); | 287 ASSERT_TRUE(RunExtensionTest("usb/transfer_failure")); |
| 286 } | 288 } |
| 287 | 289 |
| 288 IN_PROC_BROWSER_TEST_F(UsbApiTest, InvalidLengthTransfer) { | 290 IN_PROC_BROWSER_TEST_F(UsbApiTest, InvalidLengthTransfer) { |
| 289 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); | 291 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); |
| 290 ASSERT_TRUE(RunExtensionTest("usb/invalid_length_transfer")); | 292 ASSERT_TRUE(RunExtensionTest("usb/invalid_length_transfer")); |
| 291 } | 293 } |
| OLD | NEW |