~ci-train-bot/mir/mir-ubuntu-zesty-2735

« back to all changes in this revision

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

  • Committer: Bileto Bot
  • Date: 2017-02-09 21:46:11 UTC
  • mfrom: (1160.2680.216 mir-dev)
  • Revision ID: ci-train-bot@canonical.com-20170209214611-npcbbl3ivh2x981r
* New upstream release 0.26.1 (https://launchpad.net/mir/+milestone/0.26.1)
  - ABI summary:
    . mirclient ABI unchanged at 9
    . mirserver ABI unchanged at 43
    . mircommon ABI unchanged at 7
    . mirplatform ABI bumped to 15
    . mirprotobuf ABI unchanged at 3
    . mirplatformgraphics ABI bumped to 12
    . mirclientplatform ABI unchanged at 5
    . mirinputplatform ABI unchanged at 6
    . mircore ABI unchanged at 1
  - Enhancements:
    . Support for MirBuffer API that allows for better management of
      hardware/software buffers.
    . Support for MirPresentationChain API that allows better control
      over {de}queueing of individual buffers {from}to the server.
    . Interim support for MirRenderSurface API that provides a unit of
      renderable for lower level content such as MirBufferStreams and
      MirPresentationChains, etc.. MirRenderSurface API is marked
      deprecated as it (and the relevant entry points) will be renamed to
      MirSurface before general availability. It will initially be used for
      revamping support for EGL drivers.
    . Synchronous version of mir_prompt_session_new_fds_for_prompt_providers()
      API (mir_prompt_session_new_fds_for_prompt_providers_sync()) added for
      convenience.
    . Better name for MirPersistentId-->MirWindowId. MirPersistentId has now
      been deprecated.
  - Bugs fixed:
    . [regression] Unity8 stutters constantly (like half frame rate).
      (LP: #1661128)
    . mir 0.26 - spinner loading animation, minimize, maximize too fast.
      (LP: #1661072)
    . [regression] Nested server segfaults or rapidly logs exceptions when a
      fullscreen client starts [in mir_presentation_chain_set_dropping_mode
      ... std::exception::what: Operation not permitted] (LP: #1661508)
    . mir_window_request_persistent_id_sync seg faults when called twice.
      (LP: #1661704)
    . [regression] Windowed clients of nested servers are all black.
      (LP: #1661521)
    . Mir graphics platform ABI broke in series 0.26 but sonames never
      changed (LP: #1662455)
    . Fixes for 0.26 changelog.
    . [regression] mirscreencast hangs during screencast creation. (LP: #1662997)
    . libmirclient-dev missing build dependency on libmircore-dev. (LP: #1662942)
    . mir_window_spec_set_cursor_name() doesn't trigger
      mir::scene::SurfaceObserver::cursor_image_set_to. (LP: #1663197)
    . [regression] Software clients of nested servers are all black in Mir 0.25.0
      and later. (LP: #1663062)
    . New and improved client APIs: MirInputConfig, MirWindow, DisplayConfig,
      MirScreencastSpec.
    . Support for setting the input configuration.
    . Introduced an extension mechanism for platform-specific APIs.
    . Support for screencasting to a specific MirBuffer.
    . Added DisplayConfigurationController::base_configuration() so
      downstreams can get the base configuration (weirdly they can already
      set it).
    . X11 platform: Allow adjustable scale parameter.
    . Added monitor EDID support to both the client API and server-side.
    . mirout: Now shows scaling factor, subpixel arrangement, form factor and
      EDID.
    . mirout: Can now change the monitor configuration as well as report it.
    . Introduced client-side vsync which dramatically reduces latency
      from the client to the screen, by up to 44ms.
    . Removed all input resampling logic. We now expect toolkits to do their
      own, if at all. This reduces input lag by up to 16.9ms, or 8.4ms on
      average.

Show diffs side-by-side

added added

removed removed

Lines of Context:
266
266
    self->prompt_session_state_change_callback_called.store(true);
267
267
}
268
268
 
 
269
template<typename T>
 
270
auto to_mir_fds(T* raw_fds, size_t count)
 
271
{
 
272
    std::vector<mir::Fd> fds;
 
273
    for (size_t i = 0; i != count; ++i)
 
274
        fds.push_back(mir::Fd{raw_fds[i]});
 
275
    return fds;
 
276
}
 
277
 
 
278
template<typename T>
 
279
auto to_mir_fds(T const& raw_fds)
 
280
{
 
281
    return to_mir_fds(raw_fds.data(), raw_fds.size());
 
282
}
 
283
 
269
284
void client_fd_callback(MirPromptSession*, size_t count, int const* fds, void* context)
270
285
{
271
286
    auto const self = static_cast<PromptSessionClientAPI*>(context);
272
287
 
273
288
    std::unique_lock<decltype(self->mutex)> lock(self->mutex);
274
289
 
275
 
    self->actual_fds.clear();
276
 
    for (size_t i = 0; i != count; ++i)
277
 
        self->actual_fds.push_back(mir::Fd{fds[i]});
 
290
    self->actual_fds = to_mir_fds(fds, count);
278
291
 
279
292
    self->called_back = true;
280
293
    self->cv.notify_one();
353
366
    MirPromptSession* prompt_session = mir_connection_create_prompt_session_sync(
354
367
        connection, application_session_pid, null_state_change_callback, this);
355
368
 
356
 
    static std::size_t const arbritary_fd_request_count = 3;
 
369
    std::size_t const arbritary_fd_request_count = 3;
357
370
 
358
371
    mir_prompt_session_new_fds_for_prompt_providers(
359
372
        prompt_session, arbritary_fd_request_count, &client_fd_callback, this);
361
374
    EXPECT_TRUE(wait_for_callback(std::chrono::milliseconds(500)));
362
375
    EXPECT_THAT(actual_fds.size(), Eq(arbritary_fd_request_count));
363
376
 
 
377
    for (auto const& fd : actual_fds)
 
378
        EXPECT_THAT(fd, Gt(0));
 
379
 
 
380
    mir_prompt_session_release_sync(prompt_session);
 
381
}
 
382
 
 
383
TEST_F(PromptSessionClientAPI, can_get_fds_for_prompt_providers_sync)
 
384
{
 
385
    connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
 
386
 
 
387
    MirPromptSession* prompt_session = mir_connection_create_prompt_session_sync(
 
388
            connection, application_session_pid, null_state_change_callback, this);
 
389
 
 
390
    std::size_t const arbritary_fd_request_count = 3;
 
391
    std::array<int, arbritary_fd_request_count> fds;
 
392
    auto actual_fd_count = mir_prompt_session_new_fds_for_prompt_providers_sync(
 
393
            prompt_session, arbritary_fd_request_count, fds.data());
 
394
 
 
395
    auto mir_fds = to_mir_fds(fds);
 
396
    EXPECT_THAT(actual_fd_count, Eq(arbritary_fd_request_count));
 
397
    for (auto const& fd : mir_fds)
 
398
        EXPECT_THAT(fd, Gt(0));
 
399
 
364
400
    mir_prompt_session_release_sync(prompt_session);
365
401
}
366
402