~mir-team/mir/in-process-egl+input-conglomeration

« back to all changes in this revision

Viewing changes to tests/unit-tests/graphics/gbm/test_gbm_platform.cpp

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "mir/graphics/platform_ipc_package.h"
20
20
#include "mir/graphics/drm_authenticator.h"
21
21
#include "src/server/graphics/gbm/gbm_platform.h"
 
22
#include "src/server/graphics/gbm/internal_client.h"
22
23
#include "mir_test_doubles/null_virtual_terminal.h"
 
24
#include "mir_test_doubles/stub_surface.h"
23
25
 
24
26
#include "mir/graphics/null_display_report.h"
25
27
 
26
28
#include <gtest/gtest.h>
27
29
 
28
30
#include "mir_test_doubles/mock_drm.h"
29
 
#include "mock_gbm.h"
 
31
#include "mir_test_doubles/mock_gbm.h"
30
32
 
31
33
#include <gtest/gtest.h>
32
34
#include <gmock/gmock.h>
57
59
    }
58
60
 
59
61
    ::testing::NiceMock<mtd::MockDRM> mock_drm;
60
 
    ::testing::NiceMock<mg::gbm::MockGBM> mock_gbm;
 
62
    ::testing::NiceMock<mtd::MockGBM> mock_gbm;
61
63
};
62
64
}
63
65
 
139
141
        authenticator->drm_auth_magic(magic);
140
142
    }, std::runtime_error);
141
143
}
 
144
 
 
145
/* TODO: this function is a bit fragile because libmirserver and libmirclient both have very different
 
146
 *       implementations and both have symbols for it. If the linking order of the test changes,
 
147
 *       specifically, if mir_egl_mesa_display_is_valid resolves into libmirclient, then this test will break. 
 
148
 */
 
149
TEST_F(GBMGraphicsPlatform, platform_provides_validation_of_display_for_internal_clients)
 
150
{
 
151
    auto stub_surface = std::make_shared<mtd::StubSurface>();
 
152
    MirMesaEGLNativeDisplay* native_display = nullptr;
 
153
    EXPECT_EQ(0, mir_server_internal_display_is_valid(native_display));
 
154
    {
 
155
        auto platform = create_platform();
 
156
        auto client = platform->create_internal_client(stub_surface);
 
157
        native_display = reinterpret_cast<MirMesaEGLNativeDisplay*>(client->egl_native_display());
 
158
        EXPECT_EQ(1, mir_server_internal_display_is_valid(native_display));
 
159
    }
 
160
    EXPECT_EQ(0, mir_server_internal_display_is_valid(native_display));
 
161
}