~vanvugt/mir/fix-1192618

« back to all changes in this revision

Viewing changes to tests/integration-tests/compositor/test_swapping_swappers.cpp

Separate MockBufferAllocator for reuse in other test cases.

Approved by Alexandros Frantzis, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17
17
 */
18
18
 
19
 
#include "mir_test_doubles/stub_buffer.h"
 
19
#include "mir_test_doubles/mock_buffer_allocator.h"
20
20
#include "multithread_harness.h"
21
21
 
22
22
#include "src/server/compositor/switching_bundle.h"
40
40
namespace
41
41
{
42
42
 
43
 
struct MockBufferAllocator : public mc::GraphicBufferAllocator
44
 
{
45
 
    MockBufferAllocator()
46
 
    {
47
 
        using namespace testing;
48
 
        ON_CALL(*this, alloc_buffer(_))
49
 
            .WillByDefault(Return(std::make_shared<mtd::StubBuffer>()));
50
 
    }
51
 
    ~MockBufferAllocator() noexcept{}
52
 
 
53
 
    MOCK_METHOD1(alloc_buffer, std::shared_ptr<mg::Buffer>(mc::BufferProperties const&));
54
 
    MOCK_METHOD0(supported_pixel_formats, std::vector<geom::PixelFormat>());
55
 
};
56
 
 
57
43
struct SwapperSwappingStress : public ::testing::Test
58
44
{
59
45
    void SetUp()
60
46
    {
61
 
        auto allocator = std::make_shared<MockBufferAllocator>();
 
47
        auto allocator = std::make_shared<mtd::MockBufferAllocator>();
62
48
        auto factory = std::make_shared<mc::SwapperFactory>(allocator, 3);
63
49
        auto properties = mc::BufferProperties{geom::Size{380, 210},
64
50
                                          geom::PixelFormat::abgr_8888, mc::BufferUsage::hardware};