| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 base::MakeUnique<FakeChooserService>(render_frame_host), | 66 base::MakeUnique<FakeChooserService>(render_frame_host), |
| 67 std::move(request)); | 67 std::move(request)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 explicit FakeChooserService(RenderFrameHost* render_frame_host) | 70 explicit FakeChooserService(RenderFrameHost* render_frame_host) |
| 71 : render_frame_host_(render_frame_host) {} | 71 : render_frame_host_(render_frame_host) {} |
| 72 | 72 |
| 73 ~FakeChooserService() override {} | 73 ~FakeChooserService() override {} |
| 74 | 74 |
| 75 // device::usb::ChooserService: | 75 // device::usb::ChooserService: |
| 76 void GetPermission(std::vector<device::usb::DeviceFilterPtr> device_filters, | 76 void GetPermission(const std::vector<device::UsbDeviceFilter>& device_filters, |
| 77 const GetPermissionCallback& callback) override { | 77 const GetPermissionCallback& callback) override { |
| 78 auto chooser_controller = base::MakeUnique<UsbChooserController>( | 78 auto chooser_controller = base::MakeUnique<UsbChooserController>( |
| 79 render_frame_host_, std::move(device_filters), callback); | 79 render_frame_host_, device_filters, callback); |
| 80 new FakeChooserView(std::move(chooser_controller)); | 80 new FakeChooserView(std::move(chooser_controller)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 RenderFrameHost* const render_frame_host_; | 84 RenderFrameHost* const render_frame_host_; |
| 85 | 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(FakeChooserService); | 86 DISALLOW_COPY_AND_ASSIGN(FakeChooserService); |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 class WebUsbTest : public InProcessBrowserTest { | 89 class WebUsbTest : public InProcessBrowserTest { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 embedded_frame, | 192 embedded_frame, |
| 193 "navigator.usb.getDevices()" | 193 "navigator.usb.getDevices()" |
| 194 " .then(devices => {" | 194 " .then(devices => {" |
| 195 " domAutomationController.send(devices.length.toString());" | 195 " domAutomationController.send(devices.length.toString());" |
| 196 " });", | 196 " });", |
| 197 &result)); | 197 &result)); |
| 198 EXPECT_EQ("1", result); | 198 EXPECT_EQ("1", result); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace | 201 } // namespace |
| OLD | NEW |