~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Daniel van Vugt, Ubuntu daily release
  • Date: 2014-08-29 16:12:54 UTC
  • mfrom: (1.1.73)
  • Revision ID: package-import@ubuntu.com-20140829161254-wfnunk4fw3msth3c
Tags: 0.7.0+14.10.20140829-0ubuntu1
[ Daniel van Vugt ]
* New upstream release 0.7.0 (https://launchpad.net/mir/+milestone/0.7.0)
  - Enhancements:
    . Test suite: Reworked mechanism to override Mir client functions
    . Demo shell: Detect custom rendering (decorations) to make it
      compatible with overlay optimizations
    . Make sure to preserve fd resources until the end of the sending
      of the message
    . Add test cases and script for tracking changes to the new ABIs:
      libmircommon, libmirplatform
    . Symbols file for libmirplatform
    . Symbols file for libmircommon
    . Symbols file for libmirserver
    . Various improvements to the SessionMediator test
    . Various build related improvements
    . Print testcase output during package build
    . Abort test when InProcessServer startup fails
    . Link the integration and unit tests against the server objects
    . Add a document detailing the useful tests to run and the useful
      logs to collect when troubleshooting a new android chipset
    . Enable motion event resampling and prediction for a more responsive
      touch experience.
  - ABI summary: Servers need rebuilding, but clients do not
    . Mirclient ABI unchanged at 8
    . Mircommon ABI bumped to 1
    . Mirplatform ABI bumped to 2
    . Mirserver ABI bumped to 25
  - API changes
    . Deleted function - frontend::Shell::create_surface_for(). If you have
      the std::shared_ptr<frontend::Session> session, you can just do
      session->create_surface(params) instead to get a SurfaceId
  - Bug fixes:
    . Ensure we process lifecycle events before the nested server is torn
      down (LP: #1353465)
    . Fix race in InputTestingServerConfiguration (LP: #1354446)
    . Fix fd leaks in prompt session frontend code and tests (LP: #1353461)
    . Detect the additional things the demo shell draws on the renderable
      list and avoid calling the optimized post function if they are being
      drawn (LP: #1348330)
    . Client: Fix SIGTERM dispatch in our default lifecycle event handler
      (LP: #1353867)
    . DemoRenderer: Don't try to create a texture of width zero. 
      (LP: #1358210)
    . Fix CI failures (LP: #1358698)
    . Fix build failure: "variable ‘rc’ set but not used" which happens in
      release mode when NDEBUG is set (LP: #1358625)
    . Only enumerate exposed input surfaces to avoid delivering events to
      occluded surfaces (LP: #1359264)
    . Android: do not post driver cancelled buffers (LP: #1359406)
    . Client: Ensure our platform library stays loaded for as long as it is
      needed by other objects (LP: #1358191)
    . Examples: Register the DemoCompositor with the Scene to properly
      process visibility events (LP: #1359487)
    . Mir_demo_client_basic: Don't assert on user errors like failing to
      connect to a Mir server (LP: #1331958)
    . Tests: Explicitly depend on GMock target to avoid build races
      (LP: #1362646)

[ Ubuntu daily release ]
* New rebuild forced

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "mir_toolkit/mir_client_library.h"
23
23
 
24
24
#include "mir_test_framework/stubbed_server_configuration.h"
25
 
#include "mir_test_framework/in_process_server.h"
26
 
#include "mir_test_framework/using_stub_client_platform.h"
 
25
#include "mir_test_framework/basic_client_server_fixture.h"
27
26
 
28
27
#include "mir_test_doubles/null_display_changer.h"
29
28
#include "mir_test_doubles/stub_display_configuration.h"
84
83
    mtd::MockScreencast mock_screencast;
85
84
};
86
85
 
87
 
class MirScreencastTest : public mir_test_framework::InProcessServer
 
86
struct MirScreencastTest : mtf::BasicClientServerFixture<StubServerConfig>
88
87
{
89
 
public:
90
 
    mir::DefaultServerConfiguration& server_config() override { return server_config_; }
91
 
 
92
 
    mtd::MockScreencast& mock_screencast() { return server_config_.mock_screencast; }
93
 
 
94
 
    StubServerConfig server_config_;
95
 
    mtf::UsingStubClientPlatform using_stub_client_platform;
 
88
    mtd::MockScreencast& mock_screencast() { return server_configuration.mock_screencast; }
 
89
 
96
90
    MirScreencastParameters default_screencast_params {
97
91
        {0, 0, 1, 1}, 1, 1, mir_pixel_format_abgr_8888};
98
92
};
111
105
{
112
106
    using namespace testing;
113
107
 
114
 
    auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
115
 
    ASSERT_TRUE(mir_connection_is_valid(connection));
116
 
 
117
108
    mf::ScreencastSessionId const screencast_session_id{99};
118
109
 
119
110
    InSequence seq;
130
121
    auto screencast = mir_connection_create_screencast_sync(connection, &default_screencast_params);
131
122
    ASSERT_NE(nullptr, screencast);
132
123
    mir_screencast_release_sync(screencast);
133
 
 
134
 
    mir_connection_release(connection);
135
124
}
136
125
 
137
126
TEST_F(MirScreencastTest, contacts_server_screencast_with_provided_params)
138
127
{
139
128
    using namespace testing;
140
129
 
141
 
    auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
142
 
    ASSERT_TRUE(mir_connection_is_valid(connection));
143
 
 
144
130
    mf::ScreencastSessionId const screencast_session_id{99};
145
131
 
146
132
    geom::Size const size{default_screencast_params.width, default_screencast_params.height};
164
150
    ASSERT_NE(nullptr, screencast);
165
151
 
166
152
    mir_screencast_release_sync(screencast);
167
 
 
168
 
    mir_connection_release(connection);
169
153
}
170
154
 
171
155
TEST_F(MirScreencastTest, creation_with_invalid_params_fails)
172
156
{
173
157
    using namespace testing;
174
158
 
175
 
    auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
176
 
    ASSERT_TRUE(mir_connection_is_valid(connection));
177
 
 
178
159
    MirScreencastParameters params = default_screencast_params;
179
160
    params.width = params.height = 0;
180
161
    auto screencast = mir_connection_create_screencast_sync(connection, &params);
190
171
 
191
172
    screencast = mir_connection_create_screencast_sync(connection, &params);
192
173
    ASSERT_EQ(nullptr, screencast);
193
 
 
194
 
    mir_connection_release(connection);
195
174
}
196
175
 
197
176
TEST_F(MirScreencastTest, gets_valid_egl_native_window)
198
177
{
199
178
    using namespace testing;
200
179
 
201
 
    auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
202
 
    ASSERT_TRUE(mir_connection_is_valid(connection));
203
 
 
204
180
    mf::ScreencastSessionId const screencast_session_id{99};
205
181
 
206
182
    InSequence seq;
217
193
    EXPECT_NE(MirEGLNativeWindowType(), egl_native_window);
218
194
 
219
195
    mir_screencast_release_sync(screencast);
220
 
 
221
 
    mir_connection_release(connection);
222
196
}
223
197
 
224
198
TEST_F(MirScreencastTest, fails_on_client_when_server_request_fails)
225
199
{
226
200
    using namespace testing;
227
201
 
228
 
    auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
229
 
    ASSERT_TRUE(mir_connection_is_valid(connection));
230
 
 
231
202
    EXPECT_CALL(mock_screencast(), create_session(_, _, _))
232
203
        .WillOnce(Throw(std::runtime_error("")));
233
204
 
234
205
    auto screencast = mir_connection_create_screencast_sync(connection, &default_screencast_params);
235
206
    ASSERT_EQ(nullptr, screencast);
236
 
 
237
 
    mir_connection_release(connection);
238
207
}
239
208
 
240
209
namespace
255
224
    MockSessionAuthorizer mock_authorizer;
256
225
};
257
226
 
258
 
class UnauthorizedMirScreencastTest : public mir_test_framework::InProcessServer
 
227
struct UnauthorizedMirScreencastTest : mtf::BasicClientServerFixture<MockAuthorizerServerConfig>
259
228
{
260
 
public:
261
 
    mir::DefaultServerConfiguration& server_config() override { return server_config_; }
262
 
 
263
 
    MockSessionAuthorizer& mock_authorizer() { return server_config_.mock_authorizer; }
264
 
 
265
 
    MockAuthorizerServerConfig server_config_;
266
 
    mtf::UsingStubClientPlatform using_stub_client_platform;
 
229
    MockSessionAuthorizer& mock_authorizer() { return server_configuration.mock_authorizer; }
 
230
 
267
231
    MirScreencastParameters default_screencast_params {
268
232
        {0, 0, 1, 1}, 1, 1, mir_pixel_format_abgr_8888};
269
233
};