2
* Copyright © 2014 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
19
#include "src/platform/graphics/mesa/display_helpers.h"
20
#include "mir/udev/wrapper.h"
22
#include "mir_test_framework/udev_environment.h"
23
#include "mir_test_doubles/mock_drm.h"
27
#include <gtest/gtest.h>
28
#include <gmock/gmock.h>
30
namespace mgm = mir::graphics::mesa;
31
namespace mtf = mir::mir_test_framework;
32
namespace mtd = mir::test::doubles;
37
MATCHER_P(FlagSet, flag, "")
42
class DRMHelperTest : public ::testing::Test
47
fake_devices.add_standard_device("standard-drm-devices");
51
::testing::NiceMock<mtd::MockDRM> mock_drm;
52
mtf::UdevEnvironment fake_devices;
57
TEST_F(DRMHelperTest, closes_drm_fd_on_exec)
59
using namespace testing;
61
EXPECT_CALL(mock_drm, open(_, FlagSet(O_CLOEXEC), _));
63
mgm::helpers::DRMHelper drm_helper;
64
drm_helper.setup(std::make_shared<mir::udev::Context>());