forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_device_client.cc
43 lines (34 loc) · 1.35 KB
/
test_device_client.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/test/test_device_client.h"
#include "build/build_config.h"
// This file unconditionally includes these headers despite conditionally
// depending on the corresponding targets. The code below needs the destructors
// of the classes defined even when the classes are never instantiated.
// TODO: This should probably be done more explicitly to avoid ambiguity.
#include "device/hid/hid_service.h" // nogncheck
#include "device/usb/usb_service.h" // nogncheck
namespace device {
TestDeviceClient::TestDeviceClient(
scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner)
: blocking_task_runner_(blocking_task_runner) {}
TestDeviceClient::~TestDeviceClient() {}
HidService* TestDeviceClient::GetHidService() {
#if !defined(OS_ANDROID) && !defined(OS_IOS) && \
!(defined(OS_LINUX) && !defined(USE_UDEV))
if (!hid_service_) {
hid_service_ = HidService::Create(blocking_task_runner_);
}
#endif
return hid_service_.get();
}
UsbService* TestDeviceClient::GetUsbService() {
#if !defined(OS_ANDROID) && !defined(OS_IOS)
if (!usb_service_) {
usb_service_ = UsbService::Create(blocking_task_runner_);
}
#endif
return usb_service_.get();
}
} // namespace device