~ubuntu-branches/ubuntu/utopic/mir/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/unit-tests/graphics/mesa/test_platform.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-03-10 19:28:46 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: package-import@ubuntu.com-20140310192846-rq9qm3ec26yrelo2
Tags: upstream-0.1.6+14.04.20140310
ImportĀ upstreamĀ versionĀ 0.1.6+14.04.20140310

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "mir_test_doubles/mock_buffer.h"
25
25
#include "mir_test_doubles/mock_buffer_packer.h"
26
26
 
27
 
#include "mir/graphics/null_display_report.h"
 
27
#include "src/server/report/null_report_factory.h"
28
28
 
29
29
#include <gtest/gtest.h>
30
30
 
31
31
#include "mir_test_framework/udev_environment.h"
 
32
#include "mir_test/pipe.h"
32
33
 
33
34
#include "mir_test_doubles/mock_drm.h"
34
35
#include "mir_test_doubles/mock_gbm.h"
45
46
namespace mgm = mir::graphics::mesa;
46
47
namespace mtd = mir::test::doubles;
47
48
namespace mtf = mir::mir_test_framework;
 
49
namespace mr = mir::report;
48
50
 
49
51
namespace
50
52
{
56
58
    {
57
59
        ::testing::Mock::VerifyAndClearExpectations(&mock_drm);
58
60
        ::testing::Mock::VerifyAndClearExpectations(&mock_gbm);
59
 
        fake_devices.add_standard_drm_devices();
 
61
        fake_devices.add_standard_device("standard-drm-devices");
60
62
    }
61
63
 
62
64
    std::shared_ptr<mg::Platform> create_platform()
63
65
    {
64
66
        return std::make_shared<mgm::Platform>(
65
 
            std::make_shared<mg::NullDisplayReport>(),
 
67
            mr::null_display_report(),
66
68
            std::make_shared<mtd::NullVirtualTerminal>());
67
69
    }
68
70
 
75
77
TEST_F(MesaGraphicsPlatform, get_ipc_package)
76
78
{
77
79
    using namespace testing;
78
 
    const int auth_fd{66};
 
80
    mir::test::Pipe auth_pipe;
 
81
    int const auth_fd{auth_pipe.read_fd()};
79
82
 
80
83
    /* First time for master DRM fd, second for authenticated fd */
 
84
    EXPECT_CALL(mock_drm, open(_,_,_))
 
85
        .WillOnce(Return(mock_drm.fake_drm.fd()));
81
86
    EXPECT_CALL(mock_drm, drmOpen(_,_))
82
 
        .Times(2)
83
 
        .WillOnce(Return(mock_drm.fake_drm.fd()))
84
87
        .WillOnce(Return(auth_fd));
85
88
 
86
89
    /* Expect proper authorization */
106
109
{
107
110
    using namespace ::testing;
108
111
 
109
 
    EXPECT_CALL(mock_drm, drmOpen(_,_))
 
112
    EXPECT_CALL(mock_drm, open(_,_,_))
110
113
            .WillRepeatedly(Return(-1));
111
114
 
112
115
    try
185
188
{
186
189
    using namespace testing;
187
190
 
188
 
    drm_magic_t const magic{0x10111213};
 
191
    unsigned int const magic{0x10111213};
189
192
 
190
193
    EXPECT_CALL(mock_drm, drmAuthMagic(mock_drm.fake_drm.fd(),magic))
191
194
        .WillOnce(Return(0));
199
202
{
200
203
    using namespace testing;
201
204
 
202
 
    drm_magic_t const magic{0x10111213};
 
205
    unsigned int const magic{0x10111213};
203
206
 
204
207
    EXPECT_CALL(mock_drm, drmAuthMagic(mock_drm.fake_drm.fd(),magic))
205
208
        .WillOnce(Return(-1));