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

Unified Diff: extensions/browser/api/usb/usb_apitest.cc

Issue 268713013: Move chrome.usb to //extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/usb/usb_api.cc ('k') | extensions/browser/api/usb/usb_device_resource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/usb/usb_apitest.cc
diff --git a/chrome/browser/extensions/api/usb/usb_apitest.cc b/extensions/browser/api/usb/usb_apitest.cc
similarity index 79%
rename from chrome/browser/extensions/api/usb/usb_apitest.cc
rename to extensions/browser/api/usb/usb_apitest.cc
index da67ff7eee4f36edcd8fec6ad21472f4a8f409da..70a8fc33a03aa3b7d61be094c11da0f82c728df1 100644
--- a/chrome/browser/extensions/api/usb/usb_apitest.cc
+++ b/extensions/browser/api/usb/usb_apitest.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/extensions/api/usb/usb_api.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/ui/browser.h"
#include "components/usb_service/usb_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_utils.h"
+#include "extensions/browser/api/usb/usb_api.h"
#include "net/base/io_buffer.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -35,7 +35,7 @@ ACTION_TEMPLATE(InvokeUsbTransferCallback,
// standards-noncompliant behaviour of their compiler.
#if defined(OS_WIN)
#pragma warning(push)
-#pragma warning(disable:4373)
+#pragma warning(disable : 4373)
#endif
class MockUsbDeviceHandle : public UsbDeviceHandle {
@@ -44,24 +44,43 @@ class MockUsbDeviceHandle : public UsbDeviceHandle {
MOCK_METHOD0(Close, void());
- MOCK_METHOD10(ControlTransfer, void(const UsbEndpointDirection direction,
- const TransferRequestType request_type, const TransferRecipient recipient,
- const uint8 request, const uint16 value, const uint16 index,
- net::IOBuffer* buffer, const size_t length, const unsigned int timeout,
- const UsbTransferCallback& callback));
-
- MOCK_METHOD6(BulkTransfer, void(const UsbEndpointDirection direction,
- const uint8 endpoint, net::IOBuffer* buffer, const size_t length,
- const unsigned int timeout, const UsbTransferCallback& callback));
-
- MOCK_METHOD6(InterruptTransfer, void(const UsbEndpointDirection direction,
- const uint8 endpoint, net::IOBuffer* buffer, const size_t length,
- const unsigned int timeout, const UsbTransferCallback& callback));
-
- MOCK_METHOD8(IsochronousTransfer, void(const UsbEndpointDirection direction,
- const uint8 endpoint, net::IOBuffer* buffer, const size_t length,
- const unsigned int packets, const unsigned int packet_length,
- const unsigned int timeout, const UsbTransferCallback& callback));
+ MOCK_METHOD10(ControlTransfer,
+ void(const UsbEndpointDirection direction,
+ const TransferRequestType request_type,
+ const TransferRecipient recipient,
+ const uint8 request,
+ const uint16 value,
+ const uint16 index,
+ net::IOBuffer* buffer,
+ const size_t length,
+ const unsigned int timeout,
+ const UsbTransferCallback& callback));
+
+ MOCK_METHOD6(BulkTransfer,
+ void(const UsbEndpointDirection direction,
+ const uint8 endpoint,
+ net::IOBuffer* buffer,
+ const size_t length,
+ const unsigned int timeout,
+ const UsbTransferCallback& callback));
+
+ MOCK_METHOD6(InterruptTransfer,
+ void(const UsbEndpointDirection direction,
+ const uint8 endpoint,
+ net::IOBuffer* buffer,
+ const size_t length,
+ const unsigned int timeout,
+ const UsbTransferCallback& callback));
+
+ MOCK_METHOD8(IsochronousTransfer,
+ void(const UsbEndpointDirection direction,
+ const uint8 endpoint,
+ net::IOBuffer* buffer,
+ const size_t length,
+ const unsigned int packets,
+ const unsigned int packet_length,
+ const unsigned int timeout,
+ const UsbTransferCallback& callback));
MOCK_METHOD0(ResetDevice, bool());
@@ -82,8 +101,7 @@ class MockUsbConfigDescriptor : public UsbConfigDescriptor {
class MockUsbDevice : public UsbDevice {
public:
explicit MockUsbDevice(MockUsbDeviceHandle* mock_handle)
- : UsbDevice(),
- mock_handle_(mock_handle) {
+ : UsbDevice(), mock_handle_(mock_handle) {
mock_handle->set_device(this);
}
@@ -205,7 +223,13 @@ IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferEvent) {
ControlTransfer(usb_service::USB_DIRECTION_OUTBOUND,
UsbDeviceHandle::STANDARD,
UsbDeviceHandle::DEVICE,
- 1, 2, 3, _, 1, _, _))
+ 1,
+ 2,
+ 3,
+ _,
+ 1,
+ _,
+ _))
.WillOnce(
InvokeUsbTransferCallback<9>(usb_service::USB_TRANSFER_COMPLETED));
EXPECT_CALL(*mock_device_handle_.get(),
« no previous file with comments | « extensions/browser/api/usb/usb_api.cc ('k') | extensions/browser/api/usb/usb_device_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698