~robertcarr/mir/add-log-all-option

« back to all changes in this revision

Viewing changes to tests/unit-tests/frontend/test_session_mediator_gbm.cpp

tests: Deduplicate mg::GraphicBufferAllocator stubs.

Approved by Daniel van Vugt, Kevin DuBois, Alan Griffiths, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17
17
 */
18
18
 
19
 
#include "mir/graphics/graphic_buffer_allocator.h"
20
19
#include "mir/frontend/session_mediator_report.h"
21
20
#include "src/server/frontend/session_mediator.h"
22
21
#include "src/server/frontend/resource_cache.h"
35
34
#include "mir_test_doubles/null_platform.h"
36
35
#include "mir_test_doubles/mock_session.h"
37
36
#include "mir_test_doubles/stub_shell.h"
 
37
#include "mir_test_doubles/stub_buffer_allocator.h"
38
38
 
39
39
#include <gtest/gtest.h>
40
40
#include <gmock/gmock.h>
49
49
namespace
50
50
{
51
51
 
52
 
class StubGraphicBufferAllocator : public mg::GraphicBufferAllocator
53
 
{
54
 
public:
55
 
    std::shared_ptr<mg::Buffer> alloc_buffer(mg::BufferProperties const&)
56
 
    {
57
 
        return std::shared_ptr<mg::Buffer>();
58
 
    }
59
 
 
60
 
    virtual std::vector<geom::PixelFormat> supported_pixel_formats()
61
 
    {
62
 
        return std::vector<geom::PixelFormat>();
63
 
    }
64
 
};
65
 
 
66
52
class MockAuthenticatingPlatform : public mtd::NullPlatform, public mg::DRMAuthenticator
67
53
{
68
54
 public:
69
55
    std::shared_ptr<mg::GraphicBufferAllocator> create_buffer_allocator(
70
56
        const std::shared_ptr<mg::BufferInitializer>& /*buffer_initializer*/) override
71
57
    {
72
 
        return std::shared_ptr<StubGraphicBufferAllocator>();
 
58
        return std::shared_ptr<mtd::StubBufferAllocator>();
73
59
    }
74
60
 
75
61
    MOCK_METHOD1(drm_auth_magic, void(drm_magic_t));
81
67
        : shell{std::make_shared<mtd::StubShell>()},
82
68
          mock_platform{std::make_shared<MockAuthenticatingPlatform>()},
83
69
          display_changer{std::make_shared<mtd::NullDisplayChanger>()},
84
 
          buffer_allocator{std::make_shared<StubGraphicBufferAllocator>()},
 
70
          buffer_allocator{std::make_shared<mtd::StubBufferAllocator>()},
85
71
          report{std::make_shared<mf::NullSessionMediatorReport>()},
86
72
          resource_cache{std::make_shared<mf::ResourceCache>()},
87
73
          mediator{shell, mock_platform, display_changer,