~alan-griffiths/mir/keep-helgrind-happy

« back to all changes in this revision

Viewing changes to tests/acceptance-tests/test_server_shutdown.cpp

  • Committer: Tarmac
  • Author(s): Daniel van Vugt
  • Date: 2014-02-14 08:17:40 UTC
  • mfrom: (1389.6.1 stubs)
  • Revision ID: tarmac-20140214081740-4pt0pblwn20cs3nm
Unduplicate stub/null Renderer classes used by tests.
.

Approved by PS Jenkins bot, Alexandros Frantzis.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "mir_test_framework/display_server_test_fixture.h"
25
25
#include "mir_test/fake_event_hub_input_configuration.h"
26
26
#include "mir_test_framework/cross_process_sync.h"
 
27
#include "mir_test_doubles/stub_renderer.h"
27
28
 
28
29
#include <gtest/gtest.h>
29
30
 
45
46
 
46
47
char const* const mir_test_socket = mtf::test_socket_file().c_str();
47
48
 
48
 
class NullRenderer : public mc::Renderer
49
 
{
50
 
public:
51
 
    void begin(float) const override
52
 
    {
53
 
    }
54
 
 
55
 
    void render(mc::CompositingCriteria const&, mg::Buffer&) const override
56
 
    {
57
 
        /*
58
 
         * Do nothing, so that the surface's buffers are not consumed
59
 
         * by the server, thus causing the client to block when asking for
60
 
         * the second buffer (assuming double-buffering).
61
 
         */
62
 
        std::this_thread::yield();
63
 
    }
64
 
 
65
 
    void end() const override
66
 
    {
67
 
    }
68
 
    void suspend() override
69
 
    {
70
 
    }
71
 
};
72
 
 
73
 
class NullRendererFactory : public mc::RendererFactory
 
49
class StubRendererFactory : public mc::RendererFactory
74
50
{
75
51
public:
76
52
    std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&)
77
53
    {
78
 
        return std::unique_ptr<mc::Renderer>(new NullRenderer());
 
54
        return std::unique_ptr<mc::Renderer>(new mtd::StubRenderer());
79
55
    }
80
56
};
81
57
 
133
109
    {
134
110
        std::shared_ptr<mc::RendererFactory> the_renderer_factory() override
135
111
        {
136
 
            return renderer_factory([] { return std::make_shared<NullRendererFactory>(); });
 
112
            return renderer_factory([] { return std::make_shared<StubRendererFactory>(); });
137
113
        }
138
114
    } server_config;
139
115