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
3 // found in the LICENSE file.
5 #include "extensions/browser/api/serial/serial_service_factory.h"
7 #include "content/public/browser/browser_thread.h"
8 #include "device/serial/serial_service_impl.h"
10 namespace extensions
{
12 const base::Callback
<void(
13 mojo::InterfaceRequest
<device::serial::SerialService
>)>*
14 g_serial_service_test_factory
= nullptr;
17 void BindToSerialServiceRequest(
18 mojo::InterfaceRequest
<device::serial::SerialService
> request
) {
19 if (g_serial_service_test_factory
) {
20 g_serial_service_test_factory
->Run(request
.Pass());
23 device::SerialServiceImpl::CreateOnMessageLoop(
24 content::BrowserThread::GetMessageLoopProxyForThread(
25 content::BrowserThread::FILE),
26 content::BrowserThread::GetMessageLoopProxyForThread(
27 content::BrowserThread::IO
),
28 content::BrowserThread::GetMessageLoopProxyForThread(
29 content::BrowserThread::UI
),
33 void SetSerialServiceFactoryForTest(const base::Callback
<
34 void(mojo::InterfaceRequest
<device::serial::SerialService
>)>* callback
) {
35 g_serial_service_test_factory
= callback
;
38 } // namespace extensions