~mterry/unity-mir/no-focus

« back to all changes in this revision

Viewing changes to tests/application_manager_test.cpp

  • Committer: Michael Terry
  • Date: 2014-05-23 13:19:57 UTC
  • Revision ID: michael.terry@canonical.com-20140523131957-3d0hj1ucatwmnkv3
Add tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
    }
143
143
}
144
144
 
 
145
TEST_F(ApplicationManagerTests, focus_on_invalid_app_falls_back_to_focused_app)
 
146
{
 
147
    using namespace ::testing;
 
148
    quint64 a_procId = 5921;
 
149
    QByteArray a_cmd( "/usr/bin/app1 --desktop_file_hint=some_app");
 
150
    std::shared_ptr<mir::scene::Surface> aSurface(nullptr);
 
151
 
 
152
    ON_CALL(procInfo,command_line(_)).WillByDefault(Return(a_cmd));
 
153
 
 
154
    bool authed = true;
 
155
 
 
156
    std::shared_ptr<mir::scene::Session> first_session = std::make_shared<MockSession>("Oo", a_procId);
 
157
    applicationManager.authorizeSession(a_procId, authed);
 
158
    applicationManager.onSessionStarting(first_session);
 
159
    applicationManager.onSessionCreatedSurface(first_session.get(), aSurface);
 
160
 
 
161
    EXPECT_CALL(focusController, set_focus_to(first_session)).Times(1);
 
162
 
 
163
    applicationManager.onSessionFocused(nullptr);
 
164
}
 
165
 
 
166
TEST_F(ApplicationManagerTests, focus_on_invalid_app_falls_back_to_default_session)
 
167
{
 
168
    using namespace ::testing;
 
169
 
 
170
    std::shared_ptr<mir::scene::Session> null_session = nullptr;
 
171
    EXPECT_CALL(focusController, set_focus_to(null_session)).Times(1);
 
172
 
 
173
    applicationManager.onSessionFocused(nullptr);
 
174
}
145
175
 
146
176
TEST_F(ApplicationManagerTests,bug_case_1240400_second_dialer_app_fails_to_authorize_and_gets_mixed_up_with_first_one)
147
177
{