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

« back to all changes in this revision

Viewing changes to tests/mir_test_doubles/mock_gbm.cpp

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Alexandros Frantzis <alexandros.frantzis@canonical.com>
18
18
 */
19
19
 
20
 
#include "mock_gbm.h"
 
20
#include "mir_test_doubles/mock_gbm.h"
21
21
#include <gtest/gtest.h>
22
22
 
23
 
namespace mgg=mir::graphics::gbm;
 
23
namespace mtd=mir::test::doubles;
24
24
 
25
25
namespace
26
26
{
27
 
mgg::MockGBM* global_mock = NULL;
 
27
mtd::MockGBM* global_mock = NULL;
28
28
}
29
29
 
30
 
mgg::FakeGBMResources::FakeGBMResources()
 
30
mtd::FakeGBMResources::FakeGBMResources()
31
31
    : device(reinterpret_cast<gbm_device*>(0x12345678)),
32
32
      surface(reinterpret_cast<gbm_surface*>(0x1234abcd)),
33
33
      bo(reinterpret_cast<gbm_bo*>(0xabcdef12))
35
35
    bo_handle.u32 = 0x0987;
36
36
}
37
37
 
38
 
mgg::MockGBM::MockGBM()
 
38
mtd::MockGBM::MockGBM()
39
39
{
40
40
    using namespace testing;
41
41
    assert(global_mock == NULL && "Only one mock object per process is allowed");
64
64
    .WillByDefault(Invoke(this, &MockGBM::on_gbm_bo_set_user_data));
65
65
}
66
66
 
67
 
mgg::MockGBM::~MockGBM()
 
67
mtd::MockGBM::~MockGBM()
68
68
{
69
69
    // this is probably later than optimal, but at least ensures memory freed
70
70
    for (auto i = destroyers.begin(); i != destroyers.end(); ++i) (*i)();