aboutsummaryrefslogtreecommitdiffstats
path: root/brillo/udev/mock_udev.h
blob: addd29c287fb7ad05e983a5bbd65186cdb35f685 (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
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef LIBBRILLO_BRILLO_UDEV_MOCK_UDEV_H_
#define LIBBRILLO_BRILLO_UDEV_MOCK_UDEV_H_

#include <memory>

#include <brillo/brillo_export.h>
#include <brillo/udev/udev.h>
#include <brillo/udev/udev_device.h>
#include <brillo/udev/udev_enumerate.h>
#include <brillo/udev/udev_monitor.h>
#include <gmock/gmock.h>

namespace brillo {

class BRILLO_EXPORT MockUdev : public Udev {
 public:
  MockUdev() : Udev(nullptr) {}
  ~MockUdev() override = default;

  MOCK_METHOD1(CreateDeviceFromSysPath,
               std::unique_ptr<UdevDevice>(const char* sys_path));
  MOCK_METHOD2(CreateDeviceFromDeviceNumber,
               std::unique_ptr<UdevDevice>(char type, dev_t device_number));
  MOCK_METHOD2(CreateDeviceFromSubsystemSysName,
               std::unique_ptr<UdevDevice>(const char* subsystem,
                                           const char* sys_name));
  MOCK_METHOD0(CreateEnumerate, std::unique_ptr<UdevEnumerate>());
  MOCK_METHOD1(CreateMonitorFromNetlink,
               std::unique_ptr<UdevMonitor>(const char* name));

 private:
  DISALLOW_COPY_AND_ASSIGN(MockUdev);
};

}  // namespace brillo

#endif  // LIBBRILLO_BRILLO_UDEV_MOCK_UDEV_H_