| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return new FakeSerialGetDevicesFunction(); | 128 return new FakeSerialGetDevicesFunction(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 ExtensionFunction* FakeSerialConnectFunctionFactory() { | 131 ExtensionFunction* FakeSerialConnectFunctionFactory() { |
| 132 return new FakeSerialConnectFunction(); | 132 return new FakeSerialConnectFunction(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void CreateTestSerialServiceOnFileThread( | 135 void CreateTestSerialServiceOnFileThread( |
| 136 mojo::InterfaceRequest<device::serial::SerialService> request) { | 136 mojo::InterfaceRequest<device::serial::SerialService> request) { |
| 137 auto io_handler_factory = base::Bind(&FakeEchoSerialIoHandler::Create); | 137 auto io_handler_factory = base::Bind(&FakeEchoSerialIoHandler::Create); |
| 138 auto connection_factory = new device::SerialConnectionFactory( | 138 auto* connection_factory = new device::SerialConnectionFactory( |
| 139 io_handler_factory, | 139 io_handler_factory, content::BrowserThread::GetMessageLoopProxyForThread( |
| 140 content::BrowserThread::GetMessageLoopProxyForThread( | 140 content::BrowserThread::IO)); |
| 141 content::BrowserThread::IO)); | |
| 142 std::unique_ptr<device::SerialDeviceEnumerator> device_enumerator( | 141 std::unique_ptr<device::SerialDeviceEnumerator> device_enumerator( |
| 143 new FakeSerialDeviceEnumerator); | 142 new FakeSerialDeviceEnumerator); |
| 144 new device::SerialServiceImpl( | 143 new device::SerialServiceImpl( |
| 145 connection_factory, std::move(device_enumerator), std::move(request)); | 144 connection_factory, std::move(device_enumerator), std::move(request)); |
| 146 } | 145 } |
| 147 | 146 |
| 148 void CreateTestSerialService( | 147 void CreateTestSerialService( |
| 149 mojo::InterfaceRequest<device::serial::SerialService> request) { | 148 mojo::InterfaceRequest<device::serial::SerialService> request) { |
| 150 content::BrowserThread::PostTask( | 149 content::BrowserThread::PostTask( |
| 151 content::BrowserThread::FILE, | 150 content::BrowserThread::FILE, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 IN_PROC_BROWSER_TEST_P(SerialApiTest, SerialRealHardware) { | 196 IN_PROC_BROWSER_TEST_P(SerialApiTest, SerialRealHardware) { |
| 198 ResultCatcher catcher; | 197 ResultCatcher catcher; |
| 199 catcher.RestrictToBrowserContext(browser()->profile()); | 198 catcher.RestrictToBrowserContext(browser()->profile()); |
| 200 | 199 |
| 201 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; | 200 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; |
| 202 } | 201 } |
| 203 | 202 |
| 204 INSTANTIATE_TEST_CASE_P(SerialApiTest, SerialApiTest, testing::Bool()); | 203 INSTANTIATE_TEST_CASE_P(SerialApiTest, SerialApiTest, testing::Bool()); |
| 205 | 204 |
| 206 } // namespace extensions | 205 } // namespace extensions |
| OLD | NEW |