Mir

Merge lp:~afrantzis/mir/fix-1318587 into lp:mir

Proposed by Alexandros Frantzis
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 1624
Proposed branch: lp:~afrantzis/mir/fix-1318587
Merge into: lp:mir
Diff against target: 41 lines (+13/-1)
1 file modified
tests/acceptance-tests/test_custom_input_dispatcher.cpp (+13/-1)
To merge this branch: bzr merge lp:~afrantzis/mir/fix-1318587
Reviewer Review Type Date Requested Status
Alberto Aguirre (community) Approve
Kevin DuBois (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+219180@code.launchpad.net

Commit message

tests: Allow more time for event handling to happen before leaving the CustomInputDispatcherFixture.custom_input_dispatcher_receives_input test

Description of the change

tests: Allow more time for event handling to happen before leaving the CustomInputDispatcherFixture.custom_input_dispatcher_receives_input test

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

looks okay

review: Approve
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/acceptance-tests/test_custom_input_dispatcher.cpp'
2--- tests/acceptance-tests/test_custom_input_dispatcher.cpp 2014-05-09 09:56:45 +0000
3+++ tests/acceptance-tests/test_custom_input_dispatcher.cpp 2014-05-12 12:20:04 +0000
4@@ -23,6 +23,7 @@
5
6 #include "mir_test_framework/display_server_test_fixture.h"
7 #include "mir_test_framework/input_testing_server_configuration.h"
8+#include "mir_test_framework/cross_process_sync.h"
9 #include "mir_test_doubles/mock_input_dispatcher.h"
10 #include "mir_test/fake_shared.h"
11 #include "mir_test/fake_event_hub.h"
12@@ -108,7 +109,8 @@
13 using namespace ::testing;
14 InSequence seq;
15 EXPECT_CALL(dispatcher_conf->dispatcher, dispatch(mt::MotionEventWithPosition(1, 1))).Times(1);
16- EXPECT_CALL(dispatcher_conf->dispatcher, dispatch(mt::KeyDownEvent())).Times(1);
17+ EXPECT_CALL(dispatcher_conf->dispatcher, dispatch(mt::KeyDownEvent()))
18+ .WillOnce(InvokeWithoutArgs([this] { dispatching_done.signal_ready(); }));
19 }
20
21 return dispatcher_conf;
22@@ -119,9 +121,19 @@
23 fake_event_hub->synthesize_event(mis::a_motion_event().with_movement(1, 1));
24 fake_event_hub->synthesize_event(mis::a_key_down_event().of_scancode(KEY_ENTER));
25 }
26+
27+ mtf::CrossProcessSync dispatching_done;
28 } server_config;
29
30 launch_server_process(server_config);
31+
32+ // Since event handling happens asynchronously we need to allow some time
33+ // for it to take place before we leave the test. Otherwise, the server
34+ // may be stopped before events have been dispatched.
35+ run_in_test_process([&]
36+ {
37+ server_config.dispatching_done.wait_for_signal_ready_for(std::chrono::seconds{5});
38+ });
39 }
40
41 TEST_F(CustomInputDispatcherFixture, custom_input_dispatcher_gets_started_and_stopped)

Subscribers

People subscribed via source and target branches