Mir

Merge lp:mir into lp:~mir-team/mir/trunk

Proposed by kevin gunn
Status: Merged
Approved by: kevin gunn
Approved revision: 1094
Merged at revision: 1086
Proposed branch: lp:mir
Merge into: lp:~mir-team/mir/trunk
Diff against target: 1373 lines (+579/-161)
23 files modified
3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp (+157/-5)
include/test/mir_test_framework/display_server_test_fixture.h (+2/-0)
include/test/mir_test_framework/stub_client_connection_configuration.h (+35/-0)
include/test/mir_test_framework/testing_client_configuration.h (+43/-0)
include/test/mir_test_framework/testing_process_manager.h (+7/-8)
src/client/mir_client_library.cpp (+39/-17)
src/server/graphics/android/hwc_common_device.cpp (+15/-13)
src/server/options/program_option.cpp (+2/-1)
tests/acceptance-tests/test_client_authorization.cpp (+7/-0)
tests/acceptance-tests/test_client_focus_notification.cpp (+2/-9)
tests/acceptance-tests/test_client_input.cpp (+8/-15)
tests/acceptance-tests/test_client_library.cpp (+30/-17)
tests/acceptance-tests/test_focus_selection.cpp (+2/-9)
tests/acceptance-tests/test_server_shutdown.cpp (+2/-9)
tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+2/-9)
tests/acceptance-tests/test_surfaceloop.cpp (+3/-10)
tests/acceptance-tests/test_surfaces_with_output_id.cpp (+2/-9)
tests/mir_test_framework/CMakeLists.txt (+1/-0)
tests/mir_test_framework/display_server_test_fixture.cpp (+9/-6)
tests/mir_test_framework/testing_client_options.cpp (+126/-0)
tests/mir_test_framework/testing_process_manager.cpp (+41/-1)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+25/-1)
tests/unit-tests/logging/test_legacy_input_report.cpp (+19/-22)
To merge this branch: bzr merge lp:mir
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Approve
Kevin DuBois (community) Approve
Review via email: mp+188086@code.launchpad.net

Commit message

merge latest dev branch

Description of the change

graphics: android: change fb blank request to only by made when there's a change of state. Also correct a failing unit test in trunk fix: lp-1231594.

Bring back android-input logging functionality
- prefix log message with the tag name from where the log function was called.
- filter log messages by tag name and priority with the ANDROID_LOG_TAGS
  environment var.

To post a comment you must log in.
Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm, don't see any abi breakage

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK,nothing changed in include => no API changes.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:mir updated
1094. By Michael Terry

Ignore unknown options instead of aborting. Fixes: https://bugs.launchpad.net/bugs/1226227.

