| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "device/devices_app/devices_app.h" | 11 #include "device/devices_app/devices_app.h" |
| 12 #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h" | 12 #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h" |
| 13 #include "mojo/shell/public/cpp/application_impl.h" | |
| 14 #include "mojo/shell/public/cpp/application_test_base.h" | 13 #include "mojo/shell/public/cpp/application_test_base.h" |
| 15 | 14 |
| 16 namespace device { | 15 namespace device { |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 class DevicesAppTest : public mojo::test::ApplicationTestBase { | 18 class DevicesAppTest : public mojo::test::ApplicationTestBase { |
| 20 public: | 19 public: |
| 21 DevicesAppTest() {} | 20 DevicesAppTest() {} |
| 22 ~DevicesAppTest() override {} | 21 ~DevicesAppTest() override {} |
| 23 | 22 |
| 24 void SetUp() override { | 23 void SetUp() override { |
| 25 ApplicationTestBase::SetUp(); | 24 ApplicationTestBase::SetUp(); |
| 26 application_impl()->ConnectToService("mojo:devices", &usb_device_manager_); | 25 shell()->ConnectToService("mojo:devices", &usb_device_manager_); |
| 27 } | 26 } |
| 28 | 27 |
| 29 usb::DeviceManager* usb_device_manager() { return usb_device_manager_.get(); } | 28 usb::DeviceManager* usb_device_manager() { return usb_device_manager_.get(); } |
| 30 | 29 |
| 31 private: | 30 private: |
| 32 usb::DeviceManagerPtr usb_device_manager_; | 31 usb::DeviceManagerPtr usb_device_manager_; |
| 33 | 32 |
| 34 DISALLOW_COPY_AND_ASSIGN(DevicesAppTest); | 33 DISALLOW_COPY_AND_ASSIGN(DevicesAppTest); |
| 35 }; | 34 }; |
| 36 | 35 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 base::RunLoop loop; | 46 base::RunLoop loop; |
| 48 usb::EnumerationOptionsPtr options = usb::EnumerationOptions::New(); | 47 usb::EnumerationOptionsPtr options = usb::EnumerationOptions::New(); |
| 49 options->filters = mojo::Array<usb::DeviceFilterPtr>(1); | 48 options->filters = mojo::Array<usb::DeviceFilterPtr>(1); |
| 50 options->filters[0] = usb::DeviceFilter::New(); | 49 options->filters[0] = usb::DeviceFilter::New(); |
| 51 usb_device_manager()->GetDevices( | 50 usb_device_manager()->GetDevices( |
| 52 std::move(options), base::Bind(&OnGetDevices, loop.QuitClosure())); | 51 std::move(options), base::Bind(&OnGetDevices, loop.QuitClosure())); |
| 53 loop.Run(); | 52 loop.Run(); |
| 54 } | 53 } |
| 55 | 54 |
| 56 } // namespace device | 55 } // namespace device |
| OLD | NEW |