~kdub/mir/real-nested-platform

« back to all changes in this revision

Viewing changes to tests/include/mir/test/doubles/mock_buffer_bundle.h

  • Committer: Kevin DuBois
  • Date: 2016-11-23 12:59:00 UTC
  • mfrom: (3665.5.163 development-branch)
  • Revision ID: kevin.dubois@canonical.com-20161123125900-4gzspvl0y7q47rsj
merge in base, fix many conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2013 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License version 3,
6
 
 * as published by the Free Software Foundation.
7
 
 *
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.
12
 
 *
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/>.
15
 
 *
16
 
 * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17
 
 */
18
 
#ifndef MIR_TEST_DOUBLES_MOCK_BUFFER_BUNDLE_H_
19
 
#define MIR_TEST_DOUBLES_MOCK_BUFFER_BUNDLE_H_
20
 
 
21
 
#include "src/server/compositor/buffer_bundle.h"
22
 
 
23
 
#include <gmock/gmock.h>
24
 
 
25
 
namespace mir
26
 
{
27
 
namespace test
28
 
{
29
 
namespace doubles
30
 
{
31
 
 
32
 
struct MockBufferBundle : public compositor::BufferBundle
33
 
{
34
 
public:
35
 
    MockBufferBundle()
36
 
    {
37
 
        ON_CALL(*this, buffers_ready_for_compositor(testing::_))
38
 
            .WillByDefault(testing::Return(1));
39
 
        ON_CALL(*this, properties())
40
 
            .WillByDefault(testing::Return(
41
 
                graphics::BufferProperties{geometry::Size{1,1},
42
 
                mir_pixel_format_abgr_8888, graphics::BufferUsage::hardware}));
43
 
    }
44
 
 
45
 
    MOCK_METHOD1(client_acquire,     void(std::function<void(graphics::Buffer*)>));
46
 
    MOCK_METHOD1(client_release,     void(graphics::Buffer*));
47
 
    MOCK_METHOD1(compositor_acquire, std::shared_ptr<graphics::Buffer>(void const*));
48
 
    MOCK_METHOD1(compositor_release, void(std::shared_ptr<graphics::Buffer> const&));
49
 
    MOCK_METHOD0(snapshot_acquire, std::shared_ptr<graphics::Buffer>());
50
 
    MOCK_METHOD1(snapshot_release, void(std::shared_ptr<graphics::Buffer> const&));
51
 
    MOCK_METHOD1(allow_framedropping, void(bool));
52
 
    MOCK_METHOD1(set_mode, void(compositor::MultiMonitorMode));
53
 
    MOCK_CONST_METHOD0(properties, graphics::BufferProperties());
54
 
    MOCK_METHOD0(force_client_abort, void());
55
 
    MOCK_METHOD0(force_requests_to_complete, void());
56
 
    MOCK_METHOD1(resize, void(const geometry::Size &));
57
 
    MOCK_METHOD0(drop_old_buffers, void());
58
 
    MOCK_CONST_METHOD1(buffers_ready_for_compositor, int(void const*));
59
 
    int buffers_free_for_client() const override { return 1; }
60
 
    void drop_client_requests() override {}
61
 
};
62
 
 
63
 
}
64
 
}
65
 
}
66
 
 
67
 
#endif /* MIR_TEST_DOUBLES_MOCK_BUFFER_BUNDLE_H_ */