summaryrefslogtreecommitdiff
path: root/chromium/device/usb/mock_usb_service.cc
blob: 930fbd9c3ff198237c28255be6b789e67661271f (plain)
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
// 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/usb/mock_usb_service.h"

#include <string>
#include <vector>

#include "base/threading/thread_task_runner_handle.h"
#include "device/usb/usb_device.h"

namespace device {

MockUsbService::MockUsbService() : UsbService(nullptr) {}

MockUsbService::~MockUsbService() = default;

void MockUsbService::AddDevice(scoped_refptr<UsbDevice> device) {
  devices()[device->guid()] = device;
  NotifyDeviceAdded(device);
}

void MockUsbService::RemoveDevice(scoped_refptr<UsbDevice> device) {
  devices().erase(device->guid());
  UsbService::NotifyDeviceRemoved(device);
}

}  // namespace device