~vanvugt/mir/unique-id

« back to all changes in this revision

Viewing changes to tests/mir_test_framework/testing_server_options.cpp

  • Committer: Daniel van Vugt
  • Date: 2013-04-16 06:59:13 UTC
  • mfrom: (578.1.12 trunk)
  • Revision ID: daniel.van.vugt@canonical.com-20130416065913-ihl399t0ud6t2uax
MergeĀ latestĀ lp:mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "mir/compositor/graphic_buffer_allocator.h"
30
30
#include "mir/input/input_channel.h"
31
31
#include "mir/input/input_manager.h"
 
32
#include "mir/shell/input_focus_selector.h"
 
33
#include "src/server/input/android/android_input_manager.h"
 
34
#include "src/server/input/android/android_dispatcher_controller.h"
32
35
 
33
36
#include "mir_test_doubles/stub_buffer.h"
34
37
#include "mir_test_doubles/stub_surface_builder.h"
41
44
namespace mc = mir::compositor;
42
45
namespace mg = mir::graphics;
43
46
namespace mi = mir::input;
 
47
namespace mia = mir::input::android;
44
48
namespace mf = mir::frontend;
45
49
namespace mtf = mir_test_framework;
46
50
namespace mtd = mir::test::doubles;
 
51
namespace msh = mir::shell;
47
52
 
48
53
namespace
49
54
{
86
91
        auto null_configuration = std::shared_ptr<mg::DisplayConfiguration>();
87
92
        return null_configuration;
88
93
    }
 
94
    void register_pause_resume_handlers(mir::MainLoop&,
 
95
                                        std::function<void()> const&,
 
96
                                        std::function<void()> const&)
 
97
    {
 
98
    }
 
99
    void pause() {}
 
100
    void resume() {}
89
101
};
90
102
 
91
103
class StubGraphicPlatform : public mg::Platform
145
157
    {
146
158
        return std::make_shared<StubInputChannel>();
147
159
    }
 
160
};
148
161
 
 
162
class StubInputFocusSelector : public msh::InputFocusSelector
 
163
{
 
164
public:
149
165
    void set_input_focus_to(std::shared_ptr<mi::SessionTarget> const& /* session */, std::shared_ptr<mi::SurfaceTarget> const& /* surface */)
150
166
    {
151
167
    }
152
168
};
 
169
 
153
170
}
154
171
 
155
172
mtf::TestingServerConfiguration::TestingServerConfiguration() :
162
179
{
163
180
    auto options = the_options();
164
181
    if (options->get("tests-use-real-input", false))
165
 
        return mi::create_input_manager(the_event_filters(), the_display());
 
182
        return std::make_shared<mia::InputManager>(the_input_configuration());
166
183
    else
167
184
        return std::make_shared<StubInputManager>();
168
185
}
169
186
 
 
187
std::shared_ptr<msh::InputFocusSelector> mtf::TestingServerConfiguration::the_input_focus_selector()
 
188
{
 
189
    auto options = the_options();
 
190
 
 
191
   if (options->get("tests-use-real-input", false))
 
192
        return std::make_shared<mia::DispatcherController>(the_input_configuration());
 
193
    else
 
194
        return std::make_shared<StubInputFocusSelector>();
 
195
}
 
196
 
170
197
std::shared_ptr<mg::Platform> mtf::TestingServerConfiguration::the_graphics_platform()
171
198
{
172
199
    if (!graphics_platform)