1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "services/device/serial/fake_serial_device_enumerator.h"
12 FakeSerialEnumerator::FakeSerialEnumerator() = default;
14 FakeSerialEnumerator::~FakeSerialEnumerator() = default;
16 void FakeSerialEnumerator::AddDevicePath(const base::FilePath& path) {
17 auto port = mojom::SerialPortInfo::New();
18 port->token = base::UnguessableToken::Create();
20 paths_[path] = port->token;
21 AddPort(std::move(port));
24 void FakeSerialEnumerator::RemoveDevicePath(const base::FilePath& path) {
25 auto it = paths_.find(path);
26 DCHECK(it != paths_.end());
27 base::UnguessableToken token = it->second;