~untrusted-ci-dev-bot/mir/mir-ubuntu-yakkety-landing-005

« back to all changes in this revision

Viewing changes to tests/mir_test_doubles/mock_udev.cpp

  • Committer: CI Train Bot
  • Author(s): Christopher James Halse Rogers, Daniel van Vugt, Andreas Pokorny, Kevin Gunn, Alberto Aguirre, Alan Griffiths, raof at ubuntu, CI Train Bot, Cemil Azizoglu, Kevin DuBois, Kevin, Alexandros Frantzis, Alfonso Sanchez-Beato
  • Date: 2016-03-30 00:23:12 UTC
  • mfrom: (1160.2170.114 0.21)
  • Revision ID: ci-train-bot@canonical.com-20160330002312-47z3hdu0bfj3ii1z
Mir 0.21.0 release
Approved by: Daniel van Vugt, Alan Griffiths

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2016 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Andreas Pokorny <andreas.pokorny@canonical.com>
 
17
 */
 
18
 
 
19
#include "mir/test/doubles/mock_udev.h"
 
20
 
 
21
namespace mtd = mir::test::doubles;
 
22
 
 
23
namespace
 
24
{
 
25
mtd::MockUdev* global_udev = nullptr;
 
26
}
 
27
 
 
28
mtd::MockUdev::MockUdev()
 
29
{
 
30
    using namespace testing;
 
31
    assert(global_udev == nullptr && "Only one udev mock object per process is allowed");
 
32
    global_udev = this;
 
33
}
 
34
 
 
35
mtd::MockUdev::~MockUdev() noexcept
 
36
{
 
37
    global_udev = nullptr;
 
38
}
 
39
 
 
40
char const* udev_device_get_devnode(udev_device* dev)
 
41
{
 
42
    return global_udev->udev_device_get_devnode(dev);
 
43
}
 
44
 
 
45
char const* udev_device_get_property_value(udev_device* dev, char const* property)
 
46
{
 
47
    return global_udev->udev_device_get_property_value(dev, property);
 
48
}
 
49
 
 
50
udev_device* udev_device_unref(udev_device* device)
 
51
{
 
52
    return global_udev->udev_device_unref(device);
 
53
}