19
19
#include "mir/compositor/graphic_buffer_allocator.h"
20
#include "mir/frontend/application_listener.h"
20
#include "mir/frontend/application_mediator_report.h"
21
21
#include "mir/frontend/application_mediator.h"
22
22
#include "mir/frontend/resource_cache.h"
23
#include "mir/sessions/application_session.h"
24
#include "mir/sessions/session_store.h"
25
#include "mir/sessions/surface_factory.h"
23
#include "mir/shell/application_session.h"
24
#include "mir/shell/session_store.h"
25
#include "mir/shell/surface_factory.h"
26
26
#include "mir/graphics/display.h"
27
27
#include "mir/graphics/drm_authenticator.h"
28
28
#include "mir/graphics/platform.h"
41
41
namespace mc = mir::compositor;
42
42
namespace geom = mir::geometry;
43
43
namespace mp = mir::protobuf;
44
namespace msess = mir::sessions;
44
namespace msh = mir::shell;
45
45
namespace mtd = mir::test::doubles;
52
52
* without having to create doubles for classes so deep in its dependency
55
* In particular, it would be nice if msess::ApplicationSession was stubable/mockable.
55
* In particular, it would be nice if msh::ApplicationSession was stubable/mockable.
58
class StubSurfaceFactory : public msess::SurfaceFactory
58
class StubSurfaceFactory : public msh::SurfaceFactory
61
std::shared_ptr<msess::Surface> create_surface(const msess::SurfaceCreationParameters& /*params*/)
61
std::shared_ptr<msh::Surface> create_surface(const msh::SurfaceCreationParameters& /*params*/)
63
return std::shared_ptr<msess::Surface>();
63
return std::shared_ptr<msh::Surface>();
67
class StubSessionStore : public msess::SessionStore
67
class StubSessionStore : public msh::SessionStore
75
std::shared_ptr<msess::Session> open_session(std::string const& /*name*/)
75
std::shared_ptr<msh::Session> open_session(std::string const& /*name*/)
77
return std::make_shared<msess::ApplicationSession>(factory, "stub");
77
return std::make_shared<msh::ApplicationSession>(factory, "stub");
80
void close_session(std::shared_ptr<msess::Session> const& /*session*/) {}
80
void close_session(std::shared_ptr<msh::Session> const& /*session*/) {}
83
void tag_session_with_lightdm_id(std::shared_ptr<msess::Session> const&, int) {}
83
void tag_session_with_lightdm_id(std::shared_ptr<msh::Session> const&, int) {}
84
84
void focus_session_with_lightdm_id(int) {}
86
std::shared_ptr<msess::SurfaceFactory> factory;
86
std::shared_ptr<msh::SurfaceFactory> factory;
89
89
class StubGraphicBufferAllocator : public mc::GraphicBufferAllocator
131
131
mock_platform{std::make_shared<MockAuthenticatingPlatform>()},
132
132
graphics_display{std::make_shared<mtd::NullDisplay>()},
133
133
buffer_allocator{std::make_shared<StubGraphicBufferAllocator>()},
134
listener{std::make_shared<mf::NullApplicationListener>()},
134
report{std::make_shared<mf::NullApplicationMediatorReport>()},
135
135
resource_cache{std::make_shared<mf::ResourceCache>()},
136
136
mediator{session_store, mock_platform, graphics_display,
137
buffer_allocator, listener, resource_cache},
137
buffer_allocator, report, resource_cache},
138
138
null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
142
std::shared_ptr<msess::SessionStore> const session_store;
142
std::shared_ptr<msh::SessionStore> const session_store;
143
143
std::shared_ptr<MockAuthenticatingPlatform> const mock_platform;
144
144
std::shared_ptr<mg::Display> const graphics_display;
145
145
std::shared_ptr<mc::GraphicBufferAllocator> const buffer_allocator;
146
std::shared_ptr<mf::ApplicationListener> const listener;
146
std::shared_ptr<mf::ApplicationMediatorReport> const report;
147
147
std::shared_ptr<mf::ResourceCache> const resource_cache;
148
148
mf::ApplicationMediator mediator;