• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium OS 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.
4 
5 #ifndef LIBBRILLO_BRILLO_UDEV_MOCK_UDEV_H_
6 #define LIBBRILLO_BRILLO_UDEV_MOCK_UDEV_H_
7 
8 #include <memory>
9 
10 #include <brillo/brillo_export.h>
11 #include <brillo/udev/udev.h>
12 #include <brillo/udev/udev_device.h>
13 #include <brillo/udev/udev_enumerate.h>
14 #include <brillo/udev/udev_monitor.h>
15 #include <gmock/gmock.h>
16 
17 namespace brillo {
18 
19 class BRILLO_EXPORT MockUdev : public Udev {
20  public:
MockUdev()21   MockUdev() : Udev(nullptr) {}
22   ~MockUdev() override = default;
23 
24   MOCK_METHOD(std::unique_ptr<UdevDevice>,
25               CreateDeviceFromSysPath,
26               (const char*),
27               (override));
28   MOCK_METHOD(std::unique_ptr<UdevDevice>,
29               CreateDeviceFromDeviceNumber,
30               (char, dev_t),
31               (override));
32   MOCK_METHOD(std::unique_ptr<UdevDevice>,
33               CreateDeviceFromSubsystemSysName,
34               (const char*, const char*),
35               (override));
36   MOCK_METHOD(std::unique_ptr<UdevEnumerate>, CreateEnumerate, (), (override));
37   MOCK_METHOD(std::unique_ptr<UdevMonitor>,
38               CreateMonitorFromNetlink,
39               (const char*),
40               (override));
41 
42  private:
43   DISALLOW_COPY_AND_ASSIGN(MockUdev);
44 };
45 
46 }  // namespace brillo
47 
48 #endif  // LIBBRILLO_BRILLO_UDEV_MOCK_UDEV_H_
49