~robertcarr/mir/send-clients-input

« back to all changes in this revision

Viewing changes to tests/unit-tests/frontend/test_application_mediator.cpp

  • Committer: Daniel van Vugt
  • Date: 2013-03-07 08:04:05 UTC
  • mfrom: (467.1.6 trunk)
  • mto: (467.1.21 trunk)
  • mto: This revision was merged to the branch mainline in revision 486.
  • Revision ID: daniel.van.vugt@canonical.com-20130307080405-vgn5g2ts7j08xekk
MergeĀ latestĀ lp:mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17
17
 */
18
18
 
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;
50
50
 
51
51
namespace
61
61
 * stubable/mockable.
62
62
 */
63
63
 
64
 
class DestructionRecordingSession : public msess::ApplicationSession
 
64
class DestructionRecordingSession : public msh::ApplicationSession
65
65
{
66
66
public:
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"}
69
69
    {
70
70
        destroyed = false;
71
71
    }
77
77
 
78
78
bool DestructionRecordingSession::destroyed{true};
79
79
 
80
 
class StubSurfaceFactory : public msess::SurfaceFactory
 
80
class StubSurfaceFactory : public msh::SurfaceFactory
81
81
{
82
82
 public:
83
 
    std::shared_ptr<msess::Surface> create_surface(const msess::SurfaceCreationParameters& /*params*/)
 
83
    std::shared_ptr<msh::Surface> create_surface(const msh::SurfaceCreationParameters& /*params*/)
84
84
    {
85
85
        auto surface = std::make_shared<ms::Surface>("DummySurface",
86
86
                                                     std::make_shared<mtd::NullBufferBundle>());
93
93
    std::vector<std::shared_ptr<ms::Surface>> surfaces;
94
94
};
95
95
 
96
 
class StubSessionStore : public msess::SessionStore
 
96
class StubSessionStore : public msh::SessionStore
97
97
{
98
98
public:
99
99
    StubSessionStore()
101
101
    {
102
102
    }
103
103
 
104
 
    std::shared_ptr<msess::Session> open_session(std::string const& /*name*/)
 
104
    std::shared_ptr<msh::Session> open_session(std::string const& /*name*/)
105
105
    {
106
106
        return std::make_shared<DestructionRecordingSession>(factory);
107
107
    }
108
108
 
109
 
    void close_session(std::shared_ptr<msess::Session> const& /*session*/) {}
 
109
    void close_session(std::shared_ptr<msh::Session> const& /*session*/) {}
110
110
 
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) {}
114
114
 
115
 
    std::shared_ptr<msess::SurfaceFactory> factory;
 
115
    std::shared_ptr<msh::SurfaceFactory> factory;
116
116
};
117
117
 
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)}
169
169
    {
170
170
    }
171
171
 
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;
179
179