~alan-griffiths/miral/fix-1645284

« back to all changes in this revision

Viewing changes to test/persistent_surface_store.cpp

  • Committer: Alan Griffiths
  • Date: 2016-11-16 16:25:36 UTC
  • mfrom: (446 miral)
  • mto: This revision was merged to the branch mainline in revision 451.
  • Revision ID: alan@octopull.co.uk-20161116162536-fxlkrgnmyr78aq2v
mergeĀ :parent

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
struct PersistentSurfaceId : public miral::TestServer
36
36
{
37
 
    auto get_first_window() -> miral::Window
 
37
    auto get_first_window(miral::WindowManagerTools& tools) -> miral::Window
38
38
    {
39
39
        auto app = tools.find_application([&](miral::ApplicationInfo const& /*info*/){return true;});
40
40
        auto app_info = tools.info_for(app);
58
58
 
59
59
    miral::toolkit::PersistentId client_surface_id{surface};
60
60
 
61
 
    tools.invoke_under_lock([&]
 
61
    invoke_tools([&](miral::WindowManagerTools& tools)
62
62
        {
63
63
            auto const& window_info = tools.info_for_window_id(client_surface_id.c_str());
64
64
 
80
80
 
81
81
    miral::toolkit::PersistentId client_surface_id{surface};
82
82
 
83
 
    tools.invoke_under_lock([&]
 
83
    invoke_tools([&](miral::WindowManagerTools& tools)
84
84
        {
85
 
            auto window = get_first_window();
 
85
            auto window = get_first_window(tools);
86
86
            auto id = tools.id_for_window(window);
87
87
 
88
88
            ASSERT_THAT(client_surface_id.c_str(), Eq(id));
102
102
 
103
103
    miral::toolkit::PersistentId client_surface_id{surface};
104
104
 
105
 
    tools.invoke_under_lock([&]
 
105
    invoke_tools([&](miral::WindowManagerTools& tools)
106
106
        {
107
107
            EXPECT_THROW(tools.info_for_window_id(client_surface_id.c_str()), std::runtime_error);
108
108
        });
121
121
 
122
122
    miral::toolkit::PersistentId client_surface_id{surface};
123
123
 
124
 
    tools.invoke_under_lock([&]
 
124
    invoke_tools([](miral::WindowManagerTools& tools)
125
125
        {
126
 
            auto window = get_first_window();
 
126
            auto window = get_first_window(tools);
127
127
            EXPECT_THROW(tools.id_for_window(window), std::runtime_error);
128
128
        });
129
129
}
142
142
 
143
143
    miral::toolkit::PersistentId client_surface_id{surface};
144
144
 
145
 
    tools.invoke_under_lock([&]
 
145
    invoke_tools([](miral::WindowManagerTools& tools)
146
146
        {
147
147
            EXPECT_THROW(tools.info_for_window_id("garbage"), std::exception);
148
148
        });
150
150
 
151
151
TEST_F(PersistentSurfaceId, server_fails_gracefully_when_id_for_null_window_requested)
152
152
{
153
 
    tools.invoke_under_lock([&]
 
153
    invoke_tools([](miral::WindowManagerTools& tools)
154
154
        {
155
155
            miral::Window window;
156
156
            EXPECT_THROW(tools.id_for_window(window), std::runtime_error);