Approved by PS Jenkins bot, Robert Carr.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp'
2--- 3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp 2013-05-04 00:50:30 +0000
3+++ 3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp 2013-09-27 23:50:04 +0000
4@@ -14,13 +14,143 @@
5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6 *
7 * Authored by: Alan Griffiths <alan@octopull.co.uk>
8- */
9-
10-#include <std/Log.h>
11+ * Daniel d'Andrada <daniel.dandrada@canonical.com>
12+ */
13+
14+// License of the original configureInitialState() function:
15+/*
16+ * Copyright (C) 2008 The Android Open Source Project
17+ *
18+ * Licensed under the Apache License, Version 2.0 (the "License");
19+ * you may not use this file except in compliance with the License.
20+ * You may obtain a copy of the License at
21+ *
22+ * http://www.apache.org/licenses/LICENSE-2.0
23+ *
24+ * Unless required by applicable law or agreed to in writing, software
25+ * distributed under the License is distributed on an "AS IS" BASIS,
26+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27+ * See the License for the specific language governing permissions and
28+ * limitations under the License.
29+ */
30+
31+#include <android/log.h>
32 #include <std/MirLog.h>
33+#include <cctype>
34 #include <cstdarg>
35 #include <cstdio>
36-
37+#include <cstdlib>
38+#include <cstring>
39+
40+#define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */
41+#define kTagSetSize 16 /* arbitrary */
42+
43+namespace
44+{
45+ struct LogState {
46+ /* global minimum priority */
47+ int globalMinPriority;
48+
49+ /* tags and priorities */
50+ struct {
51+ char tag[kMaxTagLen];
52+ int minPriority;
53+ } tagSet[kTagSetSize];
54+ } gLogState = { .globalMinPriority = ANDROID_LOG_UNKNOWN };
55+}
56+
57+/*
58+ * Configure logging based on ANDROID_LOG_TAGS environment variable. We
59+ * need to parse a string that looks like
60+ *
61+ * *:v jdwp:d dalvikvm:d dalvikvm-gc:i dalvikvmi:i
62+ *
63+ * The tag (or '*' for the global level) comes first, followed by a colon
64+ * and a letter indicating the minimum priority level we're expected to log.
65+ * This can be used to reveal or conceal logs with specific tags.
66+ *
67+ * We also want to check ANDROID_PRINTF_LOG to determine how the output
68+ * will look.
69+ */
70+static void configureInitialState(struct LogState* logState)
71+{
72+ /* global min priority defaults to "info" level */
73+ logState->globalMinPriority = ANDROID_LOG_INFO;
74+
75+ int entry = 0;
76+
77+ /*
78+ * This is based on the the long-dead utils/Log.cpp code.
79+ */
80+ const char* tags = getenv("ANDROID_LOG_TAGS");
81+ if (tags != NULL) {
82+ while (*tags != '\0') {
83+ char tagName[kMaxTagLen];
84+ int i, minPrio;
85+
86+ while (isspace(*tags))
87+ tags++;
88+
89+ i = 0;
90+ while (*tags != '\0' && !isspace(*tags) && *tags != ':' &&
91+ i < kMaxTagLen)
92+ {
93+ tagName[i++] = *tags++;
94+ }
95+ if (i == kMaxTagLen) {
96+ break;
97+ }
98+ tagName[i] = '\0';
99+
100+ /* default priority, if there's no ":" part; also zero out '*' */
101+ minPrio = ANDROID_LOG_VERBOSE;
102+ if (tagName[0] == '*' && tagName[1] == '\0') {
103+ minPrio = ANDROID_LOG_DEBUG;
104+ tagName[0] = '\0';
105+ }
106+
107+ if (*tags == ':') {
108+ tags++;
109+ if (*tags >= '0' && *tags <= '9') {
110+ if (*tags >= ('0' + ANDROID_LOG_SILENT))
111+ minPrio = ANDROID_LOG_VERBOSE;
112+ else
113+ minPrio = *tags - '\0';
114+ } else {
115+ switch (*tags) {
116+ case 'v': minPrio = ANDROID_LOG_VERBOSE; break;
117+ case 'd': minPrio = ANDROID_LOG_DEBUG; break;
118+ case 'i': minPrio = ANDROID_LOG_INFO; break;
119+ case 'w': minPrio = ANDROID_LOG_WARN; break;
120+ case 'e': minPrio = ANDROID_LOG_ERROR; break;
121+ case 'f': minPrio = ANDROID_LOG_FATAL; break;
122+ case 's': minPrio = ANDROID_LOG_SILENT; break;
123+ default: minPrio = ANDROID_LOG_DEFAULT; break;
124+ }
125+ }
126+
127+ tags++;
128+ if (*tags != '\0' && !isspace(*tags)) {
129+ break;
130+ }
131+ }
132+
133+ if (tagName[0] == 0) {
134+ logState->globalMinPriority = minPrio;
135+ } else {
136+ logState->tagSet[entry].minPriority = minPrio;
137+ strcpy(logState->tagSet[entry].tag, tagName);
138+ entry++;
139+ }
140+ }
141+ }
142+
143+ if (entry < kTagSetSize) {
144+ // Mark the end of this array
145+ logState->tagSet[entry].minPriority = ANDROID_LOG_UNKNOWN;
146+ logState->tagSet[entry].tag[0] = '\0';
147+ }
148+}
149
150 extern "C" int __android_log_print(int prio, const char *tag, const char *fmt, ...)
151 {
152@@ -30,7 +160,29 @@
153 int result = vsnprintf(buffer, sizeof buffer - 1, fmt, ap);
154 va_end(ap);
155
156- mir::write_to_log(prio, buffer);
157+ if (gLogState.globalMinPriority == ANDROID_LOG_UNKNOWN) {
158+ configureInitialState(&gLogState);
159+ }
160+
161+ /* see if this log tag is configured */
162+ int minPrio = gLogState.globalMinPriority;
163+ for (int i = 0; i < kTagSetSize; i++) {
164+ if (gLogState.tagSet[i].minPriority == ANDROID_LOG_UNKNOWN)
165+ break; /* reached end of configured values */
166+
167+ if (strcmp(gLogState.tagSet[i].tag, tag) == 0) {
168+ minPrio = gLogState.tagSet[i].minPriority;
169+ break;
170+ }
171+ }
172+
173+ if (prio >= minPrio) {
174+ char taggedBuffer[1024];
175+ sprintf(taggedBuffer, "[%s]%s", tag, buffer);
176+ mir::write_to_log(prio, taggedBuffer);
177+ } else {
178+ // filter out log message
179+ }
180
181 return result;
182 }
183
184=== modified file 'include/test/mir_test_framework/display_server_test_fixture.h'
185--- include/test/mir_test_framework/display_server_test_fixture.h 2013-08-28 03:41:48 +0000
186+++ include/test/mir_test_framework/display_server_test_fixture.h 2013-09-27 23:50:04 +0000
187@@ -46,6 +46,7 @@
188
189 private:
190 static TestingProcessManager process_manager;
191+ static TestingServerConfiguration default_parameters;
192
193 virtual void TearDown();
194 };
195@@ -74,6 +75,7 @@
196
197 private:
198 TestingProcessManager process_manager;
199+ std::shared_ptr<mir::options::Option> test_options;
200 };
201
202 }
203
204=== added file 'include/test/mir_test_framework/stub_client_connection_configuration.h'
205--- include/test/mir_test_framework/stub_client_connection_configuration.h 1970-01-01 00:00:00 +0000
206+++ include/test/mir_test_framework/stub_client_connection_configuration.h 2013-09-27 23:50:04 +0000
207@@ -0,0 +1,35 @@
208+/*
209+ * Copyright © 2013 Canonical Ltd.
210+ *
211+ * This program is free software: you can redistribute it and/or modify it
212+ * under the terms of the GNU General Public License version 3,
213+ * as published by the Free Software Foundation.
214+ *
215+ * This program is distributed in the hope that it will be useful,
216+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
217+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
218+ * GNU General Public License for more details.
219+ *
220+ * You should have received a copy of the GNU General Public License
221+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
222+ *
223+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
224+ */
225+
226+#ifndef MIR_TESTING_STUB_CLIENT_CONNECTION_CONFIGURATION
227+#define MIR_TESTING_STUB_CLIENT_CONNECTION_CONFIGURATION
228+
229+#include "src/client/default_connection_configuration.h"
230+#include <memory>
231+
232+namespace mir_test_framework
233+{
234+
235+struct StubConnectionConfiguration : public mir::client::DefaultConnectionConfiguration
236+{
237+ StubConnectionConfiguration(std::string const& socket_file);
238+ std::shared_ptr<mir::client::ClientPlatformFactory> the_client_platform_factory() override;
239+};
240+
241+}
242+#endif /* MIR_TESTING_STUB_CLIENT_CONNECTION_CONFIGURATION */
243
244=== added file 'include/test/mir_test_framework/testing_client_configuration.h'
245--- include/test/mir_test_framework/testing_client_configuration.h 1970-01-01 00:00:00 +0000
246+++ include/test/mir_test_framework/testing_client_configuration.h 2013-09-27 23:50:04 +0000
247@@ -0,0 +1,43 @@
248+/*
249+ * Copyright © 2013 Canonical Ltd.
250+ *
251+ * This program is free software: you can redistribute it and/or modify it
252+ * under the terms of the GNU General Public License version 3,
253+ * as published by the Free Software Foundation.
254+ *
255+ * This program is distributed in the hope that it will be useful,
256+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
257+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
258+ * GNU General Public License for more details.
259+ *
260+ * You should have received a copy of the GNU General Public License
261+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
262+ *
263+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
264+ */
265+
266+#ifndef MIR_TESTING_CLIENT_CONFIGURATION
267+#define MIR_TESTING_CLIENT_CONFIGURATION
268+
269+#include "mir/options/option.h"
270+
271+namespace mir_test_framework
272+{
273+
274+struct TestingClientConfiguration
275+{
276+ virtual ~TestingClientConfiguration() = default;
277+
278+ // Code to run in client process
279+ virtual void exec() = 0;
280+
281+ //clients respect the tests-use-real-graphics option by default. use
282+ //this function to force the use of the default client configuraiton
283+ virtual bool use_real_graphics(mir::options::Option const& options)
284+ {
285+ return options.get("tests-use-real-graphics", false);
286+ }
287+};
288+
289+}
290+#endif /* MIR_TESTING_CLIENT_CONFIGURATION */
291
292=== modified file 'include/test/mir_test_framework/testing_process_manager.h'
293--- include/test/mir_test_framework/testing_process_manager.h 2013-08-28 03:41:48 +0000
294+++ include/test/mir_test_framework/testing_process_manager.h 2013-09-27 23:50:04 +0000
295@@ -24,6 +24,7 @@
296 #include "mir_test_framework/process.h"
297
298 #include "mir_test_framework/testing_server_configuration.h"
299+#include "mir_test_framework/testing_client_configuration.h"
300
301 #include <memory>
302 #include <list>
303@@ -32,19 +33,16 @@
304 namespace mir
305 {
306 class DisplayServer;
307+namespace options
308+{
309+class Option;
310+}
311 }
312
313 namespace mir_test_framework
314 {
315 using namespace mir;
316
317-struct TestingClientConfiguration
318-{
319- virtual ~TestingClientConfiguration() = default;
320- // Code to run in client process
321- virtual void exec() = 0;
322-};
323-
324
325 class TestingProcessManager
326 {
327@@ -53,7 +51,8 @@
328 ~TestingProcessManager();
329
330 void launch_server_process(TestingServerConfiguration& config);
331- void launch_client_process(TestingClientConfiguration& config);
332+ void launch_client_process(TestingClientConfiguration& config,
333+ mir::options::Option const& test_options);
334
335 void tear_down_clients();
336 void tear_down_server();
337
338=== modified file 'src/client/mir_client_library.cpp'
339--- src/client/mir_client_library.cpp 2013-08-28 03:41:48 +0000
340+++ src/client/mir_client_library.cpp 2013-09-27 23:50:04 +0000
341@@ -77,7 +77,8 @@
342
343 }
344
345-MirWaitHandle* mir_connect(char const* socket_file, char const* name, mir_connected_callback callback, void * context)
346+MirWaitHandle* mir_default_connect(
347+ char const* socket_file, char const* name, mir_connected_callback callback, void * context)
348 {
349
350 try
351@@ -93,7 +94,7 @@
352 else
353 sock = mir::default_server_socket;
354 }
355-
356+
357 mcl::DefaultConnectionConfiguration conf{sock};
358
359 MirConnection* connection = new MirConnection(conf);
360@@ -110,6 +111,42 @@
361 }
362 }
363
364+
365+void mir_default_connection_release(MirConnection * connection)
366+{
367+ if (!error_connections.contains(connection))
368+ {
369+ auto wait_handle = connection->disconnect();
370+ wait_handle->wait_for_all();
371+ }
372+ else
373+ {
374+ error_connections.remove(connection);
375+ }
376+
377+ delete connection;
378+}
379+
380+//mir_connect and mir_connection_release can be overridden by test code that sets these function
381+//pointers to do things like stub out the graphics drivers or change the connection configuration.
382+
383+//TODO: we could have a more comprehensive solution that allows us to substitute any of the functions
384+//for test purposes, not just the connect functions
385+MirWaitHandle* (*mir_connect_impl)(
386+ char const *server, char const *app_name,
387+ mir_connected_callback callback, void *context) = mir_default_connect;
388+void (*mir_connection_release_impl) (MirConnection *connection) = mir_default_connection_release;
389+
390+MirWaitHandle* mir_connect(char const* socket_file, char const* name, mir_connected_callback callback, void * context)
391+{
392+ return mir_connect_impl(socket_file, name, callback, context);
393+}
394+
395+void mir_connection_release(MirConnection *connection)
396+{
397+ return mir_connection_release_impl(connection);
398+}
399+
400 MirConnection *mir_connect_sync(char const *server,
401 char const *app_name)
402 {
403@@ -131,21 +168,6 @@
404 return connection->get_error_message();
405 }
406
407-void mir_connection_release(MirConnection * connection)
408-{
409- if (!error_connections.contains(connection))
410- {
411- auto wait_handle = connection->disconnect();
412- wait_handle->wait_for_all();
413- }
414- else
415- {
416- error_connections.remove(connection);
417- }
418-
419- delete connection;
420-}
421-
422 MirEGLNativeDisplayType mir_connection_get_egl_native_display(MirConnection *connection)
423 {
424 return connection->egl_native_display();
425
426=== modified file 'src/server/graphics/android/hwc_common_device.cpp'
427--- src/server/graphics/android/hwc_common_device.cpp 2013-09-18 16:08:14 +0000
428+++ src/server/graphics/android/hwc_common_device.cpp 2013-09-27 23:50:04 +0000
429@@ -97,22 +97,24 @@
430 coordinator->notify_vsync();
431 }
432
433-void mga::HWCCommonDevice::blank_or_unblank_screen(bool blank)
434+void mga::HWCCommonDevice::blank_or_unblank_screen(bool blank_request)
435 {
436 std::unique_lock<std::mutex> lg(blanked_mutex);
437-
438- int err = hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, blank);
439- if (err)
440+
441+ if (blank_request != blanked)
442 {
443- std::string blanking_status_msg = "Could not " +
444- (blank ? std::string("blank") : std::string("unblank")) + " display";
445- BOOST_THROW_EXCEPTION(
446- boost::enable_error_info(
447- std::runtime_error(blanking_status_msg)) <<
448- boost::errinfo_errno(-err));
449- }
450- blanked = blank;
451- blanked_cond.notify_all();
452+ if(auto err = hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, blank_request))
453+ {
454+ std::string blanking_status_msg = "Could not " +
455+ (blank_request ? std::string("blank") : std::string("unblank")) + " display";
456+ BOOST_THROW_EXCEPTION(
457+ boost::enable_error_info(
458+ std::runtime_error(blanking_status_msg)) <<
459+ boost::errinfo_errno(-err));
460+ }
461+ blanked = blank_request;
462+ blanked_cond.notify_all();
463+ }
464 }
465
466 std::unique_lock<std::mutex> mga::HWCCommonDevice::lock_unblanked()
467
468=== modified file 'src/server/options/program_option.cpp'
469--- src/server/options/program_option.cpp 2013-09-20 18:58:02 +0000
470+++ src/server/options/program_option.cpp 2013-09-27 23:50:04 +0000
471@@ -36,7 +36,8 @@
472 int argc,
473 char const* argv[])
474 {
475- po::store(po::parse_command_line(argc, argv, desc), options);
476+ // TODO: Don't allow unregistered options, once we allow better overriding of option parsing
477+ po::store(po::command_line_parser(argc, argv).options(desc).allow_unregistered().run(), options);
478 po::notify(options);
479 }
480
481
482=== modified file 'tests/acceptance-tests/test_client_authorization.cpp'
483--- tests/acceptance-tests/test_client_authorization.cpp 2013-08-28 03:41:48 +0000
484+++ tests/acceptance-tests/test_client_authorization.cpp 2013-09-27 23:50:04 +0000
485@@ -253,6 +253,13 @@
486 mir_connection_release(connection);
487 }
488
489+ //we are testing the connect function itself, without getting to the
490+ // point where drivers are used, so force using production config
491+ bool use_real_graphics(mir::options::Option const&) override
492+ {
493+ return true;
494+ }
495+
496 ClientPidTestFixture::SharedRegion* shared_region;
497 } client_config(shared_region);
498 launch_client_process(client_config);
499
500=== modified file 'tests/acceptance-tests/test_client_focus_notification.cpp'
501--- tests/acceptance-tests/test_client_focus_notification.cpp 2013-09-17 14:31:42 +0000
502+++ tests/acceptance-tests/test_client_focus_notification.cpp 2013-09-27 23:50:04 +0000
503@@ -30,13 +30,6 @@
504 namespace mt = mir::test;
505 namespace mtf = mir_test_framework;
506
507-// TODO resolve problems running tests on android
508-#ifdef ANDROID
509-#define DISABLED_ON_ANDROID(name) DISABLED_##name
510-#else
511-#define DISABLED_ON_ANDROID(name) name
512-#endif
513-
514 namespace
515 {
516 char const* const mir_test_socket = mtf::test_socket_file().c_str();
517@@ -147,7 +140,7 @@
518
519 }
520
521-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(a_surface_is_notified_of_receiving_focus))
522+TEST_F(BespokeDisplayServerTestFixture, a_surface_is_notified_of_receiving_focus)
523 {
524 using namespace ::testing;
525
526@@ -176,7 +169,7 @@
527
528 }
529
530-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(two_surfaces_are_notified_of_gaining_and_losing_focus))
531+TEST_F(BespokeDisplayServerTestFixture, two_surfaces_are_notified_of_gaining_and_losing_focus)
532 {
533 using namespace ::testing;
534
535
536=== modified file 'tests/acceptance-tests/test_client_input.cpp'
537--- tests/acceptance-tests/test_client_input.cpp 2013-09-20 15:48:40 +0000
538+++ tests/acceptance-tests/test_client_input.cpp 2013-09-27 23:50:04 +0000
539@@ -63,13 +63,6 @@
540 namespace mtd = mt::doubles;
541 namespace mtf = mir_test_framework;
542
543-// TODO resolve problems running tests on android
544-#ifdef ANDROID
545-#define DISABLED_ON_ANDROID(name) DISABLED_##name
546-#else
547-#define DISABLED_ON_ANDROID(name) name
548-#endif
549-
550 namespace
551 {
552 char const* const mir_test_socket = mtf::test_socket_file().c_str();
553@@ -312,7 +305,7 @@
554
555 using TestClientInput = BespokeDisplayServerTestFixture;
556
557-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_key_input))
558+TEST_F(TestClientInput, clients_receive_key_input)
559 {
560 using namespace ::testing;
561
562@@ -358,7 +351,7 @@
563 launch_client_process(client_config);
564 }
565
566-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_us_english_mapped_keys))
567+TEST_F(TestClientInput, clients_receive_us_english_mapped_keys)
568 {
569 using namespace ::testing;
570 static std::string const test_client_name = "1";
571@@ -404,7 +397,7 @@
572 launch_client_process(client_config);
573 }
574
575-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_motion_inside_window))
576+TEST_F(TestClientInput, clients_receive_motion_inside_window)
577 {
578 using namespace ::testing;
579 static std::string const test_client_name = "1";
580@@ -453,7 +446,7 @@
581 launch_client_process(client_config);
582 }
583
584-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_button_events_inside_window))
585+TEST_F(TestClientInput, clients_receive_button_events_inside_window)
586 {
587 using namespace ::testing;
588
589@@ -534,7 +527,7 @@
590
591 }
592
593-TEST_F(TestClientInput, DISABLED_ON_ANDROID(multiple_clients_receive_motion_inside_windows))
594+TEST_F(TestClientInput, multiple_clients_receive_motion_inside_windows)
595 {
596 using namespace ::testing;
597
598@@ -646,7 +639,7 @@
599 std::vector<geom::Rectangle> const input_rectangles;
600 };
601 }
602-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_do_not_receive_motion_outside_input_region))
603+TEST_F(TestClientInput, clients_do_not_receive_motion_outside_input_region)
604 {
605 using namespace ::testing;
606 static std::string const test_client_name = "1";
607@@ -735,7 +728,7 @@
608 launch_client_process(client_config);
609 }
610
611-TEST_F(TestClientInput, DISABLED_ON_ANDROID(surfaces_obscure_motion_events_by_stacking))
612+TEST_F(TestClientInput, surfaces_obscure_motion_events_by_stacking)
613 {
614 using namespace ::testing;
615
616@@ -853,7 +846,7 @@
617
618 }
619
620-TEST_F(TestClientInput, DISABLED_ON_ANDROID(hidden_clients_do_not_receive_pointer_events))
621+TEST_F(TestClientInput, hidden_clients_do_not_receive_pointer_events)
622 {
623 using namespace ::testing;
624
625
626=== modified file 'tests/acceptance-tests/test_client_library.cpp'
627--- tests/acceptance-tests/test_client_library.cpp 2013-09-24 11:07:53 +0000
628+++ tests/acceptance-tests/test_client_library.cpp 2013-09-27 23:50:04 +0000
629@@ -42,13 +42,6 @@
630 namespace mcl = mir::client;
631 namespace mtf = mir_test_framework;
632
633-// TODO resolve problems running tests on android
634-#ifdef ANDROID
635-#define DISABLED_ON_ANDROID(name) DISABLED_##name
636-#else
637-#define DISABLED_ON_ANDROID(name) name
638-#endif
639-
640 namespace
641 {
642 char const* const mir_test_socket = mtf::test_socket_file().c_str();
643@@ -157,7 +150,7 @@
644 launch_client_process(client_config);
645 }
646
647-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_library_creates_surface))
648+TEST_F(DefaultDisplayServerTestFixture, client_library_creates_surface)
649 {
650 struct ClientConfig : ClientConfigCommon
651 {
652@@ -220,7 +213,7 @@
653 launch_client_process(client_config);
654 }
655
656-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(surface_types))
657+TEST_F(DefaultDisplayServerTestFixture, surface_types)
658 {
659 struct ClientConfig : ClientConfigCommon
660 {
661@@ -295,7 +288,7 @@
662 launch_client_process(client_config);
663 }
664
665-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_can_set_surface_state))
666+TEST_F(DefaultDisplayServerTestFixture, client_can_set_surface_state)
667 {
668 struct ClientConfig : ClientConfigCommon
669 {
670@@ -363,7 +356,7 @@
671 launch_client_process(client_config);
672 }
673
674-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_receives_surface_state_events))
675+TEST_F(DefaultDisplayServerTestFixture, client_receives_surface_state_events)
676 {
677 struct ClientConfig : ClientConfigCommon
678 {
679@@ -528,13 +521,19 @@
680
681 mir_connection_release(connection);
682 }
683+
684+ // this test relies on gbm drivers, use real graphics always
685+ bool use_real_graphics(mir::options::Option const&) override
686+ {
687+ return true;
688+ }
689 } client_config;
690
691 launch_client_process(client_config);
692 }
693 #endif
694
695-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_library_creates_multiple_surfaces))
696+TEST_F(DefaultDisplayServerTestFixture, client_library_creates_multiple_surfaces)
697 {
698 int const n_surfaces = 13;
699
700@@ -612,7 +611,7 @@
701 launch_client_process(client_config);
702 }
703
704-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_library_accesses_and_advances_buffers))
705+TEST_F(DefaultDisplayServerTestFixture, client_library_accesses_and_advances_buffers)
706 {
707 struct ClientConfig : ClientConfigCommon
708 {
709@@ -652,7 +651,7 @@
710 launch_client_process(client_config);
711 }
712
713-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(fully_synchronous_client))
714+TEST_F(DefaultDisplayServerTestFixture, fully_synchronous_client)
715 {
716 struct ClientConfig : ClientConfigCommon
717 {
718@@ -694,7 +693,7 @@
719 launch_client_process(client_config);
720 }
721
722-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(highly_threaded_client))
723+TEST_F(DefaultDisplayServerTestFixture, highly_threaded_client)
724 {
725 struct ClientConfig : ClientConfigCommon
726 {
727@@ -838,6 +837,13 @@
728 FAIL() << error;
729 }
730 }
731+
732+ //we are testing the connect function itself, without getting to the
733+ // point where drivers are used, so force using production config
734+ bool use_real_graphics(mir::options::Option const&) override
735+ {
736+ return true;
737+ }
738 } client_config;
739
740 launch_client_process(client_config);
741@@ -867,6 +873,13 @@
742
743 mir_connection_release(connection);
744 }
745+
746+ //we are testing the connect function itself, without getting to the
747+ // point where drivers are used, so force using production config
748+ bool use_real_graphics(mir::options::Option const&) override
749+ {
750+ return true;
751+ }
752 } client_config;
753
754 launch_client_process(client_config);
755@@ -878,7 +891,7 @@
756 signalled = true;
757 }
758
759-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(ClientLibraryThreadsHandleNoSignals))
760+TEST_F(DefaultDisplayServerTestFixture, ClientLibraryThreadsHandleNoSignals)
761 {
762 struct ClientConfig : ClientConfigCommon
763 {
764@@ -961,7 +974,7 @@
765 launch_client_process(client_config);
766 }
767
768-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(MultiSurfaceClientTracksBufferFdsCorrectly))
769+TEST_F(DefaultDisplayServerTestFixture, MultiSurfaceClientTracksBufferFdsCorrectly)
770 {
771 struct ClientConfig : ClientConfigCommon
772 {
773
774=== modified file 'tests/acceptance-tests/test_focus_selection.cpp'
775--- tests/acceptance-tests/test_focus_selection.cpp 2013-09-17 14:31:42 +0000
776+++ tests/acceptance-tests/test_focus_selection.cpp 2013-09-27 23:50:04 +0000
777@@ -41,13 +41,6 @@
778 namespace mt = mir::test;
779 namespace mtf = mir_test_framework;
780
781-// TODO resolve problems running tests on android
782-#ifdef ANDROID
783-#define DISABLED_ON_ANDROID(name) DISABLED_##name
784-#else
785-#define DISABLED_ON_ANDROID(name) name
786-#endif
787-
788 namespace
789 {
790 char const* const mir_test_socket = mtf::test_socket_file().c_str();
791@@ -134,7 +127,7 @@
792 }
793 }
794
795-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(sessions_creating_surface_receive_focus))
796+TEST_F(BespokeDisplayServerTestFixture, sessions_creating_surface_receive_focus)
797 {
798 struct ServerConfig : TestingServerConfiguration
799 {
800@@ -168,7 +161,7 @@
801 launch_client_process(client);
802 }
803
804-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(surfaces_receive_input_focus_when_created))
805+TEST_F(BespokeDisplayServerTestFixture, surfaces_receive_input_focus_when_created)
806 {
807 struct ServerConfig : TestingServerConfiguration
808 {
809
810=== modified file 'tests/acceptance-tests/test_server_shutdown.cpp'
811--- tests/acceptance-tests/test_server_shutdown.cpp 2013-09-24 11:43:27 +0000
812+++ tests/acceptance-tests/test_server_shutdown.cpp 2013-09-27 23:50:04 +0000
813@@ -39,13 +39,6 @@
814 namespace ms = mir::surfaces;
815 namespace geom = mir::geometry;
816
817-// TODO resolve problems running tests on android
818-#ifdef ANDROID
819-#define DISABLED_ON_ANDROID(name) DISABLED_##name
820-#else
821-#define DISABLED_ON_ANDROID(name) name
822-#endif
823-
824 namespace
825 {
826
827@@ -119,7 +112,7 @@
828
829 }
830
831-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(server_can_shut_down_when_clients_are_blocked))
832+TEST_F(BespokeDisplayServerTestFixture, server_can_shut_down_when_clients_are_blocked)
833 {
834 Flag next_buffer_done1{"next_buffer_done1_c5d49978.tmp"};
835 Flag next_buffer_done2{"next_buffer_done2_c5d49978.tmp"};
836@@ -206,7 +199,7 @@
837 });
838 }
839
840-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(server_releases_resources_on_shutdown_with_connected_clients))
841+TEST_F(BespokeDisplayServerTestFixture, server_releases_resources_on_shutdown_with_connected_clients)
842 {
843 Flag surface_created1{"surface_created1_7e9c69fc.tmp"};
844 Flag surface_created2{"surface_created2_7e9c69fc.tmp"};
845
846=== modified file 'tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp'
847--- tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2013-09-17 14:31:42 +0000
848+++ tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2013-09-27 23:50:04 +0000
849@@ -34,13 +34,6 @@
850 namespace mtd = mt::doubles;
851 namespace mtf = mir_test_framework;
852
853-// TODO resolve problems running tests on android
854-#ifdef ANDROID
855-#define DISABLED_ON_ANDROID(name) DISABLED_##name
856-#else
857-#define DISABLED_ON_ANDROID(name) name
858-#endif
859-
860 namespace
861 {
862 char const* const mir_test_socket = mtf::test_socket_file().c_str();
863@@ -77,7 +70,7 @@
864
865 }
866
867-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(the_shell_surface_configurator_is_notified_of_attribute_changes))
868+TEST_F(BespokeDisplayServerTestFixture, the_shell_surface_configurator_is_notified_of_attribute_changes)
869 {
870 struct ServerConfiguration : TestingServerConfiguration
871 {
872@@ -116,7 +109,7 @@
873 launch_client_process(client_config);
874 }
875
876-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(the_shell_surface_configurator_may_interfere_with_attribute_changes))
877+TEST_F(BespokeDisplayServerTestFixture, the_shell_surface_configurator_may_interfere_with_attribute_changes)
878 {
879 struct ServerConfiguration : TestingServerConfiguration
880 {
881
882=== modified file 'tests/acceptance-tests/test_surfaceloop.cpp'
883--- tests/acceptance-tests/test_surfaceloop.cpp 2013-09-17 14:31:42 +0000
884+++ tests/acceptance-tests/test_surfaceloop.cpp 2013-09-27 23:50:04 +0000
885@@ -36,13 +36,6 @@
886 namespace mcl = mir::client;
887 namespace mtf = mir_test_framework;
888
889-// TODO resolve problems running tests on android
890-#ifdef ANDROID
891-#define DISABLED_ON_ANDROID(name) DISABLED_##name
892-#else
893-#define DISABLED_ON_ANDROID(name) name
894-#endif
895-
896 namespace
897 {
898 char const* const mir_test_socket = mtf::test_socket_file().c_str();
899@@ -161,7 +154,7 @@
900 }
901 }
902
903-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(creates_surface_of_correct_size))
904+TEST_F(DefaultDisplayServerTestFixture, creates_surface_of_correct_size)
905 {
906 struct Client : ClientConfigCommon
907 {
908@@ -215,7 +208,7 @@
909 launch_client_process(client_creates_surfaces);
910 }
911
912-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(surfaces_have_distinct_ids))
913+TEST_F(DefaultDisplayServerTestFixture, surfaces_have_distinct_ids)
914 {
915 struct Client : ClientConfigCommon
916 {
917@@ -260,7 +253,7 @@
918 launch_client_process(client_creates_surfaces);
919 }
920
921-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(creates_multiple_surfaces_async))
922+TEST_F(DefaultDisplayServerTestFixture, creates_multiple_surfaces_async)
923 {
924 struct Client : ClientConfigCommon
925 {
926
927=== modified file 'tests/acceptance-tests/test_surfaces_with_output_id.cpp'
928--- tests/acceptance-tests/test_surfaces_with_output_id.cpp 2013-09-17 14:31:42 +0000
929+++ tests/acceptance-tests/test_surfaces_with_output_id.cpp 2013-09-27 23:50:04 +0000
930@@ -43,13 +43,6 @@
931 namespace mg = mir::graphics;
932 namespace mtd = mir::test::doubles;
933
934-// TODO resolve problems running tests on android
935-#ifdef ANDROID
936-#define DISABLED_ON_ANDROID(name) DISABLED_##name
937-#else
938-#define DISABLED_ON_ANDROID(name) name
939-#endif
940-
941 namespace
942 {
943 char const* const mir_test_socket = mtf::test_socket_file().c_str();
944@@ -128,7 +121,7 @@
945
946 using SurfacesWithOutputId = BespokeDisplayServerTestFixture;
947
948-TEST_F(SurfacesWithOutputId, DISABLED_ON_ANDROID(fullscreen_surfaces_are_placed_at_top_left_of_correct_output))
949+TEST_F(SurfacesWithOutputId, fullscreen_surfaces_are_placed_at_top_left_of_correct_output)
950 {
951 mt::CrossProcessAction client_connect_and_create_surface;
952 mt::CrossProcessAction client_release_surface_and_disconnect;
953@@ -266,7 +259,7 @@
954 });
955 }
956
957-TEST_F(SurfacesWithOutputId, DISABLED_ON_ANDROID(non_fullscreen_surfaces_are_not_accepted))
958+TEST_F(SurfacesWithOutputId, non_fullscreen_surfaces_are_not_accepted)
959 {
960 mt::CrossProcessAction client_connect_and_create_surfaces;
961 mt::CrossProcessAction client_disconnect;
962
963=== modified file 'tests/mir_test_framework/CMakeLists.txt'
964--- tests/mir_test_framework/CMakeLists.txt 2013-08-28 03:41:48 +0000
965+++ tests/mir_test_framework/CMakeLists.txt 2013-09-27 23:50:04 +0000
966@@ -13,6 +13,7 @@
967 testing_server_options.cpp
968 input_testing_server_options.cpp
969 testing_process_manager.cpp
970+ testing_client_options.cpp
971 display_server_test_fixture.cpp
972 process.cpp
973 )
974
975=== modified file 'tests/mir_test_framework/display_server_test_fixture.cpp'
976--- tests/mir_test_framework/display_server_test_fixture.cpp 2013-08-28 03:41:48 +0000
977+++ tests/mir_test_framework/display_server_test_fixture.cpp 2013-09-27 23:50:04 +0000
978@@ -17,20 +17,22 @@
979 */
980
981 #include "mir_test_framework/display_server_test_fixture.h"
982+#include "mir_test_framework/testing_client_configuration.h"
983+#include "src/client/mir_connection.h"
984
985 namespace mc = mir::compositor;
986-
987-mir_test_framework::TestingProcessManager mir_test_framework::DefaultDisplayServerTestFixture::process_manager;
988-
989+namespace mtf = mir_test_framework;
990+
991+mtf::TestingProcessManager mir_test_framework::DefaultDisplayServerTestFixture::process_manager;
992+mtf::TestingServerConfiguration mir_test_framework::DefaultDisplayServerTestFixture::default_parameters;
993
994 void DefaultDisplayServerTestFixture::launch_client_process(TestingClientConfiguration& config)
995 {
996- process_manager.launch_client_process(config);
997+ process_manager.launch_client_process(config, *default_parameters.the_options());
998 }
999
1000 void DefaultDisplayServerTestFixture::SetUpTestCase()
1001 {
1002- TestingServerConfiguration default_parameters;
1003 process_manager.launch_server_process(default_parameters);
1004 }
1005
1006@@ -54,12 +56,13 @@
1007
1008 void BespokeDisplayServerTestFixture::launch_server_process(TestingServerConfiguration& functor)
1009 {
1010+ test_options = functor.the_options();
1011 process_manager.launch_server_process(functor);
1012 }
1013
1014 void BespokeDisplayServerTestFixture::launch_client_process(TestingClientConfiguration& config)
1015 {
1016- process_manager.launch_client_process(config);
1017+ process_manager.launch_client_process(config, *test_options);
1018 }
1019
1020 bool BespokeDisplayServerTestFixture::shutdown_server_process()
1021
1022=== added file 'tests/mir_test_framework/testing_client_options.cpp'
1023--- tests/mir_test_framework/testing_client_options.cpp 1970-01-01 00:00:00 +0000
1024+++ tests/mir_test_framework/testing_client_options.cpp 2013-09-27 23:50:04 +0000
1025@@ -0,0 +1,126 @@
1026+/*
1027+ * Copyright © 2013 Canonical Ltd.
1028+ *
1029+ * This program is free software: you can redistribute it and/or modify it
1030+ * under the terms of the GNU General Public License version 3,
1031+ * as published by the Free Software Foundation.
1032+ *
1033+ * This program is distributed in the hope that it will be useful,
1034+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1035+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1036+ * GNU General Public License for more details.
1037+ *
1038+ * You should have received a copy of the GNU General Public License
1039+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1040+ *
1041+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1042+ */
1043+
1044+#include "mir_test_framework/testing_client_configuration.h"
1045+#include "mir_test_framework/stub_client_connection_configuration.h"
1046+#include "mir/options/program_option.h"
1047+#include "src/client/default_connection_configuration.h"
1048+#include "src/client/client_platform_factory.h"
1049+#include "src/client/client_buffer_factory.h"
1050+#include "src/client/client_buffer.h"
1051+#include "src/client/client_platform.h"
1052+#include "src/client/mir_connection.h"
1053+
1054+namespace mcl = mir::client;
1055+namespace mtf=mir_test_framework;
1056+namespace geom = mir::geometry;
1057+
1058+
1059+namespace
1060+{
1061+class StubClientBuffer : public mcl::ClientBuffer
1062+{
1063+ std::shared_ptr<mcl::MemoryRegion> secure_for_cpu_write()
1064+ {
1065+ return nullptr;
1066+ }
1067+
1068+ geom::Size size() const
1069+ {
1070+ return geom::Size{};
1071+ }
1072+
1073+ geom::Stride stride() const
1074+ {
1075+ return geom::Stride{};
1076+ }
1077+
1078+ geom::PixelFormat pixel_format() const
1079+ {
1080+ return geom::PixelFormat::abgr_8888;
1081+ }
1082+
1083+ uint32_t age() const
1084+ {
1085+ return 0;
1086+ }
1087+ void increment_age()
1088+ {
1089+ }
1090+ void mark_as_submitted()
1091+ {
1092+ }
1093+ std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
1094+ {
1095+ return nullptr;
1096+ }
1097+};
1098+
1099+struct StubClientBufferFactory : public mcl::ClientBufferFactory
1100+{
1101+ std::shared_ptr<mcl::ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const&,
1102+ geom::Size, geom::PixelFormat)
1103+ {
1104+ return std::make_shared<StubClientBuffer>();
1105+ }
1106+};
1107+
1108+struct StubClientPlatform : public mcl::ClientPlatform
1109+{
1110+ MirPlatformType platform_type() const
1111+ {
1112+ return mir_platform_type_gbm;
1113+ }
1114+
1115+ std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
1116+ {
1117+ return std::make_shared<StubClientBufferFactory>();
1118+ }
1119+
1120+ std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::ClientSurface*)
1121+ {
1122+ auto fake_window = reinterpret_cast<EGLNativeWindowType>(0x12345678);
1123+ return std::make_shared<EGLNativeWindowType>(fake_window);
1124+ }
1125+
1126+ std::shared_ptr<EGLNativeDisplayType> create_egl_native_display()
1127+ {
1128+ auto fake_display = reinterpret_cast<EGLNativeDisplayType>(0x12345678);
1129+ return std::make_shared<EGLNativeDisplayType>(fake_display);
1130+ }
1131+};
1132+
1133+struct StubClientPlatformFactory : public mcl::ClientPlatformFactory
1134+{
1135+ std::shared_ptr<mcl::ClientPlatform> create_client_platform(mcl::ClientContext*)
1136+ {
1137+ return std::make_shared<StubClientPlatform>();
1138+ }
1139+};
1140+
1141+}
1142+
1143+mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)
1144+ : DefaultConnectionConfiguration(socket_file)
1145+{
1146+}
1147+
1148+std::shared_ptr<mcl::ClientPlatformFactory> mtf::StubConnectionConfiguration::the_client_platform_factory()
1149+{
1150+ return std::make_shared<StubClientPlatformFactory>();
1151+}
1152
1153=== modified file 'tests/mir_test_framework/testing_process_manager.cpp'
1154--- tests/mir_test_framework/testing_process_manager.cpp 2013-09-19 18:18:35 +0000
1155+++ tests/mir_test_framework/testing_process_manager.cpp 2013-09-27 23:50:04 +0000
1156@@ -16,8 +16,11 @@
1157 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1158 */
1159
1160+#include "mir_toolkit/client_types.h"
1161 #include "mir_test_framework/testing_process_manager.h"
1162 #include "mir_test_framework/detect_server.h"
1163+#include "mir_test_framework/stub_client_connection_configuration.h"
1164+#include "src/client/mir_connection.h"
1165 #include "mir/run_mir.h"
1166
1167 #include <gmock/gmock.h>
1168@@ -25,6 +28,7 @@
1169 #include <thread>
1170 #include <stdexcept>
1171
1172+namespace mo = mir::options;
1173 namespace mc = mir::compositor;
1174 namespace mtf = mir_test_framework;
1175
1176@@ -76,7 +80,38 @@
1177 }
1178 }
1179
1180-void mtf::TestingProcessManager::launch_client_process(TestingClientConfiguration& config)
1181+/* if set before any calls to the api functions, assigning to this pointer will allow user to
1182+ * override calls to mir_connect() and mir_connection_release(). This is mostly useful in test scenarios
1183+ */
1184+extern MirWaitHandle* (*mir_connect_impl)(
1185+ char const *server,
1186+ char const *app_name,
1187+ mir_connected_callback callback,
1188+ void *context);
1189+extern void (*mir_connection_release_impl) (MirConnection *connection);
1190+
1191+namespace
1192+{
1193+MirWaitHandle* mir_connect_test_override(
1194+ char const *socket_file,
1195+ char const *app_name,
1196+ mir_connected_callback callback,
1197+ void *context)
1198+{
1199+ mtf::StubConnectionConfiguration conf(socket_file);
1200+ auto connection = new MirConnection(conf);
1201+ return connection->connect(app_name, callback, context);
1202+}
1203+
1204+void mir_connection_release_override(MirConnection *connection)
1205+{
1206+ auto wait_handle = connection->disconnect();
1207+ wait_handle->wait_for_all();
1208+ delete connection;
1209+}
1210+}
1211+
1212+void mtf::TestingProcessManager::launch_client_process(TestingClientConfiguration& config, mo::Option const& test_options)
1213 {
1214 if (!is_test_process)
1215 {
1216@@ -108,6 +143,11 @@
1217 server_process.reset();
1218
1219 SCOPED_TRACE("Client");
1220+ if (!config.use_real_graphics(test_options))
1221+ {
1222+ mir_connect_impl = mir_connect_test_override;
1223+ mir_connection_release_impl = mir_connection_release_override;
1224+ }
1225 config.exec();
1226 exit(::testing::Test::HasFailure() ? EXIT_FAILURE : EXIT_SUCCESS);
1227 }
1228
1229=== modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp'
1230--- tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-09-25 15:46:05 +0000
1231+++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-09-27 23:50:04 +0000
1232@@ -184,9 +184,12 @@
1233 EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
1234 .Times(1)
1235 .WillOnce(Return(0));
1236- EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
1237+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
1238 .Times(1)
1239 .WillOnce(Return(-1));
1240+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
1241+ .Times(1)
1242+ .WillOnce(Return(0));
1243
1244 auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_layer_list,
1245 this->mock_fbdev, this->mock_vsync);
1246@@ -195,6 +198,27 @@
1247 }, std::runtime_error);
1248 }
1249
1250+TYPED_TEST(HWCCommon, test_blank_is_ignored_if_already_in_correct_state)
1251+{
1252+ using namespace testing;
1253+
1254+ //we start off unblanked
1255+
1256+ InSequence seq;
1257+ //from constructor
1258+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
1259+ .Times(Exactly(1))
1260+ .WillOnce(Return(0));
1261+ //from destructor
1262+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
1263+ .Times(1)
1264+ .WillOnce(Return(0));
1265+
1266+ auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_layer_list,
1267+ this->mock_fbdev, this->mock_vsync);
1268+ device->blank_or_unblank_screen(false);
1269+}
1270+
1271 TYPED_TEST(HWCCommon, test_hwc_display_is_deactivated_on_destroy)
1272 {
1273 auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_layer_list,
1274
1275=== modified file 'tests/unit-tests/logging/test_legacy_input_report.cpp'
1276--- tests/unit-tests/logging/test_legacy_input_report.cpp 2013-05-28 17:55:26 +0000
1277+++ tests/unit-tests/logging/test_legacy_input_report.cpp 2013-09-27 23:50:04 +0000
1278@@ -29,6 +29,8 @@
1279 namespace ml = mir::logging;
1280 namespace mli = mir::logging::legacy_input_report;
1281
1282+using testing::_;
1283+
1284 namespace
1285 {
1286 class MockLogger : public ml::Logger
1287@@ -49,69 +51,64 @@
1288 };
1289
1290 char const* const component = "android-input";
1291-char const* const LOG_TAG = 0;
1292+char const* const LOG_TAG = "Foo";
1293 }
1294
1295 TEST_F(InputReport, debug_message)
1296 {
1297- EXPECT_CALL(logger, log(
1298- ml::Logger::debug,
1299- testing::HasSubstr(__PRETTY_FUNCTION__),
1300- component));
1301+ // default minimum log priority is "informational". "debug" is lower than that.
1302+ EXPECT_CALL(logger, log(_, _, _)).Times(0);
1303
1304- ALOG(LOG_DEBUG, NULL, "Test function is %s", __PRETTY_FUNCTION__);
1305+ ALOG(LOG_DEBUG, NULL, "Test function is %s", __PRETTY_FUNCTION__);
1306 }
1307
1308 TEST_F(InputReport, unknown_message)
1309 {
1310 char const* const unknown = "Unknown message";
1311
1312- EXPECT_CALL(logger, log(
1313- ml::Logger::debug,
1314- unknown,
1315- component));
1316+ // default minimum log priority is "informational". "unknown" is lower than that.
1317+ // Actually, I don't think this is even a valid priority.
1318+ EXPECT_CALL(logger, log(_, _, _)).Times(0);
1319
1320- ALOG(LOG_UNKNOWN, NULL, unknown);
1321+ ALOG(LOG_UNKNOWN, NULL, unknown);
1322 }
1323
1324 TEST_F(InputReport, verbose_message)
1325 {
1326 char const* const verbose = "A very long story. (OK, I lied.)";
1327
1328- EXPECT_CALL(logger, log(
1329- ml::Logger::debug,
1330- verbose,
1331- component));
1332+ // default minimum log priority is "informational". "verbose" is lower than that.
1333+ EXPECT_CALL(logger, log(_, _, _)).Times(0);
1334
1335- ALOG(LOG_VERBOSE, NULL, verbose);
1336+ ALOG(LOG_VERBOSE, NULL, verbose);
1337 }
1338
1339 TEST_F(InputReport, info_message)
1340 {
1341 EXPECT_CALL(logger, log(
1342 ml::Logger::informational,
1343- __PRETTY_FUNCTION__,
1344+ "[Foo]Some informational message",
1345 component));
1346
1347- ALOGI(__PRETTY_FUNCTION__);
1348+ ALOGI("Some informational message");
1349 }
1350
1351 TEST_F(InputReport, warning_message)
1352 {
1353 EXPECT_CALL(logger, log(
1354 ml::Logger::warning,
1355- __PRETTY_FUNCTION__,
1356+ "[Foo]Warning!!!",
1357 component));
1358
1359- ALOGW(__PRETTY_FUNCTION__);
1360+ ALOGW("Warning!!!");
1361 }
1362
1363 TEST_F(InputReport, error_message)
1364 {
1365 EXPECT_CALL(logger, log(
1366 ml::Logger::error,
1367- __PRETTY_FUNCTION__,
1368+ "[Foo]An error occurred!",
1369 component));
1370
1371- ALOGE(__PRETTY_FUNCTION__);
1372+ ALOGE("An error occurred!");
1373 }

Subscribers

People subscribed via source and target branches