Merge lp:~alan-griffiths/mir/tidy-code into lp:mir
- tidy-code
- Merge into development-branch
Status: | Merged |
---|---|
Merged at revision: | 4120 |
Proposed branch: | lp:~alan-griffiths/mir/tidy-code |
Merge into: | lp:mir |
Diff against target: |
277 lines (+9/-214) 2 files modified
include/test/mir_test_framework/observant_shell.h (+4/-74) tests/mir_test_framework/observant_shell.cpp (+5/-140) |
To merge this branch: | bzr merge lp:~alan-griffiths/mir/tidy-code |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Needs Fixing | |
Daniel van Vugt | Approve | ||
Chris Halse Rogers | Approve | ||
Review via email: mp+321093@code.launchpad.net |
Commit message
Simplify mtf::ObservantShell
Description of the change
Mir CI Bot (mir-ci-bot) wrote : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Mir CI Bot (mir-ci-bot) : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Alan Griffiths (alan-griffiths) wrote : | # |
"08:00:55 E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem."
Is this a new failure mode? testflinger?
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Alan Griffiths (alan-griffiths) wrote : | # |
09:34:02 ++ testflinger-cli submit -q /dev/stdin
09:34:09 Traceback (most recent call last):
09:34:09 File "/snap/
09:34:09 six.raise_from(e, None)
...
09:34:09 During handling of the above exception, another exception occurred:
...
09:34:09 + JOB_ID=
09:34:09 Build step 'Execute shell' marked build as failure
09:34:09 [WS-CLEANUP] Deleting project workspace.
09:34:09 Finished: FAILURE
Mir CI Bot (mir-ci-bot) : | # |
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
SUCCESS: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Preview Diff
1 | === modified file 'include/test/mir_test_framework/observant_shell.h' | |||
2 | --- include/test/mir_test_framework/observant_shell.h 2017-03-09 17:42:58 +0000 | |||
3 | +++ include/test/mir_test_framework/observant_shell.h 2017-03-27 16:55:20 +0000 | |||
4 | @@ -19,96 +19,26 @@ | |||
5 | 19 | #ifndef MIR_TEST_OBSERVANT_SHELL_H_ | 19 | #ifndef MIR_TEST_OBSERVANT_SHELL_H_ |
6 | 20 | #define MIR_TEST_OBSERVANT_SHELL_H_ | 20 | #define MIR_TEST_OBSERVANT_SHELL_H_ |
7 | 21 | 21 | ||
11 | 22 | #include "mir/scene/session.h" | 22 | #include "mir/shell/shell_wrapper.h" |
12 | 23 | #include "mir/scene/surface.h" | 23 | |
13 | 24 | #include "mir/shell/shell.h" | 24 | namespace mir { namespace scene { class SurfaceObserver; }} |
14 | 25 | 25 | ||
15 | 26 | namespace mir_test_framework | 26 | namespace mir_test_framework |
16 | 27 | { | 27 | { |
19 | 28 | 28 | struct ObservantShell : mir::shell::ShellWrapper | |
18 | 29 | struct ObservantShell : mir::shell::Shell | ||
20 | 30 | { | 29 | { |
21 | 31 | ObservantShell( | 30 | ObservantShell( |
22 | 32 | std::shared_ptr<mir::shell::Shell> const& wrapped, | 31 | std::shared_ptr<mir::shell::Shell> const& wrapped, |
23 | 33 | std::shared_ptr<mir::scene::SurfaceObserver> const& surface_observer); | 32 | std::shared_ptr<mir::scene::SurfaceObserver> const& surface_observer); |
24 | 34 | 33 | ||
25 | 35 | void add_display(mir::geometry::Rectangle const& area) override; | ||
26 | 36 | |||
27 | 37 | void remove_display(mir::geometry::Rectangle const& area) override; | ||
28 | 38 | |||
29 | 39 | bool handle(MirEvent const& event) override; | ||
30 | 40 | |||
31 | 41 | void focus_next_session() override; | ||
32 | 42 | |||
33 | 43 | auto focused_session() const -> std::shared_ptr<mir::scene::Session> override; | ||
34 | 44 | |||
35 | 45 | void set_focus_to( | ||
36 | 46 | std::shared_ptr<mir::scene::Session> const& focus_session, | ||
37 | 47 | std::shared_ptr<mir::scene::Surface> const& focus_surface) override; | ||
38 | 48 | |||
39 | 49 | std::shared_ptr<mir::scene::Surface> focused_surface() const override; | ||
40 | 50 | |||
41 | 51 | auto surface_at(mir::geometry::Point cursor) const -> std::shared_ptr<mir::scene::Surface> override; | ||
42 | 52 | |||
43 | 53 | void raise(mir::shell::SurfaceSet const& surfaces) override; | ||
44 | 54 | |||
45 | 55 | std::shared_ptr<mir::scene::Session> open_session( | ||
46 | 56 | pid_t client_pid, | ||
47 | 57 | std::string const& name, | ||
48 | 58 | std::shared_ptr<mir::frontend::EventSink> const& sink) override; | ||
49 | 59 | |||
50 | 60 | void close_session(std::shared_ptr<mir::scene::Session> const& session) override; | ||
51 | 61 | |||
52 | 62 | std::shared_ptr<mir::scene::PromptSession> start_prompt_session_for( | ||
53 | 63 | std::shared_ptr<mir::scene::Session> const& session, | ||
54 | 64 | mir::scene::PromptSessionCreationParameters const& params) override; | ||
55 | 65 | |||
56 | 66 | void add_prompt_provider_for( | ||
57 | 67 | std::shared_ptr<mir::scene::PromptSession> const& prompt_session, | ||
58 | 68 | std::shared_ptr<mir::scene::Session> const& session) override; | ||
59 | 69 | |||
60 | 70 | void stop_prompt_session(std::shared_ptr<mir::scene::PromptSession> const& prompt_session) override; | ||
61 | 71 | |||
62 | 72 | mir::frontend::SurfaceId create_surface( | 34 | mir::frontend::SurfaceId create_surface( |
63 | 73 | std::shared_ptr<mir::scene::Session> const& session, | 35 | std::shared_ptr<mir::scene::Session> const& session, |
64 | 74 | mir::scene::SurfaceCreationParameters const& params, | 36 | mir::scene::SurfaceCreationParameters const& params, |
65 | 75 | std::shared_ptr<mir::frontend::EventSink> const& sink) override; | 37 | std::shared_ptr<mir::frontend::EventSink> const& sink) override; |
66 | 76 | 38 | ||
67 | 77 | void modify_surface( | ||
68 | 78 | std::shared_ptr<mir::scene::Session> const& session, | ||
69 | 79 | std::shared_ptr<mir::scene::Surface> const& window, | ||
70 | 80 | mir::shell::SurfaceSpecification const& modifications) override; | ||
71 | 81 | |||
72 | 82 | void destroy_surface(std::shared_ptr<mir::scene::Session> const& session, mir::frontend::SurfaceId window) override; | ||
73 | 83 | |||
74 | 84 | int set_surface_attribute( | ||
75 | 85 | std::shared_ptr<mir::scene::Session> const& session, | ||
76 | 86 | std::shared_ptr<mir::scene::Surface> const& window, | ||
77 | 87 | MirWindowAttrib attrib, | ||
78 | 88 | int value) override; | ||
79 | 89 | |||
80 | 90 | int get_surface_attribute( | ||
81 | 91 | std::shared_ptr<mir::scene::Surface> const& window, | ||
82 | 92 | MirWindowAttrib attrib) override; | ||
83 | 93 | |||
84 | 94 | void raise_surface( | ||
85 | 95 | std::shared_ptr<mir::scene::Session> const& session, | ||
86 | 96 | std::shared_ptr<mir::scene::Surface> const& window, | ||
87 | 97 | uint64_t timestamp) override; | ||
88 | 98 | |||
89 | 99 | void request_drag_and_drop( | ||
90 | 100 | std::shared_ptr<mir::scene::Session> const& session, | ||
91 | 101 | std::shared_ptr<mir::scene::Surface> const& window, | ||
92 | 102 | uint64_t timestamp) override; | ||
93 | 103 | |||
94 | 104 | void set_drag_and_drop_handle(std::vector<uint8_t> const& handle) override; | ||
95 | 105 | void clear_drag_and_drop_handle() override; | ||
96 | 106 | |||
97 | 107 | private: | 39 | private: |
98 | 108 | std::shared_ptr<mir::shell::Shell> const wrapped; | ||
99 | 109 | std::shared_ptr<mir::scene::SurfaceObserver> const surface_observer; | 40 | std::shared_ptr<mir::scene::SurfaceObserver> const surface_observer; |
100 | 110 | }; | 41 | }; |
101 | 111 | |||
102 | 112 | } | 42 | } |
103 | 113 | 43 | ||
104 | 114 | #endif /* MIR_TEST_OBSERVANT_SHELL_H_ */ | 44 | #endif /* MIR_TEST_OBSERVANT_SHELL_H_ */ |
105 | 115 | 45 | ||
106 | === modified file 'tests/mir_test_framework/observant_shell.cpp' | |||
107 | --- tests/mir_test_framework/observant_shell.cpp 2017-03-10 12:02:27 +0000 | |||
108 | +++ tests/mir_test_framework/observant_shell.cpp 2017-03-27 16:55:20 +0000 | |||
109 | @@ -18,163 +18,28 @@ | |||
110 | 18 | 18 | ||
111 | 19 | #include "mir_test_framework/observant_shell.h" | 19 | #include "mir_test_framework/observant_shell.h" |
112 | 20 | 20 | ||
114 | 21 | namespace geom = mir::geometry; | 21 | #include "mir/scene/session.h" |
115 | 22 | #include "mir/scene/surface.h" | ||
116 | 23 | |||
117 | 22 | namespace msh = mir::shell; | 24 | namespace msh = mir::shell; |
118 | 23 | namespace msc = mir::scene; | 25 | namespace msc = mir::scene; |
119 | 24 | namespace mf = mir::frontend; | 26 | namespace mf = mir::frontend; |
120 | 25 | namespace mi = mir::input; | ||
121 | 26 | namespace mtf = mir_test_framework; | 27 | namespace mtf = mir_test_framework; |
122 | 27 | 28 | ||
123 | 28 | mtf::ObservantShell::ObservantShell( | 29 | mtf::ObservantShell::ObservantShell( |
124 | 29 | std::shared_ptr<msh::Shell> const& wrapped, | 30 | std::shared_ptr<msh::Shell> const& wrapped, |
125 | 30 | std::shared_ptr<msc::SurfaceObserver> const& surface_observer) : | 31 | std::shared_ptr<msc::SurfaceObserver> const& surface_observer) : |
127 | 31 | wrapped(wrapped), | 32 | msh::ShellWrapper(wrapped), |
128 | 32 | surface_observer(surface_observer) | 33 | surface_observer(surface_observer) |
129 | 33 | { | 34 | { |
130 | 34 | } | 35 | } |
131 | 35 | |||
132 | 36 | void mtf::ObservantShell::add_display(geom::Rectangle const& area) | ||
133 | 37 | { | ||
134 | 38 | return wrapped->add_display(area); | ||
135 | 39 | } | ||
136 | 40 | |||
137 | 41 | void mtf::ObservantShell::remove_display(geom::Rectangle const& area) | ||
138 | 42 | { | ||
139 | 43 | return wrapped->remove_display(area); | ||
140 | 44 | } | ||
141 | 45 | |||
142 | 46 | bool mtf::ObservantShell::handle(MirEvent const& event) | ||
143 | 47 | { | ||
144 | 48 | return wrapped->handle(event); | ||
145 | 49 | } | ||
146 | 50 | |||
147 | 51 | void mtf::ObservantShell::focus_next_session() | ||
148 | 52 | { | ||
149 | 53 | wrapped->focus_next_session(); | ||
150 | 54 | } | ||
151 | 55 | |||
152 | 56 | auto mtf::ObservantShell::focused_session() const -> std::shared_ptr<msc::Session> | ||
153 | 57 | { | ||
154 | 58 | return wrapped->focused_session(); | ||
155 | 59 | } | ||
156 | 60 | |||
157 | 61 | void mtf::ObservantShell::set_focus_to( | ||
158 | 62 | std::shared_ptr<msc::Session> const& focus_session, | ||
159 | 63 | std::shared_ptr<msc::Surface> const& focus_surface) | ||
160 | 64 | { | ||
161 | 65 | return wrapped->set_focus_to(focus_session, focus_surface); | ||
162 | 66 | } | ||
163 | 67 | |||
164 | 68 | std::shared_ptr<msc::Surface> mtf::ObservantShell::focused_surface() const | ||
165 | 69 | { | ||
166 | 70 | return wrapped->focused_surface(); | ||
167 | 71 | } | ||
168 | 72 | |||
169 | 73 | auto mtf::ObservantShell::surface_at(geom::Point cursor) const -> std::shared_ptr<msc::Surface> | ||
170 | 74 | { | ||
171 | 75 | return wrapped->surface_at(cursor); | ||
172 | 76 | } | ||
173 | 77 | |||
174 | 78 | void mtf::ObservantShell::raise(msh::SurfaceSet const& surfaces) | ||
175 | 79 | { | ||
176 | 80 | wrapped->raise(surfaces); | ||
177 | 81 | } | ||
178 | 82 | |||
179 | 83 | std::shared_ptr<msc::Session> mtf::ObservantShell::open_session( | ||
180 | 84 | pid_t client_pid, | ||
181 | 85 | std::string const& name, | ||
182 | 86 | std::shared_ptr<mf::EventSink> const& sink) | ||
183 | 87 | { | ||
184 | 88 | return wrapped->open_session(client_pid, name, sink); | ||
185 | 89 | } | ||
186 | 90 | |||
187 | 91 | void mtf::ObservantShell::close_session(std::shared_ptr<msc::Session> const& session) | ||
188 | 92 | { | ||
189 | 93 | wrapped->close_session(session); | ||
190 | 94 | } | ||
191 | 95 | |||
192 | 96 | std::shared_ptr<msc::PromptSession> mtf::ObservantShell::start_prompt_session_for( | ||
193 | 97 | std::shared_ptr<msc::Session> const& session, | ||
194 | 98 | msc::PromptSessionCreationParameters const& params) | ||
195 | 99 | { | ||
196 | 100 | return wrapped->start_prompt_session_for(session, params); | ||
197 | 101 | } | ||
198 | 102 | |||
199 | 103 | void mtf::ObservantShell::add_prompt_provider_for( | ||
200 | 104 | std::shared_ptr<msc::PromptSession> const& prompt_session, | ||
201 | 105 | std::shared_ptr<msc::Session> const& session) | ||
202 | 106 | { | ||
203 | 107 | wrapped->add_prompt_provider_for(prompt_session, session); | ||
204 | 108 | } | ||
205 | 109 | |||
206 | 110 | void mtf::ObservantShell::stop_prompt_session(std::shared_ptr<msc::PromptSession> const& prompt_session) | ||
207 | 111 | { | ||
208 | 112 | wrapped->stop_prompt_session(prompt_session); | ||
209 | 113 | } | ||
210 | 114 | |||
211 | 115 | mf::SurfaceId mtf::ObservantShell::create_surface( | 36 | mf::SurfaceId mtf::ObservantShell::create_surface( |
212 | 116 | std::shared_ptr<msc::Session> const& session, | 37 | std::shared_ptr<msc::Session> const& session, |
213 | 117 | msc::SurfaceCreationParameters const& params, | 38 | msc::SurfaceCreationParameters const& params, |
214 | 118 | std::shared_ptr<mf::EventSink> const& sink) | 39 | std::shared_ptr<mf::EventSink> const& sink) |
215 | 119 | { | 40 | { |
217 | 120 | auto id = wrapped->create_surface(session, params, sink); | 41 | auto id = msh::ShellWrapper::create_surface(session, params, sink); |
218 | 121 | auto window = session->surface(id); | 42 | auto window = session->surface(id); |
219 | 122 | window->add_observer(surface_observer); | 43 | window->add_observer(surface_observer); |
220 | 123 | return id; | 44 | return id; |
221 | 124 | } | 45 | } |
222 | 125 | |||
223 | 126 | void mtf::ObservantShell::modify_surface( | ||
224 | 127 | std::shared_ptr<msc::Session> const& session, | ||
225 | 128 | std::shared_ptr<msc::Surface> const& window, | ||
226 | 129 | msh::SurfaceSpecification const& modifications) | ||
227 | 130 | { | ||
228 | 131 | wrapped->modify_surface(session, window, modifications); | ||
229 | 132 | } | ||
230 | 133 | |||
231 | 134 | void mtf::ObservantShell::destroy_surface(std::shared_ptr<msc::Session> const& session, mf::SurfaceId window) | ||
232 | 135 | { | ||
233 | 136 | wrapped->destroy_surface(session, window); | ||
234 | 137 | } | ||
235 | 138 | |||
236 | 139 | int mtf::ObservantShell::set_surface_attribute( | ||
237 | 140 | std::shared_ptr<msc::Session> const& session, | ||
238 | 141 | std::shared_ptr<msc::Surface> const& window, | ||
239 | 142 | MirWindowAttrib attrib, | ||
240 | 143 | int value) | ||
241 | 144 | { | ||
242 | 145 | return wrapped->set_surface_attribute(session, window, attrib, value); | ||
243 | 146 | } | ||
244 | 147 | |||
245 | 148 | int mtf::ObservantShell::get_surface_attribute( | ||
246 | 149 | std::shared_ptr<msc::Surface> const& window, | ||
247 | 150 | MirWindowAttrib attrib) | ||
248 | 151 | { | ||
249 | 152 | return wrapped->get_surface_attribute(window, attrib); | ||
250 | 153 | } | ||
251 | 154 | |||
252 | 155 | void mtf::ObservantShell::raise_surface( | ||
253 | 156 | std::shared_ptr<msc::Session> const& session, | ||
254 | 157 | std::shared_ptr<msc::Surface> const& window, | ||
255 | 158 | uint64_t timestamp) | ||
256 | 159 | { | ||
257 | 160 | return wrapped->raise_surface(session, window, timestamp); | ||
258 | 161 | } | ||
259 | 162 | |||
260 | 163 | void mtf::ObservantShell::request_drag_and_drop( | ||
261 | 164 | std::shared_ptr<msc::Session> const& session, | ||
262 | 165 | std::shared_ptr<msc::Surface> const& window, | ||
263 | 166 | uint64_t timestamp) | ||
264 | 167 | { | ||
265 | 168 | return wrapped->request_drag_and_drop(session, window, timestamp); | ||
266 | 169 | } | ||
267 | 170 | |||
268 | 171 | void mtf::ObservantShell::set_drag_and_drop_handle(std::vector<uint8_t> const& handle) | ||
269 | 172 | { | ||
270 | 173 | wrapped->set_drag_and_drop_handle(handle); | ||
271 | 174 | } | ||
272 | 175 | |||
273 | 176 | void mtf::ObservantShell::clear_drag_and_drop_handle() | ||
274 | 177 | { | ||
275 | 178 | wrapped->clear_drag_and_drop_handle(); | ||
276 | 179 | } | ||
277 | 180 |
PASSED: Continuous integration, rev:4119 /mir-jenkins. ubuntu. com/job/ mir-ci/ 3254/ /mir-jenkins. ubuntu. com/job/ build-mir/ 4382 /mir-jenkins. ubuntu. com/job/ build-0- fetch/4471 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 4461 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 4461 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= zesty/4461 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4414 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= zesty/4414/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4414 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4414/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4414 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= zesty/4414/ artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4414 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= cross-armhf, compiler= gcc,platform= android, release= vivid+overlay/ 4414/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4414 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 4414/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4414 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 4414/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 3254/rebuild
https:/