~robertcarr/mir/send-clients-input

« back to all changes in this revision

Viewing changes to tests/unit-tests/frontend/test_application_mediator_gbm.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:
17
17
 */
18
18
 
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;
46
46
 
47
47
namespace
52
52
 * without having to create doubles for classes so deep in its dependency
53
53
 * hierarchy.
54
54
 *
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.
56
56
 */
57
57
 
58
 
class StubSurfaceFactory : public msess::SurfaceFactory
 
58
class StubSurfaceFactory : public msh::SurfaceFactory
59
59
{
60
60
 public:
61
 
    std::shared_ptr<msess::Surface> create_surface(const msess::SurfaceCreationParameters& /*params*/)
 
61
    std::shared_ptr<msh::Surface> create_surface(const msh::SurfaceCreationParameters& /*params*/)
62
62
    {
63
 
        return std::shared_ptr<msess::Surface>();
 
63
        return std::shared_ptr<msh::Surface>();
64
64
    }
65
65
};
66
66
 
67
 
class StubSessionStore : public msess::SessionStore
 
67
class StubSessionStore : public msh::SessionStore
68
68
{
69
69
public:
70
70
    StubSessionStore()
72
72
    {
73
73
    }
74
74
 
75
 
    std::shared_ptr<msess::Session> open_session(std::string const& /*name*/)
 
75
    std::shared_ptr<msh::Session> open_session(std::string const& /*name*/)
76
76
    {
77
 
        return std::make_shared<msess::ApplicationSession>(factory, "stub");
 
77
        return std::make_shared<msh::ApplicationSession>(factory, "stub");
78
78
    }
79
79
 
80
 
    void close_session(std::shared_ptr<msess::Session> const& /*session*/) {}
 
80
    void close_session(std::shared_ptr<msh::Session> const& /*session*/) {}
81
81
 
82
82
    void shutdown() {}
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) {}
85
85
 
86
 
    std::shared_ptr<msess::SurfaceFactory> factory;
 
86
    std::shared_ptr<msh::SurfaceFactory> factory;
87
87
};
88
88
 
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)}
139
139
    {
140
140
    }
141
141
 
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;
149
149