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

Unified Diff: device/usb/mojo/device_manager_impl_unittest.cc

Issue 2821723002: Move classes in the device.usb Mojo namespace to device.mojom (Closed)
Patch Set: mcasas@ nits Created 3 years, 8 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 | « device/usb/mojo/device_manager_impl.cc ('k') | device/usb/mojo/type_converters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/mojo/device_manager_impl_unittest.cc
diff --git a/device/usb/mojo/device_manager_impl_unittest.cc b/device/usb/mojo/device_manager_impl_unittest.cc
index f3a1c9dcbf9b84c585c0304e999544e6ddfbfd4c..1a234cdaa85439765cebc0872159d9dc32173d26 100644
--- a/device/usb/mojo/device_manager_impl_unittest.cc
+++ b/device/usb/mojo/device_manager_impl_unittest.cc
@@ -30,6 +30,13 @@ using ::testing::Invoke;
using ::testing::_;
namespace device {
+
+using mojom::UsbDevicePtr;
+using mojom::UsbDeviceInfoPtr;
+using mojom::UsbDeviceManagerClientPtr;
+using mojom::UsbDeviceManagerPtr;
+using mojom::UsbEnumerationOptionsPtr;
+
namespace usb {
namespace {
@@ -47,8 +54,8 @@ class USBDeviceManagerImplTest : public testing::Test {
~USBDeviceManagerImplTest() override {}
protected:
- DeviceManagerPtr ConnectToDeviceManager() {
- DeviceManagerPtr device_manager;
+ UsbDeviceManagerPtr ConnectToDeviceManager() {
+ UsbDeviceManagerPtr device_manager;
DeviceManagerImpl::Create(permission_provider_.GetWeakPtr(),
mojo::MakeRequest(&device_manager));
return device_manager;
@@ -61,32 +68,32 @@ class USBDeviceManagerImplTest : public testing::Test {
std::unique_ptr<base::MessageLoop> message_loop_;
};
-class MockDeviceManagerClient : public DeviceManagerClient {
+class MockDeviceManagerClient : public mojom::UsbDeviceManagerClient {
public:
MockDeviceManagerClient() : binding_(this) {}
~MockDeviceManagerClient() {}
- DeviceManagerClientPtr CreateInterfacePtrAndBind() {
+ UsbDeviceManagerClientPtr CreateInterfacePtrAndBind() {
return binding_.CreateInterfacePtrAndBind();
}
- MOCK_METHOD1(DoOnDeviceAdded, void(DeviceInfo*));
- void OnDeviceAdded(DeviceInfoPtr device_info) {
+ MOCK_METHOD1(DoOnDeviceAdded, void(mojom::UsbDeviceInfo*));
+ void OnDeviceAdded(UsbDeviceInfoPtr device_info) {
DoOnDeviceAdded(device_info.get());
}
- MOCK_METHOD1(DoOnDeviceRemoved, void(DeviceInfo*));
- void OnDeviceRemoved(DeviceInfoPtr device_info) {
+ MOCK_METHOD1(DoOnDeviceRemoved, void(mojom::UsbDeviceInfo*));
+ void OnDeviceRemoved(UsbDeviceInfoPtr device_info) {
DoOnDeviceRemoved(device_info.get());
}
private:
- mojo::Binding<DeviceManagerClient> binding_;
+ mojo::Binding<mojom::UsbDeviceManagerClient> binding_;
};
void ExpectDevicesAndThen(const std::set<std::string>& expected_guids,
const base::Closure& continuation,
- std::vector<DeviceInfoPtr> results) {
+ std::vector<UsbDeviceInfoPtr> results) {
EXPECT_EQ(expected_guids.size(), results.size());
std::set<std::string> actual_guids;
for (size_t i = 0; i < results.size(); ++i)
@@ -111,9 +118,9 @@ TEST_F(USBDeviceManagerImplTest, GetDevices) {
device_client_.usb_service()->AddDevice(device1);
device_client_.usb_service()->AddDevice(device2);
- DeviceManagerPtr device_manager = ConnectToDeviceManager();
+ UsbDeviceManagerPtr device_manager = ConnectToDeviceManager();
- EnumerationOptionsPtr options = EnumerationOptions::New();
+ UsbEnumerationOptionsPtr options = mojom::UsbEnumerationOptions::New();
UsbDeviceFilter filter;
filter.vendor_id = 0x1234;
options->filters.emplace();
@@ -138,11 +145,11 @@ TEST_F(USBDeviceManagerImplTest, GetDevice) {
device_client_.usb_service()->AddDevice(mock_device);
- DeviceManagerPtr device_manager = ConnectToDeviceManager();
+ UsbDeviceManagerPtr device_manager = ConnectToDeviceManager();
{
base::RunLoop loop;
- DevicePtr device;
+ UsbDevicePtr device;
device_manager->GetDevice(mock_device->guid(), mojo::MakeRequest(&device));
// Close is a no-op if the device hasn't been opened but ensures that the
// pipe was successfully connected.
@@ -150,7 +157,7 @@ TEST_F(USBDeviceManagerImplTest, GetDevice) {
loop.Run();
}
- DevicePtr bad_device;
+ UsbDevicePtr bad_device;
device_manager->GetDevice("not a real guid", mojo::MakeRequest(&bad_device));
{
@@ -173,7 +180,7 @@ TEST_F(USBDeviceManagerImplTest, Client) {
device_client_.usb_service()->AddDevice(device0);
- DeviceManagerPtr device_manager = ConnectToDeviceManager();
+ UsbDeviceManagerPtr device_manager = ConnectToDeviceManager();
MockDeviceManagerClient mock_client;
device_manager->SetClient(mock_client.CreateInterfacePtrAndBind());
« no previous file with comments | « device/usb/mojo/device_manager_impl.cc ('k') | device/usb/mojo/type_converters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698