16
16
* Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
19
#include "mir/compositor/buffer_bundle.h"
19
#include "mir/surfaces/buffer_bundle.h"
20
20
#include "mir/compositor/buffer_ipc_package.h"
21
21
#include "mir/compositor/graphic_buffer_allocator.h"
22
#include "mir/frontend/application_listener.h"
22
#include "mir/frontend/application_mediator_report.h"
23
23
#include "mir/frontend/application_mediator.h"
24
24
#include "mir/frontend/resource_cache.h"
25
#include "mir/sessions/application_session.h"
26
#include "mir/sessions/session_store.h"
27
#include "mir/sessions/surface_factory.h"
25
#include "mir/shell/application_session.h"
26
#include "mir/shell/session_store.h"
27
#include "mir/shell/surface_factory.h"
28
28
#include "mir/graphics/display.h"
29
29
#include "mir/graphics/platform.h"
30
30
#include "mir/graphics/platform_ipc_package.h"
45
45
namespace ms = mir::surfaces;
46
46
namespace geom = mir::geometry;
47
47
namespace mp = mir::protobuf;
48
namespace msess = mir::sessions;
48
namespace msh = mir::shell;
49
49
namespace mtd = mir::test::doubles;
61
61
* stubable/mockable.
64
class DestructionRecordingSession : public msess::ApplicationSession
64
class DestructionRecordingSession : public msh::ApplicationSession
67
DestructionRecordingSession(std::shared_ptr<msess::SurfaceFactory> const& surface_factory)
68
: msess::ApplicationSession{surface_factory, "Stub"}
67
DestructionRecordingSession(std::shared_ptr<msh::SurfaceFactory> const& surface_factory)
68
: msh::ApplicationSession{surface_factory, "Stub"}
78
78
bool DestructionRecordingSession::destroyed{true};
80
class StubSurfaceFactory : public msess::SurfaceFactory
80
class StubSurfaceFactory : public msh::SurfaceFactory
83
std::shared_ptr<msess::Surface> create_surface(const msess::SurfaceCreationParameters& /*params*/)
83
std::shared_ptr<msh::Surface> create_surface(const msh::SurfaceCreationParameters& /*params*/)
85
85
auto surface = std::make_shared<ms::Surface>("DummySurface",
86
86
std::make_shared<mtd::NullBufferBundle>());
104
std::shared_ptr<msess::Session> open_session(std::string const& /*name*/)
104
std::shared_ptr<msh::Session> open_session(std::string const& /*name*/)
106
106
return std::make_shared<DestructionRecordingSession>(factory);
109
void close_session(std::shared_ptr<msess::Session> const& /*session*/) {}
109
void close_session(std::shared_ptr<msh::Session> const& /*session*/) {}
111
111
void shutdown() {}
112
void tag_session_with_lightdm_id(std::shared_ptr<msess::Session> const&, int) {}
112
void tag_session_with_lightdm_id(std::shared_ptr<msh::Session> const&, int) {}
113
113
void focus_session_with_lightdm_id(int) {}
115
std::shared_ptr<msess::SurfaceFactory> factory;
115
std::shared_ptr<msh::SurfaceFactory> factory;
118
118
class MockGraphicBufferAllocator : public mc::GraphicBufferAllocator
161
161
graphics_platform{std::make_shared<StubPlatform>()},
162
162
graphics_display{std::make_shared<mtd::NullDisplay>()},
163
163
buffer_allocator{std::make_shared<testing::NiceMock<MockGraphicBufferAllocator>>()},
164
listener{std::make_shared<mf::NullApplicationListener>()},
164
report{std::make_shared<mf::NullApplicationMediatorReport>()},
165
165
resource_cache{std::make_shared<mf::ResourceCache>()},
166
166
mediator{session_store, graphics_platform, graphics_display,
167
buffer_allocator, listener, resource_cache},
167
buffer_allocator, report, resource_cache},
168
168
null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
172
std::shared_ptr<msess::SessionStore> const session_store;
172
std::shared_ptr<msh::SessionStore> const session_store;
173
173
std::shared_ptr<mg::Platform> const graphics_platform;
174
174
std::shared_ptr<mg::Display> const graphics_display;
175
175
std::shared_ptr<testing::NiceMock<MockGraphicBufferAllocator>> const buffer_allocator;
176
std::shared_ptr<mf::ApplicationListener> const listener;
176
std::shared_ptr<mf::ApplicationMediatorReport> const report;
177
177
std::shared_ptr<mf::ResourceCache> const resource_cache;
178
178
mf::ApplicationMediator mediator;