~ubuntu-branches/ubuntu/utopic/mir/utopic-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-03-10 19:28:46 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: package-import@ubuntu.com-20140310192846-rq9qm3ec26yrelo2
Tags: upstream-0.1.6+14.04.20140310
ImportĀ upstreamĀ versionĀ 0.1.6+14.04.20140310

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