Upload upstream chromium 108.0.5359.1
[platform/framework/web/chromium-efl.git] / services / device / serial / serial_device_enumerator_unittest.cc
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.
4
5 #include "services/device/serial/serial_device_enumerator.h"
6
7 #include <vector>
8
9 #include "base/test/task_environment.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace device {
13
14 namespace {
15
16 class SerialDeviceEnumeratorTest : public testing::Test {
17  public:
18   SerialDeviceEnumeratorTest()
19       : task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {}
20   ~SerialDeviceEnumeratorTest() override = default;
21
22  protected:
23   base::test::TaskEnvironment task_environment_;
24 };
25
26 TEST_F(SerialDeviceEnumeratorTest, GetDevices) {
27   // There is no guarantee that a test machine will have a serial device
28   // available. The purpose of this test is to ensure that the process of
29   // attempting to enumerate devices does not cause a crash.
30   auto enumerator = SerialDeviceEnumerator::Create(
31       task_environment_.GetMainThreadTaskRunner());
32   ASSERT_TRUE(enumerator);
33   std::vector<mojom::SerialPortInfoPtr> devices = enumerator->GetDevices();
34 }
35
36 }  // namespace
37
38 }  // namespace device