| 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 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 RenderFrameHost* const render_frame_host_; | 87 RenderFrameHost* const render_frame_host_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(FakeChooserService); | 89 DISALLOW_COPY_AND_ASSIGN(FakeChooserService); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 class WebUsbTest : public InProcessBrowserTest { | 92 class WebUsbTest : public InProcessBrowserTest { |
| 93 public: | 93 public: |
| 94 void SetUpCommandLine(base::CommandLine* command_line) override { | 94 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 95 command_line->AppendSwitch( | 95 command_line->AppendSwitch( |
| 96 switches::kEnableExperimentalWebPlatformFeatures); | 96 switches::kEnableExperimentalWebPlatformFeatures); |
| 97 InProcessBrowserTest::SetUpCommandLine(command_line); | |
| 98 } | 97 } |
| 99 | 98 |
| 100 void SetUpOnMainThread() override { | 99 void SetUpOnMainThread() override { |
| 101 embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); | 100 embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); |
| 102 ASSERT_TRUE(embedded_test_server()->Start()); | 101 ASSERT_TRUE(embedded_test_server()->Start()); |
| 103 | 102 |
| 104 device_client_.reset(new MockDeviceClient()); | 103 device_client_.reset(new MockDeviceClient()); |
| 105 scoped_refptr<MockUsbDevice> mock_device( | 104 scoped_refptr<MockUsbDevice> mock_device( |
| 106 new MockUsbDevice(0, 0, "Test Manufacturer", "Test Device", "123456")); | 105 new MockUsbDevice(0, 0, "Test Manufacturer", "Test Device", "123456")); |
| 107 device_client_->usb_service()->AddDevice(mock_device); | 106 device_client_->usb_service()->AddDevice(mock_device); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 web_contents, | 146 web_contents, |
| 148 "navigator.usb.getDevices()" | 147 "navigator.usb.getDevices()" |
| 149 " .then(devices => {" | 148 " .then(devices => {" |
| 150 " domAutomationController.send(devices.length.toString());" | 149 " domAutomationController.send(devices.length.toString());" |
| 151 " });", | 150 " });", |
| 152 &result)); | 151 &result)); |
| 153 EXPECT_EQ("1", result); | 152 EXPECT_EQ("1", result); |
| 154 } | 153 } |
| 155 | 154 |
| 156 } // namespace | 155 } // namespace |
| OLD | NEW |