| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 virtual scoped_refptr<UsbDeviceHandle> Open() OVERRIDE { | 124 virtual scoped_refptr<UsbDeviceHandle> Open() OVERRIDE { |
| 125 return mock_handle_; | 125 return mock_handle_; |
| 126 } | 126 } |
| 127 | 127 |
| 128 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) OVERRIDE { | 128 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) OVERRIDE { |
| 129 EXPECT_TRUE(false) << "Should not be reached"; | 129 EXPECT_TRUE(false) << "Should not be reached"; |
| 130 return false; | 130 return false; |
| 131 } | 131 } |
| 132 | 132 |
| 133 #if defined(OS_CHROMEOS) | 133 #if defined(OS_CHROMEOS) |
| 134 virtual void RequestUsbAcess( | 134 virtual void RequestUsbAccess( |
| 135 int interface_id, | 135 int interface_id, |
| 136 const base::Callback<void(bool success)>& callback) OVERRIDE { | 136 const base::Callback<void(bool success)>& callback) OVERRIDE { |
| 137 BrowserThread::PostTask( | 137 BrowserThread::PostTask( |
| 138 BrowserThread::FILE, FROM_HERE, base::Bind(callback, true)); | 138 BrowserThread::FILE, FROM_HERE, base::Bind(callback, true)); |
| 139 } | 139 } |
| 140 #endif // OS_CHROMEOS | 140 #endif // OS_CHROMEOS |
| 141 | 141 |
| 142 MOCK_METHOD0(ListInterfaces, scoped_refptr<UsbConfigDescriptor>()); | 142 MOCK_METHOD0(ListInterfaces, scoped_refptr<UsbConfigDescriptor>()); |
| 143 | 143 |
| 144 private: | 144 private: |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 .WillOnce( | 282 .WillOnce( |
| 283 InvokeUsbTransferCallback<5>(usb_service::USB_TRANSFER_TIMEOUT)); | 283 InvokeUsbTransferCallback<5>(usb_service::USB_TRANSFER_TIMEOUT)); |
| 284 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); | 284 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); |
| 285 ASSERT_TRUE(RunExtensionTest("usb/transfer_failure")); | 285 ASSERT_TRUE(RunExtensionTest("usb/transfer_failure")); |
| 286 } | 286 } |
| 287 | 287 |
| 288 IN_PROC_BROWSER_TEST_F(UsbApiTest, InvalidLengthTransfer) { | 288 IN_PROC_BROWSER_TEST_F(UsbApiTest, InvalidLengthTransfer) { |
| 289 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); | 289 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(AnyNumber()); |
| 290 ASSERT_TRUE(RunExtensionTest("usb/invalid_length_transfer")); | 290 ASSERT_TRUE(RunExtensionTest("usb/invalid_length_transfer")); |
| 291 } | 291 } |
| OLD | NEW |