~mir-team/mir/trunk

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Alan Griffiths
  • Date: 2013-04-25 23:50:01 UTC
  • mfrom: (526.2.22 mir1)
  • Revision ID: tarmac-20130425235001-c3b3x2yyb3eldyx1
frontend, shell, tests: surface-states updated to avoid supplying dependencies through public member functions.

Approved by PS Jenkins bot, Chris Halse Rogers, Robert Ancell, Kevin DuBois.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "mir_test_doubles/stub_session.h"
35
35
#include "mir_test_doubles/stub_surface_builder.h"
36
36
#include "mir_test/fake_shared.h"
37
 
#include "mir/event_queue.h"
 
37
#include "mir/events/event_sink.h"
38
38
#include "mir/shell/surface.h"
39
39
 
40
40
#include <gtest/gtest.h>
129
129
    }
130
130
};
131
131
 
132
 
}
 
132
class NullEventSink : public mir::events::EventSink
 
133
{
 
134
public:
 
135
    void handle_event(MirEvent const& ) override {}
 
136
};
133
137
 
134
138
struct SessionMediatorTest : public ::testing::Test
135
139
{
142
146
          resource_cache{std::make_shared<mf::ResourceCache>()},
143
147
          mediator{shell, graphics_platform, graphics_display,
144
148
                   buffer_allocator, report, 
145
 
                   std::make_shared<mir::EventQueue>(),
 
149
                   std::make_shared<NullEventSink>(),
146
150
                   resource_cache},
147
151
          stubbed_session{std::make_shared<StubbedSession>()},
148
152
          null_callback{google::protobuf::NewPermanentCallback(google::protobuf::DoNothing)}
149
153
    {
150
154
        using namespace ::testing;
151
155
 
152
 
        ON_CALL(*shell, open_session(_)).WillByDefault(Return(stubbed_session));
 
156
        ON_CALL(*shell, open_session(_, _)).WillByDefault(Return(stubbed_session));
153
157
        ON_CALL(*shell, create_surface_for(_, _)).WillByDefault(Return(mf::SurfaceId{1}));
154
158
    }
155
159
 
164
168
 
165
169
    std::unique_ptr<google::protobuf::Closure> null_callback;
166
170
};
167
 
 
 
171
}
168
172
 
169
173
TEST_F(SessionMediatorTest, disconnect_releases_session)
170
174
{